]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c
Update version numbers in preparation for new release.
[freertos] / FreeRTOS / Demo / CORTEX_M4_ATSAM4S_Atmel_Studio / src / main_full.c
index 0522e8c5bd174a0f76880224f0a210426c1d527b..4c82c39bff8db876a321e38bec5f77a956e7d379 100644 (file)
@@ -1,60 +1,64 @@
 /*\r
-    FreeRTOS V8.1.0 - Copyright (C) 2014 Real Time Engineers Ltd.\r
+    FreeRTOS V8.2.2 - 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
+    ***************************************************************************\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
 /* 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_PERIOD_MS constant. */\r
-#define mainCHECK_TIMER_PERIOD_MS                      ( 3000UL / portTICK_PERIOD_MS )\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_PERIOD_MS constant. */\r
-#define mainERROR_CHECK_TIMER_PERIOD_MS        ( 200UL / portTICK_PERIOD_MS )\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,8 +173,23 @@ 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
@@ -175,11 +199,10 @@ static void prvCheckTimerCallback( TimerHandle_t xTimer );
 \r
 void main_full( void )\r
 {\r
-TimerHandle_t 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 @@ TimerHandle_t 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
@@ -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