mirror of
https://github.com/gbowne1/ClassicOS.git
synced 2025-11-22 08:35:27 -08:00
Update scheduler.h
This commit is contained in:
@@ -4,18 +4,21 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define MAX_TASKS 8
|
#define MAX_TASKS 8
|
||||||
#define STACK_SIZE 1024
|
#define STACK_SIZE 1024 // in bytes
|
||||||
|
|
||||||
typedef struct task {
|
typedef struct task {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
void (*entry)(void);
|
|
||||||
|
// The most important field:
|
||||||
|
// Where was the stack pointer when we last left this task?
|
||||||
uint32_t *stack_ptr;
|
uint32_t *stack_ptr;
|
||||||
|
|
||||||
struct task *next;
|
struct task *next;
|
||||||
} task_t;
|
} task_t;
|
||||||
|
|
||||||
void scheduler_init();
|
void scheduler_init();
|
||||||
void scheduler_add_task(void (*entry)(void));
|
void scheduler_add_task(void (*entry)(void));
|
||||||
void scheduler_schedule();
|
void scheduler_schedule();
|
||||||
void scheduler_yield(); // Optional for cooperative scheduling
|
void scheduler_yield();
|
||||||
|
|
||||||
#endif // SCHEDULER_H
|
#endif // SCHEDULER_H
|
||||||
|
|||||||
Reference in New Issue
Block a user