]> git.sur5r.net Git - freertos/blobdiff - Demo/MB96340_Softune/FreeRTOS_96348hs_SK16FX100PMC/Src/main.c
Remove unnecessary use of portLONG, portCHAR and portSHORT.
[freertos] / Demo / MB96340_Softune / FreeRTOS_96348hs_SK16FX100PMC / Src / main.c
index 3c3c06a7904062dfd7c05c7846f144319b36b09b..a66f061d73dc2d49e0867d31cea9cb5b79ee9cf0 100644 (file)
 /*\r
-       FreeRTOS.org V4.7.1 - Copyright (C) 2003-2008 Richard Barry.\r
+    FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.\r
 \r
-       This file is part of the FreeRTOS.org distribution.\r
+    This file is part of the FreeRTOS distribution.\r
 \r
-       FreeRTOS.org is free software; you can redistribute it and/or modify\r
-       it under the terms of the GNU General Public License as published by\r
-       the Free Software Foundation; either version 2 of the License, or\r
-       (at your option) any later version.\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
+    **NOTE** The exception to the GPL is included to allow you to distribute a\r
+    combined work that includes FreeRTOS without being obliged to provide the\r
+    source code for proprietary components outside of the FreeRTOS kernel.\r
+    Alternative commercial license and support terms are also available upon\r
+    request.  See the licensing section of http://www.FreeRTOS.org for full\r
+    license details.\r
 \r
-       FreeRTOS.org is distributed in the hope that it will be useful,\r
-       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-       GNU General Public License for more details.\r
+    FreeRTOS is distributed in the hope that it will be useful,    but WITHOUT\r
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
+    more details.\r
 \r
-       You should have received a copy of the GNU General Public License\r
-       along with FreeRTOS.org; if not, write to the Free Software\r
-       Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+    You should have received a copy of the GNU General Public License along\r
+    with FreeRTOS; if not, write to the Free Software Foundation, Inc., 59\r
+    Temple Place, Suite 330, Boston, MA  02111-1307  USA.\r
 \r
-       A special exception to the GPL can be applied should you wish to distribute\r
-       a combined work that includes FreeRTOS.org, without being obliged to provide\r
-       the source code for any proprietary components.  See the licensing section\r
-       of http://www.FreeRTOS.org for full details of how and when the exception\r
-       can be applied.\r
 \r
-       ***************************************************************************\r
+    ***************************************************************************\r
+    *                                                                         *\r
+    * The FreeRTOS eBook and reference manual are available to purchase for a *\r
+    * small fee. Help yourself get started quickly while also helping the     *\r
+    * FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *\r
+    *                                                                         *\r
+    ***************************************************************************\r
 \r
-       Please ensure to read the configuration and relevant port sections of the \r
-       online documentation.\r
+    1 tab == 4 spaces!\r
 \r
-       +++ http://www.FreeRTOS.org +++\r
-       Documentation, latest information, license and contact details.  \r
+    Please ensure to read the configuration and relevant port sections of the\r
+    online documentation.\r
 \r
-       +++ http://www.SafeRTOS.com +++\r
-       A version that is certified for use in safety critical systems.\r
+    http://www.FreeRTOS.org - Documentation, latest information, license and\r
+    contact details.\r
 \r
-       +++ http://www.OpenRTOS.com +++\r
-       Commercial support, development, porting, licensing and training services.\r
+    http://www.SafeRTOS.com - A version that is certified for use in safety\r
+    critical systems.\r
 \r
-       ***************************************************************************\r
+    http://www.OpenRTOS.com - Commercial support, development, porting,\r
+    licensing and training services.\r
 */\r
 \r
-/*---------------------------------------------------------------------------\r
-  MAIN.C\r
-  - description\r
-  - See README.TXT for project description and disclaimer.\r
-\r
-/*---------------------------------------------------------------------------*/\r
+/*\r
+ * Creates all the demo application tasks, then starts the scheduler.  The WEB\r
+ * documentation provides more details of the demo application tasks.\r
+ * \r
+ * In addition to the standard demo tasks, the follow demo specific tasks are\r
+ * create:\r
+ *\r
+ * The "Check" task.  This only executes every three seconds but has the highest \r
+ * priority so is guaranteed to get processor time.  Its main function is to \r
+ * check that all the other tasks are still operational.  Most tasks maintain \r
+ * a unique count that is incremented each time the task successfully completes \r
+ * its function.  Should any error occur within such a task the count is \r
+ * permanently halted.  The check task inspects the count of each task to ensure \r
+ * it has changed since the last time the check task executed.  If all the count \r
+ * variables have changed all the tasks are still executing error free, and the \r
+ * check task toggles the onboard LED.  Should any task contain an error at any time \r
+ * the LED toggle rate will change from 3 seconds to 500ms.\r
+ *\r
+ * The "Trace Utility" task.  This can be used to obtain trace and debug \r
+ * information via UART1.\r
+ */\r
 \r
-/* 16FX includes */\r
-#include "mb96348hs.h"\r
 \r
 /* Scheduler includes. */\r
 #include "FreeRTOS.h"\r
 #include "task.h"\r
 #include "semphr.h"\r
+\r
+/* Demo application includes. */\r
+#include "flash.h"\r
+#include "integer.h"\r
+#include "comtest2.h"\r
+#include "PollQ.h"\r
+#include "semtest.h"\r
+#include "BlockQ.h"\r
+#include "dynamic.h"\r
+#include "flop.h"\r
+#include "GenQTest.h"\r
+#include "QPeek.h"\r
+#include "blocktim.h"\r
+#include "death.h"\r
+#include "taskutility.h"\r
+#include "partest.h"\r
+#include "crflash.h"\r
+#include "watchdog.h"\r
+\r
+/* Library includes. */\r
 #include <watchdog.h>\r
-#include <config.h>\r
 \r
-/*---------------------------------------------------------------------------*/\r
+/*-----------------------------------------------------------*/\r
 \r
 /* Demo task priorities. */\r
 #define WTC_TASK_PRIORITY                      ( tskIDLE_PRIORITY + 5 )\r
 #define mainCHECK_TASK_PRIORITY                ( tskIDLE_PRIORITY + 4 )\r
-#define TASK_UTILITY_PRIORITY          ( tskIDLE_PRIORITY + 3 )\r
+#define TASK_UTILITY_PRIORITY          ( tskIDLE_PRIORITY )\r
 #define mainSEM_TEST_PRIORITY          ( tskIDLE_PRIORITY + 3 )\r
 #define mainCOM_TEST_PRIORITY          ( tskIDLE_PRIORITY + 2 )\r
 #define mainQUEUE_POLL_PRIORITY                ( tskIDLE_PRIORITY + 2 )\r
 #define mainGENERIC_QUEUE_PRIORITY     ( tskIDLE_PRIORITY )\r
 \r
 /* Baud rate used by the COM test tasks. */\r
-#define mainCOM_TEST_BAUD_RATE ( ( unsigned portLONG ) 19200 )\r
+#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 19200 )\r
 \r
 /* The frequency at which the 'Check' tasks executes.  See the comments at the \r
 top of the page.  When the system is operating error free the 'Check' task\r
 toggles an LED every three seconds.  If an error is discovered in any task the\r
 rate is increased to 500 milliseconds.  [in this case the '*' characters on the \r
-LCD represent LED's]*/\r
+LCD represent LED's] */\r
 #define mainNO_ERROR_CHECK_DELAY       ( (portTickType) 3000 / portTICK_RATE_MS )\r
 #define mainERROR_CHECK_DELAY          ( (portTickType) 500 / portTICK_RATE_MS )\r
 \r
-/*---------------------------------------------------------------------------*/\r
-#define ledNUMBER_OF_LEDS      8\r
-#define mainCOM_TEST_LED       0x05\r
-#define mainCHECK_TEST_LED     0x07\r
+/* LED assignments for the demo tasks. */\r
+#define mainNUM_FLASH_CO_ROUTINES      8\r
+#define mainCOM_TEST_LED                       0x05\r
+#define mainCHECK_TEST_LED                     0x07\r
 \r
-/*---------------------------------------------------------------------------*/\r
+/*-----------------------------------------------------------*/\r
 \r
 /* \r
  * The function that implements the Check task.  See the comments at the head\r
  * of the page for implementation details.\r
  */\r
-static void                                    vErrorChecks( void *pvParameters );\r
+static void    vErrorChecks( void *pvParameters );\r
 \r
 /*\r
  * Called by the Check task.  Returns pdPASS if all the other tasks are found\r
  * to be operating without error - otherwise returns pdFAIL.\r
  */\r
-static portSHORT                       prvCheckOtherTasksAreStillRunning( void );\r
-\r
-/*---------------------------------------------------------------------------*/\r
-static unsigned portCHAR       sState[2] = { 0xFF, 0xFF };\r
-\r
-/*---------------------------------------------------------------------------\r
- * The below callback function is called from Tick ISR if configUSE_TICK_HOOK \r
- * is configured as 1.\r
- *---------------------------------------------------------------------------*/\r
-\r
-/*void vApplicationTickHook ( void )\r
-{\r
-#if WATCHDOG == WTC_IN_TICK\r
-       Kick_Watchdog();\r
-#endif\r
-}*/\r
-\r
-/*---------------------------------------------------------------------------\r
- * The below callback function is called from Delayed ISR if configUSE_IDLE_HOOK \r
- * is configured as 1.\r
- *---------------------------------------------------------------------------*/\r
-void vApplicationIdleHook( void )\r
-{\r
-       #if WATCHDOG == WTC_IN_IDLE\r
-       Kick_Watchdog();\r
-       #endif\r
-       #if ( INCLUDE_StartFlashCoRoutines == 1 || INCLUDE_StartHookCoRoutines == 1 )\r
-       vCoRoutineSchedule();\r
-       #endif\r
-}\r
+static short prvCheckOtherTasksAreStillRunning( void );\r
 \r
-/*---------------------------------------------------------------------------\r
- * Initialize Port 00\r
- *---------------------------------------------------------------------------*/\r
-static void prvInitPort00( void )\r
-{\r
-       DDR00 = 0xFF;\r
-       PDR00 = 0xFF;\r
-       DDR09 = 0xFF;\r
-       PDR09 = 0xFF;\r
-}\r
-\r
-/*---------------------------------------------------------------------------\r
- * Setup the hardware\r
- *---------------------------------------------------------------------------*/\r
-static void prvSetupHardware( void )\r
-{\r
-       prvInitPort00();\r
+/*\r
+ * Perform any hardware setup necessary for the demo.\r
+ */\r
+static void prvSetupHardware( void );\r
 \r
-       #if WATCHDOG != WTC_NONE\r
-       InitWatchdog();\r
-       #endif\r
-}\r
+/*-----------------------------------------------------------*/\r
 \r
-/*---------------------------------------------------------------------------\r
- * main()\r
- *---------------------------------------------------------------------------*/\r
 void main( void )\r
 {\r
        InitIrqLevels();                /* Initialize interrupts */\r
@@ -164,157 +154,62 @@ void main( void )
        prvSetupHardware();\r
 \r
        #if WATCHDOG == WTC_IN_TASK\r
-       vStartWatchdogTask( WTC_TASK_PRIORITY );\r
+               vStartWatchdogTask( WTC_TASK_PRIORITY );\r
        #endif\r
 \r
        /* Start the standard demo application tasks. */\r
-       #if ( INCLUDE_StartLEDFlashTasks == 1 )\r
        vStartLEDFlashTasks( mainLED_TASK_PRIORITY );\r
-       #endif\r
-       #if ( INCLUDE_StartIntegerMathTasks == 1 )\r
-       vStartIntegerMathTasks( tskIDLE_PRIORITY );\r
-       #endif\r
-       #if ( INCLUDE_AltStartComTestTasks == 1 )\r
-       vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED - 1 );\r
-       #endif\r
-       #if ( INCLUDE_StartPolledQueueTasks == 1 )\r
+       vStartIntegerMathTasks( tskIDLE_PRIORITY );     \r
        vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
-       #endif\r
-       #if ( INCLUDE_StartSemaphoreTasks == 1 )\r
        vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
-       #endif\r
-       #if ( INCLUDE_StartBlockingQueueTasks == 1 )\r
        vStartBlockingQueueTasks( mainQUEUE_BLOCK_PRIORITY );\r
-       #endif\r
-       #if ( INCLUDE_StartDynamicPriorityTasks == 1 )\r
        vStartDynamicPriorityTasks();\r
-       #endif\r
-       #if ( INCLUDE_StartMathTasks == 1 )\r
-       vStartMathTasks( tskIDLE_PRIORITY );\r
-       #endif\r
-       #if ( INCLUDE_StartFlashCoRoutines == 1 )\r
-       vStartFlashCoRoutines( ledNUMBER_OF_LEDS );\r
-       #endif\r
-       #if ( INCLUDE_StartHookCoRoutines == 1 )\r
-       vStartHookCoRoutines();\r
-       #endif\r
-       #if ( INCLUDE_StartGenericQueueTasks == 1 )\r
+       vStartFlashCoRoutines( mainNUM_FLASH_CO_ROUTINES );\r
        vStartGenericQueueTasks( mainGENERIC_QUEUE_PRIORITY );\r
-       #endif\r
-       #if ( INCLUDE_StartQueuePeekTasks == 1 )\r
-       vStartQueuePeekTasks();\r
-       #endif\r
-       #if ( INCLUDE_CreateBlockTimeTasks == 1 )\r
        vCreateBlockTimeTasks();\r
-       #endif\r
-       #if ( INCLUDE_CreateSuicidalTasks == 1 )\r
-       vCreateSuicidalTasks( mainDEATH_PRIORITY );\r
-       #endif\r
-       #if ( INCLUDE_TraceListTasks == 1 )\r
-       vTraceListTasks( TASK_UTILITY_PRIORITY );\r
+\r
+       /* The definition INCLUDE_TraceListTasks is set within FreeRTOSConfig.h. */\r
+       #if INCLUDE_TraceListTasks == 1\r
+               vUtilityStartTraceTask( TASK_UTILITY_PRIORITY );\r
+       #else\r
+               vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED - 1 );\r
        #endif\r
 \r
        /* Start the 'Check' task which is defined in this file. */\r
-       xTaskCreate( vErrorChecks, (signed portCHAR *) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
+       xTaskCreate( vErrorChecks, (signed char *) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
 \r
-       vTaskStartScheduler();\r
+       /* The suicide tasks must be started last as they record the number of other\r
+       tasks that exist within the system.  The value is then used to ensure at run\r
+       time the number of tasks that exists is within expected bounds. */\r
+       vCreateSuicidalTasks( mainDEATH_PRIORITY );\r
 \r
-       /* Should not reach here */\r
-       while( 1 )\r
-       {\r
-               __asm( " NOP " );       /*  //  */\r
-       }\r
+       /* Now start the scheduler.  Following this call the created tasks should\r
+       be executing. */        \r
+       vTaskStartScheduler( );\r
+       \r
+       /* vTaskStartScheduler() will only return if an error occurs while the \r
+       idle task is being created. */\r
+       for( ;; );\r
 }\r
-\r
 /*-----------------------------------------------------------*/\r
-void vParTestToggleLED( unsigned portBASE_TYPE uxLED )\r
-{\r
-       if( uxLED < ledNUMBER_OF_LEDS )\r
-       {\r
-               vTaskSuspendAll();\r
 \r
-               /* Toggle the state of the single genuine on board LED. */\r
-               if( (sState[0] & ((portCHAR) (1 << uxLED))) == 0 )\r
-               {\r
-                       PDR09 |= ( 1 << uxLED );\r
-                       sState[0] |= ( 1 << uxLED );\r
-               }\r
-               else\r
-               {\r
-                       PDR09 &= ~( 1 << uxLED );\r
-                       sState[0] &= ~( 1 << uxLED );\r
-               }\r
-\r
-               xTaskResumeAll();\r
-       }\r
-       else\r
-       {\r
-               vTaskSuspendAll();\r
-\r
-               uxLED -= ledNUMBER_OF_LEDS;\r
-\r
-               if( (sState[1] & ((portCHAR) (1 << uxLED))) == 0 )\r
-               {\r
-                       PDR00 |= ( 1 << uxLED );\r
-                       sState[1] |= ( 1 << uxLED );\r
-               }\r
-               else\r
-               {\r
-                       PDR00 &= ~( 1 << uxLED );\r
-                       sState[1] &= ~( 1 << uxLED );\r
-               }\r
-\r
-               xTaskResumeAll();\r
-       }\r
-}\r
-\r
-/*-----------------------------------------------------------*/\r
-void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )\r
+static void prvSetupHardware( void )\r
 {\r
-       /* Set or clear the output [in this case show or hide the '*' character. */\r
-       if( uxLED < ledNUMBER_OF_LEDS )\r
-       {\r
-               vTaskSuspendAll();\r
-               {\r
-                       if( xValue )\r
-                       {\r
-                               PDR09 &= ~( 1 << uxLED );\r
-                               sState[0] &= ~( 1 << uxLED );\r
-                       }\r
-                       else\r
-                       {\r
-                               PDR09 |= ( 1 << uxLED );\r
-                               sState[0] |= ( 1 << uxLED );\r
-                       }\r
-               }\r
+       /* Initialise the port used by the LEDs. */\r
+       vParTestInitialise();\r
 \r
-               xTaskResumeAll();\r
-       }\r
-       else\r
-       {\r
-               vTaskSuspendAll();\r
-               {\r
-                       if( xValue )\r
-                       {\r
-                               PDR00 &= ~( 1 << uxLED );\r
-                               sState[1] &= ~( 1 << uxLED );\r
-                       }\r
-                       else\r
-                       {\r
-                               PDR00 |= ( 1 << uxLED );\r
-                               sState[1] |= ( 1 << uxLED );\r
-                       }\r
-               }\r
-\r
-               xTaskResumeAll();\r
-       }\r
+       /* See watchdog.h for definitions relating to the watchdog use. */\r
+       #if WATCHDOG != WTC_NONE\r
+               InitWatchdog();\r
+       #endif\r
 }\r
-\r
 /*-----------------------------------------------------------*/\r
+\r
 static void vErrorChecks( void *pvParameters )\r
 {\r
-       static volatile unsigned portLONG       ulDummyVariable = 3UL;\r
-       portTickType                                            xDelayPeriod = mainNO_ERROR_CHECK_DELAY;\r
+portTickType xDelayPeriod = mainNO_ERROR_CHECK_DELAY;\r
+\r
+       /* Just to remove compiler warnings. */\r
        ( void ) pvParameters;\r
 \r
        /* Cycle for ever, delaying then checking all the other tasks are still\r
@@ -326,14 +221,6 @@ static void vErrorChecks( void *pvParameters )
                detected the time is shortened resulting in a faster LED flash rate. */\r
                vTaskDelay( xDelayPeriod );\r
 \r
-               /* Perform a bit of 32bit maths to ensure the registers used by the \r
-               integer tasks get some exercise outside of the integer tasks \r
-               themselves. The result here is not important we are just deliberately\r
-               changing registers used by other tasks to ensure that their context\r
-               switch is operating as required. - see the demo application \r
-               documentation for more info. */\r
-               ulDummyVariable *= 3UL;\r
-\r
                /* See if the other tasks are all ok. */\r
                if( prvCheckOtherTasksAreStillRunning() != pdPASS )\r
                {\r
@@ -347,11 +234,11 @@ static void vErrorChecks( void *pvParameters )
                vParTestToggleLED( mainCHECK_TEST_LED );\r
        }\r
 }\r
-\r
 /*-----------------------------------------------------------*/\r
-static portSHORT prvCheckOtherTasksAreStillRunning( void )\r
+\r
+static short prvCheckOtherTasksAreStillRunning( void )\r
 {\r
-       static portSHORT        sNoErrorFound = pdTRUE;\r
+       static short    sNoErrorFound = pdTRUE;\r
 \r
        /* The demo tasks maintain a count that increments every cycle of the task\r
        provided that the task has never encountered an error.  This function \r
@@ -359,98 +246,101 @@ static portSHORT prvCheckOtherTasksAreStillRunning( void )
        incremented.  A count remaining at the same value between calls therefore\r
        indicates that an error has been detected.  Only tasks that do not flash\r
        an LED are checked. */\r
-       #if ( INCLUDE_StartIntegerMathTasks == 1 )\r
        if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
        {\r
                sNoErrorFound = pdFALSE;\r
        }\r
 \r
-       #endif\r
-       #if ( INCLUDE_AltStartComTestTasks == 1 )\r
-       if( xAreComTestTasksStillRunning() != pdTRUE )\r
-       {\r
-               sNoErrorFound = pdFALSE;\r
-       }\r
-\r
-       #endif\r
-       #if ( INCLUDE_StartPolledQueueTasks == 1 )\r
        if( xArePollingQueuesStillRunning() != pdTRUE )\r
        {\r
                sNoErrorFound = pdFALSE;\r
        }\r
 \r
-       #endif\r
-       #if ( INCLUDE_StartSemaphoreTasks == 1 )\r
        if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
        {\r
                sNoErrorFound = pdFALSE;\r
        }\r
 \r
-       #endif\r
-       #if ( INCLUDE_StartBlockingQueueTasks == 1 )\r
        if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
        {\r
                sNoErrorFound = pdFALSE;\r
        }\r
 \r
-       #endif\r
-       #if ( INCLUDE_StartDynamicPriorityTasks == 1 )\r
        if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
        {\r
                sNoErrorFound = pdFALSE;\r
        }\r
 \r
-       #endif\r
-       #if ( INCLUDE_StartMathTasks == 1 )\r
-       if( xAreMathsTaskStillRunning() != pdTRUE )\r
+       if( xAreFlashCoRoutinesStillRunning() != pdTRUE )\r
        {\r
                sNoErrorFound = pdFALSE;\r
        }\r
 \r
-       #endif\r
-       #if ( INCLUDE_StartFlashCoRoutines == 1 )\r
-       if( xAreFlashCoRoutinesStillRunning() != pdTRUE )\r
+       if( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
        {\r
                sNoErrorFound = pdFALSE;\r
        }\r
 \r
-       #endif\r
-       #if ( INCLUDE_StartHookCoRoutines == 1 )\r
-       if( xAreHookCoRoutinesStillRunning() != pdTRUE )\r
+       if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
        {\r
                sNoErrorFound = pdFALSE;\r
        }\r
 \r
-       #endif\r
-       #if ( INCLUDE_StartGenericQueueTasks == 1 )\r
-       if( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
+       if( xIsCreateTaskStillRunning() != pdTRUE )\r
        {\r
                sNoErrorFound = pdFALSE;\r
        }\r
 \r
-       #endif\r
-       #if ( INCLUDE_StartQueuePeekTasks == 1 )\r
-       if( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
+       #if INCLUDE_TraceListTasks == 0\r
        {\r
-               sNoErrorFound = pdFALSE;\r
+               if( xAreComTestTasksStillRunning() != pdTRUE )\r
+               {\r
+                       sNoErrorFound = pdFALSE;\r
+               }\r
        }\r
-\r
        #endif\r
-       #if ( INCLUDE_CreateBlockTimeTasks == 1 )\r
-       if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
+\r
+       return sNoErrorFound;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Idle hook function. */\r
+#if configUSE_IDLE_HOOK == 1\r
+       void vApplicationIdleHook( void )\r
        {\r
-               sNoErrorFound = pdFALSE;\r
+               /* Are we using the idle task to kick the watchdog?  See watchdog.h\r
+               for watchdog kicking options. Note this is for demonstration only\r
+               and is not a suggested method of servicing the watchdog in a real\r
+               application. */\r
+               #if WATCHDOG == WTC_IN_IDLE\r
+                       Kick_Watchdog();\r
+               #endif\r
+\r
+               vCoRoutineSchedule();\r
        }\r
-\r
+#else\r
+       #if WATCHDOG == WTC_IN_IDLE\r
+               #error configUSE_IDLE_HOOK must be set to 1 in FreeRTOSConfig.h if the watchdog is being cleared in the idle task hook.\r
        #endif\r
-       #if ( INCLUDE_CreateSuicidalTasks == 1 )\r
-       if( xIsCreateTaskStillRunning() != pdTRUE )\r
+#endif\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Tick hook function. */\r
+#if configUSE_TICK_HOOK == 1\r
+       void vApplicationTickHook( void )\r
        {\r
-               sNoErrorFound = pdFALSE;\r
+               /* Are we using the tick to kick the watchdog?  See watchdog.h\r
+               for watchdog kicking options.  Note this is for demonstration\r
+               only and is not a suggested method of servicing the watchdog in\r
+               a real application. */\r
+               #if WATCHDOG == WTC_IN_TICK\r
+                       Kick_Watchdog();\r
+               #endif\r
        }\r
-\r
+#else\r
+       #if WATCHDOG == WTC_IN_TICK\r
+               #error configUSE_TICK_HOOK must be set to 1 in FreeRTOSConfig.h if the watchdog is being cleared in the tick hook.\r
        #endif\r
-       return sNoErrorFound;\r
-}\r
-\r
-/*---------------------------------------------------------------------------*/\r
+#endif\r
+/*-----------------------------------------------------------*/\r