]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Tasking/main.c
Update XMC4000 tasking project to use latest system files.
[freertos] / FreeRTOS / Demo / CORTEX_M4F_Infineon_XMC4000_Tasking / main.c
index 8e00d49a06cf5c49114808172c208d7dfba5bb50..008b7584295d8a78812dea6b2c9a19fdef38e27b 100644 (file)
@@ -73,9 +73,9 @@
  * This file implements the code that is not demo specific, including the\r
  * hardware setup and FreeRTOS hook functions.\r
  *\r
- * \r
+ *\r
  * Additional code:\r
- * \r
+ *\r
  * This demo does not contain a non-kernel interrupt service routine that\r
  * can be used as an example for application writers to use as a reference.\r
  * Therefore, the framework of a dummy (not installed) handler is provided\r
 #include "XMC4500.h"\r
 #include "System_XMC4500.h"\r
 \r
+/* Standard demo includes. */\r
+#include "QueueSet.h"\r
+#include "QueueOverwrite.h"\r
+\r
 /* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,\r
 or 0 to run the more comprehensive test and demo application. */\r
 #define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY     0\r
@@ -107,9 +111,9 @@ or 0 to run the more comprehensive test and demo application. */
  */\r
 static void prvSetupHardware( void );\r
 \r
-/* \r
+/*\r
  * main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.\r
- * main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0. \r
+ * main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.\r
  */\r
 extern void main_blinky( void );\r
 extern void main_full( void );\r
@@ -139,13 +143,7 @@ int main( void )
 \r
 static void prvSetupHardware( void )\r
 {\r
-extern void SystemCoreClockUpdate( void );\r
-\r
-       /* Ensure SystemCoreClock variable is set. */\r
-       SystemCoreClockUpdate();\r
-\r
-       /* Configure pin P3.9 for the LED. */\r
-       PORT3->IOCR8 = 0x00008000;\r
+       configCONFIGURE_LED();\r
 \r
        /* Ensure all priority bits are assigned as preemption priority bits. */\r
        NVIC_SetPriorityGrouping( 0 );\r
@@ -204,11 +202,22 @@ void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName
 \r
 void vApplicationTickHook( void )\r
 {\r
-       /* This function will be called by each tick interrupt if \r
+       /* This function will be called by each tick interrupt if\r
        configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h.  User code can be\r
        added here, but the tick hook is called from an interrupt context, so\r
        code must not attempt to block, and only the interrupt safe FreeRTOS API\r
        functions can be used (those that end in FromISR()). */\r
+\r
+       #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0\r
+       {\r
+               /* Write to a queue that is in use as part of the queue set demo to\r
+               demonstrate using queue sets from an ISR. */\r
+               vQueueSetAccessQueueSetFromISR();\r
+\r
+               /* Test the ISR safe queue overwrite functions. */\r
+               vQueueOverwritePeriodicISRDemo();\r
+       }\r
+       #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -220,19 +229,19 @@ long lHigherPriorityTaskWoken = pdFALSE;
 \r
        /* Clear the interrupt if necessary. */\r
        Dummy_ClearITPendingBit();\r
-       \r
+\r
        /* This interrupt does nothing more than demonstrate how to synchronise a\r
        task with an interrupt.  A semaphore is used for this purpose.  Note\r
        lHigherPriorityTaskWoken is initialised to zero. */\r
        xSemaphoreGiveFromISR( xTestSemaphore, &lHigherPriorityTaskWoken );\r
-       \r
+\r
        /* If there was a task that was blocked on the semaphore, and giving the\r
        semaphore caused the task to unblock, and the unblocked task has a priority\r
        higher than the current Running state task (the task that this interrupt\r
        interrupted), then lHigherPriorityTaskWoken will have been set to pdTRUE\r
-       internally within xSemaphoreGiveFromISR().  Passing pdTRUE into the \r
+       internally within xSemaphoreGiveFromISR().  Passing pdTRUE into the\r
        portEND_SWITCHING_ISR() macro will result in a context switch being pended to\r
-       ensure this interrupt returns directly to the unblocked, higher priority, \r
+       ensure this interrupt returns directly to the unblocked, higher priority,\r
        task.  Passing pdFALSE into portEND_SWITCHING_ISR() has no effect. */\r
        portEND_SWITCHING_ISR( lHigherPriorityTaskWoken );\r
 }\r