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:
parent
3f9a9a1a01
commit
035529c487
4 changed files with 36 additions and 15 deletions
|
|
@ -3598,8 +3598,6 @@ static void audio_thread(void)
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
intptr_t result = 0;
|
|
||||||
|
|
||||||
if (filling)
|
if (filling)
|
||||||
{
|
{
|
||||||
queue_wait_w_tmo(&audio_queue, &ev, 0);
|
queue_wait_w_tmo(&audio_queue, &ev, 0);
|
||||||
|
|
@ -3685,12 +3683,12 @@ static void audio_thread(void)
|
||||||
|
|
||||||
case Q_AUDIO_REBUFFER_SEEK:
|
case Q_AUDIO_REBUFFER_SEEK:
|
||||||
LOGFQUEUE("audio < 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;
|
break;
|
||||||
|
|
||||||
case Q_AUDIO_CHECK_NEW_TRACK:
|
case Q_AUDIO_CHECK_NEW_TRACK:
|
||||||
LOGFQUEUE("audio < 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;
|
break;
|
||||||
|
|
||||||
case Q_AUDIO_DIR_SKIP:
|
case Q_AUDIO_DIR_SKIP:
|
||||||
|
|
@ -3729,8 +3727,6 @@ static void audio_thread(void)
|
||||||
default:
|
default:
|
||||||
LOGFQUEUE("audio < default");
|
LOGFQUEUE("audio < default");
|
||||||
} /* end switch */
|
} /* end switch */
|
||||||
|
|
||||||
queue_reply(&audio_queue, result);
|
|
||||||
} /* end while */
|
} /* end while */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,6 @@ void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
|
||||||
static struct event_queue *all_queues[32] NOCACHEBSS_ATTR;
|
static struct event_queue *all_queues[32] NOCACHEBSS_ATTR;
|
||||||
static int num_queues NOCACHEBSS_ATTR;
|
static int num_queues NOCACHEBSS_ATTR;
|
||||||
|
|
||||||
void queue_wait(struct event_queue *q, struct event *ev) ICODE_ATTR;
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Standard kernel stuff
|
* Standard kernel stuff
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
@ -234,7 +232,15 @@ void queue_wait(struct event_queue *q, struct event *ev)
|
||||||
int oldlevel;
|
int oldlevel;
|
||||||
unsigned int rd;
|
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)
|
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)
|
void queue_wait_w_tmo(struct event_queue *q, struct event *ev, int ticks)
|
||||||
{
|
{
|
||||||
int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL);
|
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)
|
if (q->read == q->write && ticks > 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1358,7 +1358,6 @@ static void pcmrec_stop(void)
|
||||||
if (is_recording)
|
if (is_recording)
|
||||||
{
|
{
|
||||||
dma_lock = true; /* lock dma write position */
|
dma_lock = true; /* lock dma write position */
|
||||||
queue_reply(&pcmrec_queue, 0);
|
|
||||||
|
|
||||||
/* flush all available data first to avoid overflow while waiting
|
/* flush all available data first to avoid overflow while waiting
|
||||||
for encoding to finish */
|
for encoding to finish */
|
||||||
|
|
@ -1519,15 +1518,11 @@ static void pcmrec_thread(void)
|
||||||
if (is_recording)
|
if (is_recording)
|
||||||
break;
|
break;
|
||||||
pcmrec_close();
|
pcmrec_close();
|
||||||
/* Be sure other threads are released if waiting */
|
|
||||||
queue_clear(&pcmrec_queue);
|
|
||||||
flush_interrupts = 0;
|
|
||||||
usb_acknowledge(SYS_USB_CONNECTED_ACK);
|
usb_acknowledge(SYS_USB_CONNECTED_ACK);
|
||||||
usb_wait_for_disconnect(&pcmrec_queue);
|
usb_wait_for_disconnect(&pcmrec_queue);
|
||||||
|
flush_interrupts = 0;
|
||||||
break;
|
break;
|
||||||
} /* end switch */
|
} /* end switch */
|
||||||
|
|
||||||
queue_reply(&pcmrec_queue, 0);
|
|
||||||
} /* end while */
|
} /* end while */
|
||||||
} /* pcmrec_thread */
|
} /* pcmrec_thread */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,14 @@ void queue_wait(struct event_queue *q, struct event *ev)
|
||||||
{
|
{
|
||||||
unsigned int rd;
|
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)
|
if (q->read == q->write)
|
||||||
{
|
{
|
||||||
block_thread(&q->thread);
|
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)
|
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)
|
if (q->read == q->write && ticks > 0)
|
||||||
{
|
{
|
||||||
block_thread_w_tmo(&q->thread, ticks);
|
block_thread_w_tmo(&q->thread, ticks);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue