Espresso 0.0.2c
This commit is contained in:
32
files/scheduler.h
Normal file
32
files/scheduler.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef _SCHEDULER_H
|
||||
#define _SCHEDULER_H
|
||||
|
||||
#include <drivers/irq.h>
|
||||
|
||||
#include <types.h>
|
||||
|
||||
typedef enum {
|
||||
TASK_READY,
|
||||
TASK_RUNNING,
|
||||
TASK_SLEEPING,
|
||||
TASK_BLOCKED,
|
||||
TASK_TERMINATED,
|
||||
} task_state_t;
|
||||
|
||||
typedef struct task {
|
||||
uint32_t id;
|
||||
|
||||
registers_t* regs; /* pointer to saved register frame */
|
||||
uint32_t* stack_base; /* original malloc() pointer */
|
||||
|
||||
task_state_t state;
|
||||
struct task* next;
|
||||
|
||||
uint64_t wakeup_tick;
|
||||
} task_t;
|
||||
|
||||
void scheduler_init(void);
|
||||
task_t* create_task(void (*entry)());
|
||||
void scheduler_tick(registers_t* regs);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user