]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_LM3Sxxxx_IAR_Keil/main.c
0e4426cfb4c35145d1725253160e8bd88967ed40
[freertos] / FreeRTOS / Demo / CORTEX_LM3Sxxxx_IAR_Keil / main.c
1 /*\r
2  * FreeRTOS Kernel V10.2.1\r
3  * Copyright (C) 2019 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
4  *\r
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
6  * this software and associated documentation files (the "Software"), to deal in\r
7  * the Software without restriction, including without limitation the rights to\r
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
9  * the Software, and to permit persons to whom the Software is furnished to do so,\r
10  * subject to the following conditions:\r
11  *\r
12  * The above copyright notice and this permission notice shall be included in all\r
13  * copies or substantial portions of the Software.\r
14  *\r
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
21  *\r
22  * http://www.FreeRTOS.org\r
23  * http://aws.amazon.com/freertos\r
24  *\r
25  * 1 tab == 4 spaces!\r
26  */\r
27 \r
28 \r
29 /*\r
30  * Creates all the demo application tasks, then starts the scheduler.  The WEB\r
31  * documentation provides more details of the standard demo application tasks.\r
32  * In addition to the standard demo tasks, the following tasks and tests are\r
33  * defined and/or created within this file:\r
34  *\r
35  * "Fast Interrupt Test" - A high frequency periodic interrupt is generated\r
36  * using a free running timer to demonstrate the use of the\r
37  * configKERNEL_INTERRUPT_PRIORITY configuration constant.  The interrupt\r
38  * service routine measures the number of processor clocks that occur between\r
39  * each interrupt - and in so doing measures the jitter in the interrupt timing.\r
40  * The maximum measured jitter time is latched in the ulMaxJitter variable, and\r
41  * displayed on the OLED display by the 'OLED' task as described below.  The\r
42  * fast interrupt is configured and handled in the timertest.c source file.\r
43  *\r
44  * "OLED" task - the OLED task is a 'gatekeeper' task.  It is the only task that\r
45  * is permitted to access the display directly.  Other tasks wishing to write a\r
46  * message to the OLED send the message on a queue to the OLED task instead of\r
47  * accessing the OLED themselves.  The OLED task just blocks on the queue waiting\r
48  * for messages - waking and displaying the messages as they arrive.\r
49  *\r
50  * "Check" hook -  This only executes every five seconds from the tick hook.\r
51  * Its main function is to check that all the standard demo tasks are still\r
52  * operational.  Should any unexpected behaviour within a demo task be discovered\r
53  * the tick hook will write an error to the OLED (via the OLED task).  If all the\r
54  * demo tasks are executing with their expected behaviour then the check task\r
55  * writes PASS to the OLED (again via the OLED task), as described above.\r
56  *\r
57  * "uIP" task -  This is the task that handles the uIP stack.  All TCP/IP\r
58  * processing is performed in this task.\r
59  */\r
60 \r
61 \r
62 \r
63 \r
64 /*************************************************************************\r
65  * Please ensure to read http://www.freertos.org/portlm3sx965.html\r
66  * which provides information on configuring and running this demo for the\r
67  * various Luminary Micro EKs.\r
68  *************************************************************************/\r
69 \r
70 /* Set the following option to 1 to include the WEB server in the build.  By\r
71 default the WEB server is excluded to keep the compiled code size under the 32K\r
72 limit imposed by the KickStart version of the IAR compiler.  The graphics\r
73 libraries take up a lot of ROM space, hence including the graphics libraries\r
74 and the TCP/IP stack together cannot be accommodated with the 32K size limit. */\r
75 #define mainINCLUDE_WEB_SERVER          0\r
76 \r
77 \r
78 /* Standard includes. */\r
79 #include <stdio.h>\r
80 #include <string.h>\r
81 \r
82 /* Scheduler includes. */\r
83 #include "FreeRTOS.h"\r
84 #include "task.h"\r
85 #include "queue.h"\r
86 #include "semphr.h"\r
87 \r
88 /* Hardware library includes. */\r
89 #include "hw_memmap.h"\r
90 #include "hw_types.h"\r
91 #include "hw_sysctl.h"\r
92 #include "sysctl.h"\r
93 #include "gpio.h"\r
94 #include "grlib.h"\r
95 #include "rit128x96x4.h"\r
96 #include "osram128x64x4.h"\r
97 #include "formike128x128x16.h"\r
98 \r
99 /* Demo app includes. */\r
100 #include "death.h"\r
101 #include "blocktim.h"\r
102 #include "flash.h"\r
103 #include "partest.h"\r
104 #include "semtest.h"\r
105 #include "PollQ.h"\r
106 #include "lcd_message.h"\r
107 #include "bitmap.h"\r
108 #include "GenQTest.h"\r
109 #include "QPeek.h"\r
110 #include "recmutex.h"\r
111 #include "IntQueue.h"\r
112 #include "QueueSet.h"\r
113 #include "EventGroupsDemo.h"\r
114 #include "MessageBufferDemo.h"\r
115 #include "StreamBufferDemo.h"\r
116 \r
117 /*-----------------------------------------------------------*/\r
118 \r
119 /* The time between cycles of the 'check' functionality (defined within the\r
120 tick hook. */\r
121 #define mainCHECK_DELAY                                         ( ( TickType_t ) 5000 / portTICK_PERIOD_MS )\r
122 \r
123 /* Size of the stack allocated to the uIP task. */\r
124 #define mainBASIC_WEB_STACK_SIZE            ( configMINIMAL_STACK_SIZE * 3 )\r
125 \r
126 /* The OLED task uses the sprintf function so requires a little more stack too. */\r
127 #define mainOLED_TASK_STACK_SIZE                        ( configMINIMAL_STACK_SIZE + 50 )\r
128 \r
129 /* Task priorities. */\r
130 #define mainQUEUE_POLL_PRIORITY                         ( tskIDLE_PRIORITY + 2 )\r
131 #define mainCHECK_TASK_PRIORITY                         ( tskIDLE_PRIORITY + 3 )\r
132 #define mainSEM_TEST_PRIORITY                           ( tskIDLE_PRIORITY + 1 )\r
133 #define mainCREATOR_TASK_PRIORITY           ( tskIDLE_PRIORITY + 3 )\r
134 #define mainGEN_QUEUE_TASK_PRIORITY                     ( tskIDLE_PRIORITY )\r
135 \r
136 /* The maximum number of message that can be waiting for display at any one\r
137 time. */\r
138 #define mainOLED_QUEUE_SIZE                                     ( 3 )\r
139 \r
140 /* Dimensions the buffer into which the jitter time is written. */\r
141 #define mainMAX_MSG_LEN                                         25\r
142 \r
143 /* The period of the system clock in nano seconds.  This is used to calculate\r
144 the jitter time in nano seconds. */\r
145 #define mainNS_PER_CLOCK                                        ( ( unsigned long ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) )\r
146 \r
147 /* Constants used when writing strings to the display. */\r
148 #define mainCHARACTER_HEIGHT                            ( 9 )\r
149 #define mainMAX_ROWS_128                                        ( mainCHARACTER_HEIGHT * 14 )\r
150 #define mainMAX_ROWS_96                                         ( mainCHARACTER_HEIGHT * 10 )\r
151 #define mainMAX_ROWS_64                                         ( mainCHARACTER_HEIGHT * 7 )\r
152 #define mainFULL_SCALE                                          ( 15 )\r
153 #define ulSSI_FREQUENCY                                         ( 3500000UL )\r
154 \r
155 /*-----------------------------------------------------------*/\r
156 \r
157 /*\r
158  * The task that handles the uIP stack.  All TCP/IP processing is performed in\r
159  * this task.\r
160  */\r
161 extern void vuIP_Task( void *pvParameters );\r
162 \r
163 /*\r
164  * The display is written two by more than one task so is controlled by a\r
165  * 'gatekeeper' task.  This is the only task that is actually permitted to\r
166  * access the display directly.  Other tasks wanting to display a message send\r
167  * the message to the gatekeeper.\r
168  */\r
169 static void vOLEDTask( void *pvParameters );\r
170 \r
171 /*\r
172  * Configure the hardware for the demo.\r
173  */\r
174 static void prvSetupHardware( void );\r
175 \r
176 /*\r
177  * Configures the high frequency timers - those used to measure the timing\r
178  * jitter while the real time kernel is executing.\r
179  */\r
180 extern void vSetupHighFrequencyTimer( void );\r
181 \r
182 /*\r
183  * Hook functions that can get called by the kernel.\r
184  */\r
185 void vApplicationStackOverflowHook( TaskHandle_t *pxTask, signed char *pcTaskName );\r
186 void vApplicationTickHook( void );\r
187 \r
188 \r
189 /*-----------------------------------------------------------*/\r
190 \r
191 /* The queue used to send messages to the OLED task. */\r
192 QueueHandle_t xOLEDQueue;\r
193 \r
194 /* The welcome text. */\r
195 const char * const pcWelcomeMessage = "   www.FreeRTOS.org";\r
196 \r
197 /*-----------------------------------------------------------*/\r
198 \r
199 \r
200 /*************************************************************************\r
201  * Please ensure to read http://www.freertos.org/portlm3sx965.html\r
202  * which provides information on configuring and running this demo for the\r
203  * various Luminary Micro EKs.\r
204  *************************************************************************/\r
205 int main( void )\r
206 {\r
207         prvSetupHardware();\r
208 \r
209         /* Create the queue used by the OLED task.  Messages for display on the OLED\r
210         are received via this queue. */\r
211         xOLEDQueue = xQueueCreate( mainOLED_QUEUE_SIZE, sizeof( xOLEDMessage ) );\r
212 \r
213         /* Start the standard demo tasks. */\r
214         vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );\r
215         vStartInterruptQueueTasks();\r
216         vStartRecursiveMutexTasks();\r
217         vCreateBlockTimeTasks();\r
218         vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
219         vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
220         vStartQueuePeekTasks();\r
221         vStartQueueSetTasks();\r
222         vStartEventGroupTasks();\r
223         vStartMessageBufferTasks( configMINIMAL_STACK_SIZE );\r
224         vStartStreamBufferTasks();\r
225 \r
226         /* Exclude some tasks if using the kickstart version to ensure we stay within\r
227         the 32K code size limit. */\r
228         #if mainINCLUDE_WEB_SERVER != 0\r
229         {\r
230                 /* Create the uIP task if running on a processor that includes a MAC and\r
231                 PHY. */\r
232                 if( SysCtlPeripheralPresent( SYSCTL_PERIPH_ETH ) )\r
233                 {\r
234                         xTaskCreate( vuIP_Task, "uIP", mainBASIC_WEB_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL );\r
235                 }\r
236         }\r
237         #endif\r
238 \r
239         /* Start the tasks defined within this file/specific to this demo. */\r
240         xTaskCreate( vOLEDTask, "OLED", mainOLED_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
241 \r
242         /* The suicide tasks must be created last as they need to know how many\r
243         tasks were running prior to their creation in order to ascertain whether\r
244         or not the correct/expected number of tasks are running at any given time. */\r
245         vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
246 \r
247         /* Uncomment the following line to configure the high frequency interrupt\r
248         used to measure the interrupt jitter time.\r
249         vSetupHighFrequencyTimer(); */\r
250 \r
251         /* Start the scheduler. */\r
252         vTaskStartScheduler();\r
253 \r
254         /* Will only get here if there was insufficient memory to create the idle\r
255         task. */\r
256         for( ;; );\r
257 }\r
258 /*-----------------------------------------------------------*/\r
259 \r
260 void prvSetupHardware( void )\r
261 {\r
262     /* If running on Rev A2 silicon, turn the LDO voltage up to 2.75V.  This is\r
263     a workaround to allow the PLL to operate reliably. */\r
264     if( DEVICE_IS_REVA2 )\r
265     {\r
266         SysCtlLDOSet( SYSCTL_LDO_2_75V );\r
267     }\r
268 \r
269         /* Set the clocking to run from the PLL at 50 MHz */\r
270         SysCtlClockSet( SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ );\r
271 \r
272         /*      Enable Port F for Ethernet LEDs\r
273                 LED0        Bit 3   Output\r
274                 LED1        Bit 2   Output */\r
275         SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOF );\r
276         GPIODirModeSet( GPIO_PORTF_BASE, (GPIO_PIN_2 | GPIO_PIN_3), GPIO_DIR_MODE_HW );\r
277         GPIOPadConfigSet( GPIO_PORTF_BASE, (GPIO_PIN_2 | GPIO_PIN_3 ), GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD );\r
278 \r
279         vParTestInitialise();\r
280 }\r
281 /*-----------------------------------------------------------*/\r
282 \r
283 void vApplicationTickHook( void )\r
284 {\r
285 static xOLEDMessage xMessage = { "PASS" };\r
286 static unsigned long ulTicksSinceLastDisplay = 0;\r
287 portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
288 \r
289         /* Called from every tick interrupt.  Have enough ticks passed to make it\r
290         time to perform our health status check again? */\r
291         ulTicksSinceLastDisplay++;\r
292         if( ulTicksSinceLastDisplay >= mainCHECK_DELAY )\r
293         {\r
294                 ulTicksSinceLastDisplay = 0;\r
295 \r
296                 /* Has an error been found in any task? */\r
297                 if( xAreStreamBufferTasksStillRunning() != pdTRUE )\r
298                 {\r
299                         xMessage.pcMessage = "ERROR IN STRM";\r
300                 }\r
301                 else if( xAreMessageBufferTasksStillRunning() != pdTRUE )\r
302                 {\r
303                         xMessage.pcMessage = "ERROR IN MSG";\r
304                 }\r
305                 if( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
306                 {\r
307                         xMessage.pcMessage = "ERROR IN GEN Q";\r
308                 }\r
309             else if( xIsCreateTaskStillRunning() != pdTRUE )\r
310             {\r
311                 xMessage.pcMessage = "ERROR IN CREATE";\r
312             }\r
313                 else if( xAreIntQueueTasksStillRunning() != pdTRUE )\r
314                 {\r
315                         xMessage.pcMessage = "ERROR IN INT QUEUE";\r
316                 }\r
317                 else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
318                 {\r
319                         xMessage.pcMessage = "ERROR IN BLOCK TIME";\r
320                 }\r
321                 else if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
322                 {\r
323                         xMessage.pcMessage = "ERROR IN SEMAPHORE";\r
324                 }\r
325                 else if( xArePollingQueuesStillRunning() != pdTRUE )\r
326                 {\r
327                         xMessage.pcMessage = "ERROR IN POLL Q";\r
328                 }\r
329                 else if( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
330                 {\r
331                         xMessage.pcMessage = "ERROR IN PEEK Q";\r
332                 }\r
333                 else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
334                 {\r
335                         xMessage.pcMessage = "ERROR IN REC MUTEX";\r
336                 }\r
337                 else if( xAreQueueSetTasksStillRunning() != pdPASS )\r
338                 {\r
339                         xMessage.pcMessage = "ERROR IN Q SET";\r
340                 }\r
341                 else if( xAreEventGroupTasksStillRunning() != pdTRUE )\r
342                 {\r
343                         xMessage.pcMessage = "ERROR IN EVNT GRP";\r
344                 }\r
345 \r
346                 configASSERT( strcmp( ( const char * ) xMessage.pcMessage, "PASS" ) == 0 );\r
347 \r
348                 /* Send the message to the OLED gatekeeper for display. */\r
349                 xHigherPriorityTaskWoken = pdFALSE;\r
350                 xQueueSendFromISR( xOLEDQueue, &xMessage, &xHigherPriorityTaskWoken );\r
351         }\r
352 \r
353         /* Write to a queue that is in use as part of the queue set demo to\r
354         demonstrate using queue sets from an ISR. */\r
355         vQueueSetAccessQueueSetFromISR();\r
356 \r
357         /* Call the event group ISR tests. */\r
358         vPeriodicEventGroupsProcessing();\r
359 }\r
360 /*-----------------------------------------------------------*/\r
361 \r
362 void vOLEDTask( void *pvParameters )\r
363 {\r
364 xOLEDMessage xMessage;\r
365 unsigned long ulY, ulMaxY;\r
366 static char cMessage[ mainMAX_MSG_LEN ];\r
367 extern volatile unsigned long ulMaxJitter;\r
368 const unsigned char *pucImage;\r
369 \r
370 /* Functions to access the OLED.  The one used depends on the dev kit\r
371 being used. */\r
372 void ( *vOLEDInit )( unsigned long ) = NULL;\r
373 void ( *vOLEDStringDraw )( const char *, unsigned long, unsigned long, unsigned char ) = NULL;\r
374 void ( *vOLEDImageDraw )( const unsigned char *, unsigned long, unsigned long, unsigned long, unsigned long ) = NULL;\r
375 void ( *vOLEDClear )( void ) = NULL;\r
376 \r
377         /* Map the OLED access functions to the driver functions that are appropriate\r
378         for the evaluation kit being used. */\r
379         switch( HWREG( SYSCTL_DID1 ) & SYSCTL_DID1_PRTNO_MASK )\r
380         {\r
381                 case SYSCTL_DID1_PRTNO_6965     :\r
382                 case SYSCTL_DID1_PRTNO_2965     :       vOLEDInit = OSRAM128x64x4Init;\r
383                                                                                 vOLEDStringDraw = OSRAM128x64x4StringDraw;\r
384                                                                                 vOLEDImageDraw = OSRAM128x64x4ImageDraw;\r
385                                                                                 vOLEDClear = OSRAM128x64x4Clear;\r
386                                                                                 ulMaxY = mainMAX_ROWS_64;\r
387                                                                                 pucImage = pucBasicBitmap;\r
388                                                                                 break;\r
389 \r
390                 case SYSCTL_DID1_PRTNO_1968     :\r
391                 case SYSCTL_DID1_PRTNO_8962 :   vOLEDInit = RIT128x96x4Init;\r
392                                                                                 vOLEDStringDraw = RIT128x96x4StringDraw;\r
393                                                                                 vOLEDImageDraw = RIT128x96x4ImageDraw;\r
394                                                                                 vOLEDClear = RIT128x96x4Clear;\r
395                                                                                 ulMaxY = mainMAX_ROWS_96;\r
396                                                                                 pucImage = pucBasicBitmap;\r
397                                                                                 break;\r
398 \r
399                 default                                         :       vOLEDInit = vFormike128x128x16Init;\r
400                                                                                 vOLEDStringDraw = vFormike128x128x16StringDraw;\r
401                                                                                 vOLEDImageDraw = vFormike128x128x16ImageDraw;\r
402                                                                                 vOLEDClear = vFormike128x128x16Clear;\r
403                                                                                 ulMaxY = mainMAX_ROWS_128;\r
404                                                                                 pucImage = pucGrLibBitmap;\r
405                                                                                 break;\r
406 \r
407         }\r
408 \r
409         ulY = ulMaxY;\r
410 \r
411         /* Initialise the OLED and display a startup message. */\r
412         vOLEDInit( ulSSI_FREQUENCY );\r
413         vOLEDStringDraw( "POWERED BY FreeRTOS", 0, 0, mainFULL_SCALE );\r
414         vOLEDImageDraw( pucImage, 0, mainCHARACTER_HEIGHT + 1, bmpBITMAP_WIDTH, bmpBITMAP_HEIGHT );\r
415 \r
416         for( ;; )\r
417         {\r
418                 /* Wait for a message to arrive that requires displaying. */\r
419                 xQueueReceive( xOLEDQueue, &xMessage, portMAX_DELAY );\r
420 \r
421                 /* Write the message on the next available row. */\r
422                 ulY += mainCHARACTER_HEIGHT;\r
423                 if( ulY >= ulMaxY )\r
424                 {\r
425                         ulY = mainCHARACTER_HEIGHT;\r
426                         vOLEDClear();\r
427                         vOLEDStringDraw( pcWelcomeMessage, 0, 0, mainFULL_SCALE );\r
428                 }\r
429 \r
430                 /* Display the message along with the maximum jitter time from the\r
431                 high priority time test. */\r
432                 sprintf( cMessage, "%s [%uns]", xMessage.pcMessage, ulMaxJitter * mainNS_PER_CLOCK );\r
433                 vOLEDStringDraw( cMessage, 0, ulY, mainFULL_SCALE );\r
434         }\r
435 }\r
436 /*-----------------------------------------------------------*/\r
437 \r
438 volatile signed char *pcOverflowedTask = NULL;\r
439 void vApplicationStackOverflowHook( TaskHandle_t *pxTask, signed char *pcTaskName )\r
440 {\r
441         ( void ) pxTask;\r
442         pcOverflowedTask = pcTaskName;\r
443 \r
444         for( ;; );\r
445 }\r
446 /*-----------------------------------------------------------*/\r
447 \r
448 void vAssertCalled( const char *pcFile, unsigned long ulLine )\r
449 {\r
450 volatile unsigned long ulSetTo1InDebuggerToExit = 0;\r
451 \r
452         taskENTER_CRITICAL();\r
453         {\r
454                 while( ulSetTo1InDebuggerToExit == 0 )\r
455                 {\r
456                         /* Nothing to do here.  Set the loop variable to a non zero value in\r
457                         the debugger to step out of this function to the point that caused\r
458                         the assertion. */\r
459                         ( void ) pcFile;\r
460                         ( void ) ulLine;\r
461                 }\r
462         }\r
463         taskEXIT_CRITICAL();\r
464 }\r
465 \r
466 /* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an\r
467 implementation of vApplicationGetIdleTaskMemory() to provide the memory that is\r
468 used by the Idle task. */\r
469 void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize )\r
470 {\r
471 /* If the buffers to be provided to the Idle task are declared inside this\r
472 function then they must be declared static - otherwise they will be allocated on\r
473 the stack and so not exists after this function exits. */\r
474 static StaticTask_t xIdleTaskTCB;\r
475 static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];\r
476 \r
477         /* Pass out a pointer to the StaticTask_t structure in which the Idle task's\r
478         state will be stored. */\r
479         *ppxIdleTaskTCBBuffer = &xIdleTaskTCB;\r
480 \r
481         /* Pass out the array that will be used as the Idle task's stack. */\r
482         *ppxIdleTaskStackBuffer = uxIdleTaskStack;\r
483 \r
484         /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.\r
485         Note that, as the array is necessarily of type StackType_t,\r
486         configMINIMAL_STACK_SIZE is specified in words, not bytes. */\r
487         *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;\r
488 }\r
489 /*-----------------------------------------------------------*/\r
490 \r
491 /* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the\r
492 application must provide an implementation of vApplicationGetTimerTaskMemory()\r
493 to provide the memory that is used by the Timer service task. */\r
494 void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize )\r
495 {\r
496 /* If the buffers to be provided to the Timer task are declared inside this\r
497 function then they must be declared static - otherwise they will be allocated on\r
498 the stack and so not exists after this function exits. */\r
499 static StaticTask_t xTimerTaskTCB;\r
500 static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];\r
501 \r
502         /* Pass out a pointer to the StaticTask_t structure in which the Timer\r
503         task's state will be stored. */\r
504         *ppxTimerTaskTCBBuffer = &xTimerTaskTCB;\r
505 \r
506         /* Pass out the array that will be used as the Timer task's stack. */\r
507         *ppxTimerTaskStackBuffer = uxTimerTaskStack;\r
508 \r
509         /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.\r
510         Note that, as the array is necessarily of type StackType_t,\r
511         configMINIMAL_STACK_SIZE is specified in words, not bytes. */\r
512         *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;\r
513 }\r
514 \r