Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_scheduler.h
1 #ifndef _BC_SCHEDULER_H
2 #define _BC_SCHEDULER_H
3 
4 #include <bc_tick.h>
5 
9 
11 
12 #ifndef BC_SCHEDULER_MAX_TASKS
13 #define BC_SCHEDULER_MAX_TASKS 32
14 #endif
15 
17 
18 typedef size_t bc_scheduler_task_id_t;
19 
21 
22 void bc_scheduler_init(void);
23 
25 
26 void bc_scheduler_run(void);
27 
33 
34 bc_scheduler_task_id_t bc_scheduler_register(void (*task)(void *), void *param, bc_tick_t tick);
35 
38 
40 
43 
45 
48 
50 
52 
54 
56 
57 void bc_scheduler_enable_sleep(void);
58 
61 
63 
67 
69 
73 
75 
79 
81 
83 
85 
88 
90 
93 
95 
98 
100 
102 
103 #endif // _BC_SCHEDULER_H
uint64_t bc_tick_t
Timestamp data type.
Definition: bc_tick.h:16
void bc_scheduler_plan_absolute(bc_scheduler_task_id_t task_id, bc_tick_t tick)
Schedule specified task to absolute tick.
Definition: bc_scheduler.c:124
bc_tick_t bc_scheduler_get_spin_tick(void)
Get current tick of spin in which task has been run.
Definition: bc_scheduler.c:104
void bc_scheduler_run(void)
Run task scheduler (this call never ends)
Definition: bc_scheduler.c:29
bc_scheduler_task_id_t bc_scheduler_register(void(*task)(void *), void *param, bc_tick_t tick)
Register task in scheduler.
Definition: bc_scheduler.c:56
void bc_scheduler_plan_now(bc_scheduler_task_id_t task_id)
Schedule specified task for immediate execution.
Definition: bc_scheduler.c:119
void bc_scheduler_plan_current_absolute(bc_tick_t tick)
Schedule current task to absolute tick.
Definition: bc_scheduler.c:144
void bc_scheduler_disable_sleep(void)
Disable sleep mode, implemented as semaphore.
Definition: bc_scheduler.c:109
void bc_scheduler_enable_sleep(void)
Enable sleep mode, implemented as semaphore.
Definition: bc_scheduler.c:114
void bc_scheduler_plan_current_relative(bc_tick_t tick)
Schedule current task to tick relative from current spin.
Definition: bc_scheduler.c:149
size_t bc_scheduler_task_id_t
Task ID assigned by scheduler.
Definition: bc_scheduler.h:18
void bc_scheduler_plan_relative(bc_scheduler_task_id_t task_id, bc_tick_t tick)
Schedule specified task to tick relative from current spin.
Definition: bc_scheduler.c:129
bc_scheduler_task_id_t bc_scheduler_get_current_task_id(void)
Get task ID of currently executing task.
Definition: bc_scheduler.c:99
void bc_scheduler_plan_from_now(bc_scheduler_task_id_t task_id, bc_tick_t tick)
Schedule specified task to tick relative from now.
Definition: bc_scheduler.c:134
void bc_scheduler_init(void)
Initialize task scheduler.
Definition: bc_scheduler.c:24
void bc_scheduler_plan_current_from_now(bc_tick_t tick)
Schedule current task to tick relative from now.
Definition: bc_scheduler.c:154
void bc_scheduler_plan_current_now(void)
Schedule current task for immediate execution.
Definition: bc_scheduler.c:139
void bc_scheduler_unregister(bc_scheduler_task_id_t task_id)
Unregister specified task.
Definition: bc_scheduler.c:80