\r
/* The time between cycles of the 'check' functionality (defined within the\r
tick hook. */\r
-#define mainCHECK_DELAY ( ( portTickType ) 5000 / portTICK_RATE_MS )\r
+#define mainNO_ERROR_PERIOD ( ( portTickType ) 5000 / portTICK_RATE_MS )\r
+\r
+/* The rate at which the LED controlled by the 'check' task will flash when an\r
+error has been detected. */\r
+#define mainERROR_PERIOD ( 500 )\r
+\r
+/* The LED controlled by the 'check' task. */\r
+#define mainCHECK_LED ( 3 )\r
\r
/* Task priorities. */\r
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
*/\r
static void prvSetupHardware( void );\r
\r
+/*\r
+ * Implements the 'check' task functionality as described at the top of this\r
+ * file.\r
+ */\r
+static void prvCheckTask( void *pvParameters );\r
+\r
+\r
/*-----------------------------------------------------------*/\r
\r
int main( void )\r
prvSetupHardware();\r
\r
/* Start the standard demo tasks. */\r
+ vStartLEDFlashTasks( tskIDLE_PRIORITY );\r
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
- vCreateBlockTimeTasks();\r
- vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
- vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
- vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );\r
- vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );\r
- vStartQueuePeekTasks();\r
- vStartRecursiveMutexTasks();\r
+ vCreateBlockTimeTasks();\r
+ vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
+ vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
+ vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );\r
+ vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );\r
+ vStartQueuePeekTasks();\r
+ vStartRecursiveMutexTasks();\r
+\r
+ /* Create the check task. */\r
+ xTaskCreate( prvCheckTask, ( signed portCHAR * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
\r
/* The suicide tasks must be created last as they need to know how many\r
tasks were running prior to their creation in order to ascertain whether\r
\r
/* Will only get here if there was insufficient memory to create the idle\r
task. */\r
- return 0;\r
+ for( ;; );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvCheckTask( void *pvParameters )\r
+{\r
+unsigned ulTicksToWait = mainNO_ERROR_PERIOD;\r
+portTickType xLastExecutionTime;\r
+\r
+ ( void ) pvParameters;\r
+\r
+ /* Initialise the variable used to control our iteration rate prior to\r
+ its first use. */\r
+ xLastExecutionTime = xTaskGetTickCount();\r
+\r
+ for( ;; )\r
+ {\r
+ /* Wait until it is time to run the tests again. */\r
+ vTaskDelayUntil( &xLastExecutionTime, ulTicksToWait );\r
+\r
+ /* Has an error been found in any task? */\r
+ if( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
+ {\r
+ ulTicksToWait = mainERROR_PERIOD;\r
+ }\r
+ else if( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
+ {\r
+ ulTicksToWait = mainERROR_PERIOD;\r
+ }\r
+ else if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
+ {\r
+ ulTicksToWait = mainERROR_PERIOD;\r
+ }\r
+ else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
+ {\r
+ ulTicksToWait = mainERROR_PERIOD;\r
+ }\r
+ else if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
+ {\r
+ ulTicksToWait = mainERROR_PERIOD;\r
+ }\r
+ else if( xArePollingQueuesStillRunning() != pdTRUE )\r
+ {\r
+ ulTicksToWait = mainERROR_PERIOD;\r
+ }\r
+ else if( xIsCreateTaskStillRunning() != pdTRUE )\r
+ {\r
+ ulTicksToWait = mainERROR_PERIOD;\r
+ }\r
+ else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
+ {\r
+ ulTicksToWait = mainERROR_PERIOD;\r
+ }\r
+ else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
+ {\r
+ ulTicksToWait = mainERROR_PERIOD;\r
+ }\r
+\r
+ vParTestToggleLED( mainCHECK_LED );\r
+ }\r
}\r
/*-----------------------------------------------------------*/\r
\r