diff options
Diffstat (limited to 'firmware/kernel.c')
-rw-r--r-- | firmware/kernel.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/firmware/kernel.c b/firmware/kernel.c index 12b6eea781..be30d8e56b 100644 --- a/firmware/kernel.c +++ b/firmware/kernel.c | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | long current_tick = 0; | 26 | long current_tick = 0; |
27 | 27 | ||
28 | void (*tick_funcs[NUM_TICK_TASKS])(void); | 28 | void (*tick_funcs[MAX_NUM_TICK_TASKS])(void); |
29 | 29 | ||
30 | static void tick_start(unsigned int interval_in_ms); | 30 | static void tick_start(unsigned int interval_in_ms); |
31 | 31 | ||
@@ -37,7 +37,7 @@ void kernel_init(void) | |||
37 | int i; | 37 | int i; |
38 | 38 | ||
39 | /* Clear the tick task array */ | 39 | /* Clear the tick task array */ |
40 | for(i = 0;i < NUM_TICK_TASKS;i++) | 40 | for(i = 0;i < MAX_NUM_TICK_TASKS;i++) |
41 | { | 41 | { |
42 | tick_funcs[i] = NULL; | 42 | tick_funcs[i] = NULL; |
43 | } | 43 | } |
@@ -151,7 +151,7 @@ void IMIA0(void) | |||
151 | int i; | 151 | int i; |
152 | 152 | ||
153 | /* Run through the list of tick tasks */ | 153 | /* Run through the list of tick tasks */ |
154 | for(i = 0;i < NUM_TICK_TASKS;i++) | 154 | for(i = 0;i < MAX_NUM_TICK_TASKS;i++) |
155 | { | 155 | { |
156 | if(tick_funcs[i]) | 156 | if(tick_funcs[i]) |
157 | { | 157 | { |
@@ -170,7 +170,7 @@ int tick_add_task(void (*f)(void)) | |||
170 | int oldlevel = set_irq_level(15); | 170 | int oldlevel = set_irq_level(15); |
171 | 171 | ||
172 | /* Add a task if there is room */ | 172 | /* Add a task if there is room */ |
173 | for(i = 0;i < NUM_TICK_TASKS;i++) | 173 | for(i = 0;i < MAX_NUM_TICK_TASKS;i++) |
174 | { | 174 | { |
175 | if(tick_funcs[i] == NULL) | 175 | if(tick_funcs[i] == NULL) |
176 | { | 176 | { |
@@ -189,7 +189,7 @@ int tick_remove_task(void (*f)(void)) | |||
189 | int oldlevel = set_irq_level(15); | 189 | int oldlevel = set_irq_level(15); |
190 | 190 | ||
191 | /* Remove a task if it is there */ | 191 | /* Remove a task if it is there */ |
192 | for(i = 0;i < NUM_TICK_TASKS;i++) | 192 | for(i = 0;i < MAX_NUM_TICK_TASKS;i++) |
193 | { | 193 | { |
194 | if(tick_funcs[i] == f) | 194 | if(tick_funcs[i] == f) |
195 | { | 195 | { |
@@ -208,20 +208,20 @@ int tick_remove_task(void (*f)(void)) | |||
208 | ****************************************************************************/ | 208 | ****************************************************************************/ |
209 | void mutex_init(struct mutex *m) | 209 | void mutex_init(struct mutex *m) |
210 | { | 210 | { |
211 | m->count = 0; | 211 | m->locked = false; |
212 | } | 212 | } |
213 | 213 | ||
214 | void mutex_lock(struct mutex *m) | 214 | void mutex_lock(struct mutex *m) |
215 | { | 215 | { |
216 | /* Wait until the lock is open... */ | 216 | /* Wait until the lock is open... */ |
217 | while(m->count) | 217 | while(m->locked) |
218 | yield(); | 218 | yield(); |
219 | 219 | ||
220 | /* ...and lock it */ | 220 | /* ...and lock it */ |
221 | m->count++; | 221 | m->locked = true; |
222 | } | 222 | } |
223 | 223 | ||
224 | void mutex_unlock(struct mutex *m) | 224 | void mutex_unlock(struct mutex *m) |
225 | { | 225 | { |
226 | m->count--; | 226 | m->locked = false; |
227 | } | 227 | } |