forked from len0rd/rockbox
Fix red simulator builds. queue_broadcast() was missing...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14293 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
671f5d4412
commit
ea88571493
1 changed files with 52 additions and 3 deletions
|
@ -27,6 +27,10 @@
|
||||||
|
|
||||||
static void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
|
static void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
|
||||||
|
|
||||||
|
/* This array holds all queues that are initiated. It is used for broadcast. */
|
||||||
|
static struct event_queue *all_queues[32];
|
||||||
|
static int num_queues = 0;
|
||||||
|
|
||||||
int set_irq_level (int level)
|
int set_irq_level (int level)
|
||||||
{
|
{
|
||||||
static int _lv = 0;
|
static int _lv = 0;
|
||||||
|
@ -91,19 +95,52 @@ void queue_enable_queue_send(struct event_queue *q,
|
||||||
|
|
||||||
void queue_init(struct event_queue *q, bool register_queue)
|
void queue_init(struct event_queue *q, bool register_queue)
|
||||||
{
|
{
|
||||||
(void)register_queue;
|
|
||||||
|
|
||||||
q->read = 0;
|
q->read = 0;
|
||||||
q->write = 0;
|
q->write = 0;
|
||||||
q->thread = NULL;
|
q->thread = NULL;
|
||||||
#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME
|
#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME
|
||||||
q->send = NULL; /* No message sending by default */
|
q->send = NULL; /* No message sending by default */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(register_queue)
|
||||||
|
{
|
||||||
|
/* Add it to the all_queues array */
|
||||||
|
all_queues[num_queues++] = q;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void queue_delete(struct event_queue *q)
|
void queue_delete(struct event_queue *q)
|
||||||
{
|
{
|
||||||
(void)q;
|
int i;
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
|
#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME
|
||||||
|
/* Release waiting threads and reply to any dequeued message
|
||||||
|
waiting for one. */
|
||||||
|
queue_release_all_senders(q);
|
||||||
|
queue_reply(q, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Find the queue to be deleted */
|
||||||
|
for(i = 0;i < num_queues;i++)
|
||||||
|
{
|
||||||
|
if(all_queues[i] == q)
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(found)
|
||||||
|
{
|
||||||
|
/* Move the following queues up in the list */
|
||||||
|
for(;i < num_queues-1;i++)
|
||||||
|
{
|
||||||
|
all_queues[i] = all_queues[i+1];
|
||||||
|
}
|
||||||
|
|
||||||
|
num_queues--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void queue_wait(struct event_queue *q, struct event *ev)
|
void queue_wait(struct event_queue *q, struct event *ev)
|
||||||
|
@ -286,6 +323,18 @@ int queue_count(const struct event_queue *q)
|
||||||
return q->write - q->read;
|
return q->write - q->read;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int queue_broadcast(long id, intptr_t data)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for(i = 0;i < num_queues;i++)
|
||||||
|
{
|
||||||
|
queue_post(all_queues[i], id, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return num_queues;
|
||||||
|
}
|
||||||
|
|
||||||
void switch_thread(bool save_context, struct thread_entry **blocked_list)
|
void switch_thread(bool save_context, struct thread_entry **blocked_list)
|
||||||
{
|
{
|
||||||
(void)save_context;
|
(void)save_context;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue