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
35uint32_t task_timeout_us_to_ms(uint64_t timeout_us);
36
48uint32_t task_set_event(uint32_t event);
49
63uint32_t task_wait_event(int timeout_us);
64
81uint32_t task_wait_event_mask(uint32_t event_mask, int timeout_us);
82
86static inline void task_wake()
87{
88 // TODO issue #132 remove when the mock components will be running
89#ifndef LMBD_SIMULATION
90 task_set_event(TASK_EVENT_WAKE);
91#endif
92}
93
97void task_clear_event_bitmap(uint32_t eventToClear);
98
99#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