From e15d41a5619c41f3440369e625d6d96921718221 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Thu, 30 Dec 2021 20:50:44 -0800 Subject: Added Data Structures Added basic scheduling TODO: Preserve registers for context switch --- src/lib/ll.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/lib/ll.h (limited to 'src/lib/ll.h') diff --git a/src/lib/ll.h b/src/lib/ll.h new file mode 100644 index 0000000..4a11620 --- /dev/null +++ b/src/lib/ll.h @@ -0,0 +1,24 @@ +#ifndef LIB_LL_H +#define LIB_LL_H + +struct LL { + struct LL* prev; + struct LL* next; + void* data; +}; + +struct LL* new(void* val); +void push(struct LL* l, void* val); +void remove(struct LL* l, unsigned long idx); + +#define showl(L, TYPE) { \ + struct LL* t = L; \ + do { \ + uart_hex(*(TYPE*)t->data); \ + t = t->next; \ + if (t != l) \ + uart_char(' '); \ + } while (t != l); \ +} + +#endif -- cgit v1.2.1