Skip to content

Commit

Permalink
comment out semaphore shit in teakra
Browse files Browse the repository at this point in the history
  • Loading branch information
Arisotura committed Oct 24, 2022
1 parent 9e449d9 commit 9360119
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/teakra/src/apbp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class DataChannel {

void Send(u16 data) {
{
std::lock_guard lock(mutex);
//std::lock_guard lock(mutex);
ready = true;
this->data = data;
if (disable_interrupt)
Expand All @@ -24,20 +24,20 @@ class DataChannel {
handler();
}
u16 Recv() {
std::lock_guard lock(mutex);
//std::lock_guard lock(mutex);
ready = false;
return data;
}
u16 Peek() const {
std::lock_guard lock(mutex);
//std::lock_guard lock(mutex);
return data;
}
bool IsReady() const {
std::lock_guard lock(mutex);
//std::lock_guard lock(mutex);
return ready;
}
u16 GetDisableInterrupt() const {
std::lock_guard lock(mutex);
//std::lock_guard lock(mutex);
return disable_interrupt;
}
void SetDisableInterrupt(u16 v) {
Expand Down Expand Up @@ -107,7 +107,7 @@ void Apbp::SetDataHandler(unsigned channel, std::function<void()> handler) {
}

void Apbp::SetSemaphore(u16 bits) {
std::lock_guard lock(impl->semaphore_mutex);
//std::lock_guard lock(impl->semaphore_mutex);
impl->semaphore |= bits;
bool new_signal = (impl->semaphore & ~impl->semaphore_mask) != 0;
if (new_signal && impl->semaphore_handler) {
Expand All @@ -117,33 +117,33 @@ void Apbp::SetSemaphore(u16 bits) {
}

void Apbp::ClearSemaphore(u16 bits) {
std::lock_guard lock(impl->semaphore_mutex);
//std::lock_guard lock(impl->semaphore_mutex);
impl->semaphore &= ~bits;
impl->semaphore_master_signal = (impl->semaphore & ~impl->semaphore_mask) != 0;
}

u16 Apbp::GetSemaphore() const {
std::lock_guard lock(impl->semaphore_mutex);
//std::lock_guard lock(impl->semaphore_mutex);
return impl->semaphore;
}

void Apbp::MaskSemaphore(u16 bits) {
std::lock_guard lock(impl->semaphore_mutex);
//std::lock_guard lock(impl->semaphore_mutex);
impl->semaphore_mask = bits;
}

u16 Apbp::GetSemaphoreMask() const {
std::lock_guard lock(impl->semaphore_mutex);
//std::lock_guard lock(impl->semaphore_mutex);
return impl->semaphore_mask;
}

void Apbp::SetSemaphoreHandler(std::function<void()> handler) {
std::lock_guard lock(impl->semaphore_mutex);
//std::lock_guard lock(impl->semaphore_mutex);
impl->semaphore_handler = std::move(handler);
}

bool Apbp::IsSemaphoreSignaled() const {
std::lock_guard lock(impl->semaphore_mutex);
//std::lock_guard lock(impl->semaphore_mutex);
return impl->semaphore_master_signal;
}
} // namespace Teakra

0 comments on commit 9360119

Please sign in to comment.