\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
+ 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
Please ensure to read the configuration and relevant port sections of the\r
online documentation.\r
\r
- http://www.FreeRTOS.org - Documentation, latest information, license and \r
+ http://www.FreeRTOS.org - Documentation, latest information, license and\r
contact details.\r
\r
- http://www.SafeRTOS.com - A version that is certified for use in safety \r
+ http://www.SafeRTOS.com - A version that is certified for use in safety\r
critical systems.\r
\r
- http://www.OpenRTOS.com - Commercial support, development, porting, \r
+ http://www.OpenRTOS.com - Commercial support, development, porting,\r
licensing and training services.\r
*/\r
\r
/* only include in C files */\r
#ifdef __IAR_SYSTEMS_ICC__\r
\r
-#define configUSE_IDLE_HOOK 0\r
-#define configUSE_TICK_HOOK 0\r
-#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 48000000 ) /* using the external clock source */\r
-#define configTICK_RATE_HZ ( ( portTickType ) 1000 )\r
-#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 )\r
-#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 64 )\r
-#define configTOTAL_HEAP_SIZE ( (size_t ) ( 9000 ) )\r
-#define configMAX_TASK_NAME_LEN ( 10 )\r
-#define configUSE_TRACE_FACILITY 0\r
-#define configUSE_16_BIT_TICKS 0\r
-#define configIDLE_SHOULD_YIELD 1\r
+#define configUSE_IDLE_HOOK 0\r
+#define configUSE_TICK_HOOK 0\r
+#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 48000000 ) /* using the external clock source */\r
+#define configTICK_RATE_HZ ( ( portTickType ) 1000 )\r
+#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 )\r
+#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 64 )\r
+#define configTOTAL_HEAP_SIZE ( (size_t ) ( 20000 ) )\r
+#define configMAX_TASK_NAME_LEN ( 10 )\r
+#define configUSE_TRACE_FACILITY 0\r
+#define configUSE_16_BIT_TICKS 0\r
+#define configIDLE_SHOULD_YIELD 0\r
+#define configUSE_CO_ROUTINES 0\r
+#define configUSE_MUTEXES 1\r
+#define configCHECK_FOR_STACK_OVERFLOW 2\r
+#define configUSE_RECURSIVE_MUTEXES 1\r
+#define configQUEUE_REGISTRY_SIZE 0\r
+#define configUSE_COUNTING_SEMAPHORES 0\r
\r
/* Co-routine definitions. */\r
-#define configUSE_CO_ROUTINES 0\r
+#define configUSE_CO_ROUTINES 0\r
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )\r
\r
/* Set the following definitions to 1 to include the API function, or zero\r
to exclude the API function. */\r
-#define INCLUDE_vTaskPrioritySet 0\r
-#define INCLUDE_uxTaskPriorityGet 0\r
-#define INCLUDE_vTaskDelete 1\r
-#define INCLUDE_vTaskCleanUpResources 0\r
-#define INCLUDE_vTaskSuspend 0\r
+#define INCLUDE_vTaskPrioritySet 1\r
+#define INCLUDE_uxTaskPriorityGet 1\r
+#define INCLUDE_vTaskDelete 1\r
+#define INCLUDE_vTaskCleanUpResources 0\r
+#define INCLUDE_vTaskSuspend 1\r
#define INCLUDE_vTaskDelayUntil 1\r
-#define INCLUDE_vTaskDelay 1\r
+#define INCLUDE_vTaskDelay 1\r
\r
#endif /* __IAR_SYSTEMS_ICC__ */\r
\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
+ 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
Please ensure to read the configuration and relevant port sections of the\r
online documentation.\r
\r
- http://www.FreeRTOS.org - Documentation, latest information, license and \r
+ http://www.FreeRTOS.org - Documentation, latest information, license and\r
contact details.\r
\r
- http://www.SafeRTOS.com - A version that is certified for use in safety \r
+ http://www.SafeRTOS.com - A version that is certified for use in safety\r
critical systems.\r
\r
- http://www.OpenRTOS.com - Commercial support, development, porting, \r
+ http://www.OpenRTOS.com - Commercial support, development, porting,\r
licensing and training services.\r
*/\r
\r
\r
/* Demo file headers. */\r
#include <intrinsics.h>\r
-#include "PollQ.h"\r
-#include "semtest.h"\r
-#include "print.h"\r
+#include "BlockQ.h"\r
+#include "death.h"\r
+#include "flash.h"\r
+#include "partest.h"\r
#include "semtest.h"\r
-#include "led.h"\r
-#include "integer.h"\r
+#include "PollQ.h"\r
+#include "GenQTest.h"\r
+#include "QPeek.h"\r
+#include "recmutex.h"\r
\r
/*\r
* Priority definitions for most of the tasks in the demo application. Some\r
* tasks just use the idle priority.\r
*/\r
-#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
-#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
-#define mainSEMTEST_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
-#define mainLED_TOGGLE_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
+#define mainFLASH_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
+#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
+#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )\r
+#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
+#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
+#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
+#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY )\r
+#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )\r
\r
/* The period between executions of the check task. */\r
-#define mainCHECK_PERIOD ( ( portTickType ) 3000 / portTICK_RATE_MS )\r
+#define mainNO_ERROR_DELAY ( ( portTickType ) 3000 / portTICK_RATE_MS )\r
+#define mainERROR_DELAY ( ( portTickType ) 500 / portTICK_RATE_MS )\r
\r
-/* The task function for the "Check" task. */\r
-static void vErrorChecks( void *pvParameters );\r
+#define mainCHECK_TASK_LED ( 3 )\r
\r
-/*\r
- * Checks the unique counts of other tasks to ensure they are still operational.\r
- * Flashes an LED if everything is okay.\r
- */\r
-static long prvCheckOtherTasksAreStillRunning( void );\r
+/* The task function for the "Check" task. */\r
+static void prvCheckTask( void *pvParameters );\r
\r
/* low level initialization prototype */\r
unsigned portCHAR __low_level_init(void);\r
\r
+static void prvSetupHardware( void );\r
+\r
extern void vRegTest1( void *pvParameters );\r
extern void vRegTest2( void *pvParameters );\r
\r
/*-----------------------------------------------------------*/\r
\r
-volatile portLONG lRegTestStatus = pdPASS;\r
+static volatile portLONG lRegTestStatus = pdPASS;\r
\r
void vRegTestFailed( void )\r
{\r
lRegTestStatus = pdFAIL;\r
+ \r
+ /* Do not return from here as the reg test tasks clobber all registers so\r
+ function calls may not function correctly. */\r
for( ;; );\r
}\r
\r
void main( void )\r
{\r
- /* Create some standard demo tasks. */\r
-// vStartIntegerMathTasks( tskIDLE_PRIORITY );\r
-// vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
-// vStartSemaphoreTasks(mainSEMTEST_PRIORITY);\r
-\r
- /* Create a simple task that toggles a pin. */\r
-// vStartLEDToggleTasks( mainLED_TOGGLE_PRIORITY );\r
+ prvSetupHardware();\r
+ \r
+ vStartLEDFlashTasks( mainFLASH_PRIORITY );\r
+ vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
+ vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
+ vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );\r
+ vStartQueuePeekTasks();\r
+ vStartRecursiveMutexTasks();\r
+ vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
\r
/* Create the tasks defined within this file. */\r
-// xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
-\r
-// vPrintInitialise();\r
+ xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
\r
-xTaskCreate( vRegTest1, "Check", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
-xTaskCreate( vRegTest2, "Check", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+ xTaskCreate( vRegTest1, "Check", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+ xTaskCreate( vRegTest2, "Check", configMINIMAL_STACK_SIZE, NULL, tskIDLE_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
+ or not the correct/expected number of tasks are running at any given time. */\r
+ vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
+ \r
/* Start the scheduler. */\r
vTaskStartScheduler();\r
\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static void vErrorChecks( void *pvParameters )\r
+static void prvCheckTask( void *pvParameters )\r
{\r
-volatile long lError = pdFALSE;\r
+portTickType xDelayPeriod = mainNO_ERROR_DELAY, xLastWakeTime;\r
\r
/* Just to remove the compiler warning. */\r
( void ) pvParameters;\r
\r
+ xLastWakeTime = xTaskGetTickCount();\r
+ \r
/* Cycle for ever, delaying then checking all the other tasks are still\r
operating without error. */\r
for( ;; )\r
{\r
- /* Delay until it is time to check the other tasks again. */\r
- vTaskDelay( mainCHECK_PERIOD );\r
+ vTaskDelayUntil( &xLastWakeTime, xDelayPeriod );\r
+ \r
+ if( lRegTestStatus != pdPASS )\r
+ {\r
+ xDelayPeriod = mainERROR_DELAY;\r
+ }\r
+ \r
+ if( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
+ {\r
+ xDelayPeriod = mainERROR_DELAY;\r
+ }\r
\r
- if( prvCheckOtherTasksAreStillRunning() != pdPASS )\r
+ if( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
{\r
- lError = pdTRUE;\r
- \r
- /* Do something to indicate the error. */\r
- ( void ) lError;\r
+ xDelayPeriod = mainERROR_DELAY;\r
}\r
- }\r
-}\r
-/*-----------------------------------------------------------*/\r
\r
-static long prvCheckOtherTasksAreStillRunning( void )\r
-{\r
-long lStatus = pdPASS;\r
+ if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
+ {\r
+ xDelayPeriod = mainERROR_DELAY;\r
+ }\r
\r
- if( xAreIntegerMathsTaskStillRunning() != pdPASS )\r
- {\r
- lStatus = pdFAIL;\r
- }\r
+ if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
+ {\r
+ xDelayPeriod = mainERROR_DELAY;\r
+ }\r
\r
- if( xArePollingQueuesStillRunning() != pdPASS )\r
- {\r
- lStatus = pdFAIL;\r
- }\r
+ if( xArePollingQueuesStillRunning() != pdTRUE )\r
+ {\r
+ xDelayPeriod = mainERROR_DELAY;\r
+ }\r
\r
- if( xAreSemaphoreTasksStillRunning() != pdPASS )\r
- {\r
- lStatus = pdFAIL;\r
- }\r
+ if( xIsCreateTaskStillRunning() != pdTRUE )\r
+ {\r
+ xDelayPeriod = mainERROR_DELAY;\r
+ }\r
\r
- if( xAreLEDToggleTaskStillRunning() != pdPASS )\r
- {\r
- lStatus = pdFAIL;\r
- }\r
+ if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
+ {\r
+ xDelayPeriod = mainERROR_DELAY;\r
+ }\r
\r
- return lStatus;\r
+ vParTestToggleLED( mainCHECK_TASK_LED );\r
+ }\r
}\r
/*-----------------------------------------------------------*/\r
\r
return pdTRUE;\r
}\r
\r
+static void prvSetupHardware( void )\r
+{\r
+ vParTestInitialise();\r
+}\r
+\r
+void vApplicationStackOverflowHook( void )\r
+{\r
+ for( ;; );\r
+}\r
+\r
+\r
\r