diff options
Diffstat (limited to 'firmware/export/thread.h')
-rw-r--r-- | firmware/export/thread.h | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/firmware/export/thread.h b/firmware/export/thread.h index 19bf9e12fc..e16baa2256 100644 --- a/firmware/export/thread.h +++ b/firmware/export/thread.h | |||
@@ -50,32 +50,32 @@ | |||
50 | #ifndef SIMULATOR | 50 | #ifndef SIMULATOR |
51 | /* Need to keep structures inside the header file because debug_menu | 51 | /* Need to keep structures inside the header file because debug_menu |
52 | * needs them. */ | 52 | * needs them. */ |
53 | # ifdef CPU_COLDFIRE | 53 | #ifdef CPU_COLDFIRE |
54 | struct regs | 54 | struct regs |
55 | { | 55 | { |
56 | unsigned int macsr; /* EMAC status register */ | 56 | unsigned int macsr; /* 0 - EMAC status register */ |
57 | unsigned int d[6]; /* d2-d7 */ | 57 | unsigned int d[6]; /* 4-24 - d2-d7 */ |
58 | unsigned int a[5]; /* a2-a6 */ | 58 | unsigned int a[5]; /* 28-44 - a2-a6 */ |
59 | void *sp; /* Stack pointer (a7) */ | 59 | void *sp; /* 48 - Stack pointer (a7) */ |
60 | void *start; /* Thread start address, or NULL when started */ | 60 | void *start; /* 52 - Thread start address, or NULL when started */ |
61 | }; | 61 | } __attribute__((packed)); |
62 | # elif CONFIG_CPU == SH7034 | 62 | #elif CONFIG_CPU == SH7034 |
63 | struct regs | 63 | struct regs |
64 | { | 64 | { |
65 | unsigned int r[7]; /* Registers r8 thru r14 */ | 65 | unsigned int r[7]; /* 0-24 - Registers r8 thru r14 */ |
66 | void *sp; /* Stack pointer (r15) */ | 66 | void *sp; /* 28 - Stack pointer (r15) */ |
67 | void *pr; /* Procedure register */ | 67 | void *pr; /* 32 - Procedure register */ |
68 | void *start; /* Thread start address, or NULL when started */ | 68 | void *start; /* 36 - Thread start address, or NULL when started */ |
69 | }; | 69 | } __attribute__((packed)); |
70 | # elif defined(CPU_ARM) | 70 | #elif defined(CPU_ARM) |
71 | struct regs | 71 | struct regs |
72 | { | 72 | { |
73 | unsigned int r[8]; /* Registers r4-r11 */ | 73 | unsigned int r[8]; /* 0-28 - Registers r4-r11 */ |
74 | void *sp; /* Stack pointer (r13) */ | 74 | void *sp; /* 32 - Stack pointer (r13) */ |
75 | unsigned int lr; /* r14 (lr) */ | 75 | unsigned int lr; /* 36 - r14 (lr) */ |
76 | void *start; /* Thread start address, or NULL when started */ | 76 | void *start; /* 40 - Thread start address, or NULL when started */ |
77 | }; | 77 | } __attribute__((packed)); |
78 | # endif | 78 | #endif /* CONFIG_CPU */ |
79 | #else | 79 | #else |
80 | struct regs | 80 | struct regs |
81 | { | 81 | { |
@@ -140,9 +140,9 @@ struct core_entry { | |||
140 | }; | 140 | }; |
141 | 141 | ||
142 | #ifdef HAVE_PRIORITY_SCHEDULING | 142 | #ifdef HAVE_PRIORITY_SCHEDULING |
143 | #define IF_PRIO(empty, type) , type | 143 | #define IF_PRIO(...) __VA_ARGS__ |
144 | #else | 144 | #else |
145 | #define IF_PRIO(empty, type) | 145 | #define IF_PRIO(...) |
146 | #endif | 146 | #endif |
147 | 147 | ||
148 | /* PortalPlayer chips have 2 cores, therefore need atomic mutexes | 148 | /* PortalPlayer chips have 2 cores, therefore need atomic mutexes |
@@ -197,14 +197,6 @@ struct core_entry { | |||
197 | }) | 197 | }) |
198 | #endif | 198 | #endif |
199 | 199 | ||
200 | #if NUM_CORES > 1 | ||
201 | inline void lock_cores(void); | ||
202 | inline void unlock_cores(void); | ||
203 | #else | ||
204 | #define lock_cores(...) | ||
205 | #define unlock_cores(...) | ||
206 | #endif | ||
207 | |||
208 | struct thread_entry* | 200 | struct thread_entry* |
209 | create_thread(void (*function)(void), void* stack, int stack_size, | 201 | create_thread(void (*function)(void), void* stack, int stack_size, |
210 | const char *name IF_PRIO(, int priority) | 202 | const char *name IF_PRIO(, int priority) |
@@ -239,7 +231,12 @@ void priority_yield(void); | |||
239 | struct thread_entry * thread_get_current(void); | 231 | struct thread_entry * thread_get_current(void); |
240 | void init_threads(void); | 232 | void init_threads(void); |
241 | int thread_stack_usage(const struct thread_entry *thread); | 233 | int thread_stack_usage(const struct thread_entry *thread); |
234 | #if NUM_CORES > 1 | ||
235 | int idle_stack_usage(unsigned int core); | ||
236 | #endif | ||
242 | int thread_get_status(const struct thread_entry *thread); | 237 | int thread_get_status(const struct thread_entry *thread); |
238 | void thread_get_name(char *buffer, int size, | ||
239 | struct thread_entry *thread); | ||
243 | #ifdef RB_PROFILE | 240 | #ifdef RB_PROFILE |
244 | void profile_thread(void); | 241 | void profile_thread(void); |
245 | #endif | 242 | #endif |