]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c
Update version number ready for V8.2.1 release.
[freertos] / FreeRTOS / Demo / CORTEX_M4_ATSAM4S_Atmel_Studio / src / main_full.c
index 107af2403524d576cc824439c808d4cfa0046aec..0adfbb20214f5fea46cb7d3c0d4c6e5174c08242 100644 (file)
@@ -1,60 +1,64 @@
 /*\r
-    FreeRTOS V8.0.0:rc1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
+    FreeRTOS V8.2.1 - Copyright (C) 2015 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
-    ***************************************************************************\r
-     *                                                                       *\r
-     *    FreeRTOS provides completely free yet professionally developed,    *\r
-     *    robust, strictly quality controlled, supported, and cross          *\r
-     *    platform software that has become a de facto standard.             *\r
-     *                                                                       *\r
-     *    Help yourself get started quickly and support the FreeRTOS         *\r
-     *    project by purchasing a FreeRTOS tutorial book, reference          *\r
-     *    manual, or both from: http://www.FreeRTOS.org/Documentation        *\r
-     *                                                                       *\r
-     *    Thank you!                                                         *\r
-     *                                                                       *\r
-    ***************************************************************************\r
-\r
     This file is part of the FreeRTOS distribution.\r
 \r
     FreeRTOS is free software; you can redistribute it and/or modify it under\r
     the terms of the GNU General Public License (version 2) as published by the\r
     Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
 \r
-    >>! NOTE: The modification to the GPL is included to allow you to distribute\r
-    >>! a combined work that includes FreeRTOS without being obliged to provide\r
-    >>! the source code for proprietary components outside of the FreeRTOS\r
-    >>! kernel.\r
+    ***************************************************************************\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
+    ***************************************************************************\r
 \r
     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
-    FOR A PARTICULAR PURPOSE.  Full license text is available from the following\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
     link: http://www.freertos.org/a00114.html\r
 \r
-    1 tab == 4 spaces!\r
-\r
     ***************************************************************************\r
      *                                                                       *\r
-     *    Having a problem?  Start by reading the FAQ "My application does   *\r
-     *    not run, what could be wrong?"                                     *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that is more than just the market leader, it     *\r
+     *    is the industry's de facto standard.                               *\r
      *                                                                       *\r
-     *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
+     *    Help yourself get started quickly while simultaneously helping     *\r
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
+     *    tutorial book, reference manual, or both:                          *\r
+     *    http://www.FreeRTOS.org/Documentation                              *\r
      *                                                                       *\r
     ***************************************************************************\r
 \r
-    http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
-    license and Real Time Engineers Ltd. contact details.\r
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+    the FAQ page "My application does not run, what could be wrong?".  Have you\r
+    defined configASSERT()?\r
+\r
+    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+    embedded software for free we request you assist our global community by\r
+    participating in the support forum.\r
+\r
+    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+    be as productive as possible as early as possible.  Now you can receive\r
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+    Ltd, and the world's leading authority on the world's leading RTOS.\r
 \r
     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
     including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
     compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
 \r
-    http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
-    Integrity Systems to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
-    licenses offer ticketed support, indemnification and middleware.\r
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and commercial middleware.\r
 \r
     http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
     engineered and independently SIL3 certified version for use in safety and\r
 #include "partest.h"\r
 #include "comtest2.h"\r
 #include "QueueSet.h"\r
+#include "IntQueue.h"\r
+#include "TaskNotify.h"\r
+#include "TimerDemo.h"\r
+#include "EventGroupsDemo.h"\r
+#include "IntSemTest.h"\r
 \r
 /* Atmel library includes. */\r
 #include "asf.h"\r
 \r
 /* The period after which the check timer will expire, in ms, provided no errors\r
 have been reported by any of the standard demo tasks.  ms are converted to the\r
-equivalent in ticks using the portTICK_RATE_MS constant. */\r
-#define mainCHECK_TIMER_PERIOD_MS                      ( 3000UL / portTICK_RATE_MS )\r
+equivalent in ticks using the portTICK_PERIOD_MS constant. */\r
+#define mainCHECK_TIMER_PERIOD_MS                      ( pdMS_TO_TICKS( 3000UL ) )\r
 \r
 /* The period at which the check timer will expire, in ms, if an error has been\r
 reported in one of the standard demo tasks.  ms are converted to the equivalent\r
-in ticks using the portTICK_RATE_MS constant. */\r
-#define mainERROR_CHECK_TIMER_PERIOD_MS        ( 200UL / portTICK_RATE_MS )\r
+in ticks using the portTICK_PERIOD_MS constant. */\r
+#define mainERROR_CHECK_TIMER_PERIOD_MS        ( pdMS_TO_TICKS( 200UL ) )\r
 \r
 /* The standard demo flash timers can be used to flash any number of LEDs.  In\r
 this case, because only three LEDs are available, and one is in use by the\r
@@ -164,22 +173,36 @@ standard demo flash timers. */
 for the comtest, so the LED number is deliberately out of range. */\r
 #define mainCOM_TEST_LED                                       ( 3 )\r
 \r
+/* Used by the standard demo timer tasks. */\r
+#define mainTIMER_TEST_PERIOD                          ( 50 )\r
+\r
 /*-----------------------------------------------------------*/\r
 \r
+/*\r
+ * Called by the idle hook function when the project is configured to run the\r
+ * full (as opposed to the blinky) demo.\r
+ */\r
+void vFullDemoIdleHook( void );\r
+\r
+/*\r
+ * Called by the tick hook function when the project is configured to run the\r
+ * full (as opposed to the blinky) demo.\r
+ */\r
+void vFullDemoTickHook( void );\r
+\r
 /*\r
  * The check timer callback function, as described at the top of this file.\r
  */\r
-static void prvCheckTimerCallback( xTimerHandle xTimer );\r
+static void prvCheckTimerCallback( TimerHandle_t xTimer );\r
 \r
 /*-----------------------------------------------------------*/\r
 \r
 void main_full( void )\r
 {\r
-xTimerHandle xCheckTimer = NULL;\r
-\r
        /* Start all the other standard demo/test tasks.  The have not particular\r
        functionality, but do demonstrate how to use the FreeRTOS API and test the\r
        kernel port. */\r
+       vStartInterruptQueueTasks();\r
        vStartIntegerMathTasks( tskIDLE_PRIORITY );\r
        vStartDynamicPriorityTasks();\r
        vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
@@ -189,23 +212,12 @@ xTimerHandle xCheckTimer = NULL;
        vStartRecursiveMutexTasks();\r
        vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
        vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
-       vStartLEDFlashTimers( mainNUMBER_OF_FLASH_TIMERS_LEDS );\r
        vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );\r
        vStartQueueSetTasks();\r
-\r
-       /* Create the software timer that performs the 'check' functionality,\r
-       as described at the top of this file. */\r
-       xCheckTimer = xTimerCreate( "CheckTimer",                                       /* A text name, purely to help debugging. */\r
-                                                               ( mainCHECK_TIMER_PERIOD_MS ),  /* The timer period, in this case 3000ms (3s). */\r
-                                                               pdTRUE,                                                 /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */\r
-                                                               ( void * ) 0,                                   /* The ID is not used, so can be set to anything. */\r
-                                                               prvCheckTimerCallback                   /* The callback function that inspects the status of all the other tasks. */\r
-                                                         );\r
-\r
-       if( xCheckTimer != NULL )\r
-       {\r
-               xTimerStart( xCheckTimer, mainDONT_BLOCK );\r
-       }\r
+       vStartTaskNotifyTask();\r
+       vStartTimerDemoTask( mainTIMER_TEST_PERIOD );\r
+       vStartEventGroupTasks();\r
+       vStartInterruptSemaphoreTasks();\r
 \r
        /* The set of tasks created by the following function call have to be\r
        created last as they keep account of the number of tasks they expect to see\r
@@ -224,7 +236,7 @@ xTimerHandle xCheckTimer = NULL;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-static void prvCheckTimerCallback( xTimerHandle xTimer )\r
+static void prvCheckTimerCallback( TimerHandle_t xTimer )\r
 {\r
 static long lChangedTimerPeriodAlready = pdFALSE;\r
 unsigned long ulErrorFound = pdFALSE;\r
@@ -232,60 +244,86 @@ unsigned long ulErrorFound = pdFALSE;
        /* Check all the demo tasks (other than the flash tasks) to ensure\r
        they are all still running, and that none have detected an error. */\r
 \r
+       if( xAreIntQueueTasksStillRunning() != pdTRUE )\r
+       {\r
+               ulErrorFound |= 1UL << 0UL;\r
+       }\r
+\r
        if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 1UL;\r
        }\r
 \r
        if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 2UL;\r
        }\r
 \r
        if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 3UL;\r
        }\r
 \r
        if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 4UL;\r
        }\r
 \r
        if ( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 5UL;\r
        }\r
 \r
        if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 6UL;\r
        }\r
 \r
        if( xIsCreateTaskStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 7UL;\r
        }\r
 \r
        if( xArePollingQueuesStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 8UL;\r
        }\r
 \r
        if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 9UL;\r
        }\r
 \r
        if( xAreComTestTasksStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 10UL;\r
        }\r
 \r
-       if( xAreQueueSetTasksStillRunning() != pdPASS )\r
+       if( xAreQueueSetTasksStillRunning() != pdTRUE )\r
+       {\r
+               ulErrorFound |= 1UL << 11UL;\r
+       }\r
+       \r
+       if( xAreTaskNotificationTasksStillRunning() != pdTRUE )\r
+       {\r
+               ulErrorFound |= 1UL << 12UL;\r
+       }\r
+       \r
+       if( xAreTimerDemoTasksStillRunning( mainCHECK_TIMER_PERIOD_MS ) != pdTRUE )\r
+       {\r
+               ulErrorFound |= 1UL << 13UL;\r
+       }\r
+       \r
+       if( xAreEventGroupTasksStillRunning() != pdTRUE )\r
        {\r
-               ulErrorFound = pdTRUE;\r
+               ulErrorFound |= 1UL << 14UL;\r
        }\r
+       \r
+       if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE )\r
+       {\r
+               ulErrorFound |= 1UL << 15UL;\r
+       }\r
+       \r
 \r
        /* Toggle the check LED to give an indication of the system status.  If\r
        the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then\r
@@ -311,3 +349,49 @@ unsigned long ulErrorFound = pdFALSE;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
+void vFullDemoIdleHook( void )\r
+{\r
+static TimerHandle_t xCheckTimer = NULL;\r
+               \r
+       if( xCheckTimer == NULL )\r
+       {\r
+               /* Create the software timer that performs the 'check' \r
+               functionality, in the full demo.  This is not done before the\r
+               scheduler is started as to do so would prevent the standard demo\r
+               timer tasks from passing their tests (they expect the timer\r
+               command queue to be empty. */\r
+               xCheckTimer = xTimerCreate( "CheckTimer",                               /* A text name, purely to help debugging. */\r
+                                                                       mainCHECK_TIMER_PERIOD_MS,      /* The timer period, in this case 3000ms (3s). */\r
+                                                                       pdTRUE,                                         /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */\r
+                                                                       ( void * ) 0,                           /* The ID is not used, so can be set to anything. */\r
+                                                                       prvCheckTimerCallback           /* The callback function that inspects the status of all the other tasks. */\r
+                                                                       );\r
+\r
+               if( xCheckTimer != NULL )\r
+               {\r
+                       xTimerStart( xCheckTimer, mainDONT_BLOCK );\r
+               }\r
+               \r
+               /* Also start some timers that just flash LEDs. */\r
+               vStartLEDFlashTimers( mainNUMBER_OF_FLASH_TIMERS_LEDS );\r
+       }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vFullDemoTickHook( void )\r
+{\r
+       /* In this case the tick hook is used as part of the queue set test. */\r
+       vQueueSetAccessQueueSetFromISR();\r
+               \r
+       /* Use task notifications from an interrupt. */\r
+       xNotifyTaskFromISR();\r
+               \r
+       /* Use timers from an interrupt. */\r
+       vTimerPeriodicISRTests();\r
+       \r
+       /* Use event groups from an interrupt. */\r
+       vPeriodicEventGroupsProcessing();\r
+       \r
+       /* Use mutexes from interrupts. */\r
+       vInterruptSemaphorePeriodicTest();\r
+}\r