#include "FreeRTOS.h"\r
#include "Task.h"\r
\r
+/* Library includes. */\r
+#include "board.h"\r
+\r
/*\r
* The application must provide a function that configures a peripheral to\r
* create the FreeRTOS tick interrupt, then define configSETUP_TICK_INTERRUPT()\r
*/\r
void vConfigureTickInterrupt( void )\r
{\r
-#warning Needs implementing.\r
-}\r
-/*-----------------------------------------------------------*/\r
-void vApplicationIRQHandler( uint32_t ulICCIAR );\r
-void vApplicationIRQHandler( uint32_t ulICCIAR )\r
-{\r
-uint32_t ulInterruptID;\r
+extern void FreeRTOS_Tick_Handler( void );\r
\r
- /* Re-enable interrupts. */\r
- __asm ( "cpsie i" );\r
+ /* NOTE: The PIT interrupt is cleared by the configCLEAR_TICK_INTERRUPT()\r
+ macro in FreeRTOSConfig.h. */\r
\r
- /* The ID of the interrupt is obtained by bitwise anding the ICCIAR value\r
- with 0x3FF. */\r
- ulInterruptID = ulICCIAR & 0x3FFUL;\r
+ /* Enable the PIT clock. */\r
+ PMC->PMC_PCER0 = 1 << ID_PIT;\r
\r
-#warning Needs implementing.\r
+ /* Initialize the PIT to the desired frequency - specified in uS. */\r
+ PIT_Init( 1000000UL / configTICK_RATE_HZ, BOARD_MCK / 1000000 );\r
+ \r
+ /* Configure interrupt on PIT */\r
+#warning This is on the system interrupt and other interrupts may need processing to.\r
+ IRQ_ConfigureIT( ID_PIT, 0, FreeRTOS_Tick_Handler );\r
+ IRQ_EnableIT( ID_PIT );\r
+ PIT_EnableIT();\r
+ \r
+ /* Enable the pit. */\r
+ PIT_Enable();\r
}\r
+/*-----------------------------------------------------------*/\r
\r
\r
\r