]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/main.c
Update version numbers in preparation for V8.2.0 release candidate 1.
[freertos] / FreeRTOS / Demo / CORTEX_STM32F103_Primer_GCC / main.c
1 /*\r
2     FreeRTOS V8.2.0rc1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
3     All rights reserved\r
4 \r
5     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
6 \r
7     This file is part of the FreeRTOS distribution.\r
8 \r
9     FreeRTOS is free software; you can redistribute it and/or modify it under\r
10     the terms of the GNU General Public License (version 2) as published by the\r
11     Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
12 \r
13     >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
14     >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
15     >>!   obliged to provide the source code for proprietary components     !<<\r
16     >>!   outside of the FreeRTOS kernel.                                   !<<\r
17 \r
18     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
19     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
20     FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
21     link: http://www.freertos.org/a00114.html\r
22 \r
23     1 tab == 4 spaces!\r
24 \r
25     ***************************************************************************\r
26      *                                                                       *\r
27      *    Having a problem?  Start by reading the FAQ "My application does   *\r
28      *    not run, what could be wrong?".  Have you defined configASSERT()?  *\r
29      *                                                                       *\r
30      *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
31      *                                                                       *\r
32     ***************************************************************************\r
33 \r
34     ***************************************************************************\r
35      *                                                                       *\r
36      *    FreeRTOS provides completely free yet professionally developed,    *\r
37      *    robust, strictly quality controlled, supported, and cross          *\r
38      *    platform software that is more than just the market leader, it     *\r
39      *    is the industry's de facto standard.                               *\r
40      *                                                                       *\r
41      *    Help yourself get started quickly while simultaneously helping     *\r
42      *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
43      *    tutorial book, reference manual, or both:                          *\r
44      *    http://www.FreeRTOS.org/Documentation                              *\r
45      *                                                                       *\r
46     ***************************************************************************\r
47 \r
48     ***************************************************************************\r
49      *                                                                       *\r
50      *   Investing in training allows your team to be as productive as       *\r
51      *   possible as early as possible, lowering your overall development    *\r
52      *   cost, and enabling you to bring a more robust product to market     *\r
53      *   earlier than would otherwise be possible.  Richard Barry is both    *\r
54      *   the architect and key author of FreeRTOS, and so also the world's   *\r
55      *   leading authority on what is the world's most popular real time     *\r
56      *   kernel for deeply embedded MCU designs.  Obtaining your training    *\r
57      *   from Richard ensures your team will gain directly from his in-depth *\r
58      *   product knowledge and years of usage experience.  Contact Real Time *\r
59      *   Engineers Ltd to enquire about the FreeRTOS Masterclass, presented  *\r
60      *   by Richard Barry:  http://www.FreeRTOS.org/contact\r
61      *                                                                       *\r
62     ***************************************************************************\r
63 \r
64     ***************************************************************************\r
65      *                                                                       *\r
66      *    You are receiving this top quality software for free.  Please play *\r
67      *    fair and reciprocate by reporting any suspected issues and         *\r
68      *    participating in the community forum:                              *\r
69      *    http://www.FreeRTOS.org/support                                    *\r
70      *                                                                       *\r
71      *    Thank you!                                                         *\r
72      *                                                                       *\r
73     ***************************************************************************\r
74 \r
75     http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
76     license and Real Time Engineers Ltd. contact details.\r
77 \r
78     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
79     including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
80     compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
81 \r
82     http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
83     Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
84 \r
85     http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
86     Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
87     licenses offer ticketed support, indemnification and commercial middleware.\r
88 \r
89     http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
90     engineered and independently SIL3 certified version for use in safety and\r
91     mission critical applications that require provable dependability.\r
92 \r
93     1 tab == 4 spaces!\r
94 */\r
95 \r
96 /*\r
97  * Creates all the demo application tasks, then starts the scheduler.  The WEB\r
98  * documentation provides more details of the standard demo application tasks.\r
99  * In addition to the standard demo tasks, the following tasks and tests are\r
100  * defined and/or created within this file:\r
101  *\r
102  * "Fast Interrupt Test" - A high frequency periodic interrupt is generated\r
103  * using a free running timer to demonstrate the use of the\r
104  * configKERNEL_INTERRUPT_PRIORITY configuration constant.  The interrupt\r
105  * service routine measures the number of processor clocks that occur between\r
106  * each interrupt - and in so doing measures the jitter in the interrupt timing.\r
107  * The maximum measured jitter time is latched in the ulMaxJitter variable, and\r
108  * displayed on the LCD by the 'Check' task as described below.  The\r
109  * fast interrupt is configured and handled in the timertest.c source file.\r
110  *\r
111  * "LCD" task - the LCD task is a 'gatekeeper' task.  It is the only task that\r
112  * is permitted to access the display directly.  Other tasks wishing to write a\r
113  * message to the LCD send the message on a queue to the LCD task instead of\r
114  * accessing the LCD themselves.  The LCD task just blocks on the queue waiting\r
115  * for messages - waking and displaying the messages as they arrive.  Messages\r
116  * can either be a text string to display, or an instruction to update MEMS\r
117  * input.  The MEMS input is used to display a ball that can be moved around\r
118  * LCD by tilting the STM32 Primer.  45% is taken as the neutral position.\r
119  *\r
120  * "Check" task -  This only executes every five seconds but has the highest\r
121  * priority so is guaranteed to get processor time.  Its main function is to\r
122  * check that all the standard demo tasks are still operational.  Should any\r
123  * unexpected behaviour within a demo task be discovered the 'check' task will\r
124  * write an error to the LCD (via the LCD task).  If all the demo tasks are\r
125  * executing with their expected behaviour then the check task writes PASS\r
126  * along with the max jitter time to the LCD (again via the LCD task), as\r
127  * described above.\r
128  *\r
129  * Tick Hook - A tick hook is provided just for demonstration purposes.  In\r
130  * this case it is used to periodically send an instruction to updated the\r
131  * MEMS input to the LCD task.\r
132  *\r
133  */\r
134 \r
135 /* CircleOS includes.  Some of the CircleOS peripheral functionality is\r
136 utilised, although CircleOS itself is not used. */\r
137 #include "circle.h"\r
138 \r
139 /* Standard includes. */\r
140 #include <string.h>\r
141 \r
142 /* Scheduler includes. */\r
143 #include "FreeRTOS.h"\r
144 #include "task.h"\r
145 #include "queue.h"\r
146 \r
147 /* Demo app includes. */\r
148 #include "BlockQ.h"\r
149 #include "blocktim.h"\r
150 #include "GenQTest.h"\r
151 #include "partest.h"\r
152 #include "QPeek.h"\r
153 \r
154 /* The bitmap used to display the FreeRTOS.org logo is stored in 16bit format\r
155 and therefore takes up a large proportion of the Flash space.  Setting this\r
156 parameter to 0 excludes the bitmap from the build, freeing up Flash space for\r
157 extra code. */\r
158 #define mainINCLUDE_BITMAP                                      0\r
159 \r
160 #if mainINCLUDE_BITMAP == 1\r
161         #include "bitmap.h"\r
162 #endif\r
163 \r
164 /* Task priorities. */\r
165 #define mainQUEUE_POLL_PRIORITY                         ( tskIDLE_PRIORITY + 2 )\r
166 #define mainCHECK_TASK_PRIORITY                         ( tskIDLE_PRIORITY + 3 )\r
167 #define mainBLOCK_Q_PRIORITY                            ( tskIDLE_PRIORITY + 2 )\r
168 #define mainGEN_Q_PRIORITY                                      ( tskIDLE_PRIORITY + 0 )\r
169 #define mainFLASH_TASK_PRIORITY                         ( tskIDLE_PRIORITY + 2 )\r
170 \r
171 /* Splash screen related constants. */\r
172 #define mainBITMAP_Y                                            ( 38 )\r
173 #define mainBITMAP_X                                            ( 18 )\r
174 #define mainURL_Y                                                       ( 8 )\r
175 #define mainURL_X                                                       ( 78 )\r
176 #define mainSPLASH_SCREEN_DELAY         ( 2000 / portTICK_PERIOD_MS )\r
177 \r
178 /* Text drawing related constants. */\r
179 #define mainLCD_CHAR_HEIGHT                     ( 13 )\r
180 #define mainLCD_MAX_Y                           ( 110 )\r
181 \r
182 /* The maximum number of message that can be waiting for display at any one\r
183 time. */\r
184 #define mainLCD_QUEUE_SIZE                                      ( 3 )\r
185 \r
186 /* The check task uses the sprintf function so requires a little more stack. */\r
187 #define mainCHECK_TASK_STACK_SIZE                       ( configMINIMAL_STACK_SIZE + 50 )\r
188 \r
189 /* The LCD task calls some of the CircleOS functions (for MEMS and LCD access),\r
190 these can require a larger stack. */\r
191 #define configLCD_TASK_STACK_SIZE                       ( configMINIMAL_STACK_SIZE + 50 )\r
192 \r
193 /* Dimensions the buffer into which the jitter time is written. */\r
194 #define mainMAX_MSG_LEN                                         25\r
195 \r
196 /* The time between cycles of the 'check' task. */\r
197 #define mainCHECK_DELAY                                         ( ( TickType_t ) 5000 / portTICK_PERIOD_MS )\r
198 \r
199 /* The period at which the MEMS input should be updated. */\r
200 #define mainMEMS_DELAY                                          ( ( TickType_t ) 100 / portTICK_PERIOD_MS )\r
201 \r
202 /* The rate at which the flash task toggles the LED. */\r
203 #define mainFLASH_DELAY                                         ( ( TickType_t ) 1000 / portTICK_PERIOD_MS )\r
204 \r
205 /* The number of nano seconds between each processor clock. */\r
206 #define mainNS_PER_CLOCK ( ( unsigned long ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) )\r
207 \r
208 /* The two types of message that can be sent to the LCD task. */\r
209 #define mainUPDATE_BALL_MESSAGE                         ( 0 )\r
210 #define mainWRITE_STRING_MESSAGE                        ( 1 )\r
211 \r
212 /* Type of the message sent to the LCD task. */\r
213 typedef struct\r
214 {\r
215         portBASE_TYPE xMessageType;\r
216         signed char *pcMessage;\r
217 } xLCDMessage;\r
218 \r
219 /*-----------------------------------------------------------*/\r
220 \r
221 /*\r
222  * Configure the clocks, GPIO and other peripherals as required by the demo.\r
223  */\r
224 static void prvSetupHardware( void );\r
225 \r
226 /*\r
227  * The LCD is written two by more than one task so is controlled by a\r
228  * 'gatekeeper' task.  This is the only task that is actually permitted to\r
229  * access the LCD directly.  Other tasks wanting to display a message send\r
230  * the message to the gatekeeper.\r
231  */\r
232 static void prvLCDTask( void *pvParameters );\r
233 \r
234 /*\r
235  * Checks the status of all the demo tasks then prints a message to the\r
236  * display.  The message will be either PASS - and include in brackets the\r
237  * maximum measured jitter time (as described at the to of the file), or a\r
238  * message that describes which of the standard demo tasks an error has been\r
239  * discovered in.\r
240  *\r
241  * Messages are not written directly to the terminal, but passed to prvLCDTask\r
242  * via a queue.\r
243  *\r
244  * The check task also receives instructions to update the MEMS input, which\r
245  * in turn can also lead to the LCD being updated.\r
246  */\r
247 static void prvCheckTask( void *pvParameters );\r
248 \r
249 /*\r
250  * Configures the timers and interrupts for the fast interrupt test as\r
251  * described at the top of this file.\r
252  */\r
253 extern void vSetupTimerTest( void );\r
254 \r
255 /*\r
256  * A cut down version of sprintf() used to percent the HUGE GCC library\r
257  * equivalent from being included in the binary image.\r
258  */\r
259 extern int sprintf(char *out, const char *format, ...);\r
260 \r
261 /*\r
262  * Simple toggle the LED periodically for timing verification.\r
263  */\r
264 static void prvFlashTask( void *pvParameters );\r
265 \r
266 /*-----------------------------------------------------------*/\r
267 \r
268 /* The queue used to send messages to the LCD task. */\r
269 QueueHandle_t xLCDQueue;\r
270 \r
271 /*-----------------------------------------------------------*/\r
272 \r
273 int main( void )\r
274 {\r
275         #ifdef DEBUG\r
276                 debug();\r
277         #endif\r
278 \r
279         prvSetupHardware();\r
280 \r
281         /* Create the queue used by the LCD task.  Messages for display on the LCD\r
282         are received via this queue. */\r
283         xLCDQueue = xQueueCreate( mainLCD_QUEUE_SIZE, sizeof( xLCDMessage ) );\r
284 \r
285         /* Start the standard demo tasks. */\r
286         vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
287     vCreateBlockTimeTasks();\r
288         vStartGenericQueueTasks( mainGEN_Q_PRIORITY );\r
289         vStartQueuePeekTasks();\r
290         vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
291 \r
292         /* Start the tasks defined within this file/specific to this demo. */\r
293     xTaskCreate( prvCheckTask, "Check", mainCHECK_TASK_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
294         xTaskCreate( prvLCDTask, "LCD", configLCD_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
295         xTaskCreate( prvFlashTask, "Flash", configMINIMAL_STACK_SIZE, NULL, mainFLASH_TASK_PRIORITY, NULL );\r
296 \r
297         /* Configure the timers used by the fast interrupt timer test. */\r
298         vSetupTimerTest();\r
299 \r
300         /* Start the scheduler. */\r
301         vTaskStartScheduler();\r
302 \r
303         /* Will only get here if there was not enough heap space to create the\r
304         idle task. */\r
305         return 0;\r
306 }\r
307 /*-----------------------------------------------------------*/\r
308 \r
309 void prvLCDTask( void *pvParameters )\r
310 {\r
311 xLCDMessage xMessage;\r
312 char cY = mainLCD_CHAR_HEIGHT;\r
313 const char * const pcString = "www.FreeRTOS.org";\r
314 const char * const pcBlankLine = "                  ";\r
315 \r
316         DRAW_Init();\r
317 \r
318         #if mainINCLUDE_BITMAP == 1\r
319                 DRAW_SetImage( pucImage, mainBITMAP_Y, mainBITMAP_X, bmpBITMAP_HEIGHT, bmpBITMAP_WIDTH );\r
320         #endif\r
321 \r
322         LCD_SetScreenOrientation( V9 );\r
323         DRAW_DisplayString( mainURL_Y, mainURL_X, pcString, strlen( pcString ) );\r
324         vTaskDelay( mainSPLASH_SCREEN_DELAY );\r
325         LCD_FillRect( 0, 0, CHIP_SCREEN_WIDTH, CHIP_SCREEN_HEIGHT, RGB_WHITE );\r
326 \r
327         for( ;; )\r
328         {\r
329                 /* Wait for a message to arrive that requires displaying. */\r
330                 while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS );\r
331 \r
332                 /* Check the message type. */\r
333                 if( xMessage.xMessageType == mainUPDATE_BALL_MESSAGE )\r
334                 {\r
335                         /* Read the MEMS and update the ball display on the LCD if required. */\r
336                         MEMS_Handler();\r
337                         POINTER_Handler();\r
338                 }\r
339                 else\r
340                 {\r
341                         /* A text string was sent.  First blank off the old text string, then\r
342                         draw the new text on the next line down. */\r
343                         DRAW_DisplayString( 0, cY, pcBlankLine, strlen( pcBlankLine ) );\r
344 \r
345                         cY -= mainLCD_CHAR_HEIGHT;\r
346                         if( cY <= ( mainLCD_CHAR_HEIGHT - 1 ) )\r
347                         {\r
348                                 /* Wrap the line onto which we are going to write the text. */\r
349                                 cY = mainLCD_MAX_Y;\r
350                         }\r
351 \r
352                         /* Display the message. */\r
353                         DRAW_DisplayString( 0, cY, xMessage.pcMessage, strlen( xMessage.pcMessage ) );\r
354                 }\r
355         }\r
356 }\r
357 /*-----------------------------------------------------------*/\r
358 \r
359 static void prvCheckTask( void *pvParameters )\r
360 {\r
361 TickType_t xLastExecutionTime;\r
362 xLCDMessage xMessage;\r
363 static signed char cPassMessage[ mainMAX_MSG_LEN ];\r
364 extern unsigned short usMaxJitter;\r
365 \r
366         /* Initialise the xLastExecutionTime variable on task entry. */\r
367         xLastExecutionTime = xTaskGetTickCount();\r
368 \r
369         /* Setup the message we are going to send to the LCD task. */\r
370         xMessage.xMessageType = mainWRITE_STRING_MESSAGE;\r
371         xMessage.pcMessage = cPassMessage;\r
372 \r
373     for( ;; )\r
374         {\r
375                 /* Perform this check every mainCHECK_DELAY milliseconds. */\r
376                 vTaskDelayUntil( &xLastExecutionTime, mainCHECK_DELAY );\r
377 \r
378                 /* Has an error been found in any task?   If so then point the text\r
379                 we are going to send to the LCD task to an error message instead of\r
380                 the PASS message. */\r
381                 if( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
382                 {\r
383                         xMessage.pcMessage = "ERROR IN GEN Q";\r
384                 }\r
385         if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
386                 {\r
387                         xMessage.pcMessage = "ERROR IN BLOCK Q";\r
388                 }\r
389                 else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
390                 {\r
391                         xMessage.pcMessage = "ERROR IN BLOCK TIME";\r
392                 }\r
393         else if( xArePollingQueuesStillRunning() != pdTRUE )\r
394         {\r
395             xMessage.pcMessage = "ERROR IN POLL Q";\r
396         }\r
397                 else if( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
398                 {\r
399                         xMessage.pcMessage = "ERROR IN PEEK Q";\r
400                 }\r
401                 else\r
402                 {\r
403                         /* No errors were found in any task, so send a pass message\r
404                         with the max measured jitter time also included (as per the\r
405                         fast interrupt test described at the top of this file and on\r
406                         the online documentation page for this demo application). */\r
407                         sprintf( ( char * ) cPassMessage, "PASS [%uns]", ( ( unsigned long ) usMaxJitter ) * mainNS_PER_CLOCK );\r
408                 }\r
409 \r
410                 /* Send the message to the LCD gatekeeper for display. */\r
411                 xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY );\r
412         }\r
413 }\r
414 /*-----------------------------------------------------------*/\r
415 \r
416 void vApplicationTickHook( void )\r
417 {\r
418 static unsigned long ulCallCount;\r
419 static const xLCDMessage xMemsMessage = { mainUPDATE_BALL_MESSAGE, NULL };\r
420 static portBASE_TYPE xHigherPriorityTaskWoken;\r
421 \r
422         /* Periodically send a message to the LCD task telling it to update\r
423         the MEMS input, and then if necessary the LCD. */\r
424         ulCallCount++;\r
425         if( ulCallCount >= mainMEMS_DELAY )\r
426         {\r
427                 ulCallCount = 0;\r
428                 xHigherPriorityTaskWoken = pdFALSE;\r
429                 xQueueSendFromISR( xLCDQueue, &xMemsMessage, &xHigherPriorityTaskWoken );\r
430         }\r
431 }\r
432 /*-----------------------------------------------------------*/\r
433 \r
434 static void prvSetupHardware( void )\r
435 {\r
436         /* Start with the clocks in their expected state. */\r
437         RCC_DeInit();\r
438 \r
439         /* Enable HSE (high speed external clock). */\r
440         RCC_HSEConfig( RCC_HSE_ON );\r
441 \r
442         /* Wait till HSE is ready. */\r
443         while( RCC_GetFlagStatus( RCC_FLAG_HSERDY ) == RESET )\r
444         {\r
445         }\r
446 \r
447         /* 2 wait states required on the flash. */\r
448         *( ( unsigned long * ) 0x40022000 ) = 0x02;\r
449 \r
450         /* HCLK = SYSCLK */\r
451         RCC_HCLKConfig( RCC_SYSCLK_Div1 );\r
452 \r
453         /* PCLK2 = HCLK */\r
454         RCC_PCLK2Config( RCC_HCLK_Div1 );\r
455 \r
456         /* PCLK1 = HCLK/2 */\r
457         RCC_PCLK1Config( RCC_HCLK_Div2 );\r
458 \r
459         /* PLLCLK = 12MHz * 6 = 72 MHz. */\r
460         RCC_PLLConfig( RCC_PLLSource_HSE_Div1, RCC_PLLMul_6 );\r
461 \r
462         /* Enable PLL. */\r
463         RCC_PLLCmd( ENABLE );\r
464 \r
465         /* Wait till PLL is ready. */\r
466         while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)\r
467         {\r
468         }\r
469 \r
470         /* Select PLL as system clock source. */\r
471         RCC_SYSCLKConfig( RCC_SYSCLKSource_PLLCLK );\r
472 \r
473         /* Wait till PLL is used as system clock source. */\r
474         while( RCC_GetSYSCLKSource() != 0x08 )\r
475         {\r
476         }\r
477 \r
478         /* Enable GPIOA, GPIOB, GPIOC, GPIOD, GPIOE and AFIO clocks */\r
479         RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |RCC_APB2Periph_GPIOC\r
480                                                         | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO, ENABLE );\r
481 \r
482         /* SPI2 Periph clock enable */\r
483         RCC_APB1PeriphClockCmd( RCC_APB1Periph_SPI2, ENABLE );\r
484 \r
485 \r
486         /* Set the Vector Table base address at 0x08000000 */\r
487         NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 );\r
488 \r
489         NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );\r
490 \r
491         /* Configure HCLK clock as SysTick clock source. */\r
492         SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK );\r
493 \r
494         /* Misc initialisation, including some of the CircleOS features.  Note\r
495         that CircleOS itself is not used. */\r
496         vParTestInitialise();\r
497         MEMS_Init();\r
498         POINTER_Init();\r
499         POINTER_SetMode( POINTER_RESTORE_LESS );\r
500 }\r
501 /*-----------------------------------------------------------*/\r
502 \r
503 static void prvFlashTask( void *pvParameters )\r
504 {\r
505 TickType_t xLastExecutionTime;\r
506 \r
507         /* Initialise the xLastExecutionTime variable on task entry. */\r
508         xLastExecutionTime = xTaskGetTickCount();\r
509 \r
510     for( ;; )\r
511         {\r
512                 /* Simple toggle the LED periodically.  This just provides some timing\r
513                 verification. */\r
514                 vTaskDelayUntil( &xLastExecutionTime, mainFLASH_DELAY );\r
515                 vParTestToggleLED( 0 );\r
516         }\r
517 }\r
518 /*-----------------------------------------------------------*/\r
519 \r
520 void starting_delay( unsigned long ul )\r
521 {\r
522         vTaskDelay( ( TickType_t ) ul );\r
523 }\r
524 \r
525 \r
526 \r