1
0
Fork 0
forked from len0rd/rockbox

Enable auto reply for queue messages sent with queue_send. It's only nescessary to use queue_reply to return a value other than zero or to return a result before waiting on the queue again.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14923 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2007-09-30 17:23:13 +00:00
parent 3f9a9a1a01
commit 035529c487
4 changed files with 36 additions and 15 deletions

View file

@ -3598,8 +3598,6 @@ static void audio_thread(void)
while (1)
{
intptr_t result = 0;
if (filling)
{
queue_wait_w_tmo(&audio_queue, &ev, 0);
@ -3685,12 +3683,12 @@ static void audio_thread(void)
case Q_AUDIO_REBUFFER_SEEK:
LOGFQUEUE("audio < Q_AUDIO_REBUFFER_SEEK");
result = audio_rebuffer_and_seek(ev.data);
queue_reply(&audio_queue, audio_rebuffer_and_seek(ev.data));
break;
case Q_AUDIO_CHECK_NEW_TRACK:
LOGFQUEUE("audio < Q_AUDIO_CHECK_NEW_TRACK");
result = audio_check_new_track();
queue_reply(&audio_queue, audio_check_new_track());
break;
case Q_AUDIO_DIR_SKIP:
@ -3729,8 +3727,6 @@ static void audio_thread(void)
default:
LOGFQUEUE("audio < default");
} /* end switch */
queue_reply(&audio_queue, result);
} /* end while */
}

View file

@ -38,8 +38,6 @@ void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
static struct event_queue *all_queues[32] NOCACHEBSS_ATTR;
static int num_queues NOCACHEBSS_ATTR;
void queue_wait(struct event_queue *q, struct event *ev) ICODE_ATTR;
/****************************************************************************
* Standard kernel stuff
****************************************************************************/
@ -234,7 +232,15 @@ void queue_wait(struct event_queue *q, struct event *ev)
int oldlevel;
unsigned int rd;
oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL);
oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL);
#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME
if(q->send && q->send->curr_sender)
{
/* auto-reply */
queue_release_sender(&q->send->curr_sender, 0);
}
#endif
if (q->read == q->write)
{
@ -259,6 +265,14 @@ void queue_wait(struct event_queue *q, struct event *ev)
void queue_wait_w_tmo(struct event_queue *q, struct event *ev, int ticks)
{
int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL);
#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME
if (q->send && q->send->curr_sender)
{
/* auto-reply */
queue_release_sender(&q->send->curr_sender, 0);
}
#endif
if (q->read == q->write && ticks > 0)
{

View file

@ -1358,7 +1358,6 @@ static void pcmrec_stop(void)
if (is_recording)
{
dma_lock = true; /* lock dma write position */
queue_reply(&pcmrec_queue, 0);
/* flush all available data first to avoid overflow while waiting
for encoding to finish */
@ -1519,15 +1518,11 @@ static void pcmrec_thread(void)
if (is_recording)
break;
pcmrec_close();
/* Be sure other threads are released if waiting */
queue_clear(&pcmrec_queue);
flush_interrupts = 0;
usb_acknowledge(SYS_USB_CONNECTED_ACK);
usb_wait_for_disconnect(&pcmrec_queue);
flush_interrupts = 0;
break;
} /* end switch */
queue_reply(&pcmrec_queue, 0);
} /* end while */
} /* pcmrec_thread */

View file

@ -159,6 +159,14 @@ void queue_wait(struct event_queue *q, struct event *ev)
{
unsigned int rd;
#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME
if (q->send && q->send->curr_sender)
{
/* auto-reply */
queue_release_sender(&q->send->curr_sender, 0);
}
#endif
if (q->read == q->write)
{
block_thread(&q->thread);
@ -178,6 +186,14 @@ void queue_wait(struct event_queue *q, struct event *ev)
void queue_wait_w_tmo(struct event_queue *q, struct event *ev, int ticks)
{
#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME
if (q->send && q->send->curr_sender)
{
/* auto-reply */
queue_release_sender(&q->send->curr_sender, 0);
}
#endif
if (q->read == q->write && ticks > 0)
{
block_thread_w_tmo(&q->thread, ticks);