/* Setup the PIT to generate the tick interrupts. */\r
static void prvSetupTimerInterrupt( void );\r
\r
+/* The PIT interrupt handler - the RTOS tick. */\r
+static void vPortTickISR( void );\r
+\r
/* ulCriticalNesting will get set to zero when the first task starts. It\r
cannot be initialised to 0 as this will cause interrupts to be enabled\r
during the kernel initialisation process. */\r
}\r
/*-----------------------------------------------------------*/\r
\r
-#if configUSE_PREEMPTION == 0\r
-\r
- /* The cooperative scheduler requires a normal IRQ service routine to\r
- simply increment the system tick. */\r
- static __arm __irq void vPortNonPreemptiveTick( void );\r
- static __arm __irq void vPortNonPreemptiveTick( void )\r
- {\r
- unsigned portLONG ulDummy;\r
- \r
- /* Increment the tick count - which may wake some tasks but as the\r
- preemptive scheduler is not being used any woken task is not given\r
- processor time no matter what its priority. */\r
- vTaskIncrementTick();\r
- \r
- /* Clear the PIT interrupt. */\r
- ulDummy = AT91C_BASE_PITC->PITC_PIVR;\r
+static __arm void vPortTickISR( void )\r
+{\r
+volatile unsigned portLONG ulDummy;\r
+ \r
+ /* Increment the tick count - which may wake some tasks but as the\r
+ preemptive scheduler is not being used any woken task is not given\r
+ processor time no matter what its priority. */\r
+ vTaskIncrementTick();\r
+\r
+ #if configUSE_PREEMPTION == 0\r
+ vTaskSwitchContext();\r
+ #endif \r
\r
- /* End the interrupt in the AIC. */\r
- AT91C_BASE_AIC->AIC_EOICR = ulDummy;\r
- }\r
-\r
-#else\r
-\r
- /* Currently the IAR port requires the preemptive tick function to be\r
- defined in an asm file. */\r
-\r
-#endif\r
-\r
+ /* Clear the PIT interrupt. */\r
+ ulDummy = AT91C_BASE_PITC->PITC_PIVR;\r
+ \r
+ /* To remove compiler warning. */\r
+ ( void ) ulDummy;\r
+ \r
+ /* The AIC is cleared in the asm wrapper, outside of this function. */\r
+}\r
/*-----------------------------------------------------------*/\r
\r
static void prvSetupTimerInterrupt( void )\r
\r
/* Setup the PIT interrupt. */\r
AIC_DisableIT( AT91C_ID_SYS );\r
-\r
- #if configUSE_PREEMPTION == 0 \r
- AIC_ConfigureIT( AT91C_ID_SYS, AT91C_AIC_PRIOR_LOWEST, vPortNonPreemptiveTick );\r
- #else\r
- extern void ( vPortPreemptiveTick )( void );\r
- AIC_ConfigureIT( AT91C_ID_SYS, AT91C_AIC_PRIOR_LOWEST, vPortPreemptiveTick ); \r
- #endif\r
-\r
+ AIC_ConfigureIT( AT91C_ID_SYS, AT91C_AIC_PRIOR_LOWEST, vPortTickISR );\r
AIC_EnableIT( AT91C_ID_SYS );\r
PIT_EnableIT();\r
\r
CODE32\r
\r
EXTERN vTaskSwitchContext\r
- EXTERN vTaskIncrementTick\r
\r
PUBLIC vPortYieldProcessor\r
- PUBLIC vPortPreemptiveTick\r
PUBLIC vPortStartFirstTask\r
\r
#include "ISR_Support.h"\r
BX R0\r
portRESTORE_CONTEXT ; Restore the context of the selected task.\r
\r
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
-; Preemptive context switch function. This will only ever get installed if\r
-; portUSE_PREEMPTION is set to 1 in portmacro.h.\r
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
-vPortPreemptiveTick:\r
- portSAVE_CONTEXT ; Save the context of the current task.\r
-\r
- LDR R0, =vTaskIncrementTick ; Increment the tick count - this may wake a task.\r
- mov lr, pc\r
- BX R0\r
- LDR R0, =vTaskSwitchContext ; Select the next task to execute.\r
- mov lr, pc\r
- BX R0\r
-#if 0\r
- LDR R14, =AT91C_BASE_PITC ; Clear the PIT interrupt\r
- LDR R0, [R14, #PITC_PIVR ]\r
-\r
- LDR R14, =AT91C_BASE_AIC ; Mark the End of Interrupt on the AIC\r
- STR R14, [R14, #AIC_EOICR]\r
-#endif\r
- portRESTORE_CONTEXT ; Restore the context of the selected task.\r
-\r
\r
END\r
\r