Changed the way the ARM7/9 GCC ports enter interrupts that can cause a context switch.

This commit is contained in:
Richard Barry 2007-10-28 13:55:35 +00:00
parent c54ec1c639
commit ada7fa862d
24 changed files with 322 additions and 275 deletions

View file

@ -39,18 +39,43 @@
/*
* Interrupt routine that simply wakes vButtonHandlerTask on each interrupt
* generated by a push of the built in button.
* generated by a push of the built in button. The wrapper takes care of
* the ISR entry. This then calls the actual handler function to perform
* the work. This work should not be done in the wrapper itself unless
* you are absolutely sure that no stack space is used.
*/
void vButtonISR( void ) __attribute__ ((naked));
void vButtonISRWrapper( void ) __attribute__ ((naked));
void vButtonHandler( void );
void vButtonHandler( void )
{
extern xSemaphoreHandle xButtonSemaphore;
void vButtonISR( void )
if( xSemaphoreGiveFromISR( xButtonSemaphore, pdFALSE ) )
{
/* We have woken a task. Calling "yield from ISR" here will ensure
the interrupt returns to the woken task if it has a priority higher
than the interrupted task. */
portYIELD_FROM_ISR();
}
EXTINT = isrCLEAR_EINT_1;
VICVectAddr = 0;
}
/*-----------------------------------------------------------*/
void vButtonISRWrapper( void )
{
portENTER_SWITCHING_ISR();
xSemaphoreGiveFromISR( xButtonSemaphore, pdFALSE );
EXTINT = isrCLEAR_EINT_1;
VICVectAddr = 0;
portEXIT_SWITCHING_ISR( pdTRUE );
/* Save the context of the interrupted task. */
portSAVE_CONTEXT();
/* Call the handler to do the work. This must be a separate function to
the wrapper to ensure the correct stack frame is set up. */
vButtonHandler();
/* Restore the context of whichever task is going to run once the interrupt
completes. */
portRESTORE_CONTEXT();
}