]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/main.c
Update version number to V8.0.0 (without the release candidate number).
[freertos] / FreeRTOS / Demo / CORTEX_M0+_Atmel_SAMD20_XPlained / RTOSDemo / src / main.c
index 080586c31086ff5a22e9ff7e7e88a0a18d905fa0..0bb72243408274219826238b9b2f301e9dd60447 100644 (file)
@@ -1,5 +1,6 @@
 /*\r
-    FreeRTOS V7.5.2 - Copyright (C) 2013 Real Time Engineers Ltd.\r
+    FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. \r
+    All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
 \r
@@ -98,8 +99,7 @@ or 0 to run the more comprehensive test and demo application. */
 /*-----------------------------------------------------------*/\r
 \r
 /*\r
- * Perform any application specific hardware configuration.  The clocks,\r
- * memory, etc. are configured before main() is called.\r
+ * Perform any application specific hardware configuration.  \r
  */\r
 static void prvSetupHardware( void );\r
 \r
@@ -109,7 +109,7 @@ static void prvSetupHardware( void );
  */\r
 void vApplicationMallocFailedHook( void );\r
 void vApplicationIdleHook( void );\r
-void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName );\r
+void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );\r
 void vApplicationTickHook( void );\r
 \r
 /*\r
@@ -183,7 +183,7 @@ void vApplicationIdleHook( void )
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName )\r
+void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )\r
 {\r
        ( void ) pcTaskName;\r
        ( void ) pxTask;\r
@@ -202,12 +202,7 @@ void vApplicationTickHook( void )
        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()).  The code in this\r
-       tick hook implementation is for demonstration only - it has no real\r
-       purpose.  It just gives a semaphore every 50ms.  The semaphore unblocks a\r
-       task that then toggles an LED.  Additionally, the call to\r
-       vQueueSetAccessQueueSetFromISR() is part of the "standard demo tasks"\r
-       functionality. */\r
+       functions can be used (those that end in FromISR()). */\r
 \r
        /* The semaphore and associated task are not created when the simple blinky\r
        demo is used. */\r
@@ -223,6 +218,8 @@ void vApplicationTickHook( void )
 \r
 void vMainConfigureTimerForRunTimeStats( void )\r
 {\r
+       /* Used by the optional run-time stats gathering functionality. */\r
+       \r
        /* How many clocks are there per tenth of a millisecond? */\r
        ulClocksPer10thOfAMilliSecond = configCPU_CLOCK_HZ / 10000UL;\r
 }\r
@@ -236,6 +233,9 @@ volatile unsigned long * const pulCurrentSysTickCount = ( ( volatile unsigned lo
 volatile unsigned long * const pulInterruptCTRLState = ( ( volatile unsigned long *) 0xe000ed04 );\r
 const unsigned long ulSysTickPendingBit = 0x04000000UL;\r
 \r
+       /* Used by the optional run-time stats gathering functionality. */\r
+\r
+\r
        /* NOTE: There are potentially race conditions here.  However, it is used\r
        anyway to keep the examples simple, and to avoid reliance on a separate\r
        timer peripheral. */\r
@@ -276,4 +276,33 @@ const unsigned long ulSysTickPendingBit = 0x04000000UL;
        \r
        return ulReturn;        \r
 }\r
+/*-----------------------------------------------------------*/\r
+\r
+#ifdef JUST_AN_EXAMPLE_ISR\r
+\r
+void Dummy_IRQHandler(void)\r
+{\r
+long lHigherPriorityTaskWoken = pdFALSE;\r
+\r
+       /* Clear the interrupt if necessary. */\r
+       Dummy_ClearITPendingBit();\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. Only FreeRTOS API functions\r
+       that end in "FromISR" can be called from an ISR. */\r
+       xSemaphoreGiveFromISR( xTestSemaphore, &lHigherPriorityTaskWoken );\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
+       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
+       task.  Passing pdFALSE into portEND_SWITCHING_ISR() has no effect. */\r
+       portEND_SWITCHING_ISR( lHigherPriorityTaskWoken );\r
+}\r
+\r
+#endif /* JUST_AN_EXAMPLE_ISR */\r
 \r