]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/FreeRTOS_tick_config.c
SAMA5D3 Xplained demo blinky running.
[freertos] / FreeRTOS / Demo / CORTEX_A5_SAMA5D3x_Xplained_IAR / FreeRTOS_tick_config.c
index cdde1261ff455620c8e4810be5e363be0efa3961..663b3f95b92717cae5cdf3c2d8cb61e6c1c25068 100644 (file)
@@ -67,6 +67,9 @@
 #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