Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
task.h
1#ifndef PD_TASK_H
2#define PD_TASK_H
3
4#include <stdint.h>
5
6#define TASK_EVENT_PD_AWAKE (1 << 18)
7
8/* task_wake() called on task */
9#define TASK_EVENT_WAKE (1 << 29)
10
11/*
12 * Timer expired. For example, task_wait_event() timed out before receiving
13 * another event.
14 */
15#define TASK_EVENT_TIMER (1U << 31)
16
18typedef union
19{
20 uint64_t val;
21 struct
22 {
23 uint32_t lo;
24 uint32_t hi;
25 } le;
27
28// Get the current timestamp from the system timer (in uS).
29timestamp_t get_time(void);
30
31// call in a dedicated task
32void task_scheduler(void);
33
45uint32_t task_set_event(uint32_t event);
46
60uint32_t task_wait_event(int timeout_us);
61
78uint32_t task_wait_event_mask(uint32_t event_mask, int timeout_us);
79
83static inline void task_wake() { task_set_event(TASK_EVENT_WAKE); }
84
88void task_clear_event_bitmap(uint32_t eventToClear);
89
90#endif
Convert a 64 bits to little endian encoding.
Definition: task.h:19
uint32_t lo
low side of the binary
Definition: task.h:23
uint32_t hi
low side of the binary
Definition: task.h:24
uint64_t val
value to store the binary
Definition: task.h:20