]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/ARM7_LPC2368_Eclipse/RTOSDemo/webserver/EMAC_ISR.c
6d7b5531088ac9a23badbdf8d42ae1ae2851f6a0
[freertos] / FreeRTOS / Demo / ARM7_LPC2368_Eclipse / RTOSDemo / 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 handler that does the actual work. */\r
9 void vEMAC_ISR_Handler( void ) __attribute__((noinline));\r
10 \r
11 extern xSemaphoreHandle xEMACSemaphore;\r
12 \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     MAC_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         /* Giving the semaphore woke a task. */\r
28         portYIELD_FROM_ISR();\r
29     }\r
30 }\r
31 /*-----------------------------------------------------------*/\r
32 \r
33 void vEMAC_ISR_Wrapper( void )\r
34 {\r
35         /* Save the context of the interrupted task. */\r
36     portSAVE_CONTEXT();\r
37     \r
38     /* Call the handler.  This must be a separate function unless you can\r
39     guarantee that no stack will be used. */\r
40     __asm volatile ( "bl vEMAC_ISR_Handler" );\r
41     \r
42     /* Restore the context of whichever task is going to run next. */\r
43     portRESTORE_CONTEXT();\r
44 }\r
45 \r