aboutsummaryrefslogtreecommitdiff
path: root/src/tasks.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tasks.c')
-rw-r--r--src/tasks.c64
1 files changed, 55 insertions, 9 deletions
diff --git a/src/tasks.c b/src/tasks.c
index 1d94eaa..abc2add 100644
--- a/src/tasks.c
+++ b/src/tasks.c
@@ -1,16 +1,62 @@
-#include "../tasks.h"
-
+#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 taskDelayTillT(int8_t *condition, uint8_t timeout_10us) {
- while(*condition == 0) {
- if (timeout_10us == 0)
- return 1;
- timeout_10us--;
- _delay_us(10);
- }
+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;
}