summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/kernel.c18
-rw-r--r--firmware/kernel.h4
2 files changed, 11 insertions, 11 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 @@
long current_tick = 0;
-void (*tick_funcs[NUM_TICK_TASKS])(void);
+void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
static void tick_start(unsigned int interval_in_ms);
@@ -37,7 +37,7 @@ void kernel_init(void)
int i;
/* Clear the tick task array */
- for(i = 0;i < NUM_TICK_TASKS;i++)
+ for(i = 0;i < MAX_NUM_TICK_TASKS;i++)
{
tick_funcs[i] = NULL;
}
@@ -151,7 +151,7 @@ void IMIA0(void)
int i;
/* Run through the list of tick tasks */
- for(i = 0;i < NUM_TICK_TASKS;i++)
+ for(i = 0;i < MAX_NUM_TICK_TASKS;i++)
{
if(tick_funcs[i])
{
@@ -170,7 +170,7 @@ int tick_add_task(void (*f)(void))
int oldlevel = set_irq_level(15);
/* Add a task if there is room */
- for(i = 0;i < NUM_TICK_TASKS;i++)
+ for(i = 0;i < MAX_NUM_TICK_TASKS;i++)
{
if(tick_funcs[i] == NULL)
{
@@ -189,7 +189,7 @@ int tick_remove_task(void (*f)(void))
int oldlevel = set_irq_level(15);
/* Remove a task if it is there */
- for(i = 0;i < NUM_TICK_TASKS;i++)
+ for(i = 0;i < MAX_NUM_TICK_TASKS;i++)
{
if(tick_funcs[i] == f)
{
@@ -208,20 +208,20 @@ int tick_remove_task(void (*f)(void))
****************************************************************************/
void mutex_init(struct mutex *m)
{
- m->count = 0;
+ m->locked = false;
}
void mutex_lock(struct mutex *m)
{
/* Wait until the lock is open... */
- while(m->count)
+ while(m->locked)
yield();
/* ...and lock it */
- m->count++;
+ m->locked = true;
}
void mutex_unlock(struct mutex *m)
{
- m->count--;
+ m->locked = false;
}
diff --git a/firmware/kernel.h b/firmware/kernel.h
index f79bc42b80..ee9ded7ab0 100644
--- a/firmware/kernel.h
+++ b/firmware/kernel.h
@@ -27,7 +27,7 @@
#define HZ 100 /* number of ticks per second */
-#define NUM_TICK_TASKS 4
+#define MAX_NUM_TICK_TASKS 4
#define QUEUE_LENGTH 16 /* MUST be a power of 2 */
#define QUEUE_LENGTH_MASK (QUEUE_LENGTH - 1)
@@ -47,7 +47,7 @@ struct event_queue
struct mutex
{
- int count;
+ bool locked;
};
/* global tick variable */