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