Skip to content
Snippets Groups Projects
Commit 95b6e45c authored by Thierno souleymane Bah's avatar Thierno souleymane Bah
Browse files

feat(getc with semanphore implemented, everything works as expected)

parent 3d139216
No related branches found
No related tags found
No related merge requests found
...@@ -99,7 +99,7 @@ void add_to_queue(unsigned char c) ...@@ -99,7 +99,7 @@ void add_to_queue(unsigned char c)
keyboard_queue.array[keyboard_queue.first_free] = c; keyboard_queue.array[keyboard_queue.first_free] = c;
keyboard_queue.first_free = (keyboard_queue.first_free + 1) % QUEUE_SIZE; keyboard_queue.first_free = (keyboard_queue.first_free + 1) % QUEUE_SIZE;
keyboard_queue.cpt++; keyboard_queue.cpt++;
// sem_up(&keyboard_sem); sem_up(&keyboard_sem);
} }
irq_enable(); irq_enable();
...@@ -112,7 +112,7 @@ char getc() ...@@ -112,7 +112,7 @@ char getc()
char c = NONE; char c = NONE;
if (keyboard_queue.cpt) if (keyboard_queue.cpt)
{ {
// sem_down(&keyboard_sem); sem_down(&keyboard_sem);
int idx = (keyboard_queue.first_free + QUEUE_SIZE - keyboard_queue.cpt) % QUEUE_SIZE; int idx = (keyboard_queue.first_free + QUEUE_SIZE - keyboard_queue.cpt) % QUEUE_SIZE;
c = keyboard_queue.array[idx]; c = keyboard_queue.array[idx];
keyboard_queue.cpt--; keyboard_queue.cpt--;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment