From: richardbarry Date: Tue, 25 Oct 2011 11:16:59 +0000 (+0000) Subject: Add timer demo to TriCore port. Add mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY into... X-Git-Tag: V7.1.0~35 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=650e48b53a1220710a022f0d29372515124603f8;p=freertos Add timer demo to TriCore port. Add mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY into main.c. Finish commenting main.c. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1625 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Demo/TriCore_TC1782_TriBoard_GCC/.cproject b/Demo/TriCore_TC1782_TriBoard_GCC/.cproject index 87e438c87..25a539d80 100644 --- a/Demo/TriCore_TC1782_TriBoard_GCC/.cproject +++ b/Demo/TriCore_TC1782_TriBoard_GCC/.cproject @@ -549,11 +549,15 @@ + diff --git a/Demo/TriCore_TC1782_TriBoard_GCC/.ude/UDEDefEclipseWorkspace.wsx b/Demo/TriCore_TC1782_TriBoard_GCC/.ude/UDEDefEclipseWorkspace.wsx index 8f0f69fb4..0b5b53a9e 100644 --- a/Demo/TriCore_TC1782_TriBoard_GCC/.ude/UDEDefEclipseWorkspace.wsx +++ b/Demo/TriCore_TC1782_TriBoard_GCC/.ude/UDEDefEclipseWorkspace.wsx @@ -1,6 +1,6 @@ - UDEDefEclipseWorkspace.wsx0011vQTv/gAAAQAQAAIAoAgKAAAAAwAAAAAAPwAAAAAAAAAEAAAAAgAAAAAAAAAAAAAAAAAAAA==3.009.10.2011 23:28:09:000 + UDEDefEclipseWorkspace.wsx0012vQTv/gAAAQAQAAIAoAgKAAAAAwAAAAAAPwAAAAAAAAAEAAAAAgAAAAAAAAAAAAAAAAAAAA==3.009.10.2011 23:28:09:000 @@ -47,9 +47,12 @@ - + + + + @@ -68,7 +71,7 @@ - + @@ -80,7 +83,7 @@ - + @@ -96,14 +99,16 @@ - + - - + + - + + + @@ -113,6 +118,9 @@ + + + @@ -136,23 +144,23 @@ - + - + - + - + - + @@ -167,52 +175,17 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - + + + @@ -231,17 +204,26 @@ + + + + + + - + + + + - + @@ -254,6 +236,7 @@ + @@ -279,7 +262,7 @@ - + @@ -345,7 +328,7 @@ - + @@ -412,9 +395,12 @@ - + + + + @@ -433,7 +419,7 @@ - + @@ -445,7 +431,7 @@ - + @@ -461,14 +447,16 @@ - + - - + + - + + + @@ -478,6 +466,9 @@ + + + @@ -499,163 +490,161 @@ - - - - - - + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -677,7 +666,7 @@ 009.10.2011 23:28:11:619nAAAAD8AAYAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1515524294967295100Samsung SCX-3200 Series..\..\..\..\Program Files (x86)\pls\UDE 3.0\StdLibrary.mso{7c641d47-534f-4ed9-9070-088b60a3befa}..\..\..\..\Users\Public\Documents\pls\UDE 3.0The script contains a collection of macros to save memory content into different file formats +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1515524294967295100Samsung SCX-3200 Series..\..\..\..\Program Files (x86)\pls\UDE 3.0\StdLibrary.mso{7c641d47-534f-4ed9-9070-088b60a3befa}..\..\..\..\Users\Public\Documents\pls\UDE 3.0The script contains a collection of macros to save memory content into different file formats and fill target memory rangesV:\UDE\AddOns\Macro\MacroLibrary\StdMacros1.dsm' ' $Header: /Ude/AddOns/Macro/MacroLibrary/StdMacros.dsm 3 30.04.04 9:34 Weisses $ '_______________________________________________________ @@ -947,4 +936,4 @@ Sub FillDWord(ParameterObj) debugger.Write Address,udearrayobj Next -End Sub63VBScript24.11.2006 14:43:20:0001WS_CORE_DUOMacro_24_10_11_12_23_52_010Execute UnAss ..Macro UnAssExecute macro UnAss0210Execute SaveHEX ..Macro SaveHEXExecute macro SaveHEX0210Execute FillByte ..Macro FillByteExecute macro FillByte0110Execute FillWord ..Macro FillWordExecute macro FillWord0110Execute FillDWord ..Macro FillDWordExecute macro FillDWord015118.10.2011 12:08:31:0830x000000001351684294967295009.10.2011 23:28:11:73713926442949672951009.10.2011 23:28:17:413..\RTOSDemo\main.c13516842949672956024.10.2011 10:48:48:675..\RTOSDemo\FreeRTOS_Source\tasks.c1351684294967295221.10.2011 11:09:25:6341351684294967295..\RTOSDemo\Common_Demo_Source\death.c21.10.2011 11:09:53:005..\RTOSDemo\FreeRTOS_Source\portable\GCC\TriCore_1782\porttrap.c13516842949672953524.10.2011 10:49:13:935..\RTOSDemo\FreeRTOS_Source\queue.c1351684294967295121.10.2011 11:11:16:7721351684294967295..\RTOSDemo\FreeRTOS_Source\portable\GCC\TriCore_1782\port.c21.10.2011 12:09:01:970..\RTOSDemo\Common_Demo_Source\integer.c1351684294967295460109.10.2011 23:54:28:21928801920013516842949672950121.10.2011 12:11:03:52508972066300330033ulRegisterTest1Count [C:\E\Dev\FreeRTOS\WorkingCopy\Demo\TriCore_TC1782_TriBoard_GCC\RTOSDemo\main.c] @1pxHeadCSA (global) @1#0$1,1$#0$1,1$pxTailCSA (global) @1#0$1,1$#0$1,1$pucTemp (global) @1#0,0$1,1$#0#0,0$1,1$ucTemp (global) @1#0$1,1$#0$1,1$pulNextCSA (global) @1#0,0$1,1$#0#0,0$1,1$pxTCBx (global) @11351684294967295024.10.2011 11:39:29:87501330033?(*((unsigned long *)0xD000AB80))#0$1,1$#0$1,1$753050300135168429496729500000024.10.2011 11:37:39:7580xD000AB80AAAAAA==AAAAAA==AgAAAA==AQAAAA==AAAAAA==AAAAAA==BAAAAA==
EIXr0Q==
13053398801307275768
1351684294967295
109.10.2011 23:57:15:537<_ExtentX type="bin" size="8">1CUAAA==<_ExtentY type="bin" size="8">vhAAAA==<_StockProps type="bin" size="8">AAAAAA==AgAAAA==UABDAAAAUABDAAAAAAAAAA==YAAAAA==RgB1AG4AYwB0AGkAbwBuAAAARgB1AG4AYwB0AGkAbwBuAAAAAAAAAA==QAYAAA==13516842949672950
OFF010000x00x00000000x00x00000000010000x00x00000000x00x00000000010001120100000001429496729542949672954294967295429496729542949672954294967295429496729542949672954294967295429496729542949672951..\iRAM\FreeRTOS_Demo.elfvCreateTasks01100000verify.txt0000009..\RTOSDemo\Common_Demo_Source\flash.c..\RTOSDemo\ThirdPartyCode\cpufreq.c..\RTOSDemo\Common_Demo_Source\integer.c..\RTOSDemo\main.c..\RTOSDemo\Common_Demo_Source\death.c..\RTOSDemo\FreeRTOS_Source\portable\GCC\TriCore_1782\porttrap.c..\RTOSDemo\FreeRTOS_Source\portable\GCC\TriCore_1782\port.c..\RTOSDemo\FreeRTOS_Source\tasks.c..\RTOSDemo\FreeRTOS_Source\queue.c
.target\TriBoard_TC1782.cfg24.10.2011 12:23:52:000
+End Sub63VBScript24.11.2006 14:43:20:0001WS_CORE_DUOMacro_25_10_11_12_15_14_010Execute UnAss ..Macro UnAssExecute macro UnAss0210Execute SaveHEX ..Macro SaveHEXExecute macro SaveHEX0210Execute FillByte ..Macro FillByteExecute macro FillByte0110Execute FillWord ..Macro FillWordExecute macro FillWord0110Execute FillDWord ..Macro FillDWordExecute macro FillDWord015118.10.2011 12:08:31:0830x000000001351684294967295009.10.2011 23:28:11:73713926442949672951009.10.2011 23:28:17:413..\RTOSDemo\main.c13516842949672959024.10.2011 10:48:48:675..\RTOSDemo\FreeRTOS_Source\tasks.c1351684294967295221.10.2011 11:09:25:6341351684294967295..\RTOSDemo\Common_Demo_Source\death.c21.10.2011 11:09:53:005..\RTOSDemo\FreeRTOS_Source\portable\GCC\TriCore_1782\porttrap.c13516842949672953524.10.2011 10:49:13:935..\RTOSDemo\FreeRTOS_Source\queue.c1351684294967295121.10.2011 11:11:16:7721351684294967295..\RTOSDemo\FreeRTOS_Source\portable\GCC\TriCore_1782\port.c25.10.2011 10:02:06:267..\RTOSDemo\Common_Demo_Source\countsem.c13516842949672954625.10.2011 11:38:01:109..\RTOSDemo\Common_Demo_Source\blocktim.c135168429496729525.10.2011 11:40:09:775code <0xC0000000-0xC00003FF>1351684294967295780109.10.2011 23:54:28:21928801920013516842949672950121.10.2011 12:11:03:525009720663003300331351684294967295024.10.2011 11:39:29:87501330033?(*((unsigned long *)0xD000AB80))#0$1,1$#0$1,1$753050300135168429496729500000024.10.2011 11:37:39:7580xD000AB80AAAAAA==AAAAAA==AgAAAA==AQAAAA==AAAAAA==AAAAAA==BAAAAA==
EIXr0Q==
13053398801307275768
1351684294967295
109.10.2011 23:57:15:537<_ExtentX type="bin" size="8">AAAAAA==<_ExtentY type="bin" size="8">AAAAAA==<_StockProps type="bin" size="8">AAAAAA==AgAAAA==UABDAAAAUABDAAAAAAAAAA==YAAAAA==RgB1AG4AYwB0AGkAbwBuAAAARgB1AG4AYwB0AGkAbwBuAAAAAAAAAA==QAYAAA==13516842949672950
OFF010000x00x00000000x00x00000000010000x00x00000000x00x00000000010001120100000001429496729542949672954294967295429496729542949672954294967295429496729542949672954294967295429496729542949672951..\iRAM\FreeRTOS_Demo.elfvCreateTasks01100000verify.txt00000012..\RTOSDemo\Common_Demo_Source\flash.c..\RTOSDemo\ThirdPartyCode\cpufreq.c..\RTOSDemo\Common_Demo_Source\integer.c..\RTOSDemo\main.c..\RTOSDemo\Common_Demo_Source\death.c..\RTOSDemo\FreeRTOS_Source\portable\GCC\TriCore_1782\porttrap.c..\RTOSDemo\FreeRTOS_Source\portable\GCC\TriCore_1782\port.c..\RTOSDemo\FreeRTOS_Source\tasks.c..\RTOSDemo\FreeRTOS_Source\queue.c..\RTOSDemo\Common_Demo_Source\countsem.c..\RTOSDemo\Common_Demo_Source\blocktim.ccode <0xC0000000-0xC00003FF>
.target\TriBoard_TC1782.cfg25.10.2011 12:15:15:000 diff --git a/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/FreeRTOSConfig.h b/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/FreeRTOSConfig.h index c015f4a4a..9cea43a5d 100644 --- a/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/FreeRTOSConfig.h +++ b/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/FreeRTOSConfig.h @@ -68,50 +68,58 @@ /*----------------------------------------------------------*/ -#define configUSE_PREEMPTION 1 -#define configUSE_IDLE_HOOK 0 -#define configUSE_TICK_HOOK 0 -/* CPU is actually 150MHz but FPIDIV is 1 meaning divide by 2. */ -#define configCPU_CLOCK_HZ ( ( unsigned long ) 150000000UL ) -#define configPERIPHERAL_CLOCK_HZ ( ( unsigned long ) configCPU_CLOCK_HZ / 2UL ) -#define configTICK_RATE_HZ ( ( portTickType ) 1000UL ) -#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 ) -#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 ) -#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 32 * 1024 ) ) -#define configMAX_TASK_NAME_LEN ( 16 ) -#define configUSE_TRACE_FACILITY 0 -#define configUSE_16_BIT_TICKS 0 -#define configIDLE_SHOULD_YIELD 0 -#define configUSE_MALLOC_FAILED_HOOK 1 -#define configCHECK_FOR_STACK_OVERFLOW 0 +#define configUSE_PREEMPTION 1 +#define configUSE_IDLE_HOOK 0 +/* CPU is actually 150MHz but FPIDIV is 1 meaning divide by 2 for the +peripheral clock. */ +#define configCPU_CLOCK_HZ ( ( unsigned long ) 150000000UL ) +#define configPERIPHERAL_CLOCK_HZ ( ( unsigned long ) configCPU_CLOCK_HZ / 2UL ) +#define configTICK_RATE_HZ ( ( portTickType ) 1000UL ) +#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 ) +#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 ) +#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 32 * 1024 ) ) +#define configMAX_TASK_NAME_LEN ( 16 ) +#define configUSE_TRACE_FACILITY 0 +#define configUSE_16_BIT_TICKS 0 +#define configIDLE_SHOULD_YIELD 0 +#define configUSE_MALLOC_FAILED_HOOK 1 +#define configCHECK_FOR_STACK_OVERFLOW 0 + +#define configUSE_COUNTING_SEMAPHORES 1 +#define configUSE_RECURSIVE_MUTEXES 1 +#define configUSE_MUTEXES 1 /* Co-routine definitions. */ -#define configUSE_CO_ROUTINES 0 -#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) - -/* Mutual Exclusion. */ -#define configUSE_COUNTING_SEMAPHORES 1 -#define configUSE_RECURSIVE_MUTEXES 1 -#define configUSE_MUTEXES 1 - -/* Timer functionality. */ -#define configUSE_TIMERS 0 -#define configTIMER_TASK_PRIORITY ( 4 ) -#define configTIMER_QUEUE_LENGTH ( 2 ) +#define configUSE_CO_ROUTINES 0 +#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) + +/* Timer functionality. For space constraint reasons, the standard demo timer +tests are only included in the build configuration that generates code that +runs from Flash, and not in the build configuration that generates code that +runs from RAM. */ +#ifdef BUILD_FOR_RAM_EXECUTION + #define configUSE_TIMERS 0 + #define configUSE_TICK_HOOK 0 +#else + #define configUSE_TIMER 1 + #define configUSE_TICK_HOOK 1 +#endif + +#define configTIMER_TASK_PRIORITY ( 4 ) +#define configTIMER_QUEUE_LENGTH ( 5 ) +#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE /* Set the following definitions to 1 to include the API function, or zero to exclude the API function. We use --gc-sections when linking, so there is no harm is setting all of these to 1 */ -#define INCLUDE_vTaskPrioritySet 1 -#define INCLUDE_uxTaskPriorityGet 1 -#define INCLUDE_vTaskDelete 1 -#define INCLUDE_vTaskCleanUpResources 1 -#define INCLUDE_vTaskSuspend 1 -#define INCLUDE_vTaskDelayUntil 1 -#define INCLUDE_vTaskDelay 1 - -#define BLOCKQ_1 0 +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_vTaskCleanUpResources 1 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_vTaskDelay 1 #endif /* FREERTOS_CONFIG_H */ diff --git a/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/main.c b/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/main.c index 7376e22d2..7cbfe7832 100644 --- a/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/main.c +++ b/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/main.c @@ -51,9 +51,52 @@ licensing and training services. */ - -/* _RB_ Add description here. */ - +/****************************************************************************** + * >>>>>> NOTE: <<<<<< + * + * main() can be configured to create either a very simple LED flasher demo, or + * a more comprehensive test/demo application. + * + * To create a very simple LED flasher example, set the + * mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY constant (defined below) to 1. When + * this is done, only the standard demo flash tasks are created, whereby three + * tasks each toggle an LED at a fixed but different frequency. + * + * To create a more comprehensive test and demo application, set + * mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY to 0. + ****************************************************************************** + * + * main() creates all the demo application tasks and timers, then starts the + * scheduler. The web documentation provides more details of the standard demo + * application tasks, which provide no particular functionality, but do provide + * a good example of how to use the FreeRTOS API. + * + * In addition to the standard demo tasks, the following tasks and tests are + * defined and/or created within this file: + * + * "Reg test" tasks - These fill the registers with known values, then check + * that each register maintains its expected value for the lifetime of the + * task. Each task uses a different set of values. The reg test tasks execute + * with a very low priority, so get preempted very frequently. A register + * containing an unexpected value is indicative of an error in the context + * switching mechanism. + * + * "Check" task - The check task period is initially set to five seconds. + * Each time it executes, the check task checks that all the standard demo + * tasks, and the register check tasks, are not only still executing, but are + * executing without reporting any errors. If the check task discovers that a + * task has either stalled, or reported an error, then it changes its own + * execution period from the initial five seconds, to just 500ms. The check + * task also toggles an LED each time it is called. This provides a visual + * indication of the system status: If the LED toggles every five seconds, + * then no issues have been discovered. If the LED toggles every 500ms, then + * an issue has been discovered with at least one task. + * + * ***NOTE*** This demo uses the standard comtest tasks, which has special + * hardware requirements as a loopback connector, or UART echo server are + * required. See the documentation page for this demo on the FreeRTOS.org web + * site for more information. + */ /* Standard includes. */ #include @@ -79,6 +122,8 @@ #include "recmutex.h" #include "serial.h" #include "death.h" +#include "TimerDemo.h" + /*-----------------------------------------------------------*/ /* Constants for the ComTest tasks. */ @@ -100,6 +145,14 @@ error. */ #define mainERROR_FLASH_PERIOD ( ( portTickType ) 500 / portTICK_RATE_MS ) #define mainON_BOARD_LED_BIT ( ( unsigned long ) 7 ) +/* Constant used by the standard timer test functions. */ +#define mainTIMER_TEST_PERIOD ( 50 ) + +/* Set mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY to 1 to create a simple demo. +Set mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY to 0 to create a much more +comprehensive test application. See the comments at the top of this file. */ +#define mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY 0 + /*-----------------------------------------------------------*/ /* @@ -124,8 +177,8 @@ static void prvSetupHardware( void ); * Writes to and checks the value of each register that is used in the context * of a task. */ -static void prvRegTask1( void *pvParameters ); -static void prvRegTask2( void *pvParameters ); +static void prvRegisterCheckTask1( void *pvParameters ); +static void prvRegisterCheckTask2( void *pvParameters ); /* * Specific check to see if the Register test functions are still operating @@ -133,6 +186,17 @@ static void prvRegTask2( void *pvParameters ); */ static portBASE_TYPE prvAreRegTestTasksStillRunning( void ); +/* + * This file can be used to create either a simple LED flasher example, or a + * comprehensive test/demo application - depending on the setting of the + * mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY constant defined above. If + * mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY is set to 1, then the following + * function will create a lot of additional tasks and timers. If + * mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY is set to 0, then the following + * function will do nothing. + */ +static void prvOptionallyCreateComprehensveTestApplication( void ); + /*-----------------------------------------------------------*/ /* Used by the register test tasks to indicated liveness. */ @@ -149,30 +213,17 @@ int main( void ) /* Setup the hardware for use with the TriCore evaluation board. */ prvSetupHardware(); - /* Start standard demo/test application tasks. */ - vStartIntegerMathTasks( tskIDLE_PRIORITY ); + /* Start standard demo/test application tasks. See the comments at the + top of this file. The LED flash tasks are always created. The other tasks + are only created if mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY is set to 1 (at + the top of this file). See the comments at the top of this file for more + information. */ vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartDynamicPriorityTasks(); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vCreateBlockTimeTasks(); - vStartCountingSemaphoreTasks(); - vStartGenericQueueTasks( tskIDLE_PRIORITY ); - vStartRecursiveMutexTasks(); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - /* _RB_ Create the timer test task here too. */ - - /* Create the register test tasks, as described at the top of this file. */ - xTaskCreate( prvRegTask1, ( signed char * ) "Reg 1", configMINIMAL_STACK_SIZE, &ulRegisterTest1Count, tskIDLE_PRIORITY, NULL ); - xTaskCreate( prvRegTask2, ( signed char * ) "Reg 2", configMINIMAL_STACK_SIZE, &ulRegisterTest2Count, tskIDLE_PRIORITY, NULL ); - - /* Start the check task - which is defined in this file. */ - xTaskCreate( prvCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - - /* This task has to be created last as it keeps account of the number of tasks - it expects to see running. */ - vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); + + /* The following function will only create more tasks and timers if + mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY is set to 1 (at the top of this + file). See the comments at the top of this file for more information. */ + prvOptionallyCreateComprehensveTestApplication(); /* Now all the tasks have been started - start the scheduler. */ vTaskStartScheduler(); @@ -289,6 +340,17 @@ long lReturn = pdPASS; lReturn = pdFAIL; } + #if configUSE_TIMERS == 1 + { + /* For space constraint reasons, do not include the timer demo in + builds that execute from RAM. */ + if( xAreTimerDemoTasksStillRunning( mainNO_ERROR_FLASH_PERIOD ) != pdTRUE ) + { + lReturn = pdFAIL; + } + } + #endif + return lReturn; } /*-----------------------------------------------------------*/ @@ -325,10 +387,18 @@ void vApplicationMallocFailedHook( void ) void vApplicationTickHook( void ) { - /* vApplicationTickHook() will only be called if configUSE_TICK_HOOK is set - to 1 in FreeRTOSConfig.h. It is a hook function that will get called during - each FreeRTOS tick interrupt. Note that vApplicationTickHook() is called - from an interrupt context. */ + #if mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY != 1 + { + /* vApplicationTickHook() will only be called if configUSE_TICK_HOOK is set + to 1 in FreeRTOSConfig.h. It is a hook function that will get called during + each FreeRTOS tick interrupt. Note that vApplicationTickHook() is called + from an interrupt context. */ + + /* Call the periodic timer test, which tests the timer API functions that + can be called from an ISR. */ + vTimerPeriodicISRTests(); + } + #endif /* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY */ } /*-----------------------------------------------------------*/ @@ -371,7 +441,7 @@ portBASE_TYPE xReturn = pdPASS; } /*-----------------------------------------------------------*/ -static void prvRegTask1( void *pvParameters ) +static void prvRegisterCheckTask1( void *pvParameters ) { /* Make space on the stack for the parameter and a counter. */ __asm volatile( " sub.a %sp, 4 \n" @@ -479,7 +549,7 @@ static void prvRegTask1( void *pvParameters ) } /*-----------------------------------------------------------*/ -static void prvRegTask2( void *pvParameters ) +static void prvRegisterCheckTask2( void *pvParameters ) { /* Make space on the stack for the parameter and a counter. */ __asm volatile( " sub.a %sp, 4 \n" \ @@ -586,3 +656,50 @@ static void prvRegTask2( void *pvParameters ) } /*-----------------------------------------------------------*/ +static void prvOptionallyCreateComprehensveTestApplication( void ) +{ + #if mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY == 0 + { + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartDynamicPriorityTasks(); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vCreateBlockTimeTasks(); + vStartCountingSemaphoreTasks(); + vStartGenericQueueTasks( tskIDLE_PRIORITY ); + vStartRecursiveMutexTasks(); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + + #if configUSE_TIMERS == 1 + { + /* For space constraint reasons, do not include the timer demo in + builds that execute from RAM. */ + vStartTimerDemoTask( mainTIMER_TEST_PERIOD ); + } + #endif /* configUSE_TIMERS */ + + /* Create the register test tasks, as described at the top of this file. */ + xTaskCreate( prvRegisterCheckTask1, ( signed char * ) "Reg 1", configMINIMAL_STACK_SIZE, &ulRegisterTest1Count, tskIDLE_PRIORITY, NULL ); + xTaskCreate( prvRegisterCheckTask2, ( signed char * ) "Reg 2", configMINIMAL_STACK_SIZE, &ulRegisterTest2Count, tskIDLE_PRIORITY, NULL ); + + /* Start the check task - which is defined in this file. */ + xTaskCreate( prvCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + + /* This task has to be created last as it keeps account of the number of tasks + it expects to see running. */ + vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); + } + #else /* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY */ + { + /* Just to prevent compiler warnings when the configuration options are + set such that these static functions are not used. */ + ( void ) prvCheckTask; + ( void ) prvRegisterCheckTask1; + ( void ) prvRegisterCheckTask2; + } + #endif /* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY */ +} + +/*-----------------------------------------------------------*/ +