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

@ -2,21 +2,17 @@
#include "Semphr.h"
#include "Task.h"
void vEMAC_ISR( void ) __attribute__((naked));
/* The interrupt entry point. */
void vEMAC_ISR_Wrapper( void ) __attribute__((naked));
/* The function that actually performs the interrupt processing. This must be
separate to the wrapper to ensure the correct stack frame is set up. */
void vEMAC_ISR_Handler( void );
extern xSemaphoreHandle xEMACSemaphore;
void vEMAC_ISR( void )
void vEMAC_ISR_Handler( void )
{
portENTER_SWITCHING_ISR();
/* Variable must be static. */
static portBASE_TYPE xSwitchRequired;
/* As the variable is static it must be manually initialised here. */
xSwitchRequired = pdFALSE;
/* Clear the interrupt. */
IntClear = 0xffff;
VICVectAddr = 0;
@ -24,11 +20,27 @@ void vEMAC_ISR( void )
/* Ensure the uIP task is not blocked as data has arrived. */
if( xSemaphoreGiveFromISR( xEMACSemaphore, pdFALSE ) )
{
xSwitchRequired = pdTRUE;
/* If the uIP task was unblocked then calling "Yield from ISR" here
will ensure the interrupt returns directly to the uIP task, if it
is the highest priority read task. */
portYIELD_FROM_ISR();
}
}
/*-----------------------------------------------------------*/
/* Switch to the uIP task. */
portEXIT_SWITCHING_ISR( xSwitchRequired );
void vEMAC_ISR_Wrapper( void )
{
/* Save the context of the interrupted task. */
portSAVE_CONTEXT();
/* Call the handler function. This must be separate from the wrapper
function to ensure the correct stack frame is set up. */
vEMAC_ISR_Handler();
/* Restore the context of whichever task is going to run next. */
portRESTORE_CONTEXT();
}

View file

@ -115,7 +115,7 @@ void vuIP_Task( void *pvParameters )
portBASE_TYPE i;
uip_ipaddr_t xIPAddr;
struct timer periodic_timer, arp_timer;
extern void ( vEMAC_ISR )( void );
extern void ( vEMAC_ISR_Wrapper )( void );
/* Create the semaphore used by the ISR to wake this task. */
vSemaphoreCreateBinary( xEMACSemaphore );
@ -138,7 +138,7 @@ extern void ( vEMAC_ISR )( void );
{
IntEnable = INT_RX_DONE;
VICIntEnable |= 0x00200000;
VICVectAddr21 = ( portLONG ) vEMAC_ISR;
VICVectAddr21 = ( portLONG ) vEMAC_ISR_Wrapper;
prvSetMACAddress();
}
portEXIT_CRITICAL();