rum
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "epilogues.h"
|
||||
|
||||
#include "../debug/output.h"
|
||||
#include "guard.h"
|
||||
|
||||
extern Key kout_key;
|
||||
@@ -8,6 +9,7 @@ extern TextStream kout;
|
||||
namespace Epilogues {
|
||||
|
||||
void keyboard(Vault& g) {
|
||||
DBG << "keyboard epi" << endl << flush;
|
||||
(void)g;
|
||||
kout << kout_key.ascii() << endl << flush ;
|
||||
}
|
||||
|
||||
@@ -44,22 +44,23 @@ void Guard::leave() {
|
||||
}
|
||||
|
||||
void Guard::relay(Epilogue handler) {
|
||||
if(!epilogue_queue FOR_CURRENT_CORE.consume(handler))
|
||||
return; // enqueue, but dont execute
|
||||
if(epi_flag FOR_CURRENT_CORE){
|
||||
enter();
|
||||
Core::Interrupt::disable();
|
||||
leave();
|
||||
}
|
||||
//Core::Interrupt::enable(); // goto level 0.5
|
||||
//if(epi_flag FOR_CURRENT_CORE){
|
||||
// epilogue_queue->produce(handler);
|
||||
//}
|
||||
//else{
|
||||
// epi_flag FOR_CURRENT_CORE = true;
|
||||
//if(!epilogue_queue FOR_CURRENT_CORE.produce(handler))
|
||||
// return; // enqueue, but dont execute
|
||||
//if(!epi_flag FOR_CURRENT_CORE){
|
||||
// enter();
|
||||
// Core::Interrupt::enable();
|
||||
// handler(global_vault);
|
||||
// leave(); // maybe not needed since destructor also calls leave
|
||||
// leave();
|
||||
//}
|
||||
Core::Interrupt::enable(); // goto level 0.5
|
||||
if(epi_flag FOR_CURRENT_CORE){
|
||||
epilogue_queue->produce(handler);
|
||||
}
|
||||
else{
|
||||
epi_flag FOR_CURRENT_CORE = true;
|
||||
handler(global_vault);
|
||||
leave(); // maybe not needed since destructor also calls leave
|
||||
}
|
||||
}
|
||||
|
||||
const Vault &Guard::unsafeConstAccess() { return global_vault; }
|
||||
|
||||
@@ -78,6 +78,7 @@ extern Ticketlock koutlock;
|
||||
extern Vault keyboard_vault;
|
||||
|
||||
void handle_keyboard() {
|
||||
DBG << "keyboard pro" << endl << flush;
|
||||
//Key key = Key();
|
||||
if (PS2Controller::fetch(kout_key)) {
|
||||
Guard::relay(Epilogues::keyboard);
|
||||
|
||||
6
main.cc
6
main.cc
@@ -31,7 +31,7 @@ Ticketlock koutlock;
|
||||
//};
|
||||
|
||||
TextStream dout[Core::MAX] = {
|
||||
{0, 40, 10, 14},
|
||||
{0, 40, 10, 20},
|
||||
{40, 80, 10, 14},
|
||||
{0, 40, 14, 18},
|
||||
{40, 80, 14, 18},
|
||||
@@ -110,8 +110,8 @@ extern "C" int main() {
|
||||
|
||||
Application{}.action();
|
||||
while (true){
|
||||
DBG << "pos: " << testx << ", " << testy << endl << flush;
|
||||
Core::pause();
|
||||
//DBG << "pos: " << testx << ", " << testy << endl << flush;
|
||||
//Core::pause();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "sync/ticketlock.h"
|
||||
#include "debug/output.h"
|
||||
|
||||
void Ticketlock::lock() {
|
||||
uint64_t ticket = __atomic_fetch_add(&ticket_count, 1, __ATOMIC_RELAXED);
|
||||
@@ -8,5 +9,7 @@ void Ticketlock::lock() {
|
||||
}
|
||||
|
||||
void Ticketlock::unlock() {
|
||||
__atomic_fetch_add(&ticket_current, 1, __ATOMIC_RELEASE);
|
||||
if(ticket_current != ticket_count){
|
||||
__atomic_fetch_add(&ticket_current, 1, __ATOMIC_RELEASE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ void Application::action() { // NOLINT
|
||||
kout << text[cnt-1];
|
||||
}
|
||||
kout << endl << flush;
|
||||
Guard::leave();
|
||||
//Guard::leave();
|
||||
//koutlock.unlock();
|
||||
|
||||
activeWaitDelay(1000000000);
|
||||
|
||||
Reference in New Issue
Block a user