OpenWSN Firmware
scheduler.h
Go to the documentation of this file.
1 #ifndef __SCHEDULER_H
2 #define __SCHEDULER_H
3 
11 #include "openwsn.h"
12 
13 //=========================== define ==========================================
14 
15 typedef enum {
16  TASKPRIO_NONE = 0x00,
17  // tasks trigger by radio
20  // tasks triggered by timers
22  TASKPRIO_RPL = 0x04,
24  TASKPRIO_COAP = 0x06,
26  TASKPRIO_OTF = 0x08,
27  // tasks trigger by other interrupts
30  TASKPRIO_MAX = 0x0b,
31 } task_prio_t;
32 
33 #define TASK_LIST_DEPTH 10
34 
35 //=========================== typedef =========================================
36 
37 typedef void (*task_cbt)(void);
38 
39 typedef struct task_llist_t {
42  void* next;
44 
45 //=========================== module variables ================================
46 
47 typedef struct {
50  uint8_t numTasksCur;
51  uint8_t numTasksMax;
53 
54 typedef struct {
55  uint8_t numTasksCur;
56  uint8_t numTasksMax;
58 
59 //=========================== prototypes ======================================
60 
61 // public functions
62 void scheduler_init(void);
63 void scheduler_start(void);
64 void scheduler_push_task(task_cbt task_cb, task_prio_t prio);
65 
66 // interrupt handlers
67 void isr_ieee154e_newSlot(void);
68 void isr_ieee154e_timer(void);
69 void isr_adc(void);
70 #ifdef ISR_GYRO
71 void isr_gyro(void);
72 #endif
73 #ifdef ISR_LARGE_RANGE_ACCEL
74 void isr_large_range_accel(void);
75 #endif
76 #ifdef ISR_BUTTON
77 void isr_button(void);
78 #endif
79 
85 #endif
void scheduler_start()
Definition: scheduler.c:34
void scheduler_init()
Definition: scheduler.c:24
task_prio_t prio
Definition: scheduler.h:41
Definition: scheduler.h:26
task_cbt cb
Definition: scheduler.h:40
Definition: scheduler.h:23
Definition: scheduler.h:54
void scheduler_push_task(task_cbt cb, task_prio_t prio)
Definition: scheduler.c:61
void isr_adc(void)
uint8_t numTasksMax
Definition: scheduler.h:56
Definition: scheduler.h:19
Definition: scheduler.h:39
Definition: scheduler.h:47
void isr_ieee154e_newSlot()
Indicates a new slot has just started.
Definition: IEEE802154E.c:166
task_prio_t
Definition: scheduler.h:15
uint8_t numTasksMax
Definition: scheduler.h:51
void isr_ieee154e_timer()
Indicates the FSM timer has fired.
Definition: IEEE802154E.c:187
Definition: scheduler.h:18
Definition: scheduler.h:30
void(* task_cbt)(void)
Definition: scheduler.h:37
Definition: scheduler.h:28
struct task_llist_t taskList_item_t
Definition: scheduler.h:29
Definition: scheduler.h:21
taskList_item_t * task_list
Definition: scheduler.h:49
Definition: scheduler.h:25
uint8_t numTasksCur
Definition: scheduler.h:55
void * next
Definition: scheduler.h:42
Definition: scheduler.h:22
uint8_t numTasksCur
Definition: scheduler.h:50
#define TASK_LIST_DEPTH
Definition: scheduler.h:33
Definition: scheduler.h:24
Definition: scheduler.h:16