From 3f0e271ff968292fa7d6457e1b7c02570a2480c8 Mon Sep 17 00:00:00 2001 From: RichardBarry Date: Fri, 26 Oct 2007 10:14:19 +0000 Subject: [PATCH] Updated GCC/ARM7 ISR functions so they only use static variables. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@112 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- Demo/ARM7_AT91FR40008_GCC/serial/serialISR.c | 14 +++++++++----- Demo/ARM7_LPC2106_GCC/serial/serialISR.c | 10 +++++++--- .../RTOSDemo/webserver/EMAC_ISR.c | 4 +++- Demo/ARM7_LPC2368_Rowley/webserver/EMAC_ISR.c | 7 ++++++- Demo/WizNET_DEMO_GCC_ARM7/TCPISR.c | 7 ++++++- Demo/WizNET_DEMO_GCC_ARM7/i2cISR.c | 9 +++++++-- Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC_ISR.c | 9 ++++++--- Demo/lwIP_Demo_Rowley_ARM7/USB/USBIsr.c | 13 ++++++++----- 8 files changed, 52 insertions(+), 21 deletions(-) diff --git a/Demo/ARM7_AT91FR40008_GCC/serial/serialISR.c b/Demo/ARM7_AT91FR40008_GCC/serial/serialISR.c index 4fdcab46c..a8b3ad577 100644 --- a/Demo/ARM7_AT91FR40008_GCC/serial/serialISR.c +++ b/Demo/ARM7_AT91FR40008_GCC/serial/serialISR.c @@ -97,10 +97,14 @@ void vUART_ISR( void ) variable declarations. */ portENTER_SWITCHING_ISR(); - /* Now we can declare the local variables. */ - signed portCHAR cChar; - portBASE_TYPE xTaskWokenByTx = pdFALSE, xTaskWokenByRx = pdFALSE; - unsigned portLONG ulStatus; + /* Now we can declare the local variables. These must be static. */ + static signed portCHAR cChar; + static portBASE_TYPE xTaskWokenByTx, xTaskWokenByRx; + static unsigned portLONG ulStatus; + + /* These variables are static so need initialising manually here. */ + xTaskWokenByTx = pdFALSE; + xTaskWokenByRx = pdFALSE; /* What caused the interrupt? */ ulStatus = AT91C_BASE_US0->US_CSR & AT91C_BASE_US0->US_IMR; @@ -133,7 +137,7 @@ void vUART_ISR( void ) } } - // Acknowledge the interrupt at AIC level... + /* Acknowledge the interrupt at AIC level... */ AT91C_BASE_AIC->AIC_EOICR = serCLEAR_AIC_INTERRUPT; /* Exit the ISR. If a task was woken by either a character being received diff --git a/Demo/ARM7_LPC2106_GCC/serial/serialISR.c b/Demo/ARM7_LPC2106_GCC/serial/serialISR.c index 57a18e5c1..34d542f7c 100644 --- a/Demo/ARM7_LPC2106_GCC/serial/serialISR.c +++ b/Demo/ARM7_LPC2106_GCC/serial/serialISR.c @@ -110,9 +110,13 @@ void vUART_ISR( void ) variable declarations. */ portENTER_SWITCHING_ISR(); - /* Now we can declare the local variables. */ - signed portCHAR cChar; - portBASE_TYPE xTaskWokenByTx = pdFALSE, xTaskWokenByRx = pdFALSE; + /* Now we can declare the local variables. These must be static. */ + static signed portCHAR cChar; + static portBASE_TYPE xTaskWokenByTx, xTaskWokenByRx; + + /* As these variables are static they must be initialised manually here. */ + xTaskWokenByTx = pdFALSE; + xTaskWokenByRx = pdFALSE; /* What caused the interrupt? */ switch( UART0_IIR & serINTERRUPT_SOURCE_MASK ) diff --git a/Demo/ARM7_LPC2368_Eclipse/RTOSDemo/webserver/EMAC_ISR.c b/Demo/ARM7_LPC2368_Eclipse/RTOSDemo/webserver/EMAC_ISR.c index ba43f934e..495fea500 100644 --- a/Demo/ARM7_LPC2368_Eclipse/RTOSDemo/webserver/EMAC_ISR.c +++ b/Demo/ARM7_LPC2368_Eclipse/RTOSDemo/webserver/EMAC_ISR.c @@ -10,7 +10,9 @@ void vEMAC_ISR( void ) { portENTER_SWITCHING_ISR(); - portBASE_TYPE xSwitchRequired = pdFALSE; + static portBASE_TYPE xSwitchRequired; + + xSwitchRequired = pdFALSE; /* Clear the interrupt. */ MAC_INTCLEAR = 0xffff; diff --git a/Demo/ARM7_LPC2368_Rowley/webserver/EMAC_ISR.c b/Demo/ARM7_LPC2368_Rowley/webserver/EMAC_ISR.c index 32c7c1ddf..9df1ffe26 100644 --- a/Demo/ARM7_LPC2368_Rowley/webserver/EMAC_ISR.c +++ b/Demo/ARM7_LPC2368_Rowley/webserver/EMAC_ISR.c @@ -10,7 +10,12 @@ void vEMAC_ISR( void ) { portENTER_SWITCHING_ISR(); - portBASE_TYPE xSwitchRequired = pdFALSE; + + /* 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; diff --git a/Demo/WizNET_DEMO_GCC_ARM7/TCPISR.c b/Demo/WizNET_DEMO_GCC_ARM7/TCPISR.c index 4779a8add..5b1d3bff6 100644 --- a/Demo/WizNET_DEMO_GCC_ARM7/TCPISR.c +++ b/Demo/WizNET_DEMO_GCC_ARM7/TCPISR.c @@ -59,7 +59,12 @@ void vEINT0_ISR( void ) portENTER_SWITCHING_ISR(); extern xQueueHandle xTCPISRQueue; - portBASE_TYPE xTaskWoken = pdFALSE; + + /* Must be declared static. */ + static portBASE_TYPE xTaskWoken; + + /* As the variable is static it must be manually initialised. */ + xTaskWoken = pdFALSE; /* Just wake the TCP task so it knows an ISR has occurred. */ xQueueSendFromISR( xTCPISRQueue, ( void * ) &lDummyVariable, xTaskWoken ); diff --git a/Demo/WizNET_DEMO_GCC_ARM7/i2cISR.c b/Demo/WizNET_DEMO_GCC_ARM7/i2cISR.c index e0a97497a..cfb4e9aad 100644 --- a/Demo/WizNET_DEMO_GCC_ARM7/i2cISR.c +++ b/Demo/WizNET_DEMO_GCC_ARM7/i2cISR.c @@ -124,11 +124,16 @@ void vI2C_ISR( void ) { portENTER_SWITCHING_ISR(); + /* Variables must be static. */ + /* Holds the current transmission state. */ static I2C_STATE eCurrentState = eSentStart; static portLONG lMessageIndex = -i2cBUFFER_ADDRESS_BYTES; /* There are two address bytes to send prior to the data. */ - portBASE_TYPE xTaskWokenByTx = pdFALSE; - portLONG lBytesLeft; + static portBASE_TYPE xTaskWokenByTx; + static portLONG lBytesLeft; + + xTaskWokenByTx = pdFALSE; + /* The action taken for this interrupt depends on our current state. */ switch( eCurrentState ) diff --git a/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC_ISR.c b/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC_ISR.c index 140f72df0..32d982fe3 100644 --- a/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC_ISR.c +++ b/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC_ISR.c @@ -71,11 +71,14 @@ void vEMACISR( void ) variable declarations. */ portENTER_SWITCHING_ISR(); - /* Variable definitions can be made now. */ - volatile unsigned portLONG ulIntStatus, ulEventStatus; - portBASE_TYPE xSwitchRequired = pdFALSE; + /* Variable definitions can be made now. These must be static. */ + static volatile unsigned portLONG ulIntStatus, ulEventStatus; + static portBASE_TYPE xSwitchRequired; extern void vClearEMACTxBuffer( void ); + /* As the variable is static it must be initialised manually here. */ + xSwitchRequired = pdFALSE; + /* Find the cause of the interrupt. */ ulIntStatus = AT91C_BASE_EMAC->EMAC_ISR; ulEventStatus = AT91C_BASE_EMAC->EMAC_RSR; diff --git a/Demo/lwIP_Demo_Rowley_ARM7/USB/USBIsr.c b/Demo/lwIP_Demo_Rowley_ARM7/USB/USBIsr.c index 5c731ef54..db1f9cf91 100644 --- a/Demo/lwIP_Demo_Rowley_ARM7/USB/USBIsr.c +++ b/Demo/lwIP_Demo_Rowley_ARM7/USB/USBIsr.c @@ -71,12 +71,15 @@ void vUSB_ISR( void ) stack variable declarations. */ portENTER_SWITCHING_ISR(); - /* Now variables can be declared. */ - portCHAR cTaskWokenByPost = pdFALSE; + /* Now variables can be declared. These must be static. */ + static portCHAR cTaskWokenByPost; static volatile unsigned portLONG ulNextMessage = 0; - xISRStatus *pxMessage; - unsigned portLONG ulRxBytes; - unsigned portCHAR ucFifoIndex; + static xISRStatus *pxMessage; + static unsigned portLONG ulRxBytes; + static unsigned portCHAR ucFifoIndex; + + /* As the variables are static they must be initialised manually here. */ + cTaskWokenByPost = pdFALSE; /* Use the next message from the array. */ pxMessage = &( xISRMessages[ ( ulNextMessage & usbQUEUE_LENGTH ) ] ); -- 2.39.5