-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmegos_scheduler.h
73 lines (63 loc) · 1.9 KB
/
megos_scheduler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
* megos_scheduler.h
*
* Created: 1/11/2018 9:50:07 PM
* Author: Matthew
*/
#ifndef MEGOS_SCHEDULER_H_
#define MEGOS_SCHEDULER_H_
typedef void (*mos_task_fn)(void);
/*
* megos_new_task(mos_task_fn , unsigned int)
*
* Creates a new task with entry point aptTask and stack size of aiSize.
* Creates the task in the init state. The task must be started before
* it will be scheduled to run.
*
* @Param aptTask: Entry point for the task.
* @Param aiSize: Stack size.
* @Return: Unique identifier for the new task.
*/
unsigned int megos_new_task(mos_task_fn aptTask, unsigned int aiSize);
/*
* megos_new_task_at(mos_task_fn, void*, unsigned int)
*
* Creates a new task with entry point aptTask and stack size of aiSize and
* at location aptMem. This allows for modules to allocate their own memory
* for a task rather than rely on this tasks' malloc.
* Creates the task in the init state. The task must be started before
* it will be scheduled to run.
*
* @Param aptTask: Entry point for the task.
* @Param aptMem: Location of memory to put task.
* @Param aiSize: Stack size.
* @Return: Unique identifier for the new task.
*/
unsigned int megos_new_task_at(mos_task_fn aptTask, void* aptMem, unsigned int aiSize);
/*
* megos_task_start(unsigned int)
*
* Changes the state of the input task from INIT to READY.
*
* @Param aiTask: Task ID of task to start. Must be in INIT or this does nothing.
*/
void megos_task_start(unsigned int aiTask);
/*
* megos_task_sleep(unsigned int)
*
*/
void megos_task_sleep(unsigned int aiMilliseconds);
/*
* megos_schedule(void)
*
* Determines the next task to be run and performs the context switch.
*/
void megos_schedule(unsigned char abIsInterrupt);
/*
* megos_schedule_control_init(void)
*
* Turns on the process that cleans up other processes.
* This process should only be called when another process reaches complete.
*/
void megos_schedule_control_init(void);
#endif /* MEGOS_SCHEDULER_H_ */