forked from len0rd/rockbox
AS3525v1/2: Enable nested handling of interrupts
Mostly for the sake of reducing latency for audio servicing where other service routines can take a long time to complete, leading to occasional drops of a few samples, especially in recording, where they are fairly frequent. One mystery that remains is GPIOA IRQ being interrupted causes strange undefined instruction exceptions, most easily produced on my Fuze V2 with a scrollwheel. Making GPIOA the top ISR for now, thus not interruptible, cures it. SVC mode is used during the actual calls. Hopefully the SVC stack size is sufficient. Prologue and epilogue code only uses the IRQ stack and is large enough. Any routine code that should not be interrupted should disable IRQ itself from here on in. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31642 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
5e21bbf575
commit
307cb04948
8 changed files with 105 additions and 48 deletions
|
|
@ -1195,9 +1195,7 @@ int semaphore_wait(struct semaphore *s, int timeout)
|
|||
* in 'semaphore_init'. */
|
||||
void semaphore_release(struct semaphore *s)
|
||||
{
|
||||
#if defined(HAVE_PRIORITY_SCHEDULING) && defined(irq_enabled_checkval)
|
||||
unsigned int result = THREAD_NONE;
|
||||
#endif
|
||||
int oldlevel;
|
||||
|
||||
oldlevel = disable_irq_save();
|
||||
|
|
@ -1209,11 +1207,7 @@ void semaphore_release(struct semaphore *s)
|
|||
KERNEL_ASSERT(s->count == 0,
|
||||
"semaphore_release->threads queued but count=%d!\n", s->count);
|
||||
s->queue->retval = OBJ_WAIT_SUCCEEDED; /* indicate explicit wake */
|
||||
#if defined(HAVE_PRIORITY_SCHEDULING) && defined(irq_enabled_checkval)
|
||||
result = wakeup_thread(&s->queue);
|
||||
#else
|
||||
wakeup_thread(&s->queue);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1228,11 +1222,11 @@ void semaphore_release(struct semaphore *s)
|
|||
corelock_unlock(&s->cl);
|
||||
restore_irq(oldlevel);
|
||||
|
||||
#if defined(HAVE_PRIORITY_SCHEDULING) && defined(irq_enabled_checkval)
|
||||
/* No thread switch if IRQ disabled - it's probably called via ISR.
|
||||
* switch_thread would as well enable them anyway. */
|
||||
if((result & THREAD_SWITCH) && irq_enabled_checkval(oldlevel))
|
||||
#if defined(HAVE_PRIORITY_SCHEDULING) && defined(is_thread_context)
|
||||
/* No thread switch if not thread context */
|
||||
if((result & THREAD_SWITCH) && is_thread_context())
|
||||
switch_thread();
|
||||
#endif
|
||||
(void)result;
|
||||
}
|
||||
#endif /* HAVE_SEMAPHORE_OBJECTS */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue