summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/thread.h25
1 files changed, 17 insertions, 8 deletions
diff --git a/firmware/export/thread.h b/firmware/export/thread.h
index 8bb9ae2608..0c1567de97 100644
--- a/firmware/export/thread.h
+++ b/firmware/export/thread.h
@@ -78,14 +78,22 @@ struct regs
78 78
79#endif /* !SIMULATOR */ 79#endif /* !SIMULATOR */
80 80
81#define STATE_RUNNING 0 81#define STATE_RUNNING 0x00000000
82#define STATE_BLOCKED 1 82#define STATE_BLOCKED 0x20000000
83#define STATE_SLEEPING 2 83#define STATE_SLEEPING 0x40000000
84#define STATE_BLOCKED_W_TMO 3 84#define STATE_BLOCKED_W_TMO 0x60000000
85 85
86#define GET_STATE_ARG(state) (state & 0x3FFFFFFF) 86#define THREAD_STATE_MASK 0x60000000
87#define GET_STATE(state) ((state >> 30) & 3) 87#define STATE_ARG_MASK 0x1FFFFFFF
88#define SET_STATE(state,arg) ((state << 30) | (arg)) 88
89#define GET_STATE_ARG(state) (state & STATE_ARG_MASK)
90#define GET_STATE(state) (state & THREAD_STATE_MASK)
91#define SET_STATE(var,state,arg) (var = (state | ((arg) & STATE_ARG_MASK)))
92#define CLEAR_STATE_ARG(var) (var &= ~STATE_ARG_MASK)
93
94#define STATE_BOOSTED 0x80000000
95#define STATE_IS_BOOSTED(var) (var & STATE_BOOSTED)
96#define SET_BOOST_STATE(var) (var |= STATE_BOOSTED)
89 97
90struct thread_entry { 98struct thread_entry {
91#ifndef SIMULATOR 99#ifndef SIMULATOR
@@ -133,7 +141,8 @@ void trigger_cpu_boost(void);
133void remove_thread(struct thread_entry *thread); 141void remove_thread(struct thread_entry *thread);
134void switch_thread(bool save_context, struct thread_entry **blocked_list); 142void switch_thread(bool save_context, struct thread_entry **blocked_list);
135void sleep_thread(int ticks); 143void sleep_thread(int ticks);
136void block_thread(struct thread_entry **thread, int timeout); 144void block_thread(struct thread_entry **thread);
145void block_thread_w_tmo(struct thread_entry **thread, int timeout);
137void wakeup_thread(struct thread_entry **thread); 146void wakeup_thread(struct thread_entry **thread);
138#ifdef HAVE_PRIORITY_SCHEDULING 147#ifdef HAVE_PRIORITY_SCHEDULING
139int thread_set_priority(struct thread_entry *thread, int priority); 148int thread_set_priority(struct thread_entry *thread, int priority);