2 FreeRTOS.org V5.1.1 - Copyright (C) 2003-2008 Richard Barry.
\r
4 This file is part of the FreeRTOS.org distribution.
\r
6 FreeRTOS.org is free software; you can redistribute it and/or modify
\r
7 it under the terms of the GNU General Public License as published by
\r
8 the Free Software Foundation; either version 2 of the License, or
\r
9 (at your option) any later version.
\r
11 FreeRTOS.org is distributed in the hope that it will be useful,
\r
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 GNU General Public License for more details.
\r
16 You should have received a copy of the GNU General Public License
\r
17 along with FreeRTOS.org; if not, write to the Free Software
\r
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
20 A special exception to the GPL can be applied should you wish to distribute
\r
21 a combined work that includes FreeRTOS.org, without being obliged to provide
\r
22 the source code for any proprietary components. See the licensing section
\r
23 of http://www.FreeRTOS.org for full details of how and when the exception
\r
26 ***************************************************************************
\r
27 ***************************************************************************
\r
29 * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *
\r
30 * and even write all or part of your application on your behalf. *
\r
31 * See http://www.OpenRTOS.com for details of the services we provide to *
\r
32 * expedite your project. *
\r
34 ***************************************************************************
\r
35 ***************************************************************************
\r
37 Please ensure to read the configuration and relevant port sections of the
\r
38 online documentation.
\r
40 http://www.FreeRTOS.org - Documentation, latest information, license and
\r
43 http://www.SafeRTOS.com - A version that is certified for use in safety
\r
46 http://www.OpenRTOS.com - Commercial support, development, porting,
\r
47 licensing and training services.
\r
50 /* FreeRTOS includes. */
\r
51 #include "FreeRTOS.h"
\r
54 /* Standard demo includes. */
\r
56 #include "blocktim.h"
\r
57 #include "countsem.h"
\r
59 #include "dynamic.h"
\r
61 #include "GenQTest.h"
\r
62 #include "integer.h"
\r
65 #include "recmutex.h"
\r
66 #include "semtest.h"
\r
67 #include "ParTest.h"
\r
69 /* Standard includes. */
\r
72 /* Priorities for the demo application tasks. */
\r
73 #define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
\r
74 #define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 )
\r
75 #define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 0 )
\r
76 #define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 )
\r
77 #define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 0 )
\r
78 #define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
\r
79 #define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
\r
80 #define mainGENERIC_QUEUE_PRIORITY ( tskIDLE_PRIORITY )
\r
82 /* The period of the check task both in and out of the presense of an error. */
\r
83 #define mainNO_ERROR_PERIOD ( 5000 / portTICK_RATE_MS )
\r
84 #define mainERROR_PERIOD ( 500 / portTICK_RATE_MS );
\r
85 /*-----------------------------------------------------------*/
\r
87 /* Simple hardware setup required by the demo. */
\r
88 static void prvSetupHardware( void );
\r
90 /* The check task as described at the top of this file. */
\r
91 static void prvCheckTask( void *pvParameters );
\r
93 /*-----------------------------------------------------------*/
\r
98 /* Start the standard demo tasks. */
\r
99 vStartLEDFlashTasks( mainLED_TASK_PRIORITY );
\r
101 /* These tasks to be added once the simple flasher is running.
\r
103 vStartIntegerMathTasks( tskIDLE_PRIORITY );
\r
104 vStartLEDFlashTasks( mainLED_TASK_PRIORITY );
\r
105 vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
\r
106 vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
\r
107 vStartDynamicPriorityTasks();
\r
108 vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
\r
109 vCreateBlockTimeTasks();
\r
110 vStartCountingSemaphoreTasks();
\r
111 vStartGenericQueueTasks( tskIDLE_PRIORITY );
\r
112 vStartQueuePeekTasks();
\r
113 vStartRecursiveMutexTasks();
\r
115 The death demo tasks must be started last as the sanity checks performed
\r
116 require knowledge of the number of other tasks in the system.
\r
117 vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); */
\r
119 /* Start the scheduler. From this point on the execution will be under
\r
120 the control of the kernel. */
\r
121 vTaskStartScheduler();
\r
123 /* Will only get here if there was insufficient heap availale for the
\r
124 idle task to be created. */
\r
127 /*-----------------------------------------------------------*/
\r
129 static void prvCheckTask( void * pvParameters )
\r
131 portTickType xNextWakeTime, xPeriod = mainNO_ERROR_PERIOD;
\r
132 static volatile unsigned portLONG ulErrorCode = 0UL;
\r
134 /* Initialise xNextWakeTime prior to its first use. From this point on
\r
135 the value of the variable is handled automatically by the kernel. */
\r
136 xNextWakeTime = xTaskGetTickCount();
\r
140 vTaskDelayUntil( &xNextWakeTime, xPeriod );
\r
142 if( xAreBlockingQueuesStillRunning() != pdTRUE )
\r
144 ulErrorCode |= 0x01UL;
\r
147 if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
\r
149 ulErrorCode |= 0x02UL;
\r
152 if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )
\r
154 ulErrorCode |= 0x04UL;
\r
157 if( xIsCreateTaskStillRunning() != pdTRUE )
\r
159 ulErrorCode |= 0x08UL;
\r
162 if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
\r
164 ulErrorCode |= 0x10UL;
\r
167 if( xAreGenericQueueTasksStillRunning() != pdTRUE )
\r
169 ulErrorCode |= 0x20UL;
\r
172 if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
\r
174 ulErrorCode |= 0x40UL;
\r
177 if( xArePollingQueuesStillRunning() != pdTRUE )
\r
179 ulErrorCode |= 0x80UL;
\r
182 if( xAreQueuePeekTasksStillRunning() != pdTRUE )
\r
184 ulErrorCode |= 0x100UL;
\r
187 if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
\r
189 ulErrorCode |= 0x200UL;
\r
192 if( xAreSemaphoreTasksStillRunning() != pdTRUE )
\r
194 ulErrorCode |= 0x400UL;
\r
198 /*-----------------------------------------------------------*/
\r
200 static void prvSetupHardware( void )
\r
202 vParTestInitialise();
\r