]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c
Add the queue set test to the SAM4S-EK Atmel Studio code.
[freertos] / FreeRTOS / Demo / CORTEX_M4_ATSAM4S_Atmel_Studio / src / main_full.c
index c7a174eb8ba8c674b27c7da4492fd9c0df38e041..84cae55e624e25ca59234dab796555516a65b080 100644 (file)
@@ -1,6 +1,8 @@
 /*\r
-    FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd.\r
+    FreeRTOS V7.3.0 - Copyright (C) 2012 Real Time Engineers Ltd.\r
 \r
+    FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME.  PLEASE VISIT\r
+    http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
 \r
     ***************************************************************************\r
      *                                                                       *\r
     FreeRTOS WEB site.\r
 \r
     1 tab == 4 spaces!\r
-    \r
+\r
     ***************************************************************************\r
      *                                                                       *\r
      *    Having a problem?  Start by reading the FAQ "My application does   *\r
-     *    not run, what could be wrong?                                      *\r
+     *    not run, what could be wrong?"                                     *\r
      *                                                                       *\r
      *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
      *                                                                       *\r
     ***************************************************************************\r
 \r
-    \r
-    http://www.FreeRTOS.org - Documentation, training, latest information, \r
-    license and contact details.\r
-    \r
+\r
+    http://www.FreeRTOS.org - Documentation, training, latest versions, license\r
+    and contact details.\r
+\r
     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
     including FreeRTOS+Trace - an indispensable productivity tool.\r
 \r
-    Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell \r
-    the code with commercial support, indemnification, and middleware, under \r
+    Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell\r
+    the code with commercial support, indemnification, and middleware, under\r
     the OpenRTOS brand: http://www.OpenRTOS.com.  High Integrity Systems also\r
-    provide a safety engineered and independently SIL3 certified version under \r
+    provide a safety engineered and independently SIL3 certified version under\r
     the SafeRTOS brand: http://www.SafeRTOS.com.\r
 */\r
 \r
@@ -77,8 +79,8 @@
  ******************************************************************************\r
  *\r
  * main_full() creates all the demo application tasks and a software timer, then\r
- * starts the scheduler.  The web documentation provides more details of the \r
- * standard demo application tasks, which provide no particular functionality, \r
+ * starts the scheduler.  The web documentation provides more details of the\r
+ * standard demo application tasks, which provide no particular functionality,\r
  * but do provide a good example of how to use the FreeRTOS API.\r
  *\r
  * In addition to the standard demo tasks, the following tasks and tests are\r
  *\r
  * "Check" timer - The check software timer period is initially set to three\r
  * seconds.  The callback function associated with the check software timer\r
- * checks that all the standard demo tasks are not only still executing, but \r
- * are executing without reporting any errors.  If the check software timer \r
- * discovers that a task has either stalled, or reported an error, then it \r
- * changes its own execution period from the initial three seconds, to just \r
- * 200ms.  The check software timer callback function also toggles the green \r
- * LED each time it is called.  This provides a visual indication of the system \r
- * status:  If the green LED toggles every three seconds, then no issues have \r
- * been discovered.  If the green LED toggles every 200ms, then an issue has \r
+ * checks that all the standard demo tasks are not only still executing, but\r
+ * are executing without reporting any errors.  If the check software timer\r
+ * discovers that a task has either stalled, or reported an error, then it\r
+ * changes its own execution period from the initial three seconds, to just\r
+ * 200ms.  The check software timer callback function also toggles the green\r
+ * LED each time it is called.  This provides a visual indication of the system\r
+ * status:  If the green LED toggles every three seconds, then no issues have\r
+ * been discovered.  If the green LED toggles every 200ms, then an issue has\r
  * been discovered with at least one task.\r
  *\r
  * See the documentation page for this demo on the FreeRTOS.org web site for\r
- * full information, including hardware setup requirements. \r
+ * full information, including hardware setup requirements.\r
  */\r
 \r
 /* Standard includes. */\r
 #include "flash_timer.h"\r
 #include "partest.h"\r
 #include "comtest2.h"\r
-\r
+#include "QueueSet.h"\r
 \r
 /* Atmel library includes. */\r
 #include "asf.h"\r
@@ -192,7 +194,8 @@ xTimerHandle xCheckTimer = NULL;
        vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
        vStartLEDFlashTimers( mainNUMBER_OF_FLASH_TIMERS_LEDS );\r
        vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );\r
-       \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( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */\r
@@ -200,27 +203,27 @@ xTimerHandle xCheckTimer = NULL;
                                                                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
+                                                         );\r
+\r
        if( xCheckTimer != NULL )\r
        {\r
                xTimerStart( xCheckTimer, mainDONT_BLOCK );\r
        }\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
+       /* 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
        running. */\r
        vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
 \r
        /* Start the scheduler. */\r
        vTaskStartScheduler();\r
-       \r
+\r
        /* If all is well, the scheduler will now be running, and the following line\r
        will never be reached.  If the following line does execute, then there was\r
        insufficient FreeRTOS heap memory available for the idle and/or timer tasks\r
        to be created.  See the memory management section on the FreeRTOS web site\r
        for more details. */\r
-       for( ;; );      \r
+       for( ;; );\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -276,17 +279,22 @@ unsigned long ulErrorFound = pdFALSE;
        {\r
                ulErrorFound = pdTRUE;\r
        }\r
-       \r
+\r
        if( xAreComTestTasksStillRunning() != pdTRUE )\r
        {\r
                ulErrorFound = pdTRUE;\r
        }\r
 \r
+       if( xAreQueueSetTasksStillRunning() != pdPASS )\r
+       {\r
+               ulErrorFound = pdTRUE;\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
        everything is ok.  A faster toggle indicates an error. */\r
        vParTestToggleLED( mainCHECK_LED );\r
-       \r
+\r
        /* Have any errors been latch in ulErrorFound?  If so, shorten the\r
        period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds.\r
        This will result in an increase in the rate at which mainCHECK_LED\r
@@ -296,7 +304,7 @@ unsigned long ulErrorFound = pdFALSE;
                if( lChangedTimerPeriodAlready == pdFALSE )\r
                {\r
                        lChangedTimerPeriodAlready = pdTRUE;\r
-                       \r
+\r
                        /* This call to xTimerChangePeriod() uses a zero block time.\r
                        Functions called from inside of a timer callback function must\r
                        *never* attempt to block. */\r
@@ -306,3 +314,15 @@ unsigned long ulErrorFound = pdFALSE;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
+void vApplicationTickHook( void )\r
+{\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()).  In this case the tick\r
+       hook is used as part of the queue set test. */\r
+       vQueueSetWriteToQueueFromISR();\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r