summaryrefslogtreecommitdiff
path: root/firmware/kernel.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-06-29 21:19:55 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-06-29 21:19:55 +0000
commit2a73cec69bf7b372377f79ef561985816148b1af (patch)
treef53e50110ff9069c8c2ac4018e2fa4e1444c2c8e /firmware/kernel.c
parenteb102e1a239d75f4eaf34398c0dbb29c0bc50c84 (diff)
Added queue_broadcast()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1253 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/kernel.c')
-rw-r--r--firmware/kernel.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/firmware/kernel.c b/firmware/kernel.c
index 3e6f89bc7e..02b76e1e5d 100644
--- a/firmware/kernel.c
+++ b/firmware/kernel.c
@@ -29,21 +29,22 @@ void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
static void tick_start(unsigned int interval_in_ms);
+/* This array holds all queues that are initiated. It is used for broadcast. */
+static struct event_queue *all_queues[32];
+static int num_queues;
+
/****************************************************************************
* Standard kernel stuff
****************************************************************************/
void kernel_init(void)
{
- int i;
-
/* Init the threading API */
init_threads();
- /* Clear the tick task array */
- for(i = 0;i < MAX_NUM_TICK_TASKS;i++)
- {
- tick_funcs[i] = NULL;
- }
+ memset(tick_funcs, 0, sizeof(tick_funcs));
+
+ num_queues = 0;
+ memset(all_queues, 0, sizeof(all_queues));
tick_start(1000/HZ);
}
@@ -82,6 +83,9 @@ void queue_init(struct event_queue *q)
{
q->read = 0;
q->write = 0;
+
+ /* Add it to the all_queues array */
+ all_queues[num_queues++] = q;
}
void queue_wait(struct event_queue *q, struct event *ev)
@@ -112,6 +116,17 @@ bool queue_empty(struct event_queue* q)
return ( q->read == q->write );
}
+int queue_broadcast(int id, void *data)
+{
+ int i;
+
+ for(i = 0;i < num_queues;i++)
+ {
+ queue_post(all_queues[i], id, data);
+ }
+
+ return num_queues;
+}
/****************************************************************************
* Timer tick