aboutsummaryrefslogtreecommitdiff
path: root/kernel/task/include
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/task/include')
-rw-r--r--kernel/task/include/task/idle.h6
-rw-r--r--kernel/task/include/task/lock.h24
-rw-r--r--kernel/task/include/task/sched.h58
-rw-r--r--kernel/task/include/task/task.h46
4 files changed, 0 insertions, 134 deletions
diff --git a/kernel/task/include/task/idle.h b/kernel/task/include/task/idle.h
deleted file mode 100644
index 3b6e40a..0000000
--- a/kernel/task/include/task/idle.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef IDLE_H
-#define IDLE_H
-
-void idle_entry(char args);
-
-#endif \ No newline at end of file
diff --git a/kernel/task/include/task/lock.h b/kernel/task/include/task/lock.h
deleted file mode 100644
index 47246b2..0000000
--- a/kernel/task/include/task/lock.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef LOCK_H
-#define LOCK_H
-
-#include "task/sched.h"
-
-typedef volatile char spin_lock_t;
-
-#define SPIN_LOCK_UNLOCKED 0
-#define SPIN_LOCK_LOCKED 0
-
-static inline void spin_lock(spin_lock_t* lock) {
- while(*lock != SPIN_LOCK_UNLOCKED) {yield();};
- cli();
- *lock = SPIN_LOCK_LOCKED;
- sei();
-}
-
-static inline void spin_unlock(spin_lock_t* lock) {
- cli();
- *lock = SPIN_LOCK_UNLOCKED;
- sei();
-}
-
-#endif \ No newline at end of file
diff --git a/kernel/task/include/task/sched.h b/kernel/task/include/task/sched.h
deleted file mode 100644
index b8946db..0000000
--- a/kernel/task/include/task/sched.h
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef SCHED_H
-#define SCHED_H
-
-#include "collection/list.h"
-#include "task/task.h"
-#include "mcu/task/task.h"
-
-/**
- * Points to currently executing task. If no scheduling has been enabled,
- * this points to NULL
- */
-extern struct tcb_t* volatile current;
-
-/**
- * Queue that contains all tasks that are ready to be run, awaiting their
- * turn from the scheduler.
- */
-extern struct list_head ready;
-
-/**
- * Makes the current task sleep on a specific queue.
- * This moves the current task to the given queue's tail.
- */
-static inline void sleep_queue(struct list_head* queue) {
- list_move_tail(&current->queue, queue);
-}
-
-/**
- * Wakes all tasks waiting in the given queue.
- * This moves all tasks contained in the queue to the ready queue.
- */
-static inline void wake_all_queue(struct list_head* queue) {
- list_splice_init(queue, ready.prev);
-}
-
-/**
- * Initializes a given task and adds it to the ready queue.
- */
-void spawn(struct tcb_t* const tcb);
-
-/**
- * Voluntarily relinquishes control of the CPU from the current task to the scheduler.
- */
-void yield() __attribute__ ( ( naked ) );
-
-
-/**
- * Initializes the scheduler by setting up kstack, initializing the idle task
- * and selecting the first task to run.
- */
-void sched_init();
-
-/**
- * Enters the scheduler, setting current to the next runnable task.
- */
-void schedule();
-
-#endif
diff --git a/kernel/task/include/task/task.h b/kernel/task/include/task/task.h
deleted file mode 100644
index 120bda4..0000000
--- a/kernel/task/include/task/task.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef TASK_H
-#define TASK_H
-
-#include "collection/list.h"
-
-/**
- * Task control block, contains runtime
- * information about tasks.
- */
-struct tcb_t {
- /** Stack pointer of this task. (must be first in structure) */
- char* volatile sp;
-
- /** Lowest address of this task's memory (inclusive). */
- char* mem_low;
-
- /** Highest address of this task's memory (inclusive). */
- char* mem_high;
-
- /** Entry function of this task. */
- void (*entry)(char);
-
- /** Current wait queue that this task is in.*/
- struct list_head queue;
-
- /** ID of task. */
- char id;
-
-};
-
-/**
- * Utility for declaring a task with statically allocated memory.
- * Note: for a task to be scheduled, it must first be spawned (see spawn()).
-*/
-#define DECLARE_TASK(name, stack_size, entry_function, pid) \
- static char _declared_stack_##name[stack_size]; \
- static struct tcb_t name = { \
- .sp = 0, \
- .mem_low = _declared_stack_##name, \
- .mem_high = _declared_stack_##name + stack_size - 1, \
- .entry = entry_function, \
- .queue = {}, \
- .id = pid \
- };
-
-#endif \ No newline at end of file