]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/ARM7_LPC2368_Rowley/webserver/EMAC_ISR.c
Add FreeRTOS-Plus directory.
[freertos] / FreeRTOS / Demo / ARM7_LPC2368_Rowley / webserver / EMAC_ISR.c
1 #include "FreeRTOS.h"\r
2 #include "semphr.h"\r
3 #include "task.h"\r
4 \r
5 /* The interrupt entry point. */\r
6 void vEMAC_ISR_Wrapper( void ) __attribute__((naked));\r
7 \r
8 /* The function that actually performs the interrupt processing.  This must be \r
9 separate to the wrapper to ensure the correct stack frame is set up. */\r
10 void vEMAC_ISR_Handler( void ) __attribute__((noinline));\r
11 \r
12 extern xSemaphoreHandle xEMACSemaphore;\r
13 \r
14 void vEMAC_ISR_Handler( void )\r
15 {\r
16 portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
17 \r
18     /* Clear the interrupt. */\r
19     IntClear = 0xffff;\r
20     VICVectAddr = 0;\r
21 \r
22     /* Ensure the uIP task is not blocked as data has arrived. */\r
23     xSemaphoreGiveFromISR( xEMACSemaphore, &xHigherPriorityTaskWoken );\r
24 \r
25         if( xHigherPriorityTaskWoken )\r
26     {\r
27                 /* If the uIP task was unblocked then calling "Yield from ISR" here\r
28                 will ensure the interrupt returns directly to the uIP task, if it\r
29                 is the highest priority read task. */\r
30         portYIELD_FROM_ISR();\r
31     }\r
32 }\r
33 /*-----------------------------------------------------------*/\r
34 \r
35 void vEMAC_ISR_Wrapper( void )\r
36 {\r
37         /* Save the context of the interrupted task. */\r
38         portSAVE_CONTEXT();\r
39 \r
40         /* Call the handler function.  This must be separate from the wrapper\r
41         function to ensure the correct stack frame is set up. */\r
42         __asm volatile( "bl vEMAC_ISR_Handler" );\r
43 \r
44         /* Restore the context of whichever task is going to run next. */\r
45         portRESTORE_CONTEXT();\r
46 }\r
47 \r
48 \r
49 \r
50 \r