blob: abc2addd49b2d6b7ffb0c8358929ca275dec8cf5 (
plain)
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
|
#include <tasks.h>
#ifdef CONFIG_IOE_TASKS
void tasks_run(void) {
}
void task_init(Task * t, void (*func) (void)) {
}
void task_start(Task * t) {
}
void task_delay(uint16_t us) {
}
void task_delay_ms(uint16_t ms) {
}
void task_delay_till(volatile int8_t * boolean, uint16_t timeout) {
}
int8_t task_stack_init(TaskStack * ts, uint8_t stack_size, uint8_t flags) {
ts->stack = malloc(stack_size * sizeof(uint8_t));
ts->flags = flags;
ts->running = NULL;
ts->pending = NULL;
}
void task_stack_free(TaskStack * ts) {
free(ts->stack);
}
void task_stack_reg(TaskStack * ts, Task * t) {
}
void task_stack_unreg(TaskStack * ts, Task * t) {
}
void init_mutex(Mutex * mtx, uint8_t flags) {
};
void take_mutex(Mutex * mtx) {
};
int8_t take_mutex_t(Mutex * mtx, uint16_t timeout) {
};
void give_mutex(Mutex * mtx) {
};
#else /* CONFIG_IOE_TASKS */
int8_t task_delay_till(volatile int8_t * boolean, uint16_t timeout) {
if (timeout == 0)
while (!*boolean)
_delay_us(100);
else
// TODO this implementation should be improved to check boolean as often
// as possible
while (*boolean == 0) {
if (timeout == 0)
return 1;
timeout--;
_delay_ms(1);
}
return 0;
}
#endif /* CONFIG_IOE_TASKS */
|