2 * FreeRTOS Kernel V10.2.1
\r
3 * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
\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
12 * The above copyright notice and this permission notice shall be included in all
\r
13 * copies or substantial portions of the Software.
\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
22 * http://www.FreeRTOS.org
\r
23 * http://aws.amazon.com/freertos
\r
25 * 1 tab == 4 spaces!
\r
29 * The documentation page for this demo available on http://www.FreeRTOS.org
\r
30 * documents the hardware configuration required to run this demo. It also
\r
31 * provides more information on the expected demo application behaviour.
\r
33 * main() creates all the demo application tasks, then starts the scheduler.
\r
34 * A lot of the created tasks are from the pool of "standard demo" tasks. The
\r
35 * web documentation provides more details of the standard demo tasks, which
\r
36 * provide no particular functionality but do provide good examples of how to
\r
37 * use the FreeRTOS API.
\r
39 * In addition to the standard demo tasks, the following tasks, interrupts and
\r
40 * tests are defined and/or created within this file:
\r
42 * "LCD" task - The LCD task is a 'gatekeeper' task. It is the only task that
\r
43 * is permitted to access the LCD and therefore ensures access to the LCD is
\r
44 * always serialised and there are no mutual exclusion issues. When a task or
\r
45 * an interrupt wants to write to the LCD, it does not access the LCD directly
\r
46 * but instead sends the message to the LCD task. The LCD task then performs
\r
47 * the actual LCD output. This mechanism also allows interrupts to, in effect,
\r
48 * write to the LCD by sending messages to the LCD task.
\r
50 * The LCD task is also a demonstration of a 'controller' task design pattern.
\r
51 * Some tasks do not actually send a string to the LCD task directly, but
\r
52 * instead send a command that is interpreted by the LCD task. In a normal
\r
53 * application these commands can be control values or set points, in this
\r
54 * simple example the commands just result in messages being displayed on the
\r
57 * "Button Poll" task - This task polls the state of the 'up' key on the
\r
58 * joystick input device. It uses the vTaskDelay() API function to control
\r
59 * the poll rate to ensure debouncing is not necessary and that the task does
\r
60 * not use all the available CPU processing time.
\r
62 * Button Interrupt and run time stats display - The select button on the
\r
63 * joystick input device is configured to generate an external interrupt. The
\r
64 * handler for this interrupt sends a message to LCD task, which interprets the
\r
65 * message to mean, firstly write a message to the LCD, and secondly, generate
\r
66 * a table of run time statistics. The run time statistics are displayed as a
\r
67 * table that contains information on how much processing time each task has
\r
68 * been allocated since the application started to execute. This information
\r
69 * is provided both as an absolute time, and as a percentage of the total run
\r
70 * time. The information is displayed in the terminal IO window of the IAR
\r
71 * embedded workbench. The online documentation for this demo shows a screen
\r
72 * shot demonstrating where the run time stats can be viewed.
\r
74 * Idle Hook - The idle hook is a function that is called on each iteration of
\r
75 * the idle task. In this case it is used to place the processor into a low
\r
76 * power mode. Note however that this application is implemented using standard
\r
77 * components, and is therefore not optimised for low power operation. Lower
\r
78 * power consumption would be achieved by converting polling tasks into event
\r
79 * driven tasks, and slowing the tick interrupt frequency.
\r
81 * "Check" function called from the tick hook - The tick hook is called during
\r
82 * each tick interrupt. It is called from an interrupt context so must execute
\r
83 * quickly, not attempt to block, and not call any FreeRTOS API functions that
\r
84 * do not end in "FromISR". In this case the tick hook executes a 'check'
\r
85 * function. This only executes every five seconds. Its main function is to
\r
86 * check that all the standard demo tasks are still operational. Each time it
\r
87 * executes it sends a status code to the LCD task. The LCD task interprets the
\r
88 * code and displays an appropriate message - which will be PASS if no tasks
\r
89 * have reported any errors, or a message stating which task has reported an
\r
93 /* Standard includes. */
\r
96 /* Kernel includes. */
\r
97 #include "FreeRTOS.h"
\r
101 /* Demo application includes. */
\r
102 #include "partest.h"
\r
104 #include "dynamic.h"
\r
105 #include "comtest2.h"
\r
106 #include "GenQTest.h"
\r
108 /* Eval board includes. */
\r
109 #include "stm32_eval.h"
\r
110 #include "stm32l152_eval_lcd.h"
\r
112 /* The priorities assigned to the tasks. */
\r
113 #define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
\r
114 #define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
\r
115 #define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 )
\r
116 #define mainGENERIC_QUEUE_TEST_PRIORITY ( tskIDLE_PRIORITY )
\r
118 /* The length of the queue (the number of items the queue can hold) that is used
\r
119 to send messages from tasks and interrupts the the LCD task. */
\r
120 #define mainQUEUE_LENGTH ( 5 )
\r
122 /* Codes sent within messages to the LCD task so the LCD task can interpret
\r
123 exactly what the message it just received was. These are sent in the
\r
124 cMessageID member of the message structure (defined below). */
\r
125 #define mainMESSAGE_BUTTON_UP ( 1 )
\r
126 #define mainMESSAGE_BUTTON_SEL ( 2 )
\r
127 #define mainMESSAGE_STATUS ( 3 )
\r
129 /* When the cMessageID member of the message sent to the LCD task is
\r
130 mainMESSAGE_STATUS then these definitions are sent in the lMessageValue member
\r
131 of the same message and indicate what the status actually is. */
\r
132 #define mainERROR_DYNAMIC_TASKS ( pdPASS + 1 )
\r
133 #define mainERROR_COM_TEST ( pdPASS + 2 )
\r
134 #define mainERROR_GEN_QUEUE_TEST ( pdPASS + 3 )
\r
136 /* Baud rate used by the comtest tasks. */
\r
137 #define mainCOM_TEST_BAUD_RATE ( 115200 )
\r
139 /* The LED used by the comtest tasks. See the comtest.c file for more
\r
141 #define mainCOM_TEST_LED ( 3 )
\r
143 /* The LCD task uses printf() so requires more stack than most of the other
\r
145 #define mainLCD_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2 )
\r
147 /*-----------------------------------------------------------*/
\r
150 * System configuration is performed prior to main() being called, this function
\r
151 * configures the peripherals used by the demo application.
\r
153 static void prvSetupHardware( void );
\r
156 * Definition of the LCD/controller task described in the comments at the top
\r
159 static void prvLCDTask( void *pvParameters );
\r
162 * Definition of the button poll task described in the comments at the top of
\r
165 static void prvButtonPollTask( void *pvParameters );
\r
168 * Converts a status message value into an appropriate string for display on
\r
169 * the LCD. The string is written to pcBuffer.
\r
171 static void prvGenerateStatusMessage( char *pcBuffer, long lStatusValue );
\r
173 /*-----------------------------------------------------------*/
\r
175 /* The time base for the run time stats is generated by the 16 bit timer 6.
\r
176 Each time the timer overflows ulTIM6_OverflowCount is incremented. Therefore,
\r
177 when converting the total run time to a 32 bit number, the most significant two
\r
178 bytes are given by ulTIM6_OverflowCount and the least significant two bytes are
\r
179 given by the current TIM6 counter value. Care must be taken with data
\r
180 consistency when combining the two in case a timer overflow occurs as the
\r
181 value is being read. */
\r
182 unsigned long ulTIM6_OverflowCount = 0UL;
\r
184 /* The handle of the queue used to send messages from tasks and interrupts to
\r
186 static QueueHandle_t xLCDQueue = NULL;
\r
188 /* The definition of each message sent from tasks and interrupts to the LCD
\r
192 char cMessageID; /* << States what the message is. */
\r
193 long lMessageValue; /* << States the message value (can be an integer, string pointer, etc. depending on the value of cMessageID). */
\r
196 /*-----------------------------------------------------------*/
\r
200 /* Configure the peripherals used by this demo application. This includes
\r
201 configuring the joystick input select button to generate interrupts. */
\r
202 prvSetupHardware();
\r
204 /* Create the queue used by tasks and interrupts to send strings to the LCD
\r
206 xLCDQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( xQueueMessage ) );
\r
208 /* If the queue could not be created then don't create any tasks that might
\r
209 attempt to use the queue. */
\r
210 if( xLCDQueue != NULL )
\r
212 /* Add the created queue to the queue registry so it can be viewed in
\r
213 the IAR FreeRTOS state viewer plug-in. */
\r
214 vQueueAddToRegistry( xLCDQueue, "LCDQueue" );
\r
216 /* Create the LCD and button poll tasks, as described at the top of this
\r
218 xTaskCreate( prvLCDTask, "LCD", mainLCD_TASK_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL );
\r
219 xTaskCreate( prvButtonPollTask, "ButPoll", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
\r
221 /* Create a subset of the standard demo tasks. */
\r
222 vStartDynamicPriorityTasks();
\r
223 vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );
\r
224 vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
\r
225 vStartGenericQueueTasks( mainGENERIC_QUEUE_TEST_PRIORITY );
\r
227 /* Start the scheduler. */
\r
228 vTaskStartScheduler();
\r
231 /* If all is well then this line will never be reached. If it is reached
\r
232 then it is likely that there was insufficient (FreeRTOS) heap memory space
\r
233 to create the idle task. This may have been trapped by the malloc() failed
\r
234 hook function, if one is configured. */
\r
237 /*-----------------------------------------------------------*/
\r
239 static void prvLCDTask( void *pvParameters )
\r
241 xQueueMessage xReceivedMessage;
\r
242 long lLine = Line1;
\r
243 const long lFontHeight = (((sFONT *)LCD_GetFont())->Height);
\r
245 /* Buffer into which strings are formatted and placed ready for display on the
\r
246 LCD. Note this is a static variable to prevent it being allocated on the task
\r
247 stack, which is too small to hold such a variable. The stack size is configured
\r
248 when the task is created. */
\r
249 static char cBuffer[ 512 ];
\r
251 /* This function is the only function that uses printf(). If printf() is
\r
252 used from any other function then some sort of mutual exclusion on stdout
\r
255 This is also the only function that is permitted to access the LCD.
\r
257 First print out the number of bytes that remain in the FreeRTOS heap. This
\r
258 can be viewed in the terminal IO window within the IAR Embedded Workbench. */
\r
259 printf( "%d bytes of heap space remain unallocated\n", xPortGetFreeHeapSize() );
\r
263 /* Wait for a message to be received. Using portMAX_DELAY as the block
\r
264 time will result in an indefinite wait provided INCLUDE_vTaskSuspend is
\r
265 set to 1 in FreeRTOSConfig.h, therefore there is no need to check the
\r
266 function return value and the function will only return when a value
\r
267 has been received. */
\r
268 xQueueReceive( xLCDQueue, &xReceivedMessage, portMAX_DELAY );
\r
270 /* Clear the LCD if no room remains for any more text output. */
\r
271 if( lLine > Line9 )
\r
277 /* What is this message? What does it contain? */
\r
278 switch( xReceivedMessage.cMessageID )
\r
280 case mainMESSAGE_BUTTON_UP : /* The button poll task has just
\r
281 informed this task that the up
\r
282 button on the joystick input has
\r
283 been pressed or released. */
\r
284 sprintf( cBuffer, "Button up = %d", xReceivedMessage.lMessageValue );
\r
287 case mainMESSAGE_BUTTON_SEL : /* The select button interrupt
\r
288 just informed this task that the
\r
289 select button was pressed.
\r
290 Generate a table of task run time
\r
291 statistics and output this to
\r
292 the terminal IO window in the IAR
\r
293 embedded workbench. */
\r
294 printf( "\nTask\t Abs Time\t %%Time\n*****************************************" );
\r
295 vTaskGetRunTimeStats( cBuffer );
\r
298 /* Also print out a message to
\r
299 the LCD - in this case the
\r
300 pointer to the string to print
\r
301 is sent directly in the
\r
302 lMessageValue member of the
\r
303 message. This just demonstrates
\r
304 a different communication
\r
306 sprintf( cBuffer, "%s", ( char * ) xReceivedMessage.lMessageValue );
\r
309 case mainMESSAGE_STATUS : /* The tick interrupt hook
\r
310 function has just informed this
\r
311 task of the system status.
\r
312 Generate a string in accordance
\r
313 with the status value. */
\r
314 prvGenerateStatusMessage( cBuffer, xReceivedMessage.lMessageValue );
\r
317 default : sprintf( cBuffer, "Unknown message" );
\r
321 /* Output the message that was placed into the cBuffer array within the
\r
322 switch statement above. */
\r
323 LCD_DisplayStringLine( lLine, ( uint8_t * ) cBuffer );
\r
325 /* Move onto the next LCD line, ready for the next iteration of this
\r
327 lLine += lFontHeight;
\r
330 /*-----------------------------------------------------------*/
\r
332 static void prvGenerateStatusMessage( char *pcBuffer, long lStatusValue )
\r
334 /* Just a utility function to convert a status value into a meaningful
\r
335 string for output onto the LCD. */
\r
336 switch( lStatusValue )
\r
338 case pdPASS : sprintf( pcBuffer, "Task status = PASS" );
\r
340 case mainERROR_DYNAMIC_TASKS : sprintf( pcBuffer, "Error: Dynamic tasks" );
\r
342 case mainERROR_COM_TEST : sprintf( pcBuffer, "Err: loop connected?" ); /* Error in COM test - is the Loopback connector connected? */
\r
344 case mainERROR_GEN_QUEUE_TEST : sprintf( pcBuffer, "Error: Gen Q test" );
\r
346 default : sprintf( pcBuffer, "Unknown status" );
\r
350 /*-----------------------------------------------------------*/
\r
352 void EXTI9_5_IRQHandler( void )
\r
354 /* Define the message sent to the LCD task from this interrupt. */
\r
355 const xQueueMessage xMessage = { mainMESSAGE_BUTTON_SEL, ( unsigned long ) "Select Interrupt!" };
\r
356 long lHigherPriorityTaskWoken = pdFALSE;
\r
358 /* This is the interrupt handler for the joystick select button input.
\r
359 The button has been pushed, write a message to the LCD via the LCD task. */
\r
360 xQueueSendFromISR( xLCDQueue, &xMessage, &lHigherPriorityTaskWoken );
\r
362 EXTI_ClearITPendingBit( SEL_BUTTON_EXTI_LINE );
\r
364 /* If writing to xLCDQueue caused a task to unblock, and the unblocked task
\r
365 has a priority equal to or above the task that this interrupt interrupted,
\r
366 then lHigherPriorityTaskWoken will have been set to pdTRUE internally within
\r
367 xQueuesendFromISR(), and portEND_SWITCHING_ISR() will ensure that this
\r
368 interrupt returns directly to the higher priority unblocked task. */
\r
369 portEND_SWITCHING_ISR( lHigherPriorityTaskWoken );
\r
371 /*-----------------------------------------------------------*/
\r
373 void vApplicationTickHook( void )
\r
375 static unsigned long ulCounter = 0;
\r
376 static const unsigned long ulCheckFrequency = 5000UL / portTICK_PERIOD_MS;
\r
377 long lHigherPriorityTaskWoken = pdFALSE;
\r
379 /* Define the status message that is sent to the LCD task. By default the
\r
381 static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS };
\r
383 /* This is called from within the tick interrupt and performs the 'check'
\r
384 functionality as described in the comments at the top of this file.
\r
386 Is it time to perform the 'check' functionality again? */
\r
388 if( ulCounter >= ulCheckFrequency )
\r
390 /* See if the standard demo tasks are executing as expected, changing
\r
391 the message that is sent to the LCD task from PASS to an error code if
\r
392 any tasks set reports an error. */
\r
393 if( xAreDynamicPriorityTasksStillRunning() != pdPASS )
\r
395 xStatusMessage.lMessageValue = mainERROR_DYNAMIC_TASKS;
\r
398 if( xAreComTestTasksStillRunning() != pdPASS )
\r
400 xStatusMessage.lMessageValue = mainERROR_COM_TEST;
\r
403 if( xAreGenericQueueTasksStillRunning() != pdPASS )
\r
405 xStatusMessage.lMessageValue = mainERROR_GEN_QUEUE_TEST;
\r
408 /* As this is the tick hook the lHigherPriorityTaskWoken parameter is not
\r
409 needed (a context switch is going to be performed anyway), but it must
\r
410 still be provided. */
\r
411 xQueueSendFromISR( xLCDQueue, &xStatusMessage, &lHigherPriorityTaskWoken );
\r
415 /*-----------------------------------------------------------*/
\r
417 static void prvButtonPollTask( void *pvParameters )
\r
419 long lLastState = pdTRUE;
\r
421 xQueueMessage xMessage;
\r
423 /* This tasks performs the button polling functionality as described at the
\r
424 top of this file. */
\r
427 /* Check the button state. */
\r
428 lState = STM_EVAL_PBGetState( BUTTON_UP );
\r
429 if( lState != lLastState )
\r
431 /* The state has changed, send a message to the LCD task. */
\r
432 xMessage.cMessageID = mainMESSAGE_BUTTON_UP;
\r
433 xMessage.lMessageValue = lState;
\r
434 lLastState = lState;
\r
435 xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY );
\r
438 /* Block for 10 milliseconds so this task does not utilise all the CPU
\r
439 time and debouncing of the button is not necessary. */
\r
440 vTaskDelay( 10 / portTICK_PERIOD_MS );
\r
443 /*-----------------------------------------------------------*/
\r
445 static void prvSetupHardware( void )
\r
447 /* Ensure that all 4 interrupt priority bits are used as the pre-emption
\r
449 NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );
\r
451 /* Initialise the LEDs. */
\r
452 vParTestInitialise();
\r
454 /* Initialise the joystick inputs. */
\r
455 STM_EVAL_PBInit( BUTTON_UP, BUTTON_MODE_GPIO );
\r
456 STM_EVAL_PBInit( BUTTON_DOWN, BUTTON_MODE_GPIO );
\r
457 STM_EVAL_PBInit( BUTTON_LEFT, BUTTON_MODE_GPIO );
\r
458 STM_EVAL_PBInit( BUTTON_RIGHT, BUTTON_MODE_GPIO );
\r
460 /* The select button in the middle of the joystick is configured to generate
\r
461 an interrupt. The Eval board library will configure the interrupt
\r
462 priority to be the lowest priority available so the priority need not be
\r
463 set here explicitly. It is important that the priority is equal to or
\r
464 below that set by the configMAX_SYSCALL_INTERRUPT_PRIORITY value set in
\r
465 FreeRTOSConfig.h. */
\r
466 STM_EVAL_PBInit( BUTTON_SEL, BUTTON_MODE_EXTI );
\r
468 /* Initialize the LCD */
\r
469 STM32L152_LCD_Init();
\r
471 LCD_SetBackColor( Blue );
\r
472 LCD_SetTextColor( White );
\r
473 LCD_DisplayStringLine( Line0, " www.FreeRTOS.org" );
\r
475 /*-----------------------------------------------------------*/
\r
477 void vConfigureTimerForRunTimeStats( void )
\r
479 TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
\r
480 NVIC_InitTypeDef NVIC_InitStructure;
\r
482 /* The time base for the run time stats is generated by the 16 bit timer 6.
\r
483 Each time the timer overflows ulTIM6_OverflowCount is incremented.
\r
484 Therefore, when converting the total run time to a 32 bit number, the most
\r
485 significant two bytes are given by ulTIM6_OverflowCount and the least
\r
486 significant two bytes are given by the current TIM6 counter value. Care
\r
487 must be taken with data consistency when combining the two in case a timer
\r
488 overflow occurs as the value is being read.
\r
490 The portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() macro (in FreeRTOSConfig.h) is
\r
491 defined to call this function, so the kernel will call this function
\r
492 automatically at the appropriate time. */
\r
494 /* TIM6 clock enable */
\r
495 RCC_APB1PeriphClockCmd( RCC_APB1Periph_TIM6, ENABLE );
\r
497 /* The 32MHz clock divided by 5000 should tick (very) approximately every
\r
498 150uS and overflow a 16bit timer (very) approximately every 10 seconds. */
\r
499 TIM_TimeBaseStructure.TIM_Period = 65535;
\r
500 TIM_TimeBaseStructure.TIM_Prescaler = 5000;
\r
501 TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1;
\r
502 TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
\r
504 TIM_TimeBaseInit( TIM6, &TIM_TimeBaseStructure );
\r
506 /* Only interrupt on overflow events. */
\r
507 TIM6->CR1 |= TIM_CR1_URS;
\r
509 /* Enable the interrupt. */
\r
510 TIM_ITConfig( TIM6, TIM_IT_Update, ENABLE );
\r
512 /* Enable the TIM6 global Interrupt */
\r
513 NVIC_InitStructure.NVIC_IRQChannel = TIM6_IRQn;
\r
514 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = configLIBRARY_LOWEST_INTERRUPT_PRIORITY;
\r
515 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00; /* Not used as 4 bits are used for the pre-emption priority. */
\r
516 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
\r
517 NVIC_Init(&NVIC_InitStructure);
\r
519 TIM_ClearITPendingBit( TIM6, TIM_IT_Update );
\r
520 TIM_Cmd( TIM6, ENABLE );
\r
522 /*-----------------------------------------------------------*/
\r
524 void TIM6_IRQHandler( void )
\r
526 /* Interrupt handler for TIM 6
\r
528 The time base for the run time stats is generated by the 16 bit timer 6.
\r
529 Each time the timer overflows ulTIM6_OverflowCount is incremented.
\r
530 Therefore, when converting the total run time to a 32 bit number, the most
\r
531 significant two bytes are given by ulTIM6_OverflowCount and the least
\r
532 significant two bytes are given by the current TIM6 counter value. Care
\r
533 must be taken with data consistency when combining the two in case a timer
\r
534 overflow occurs as the value is being read. */
\r
535 if( TIM_GetITStatus( TIM6, TIM_IT_Update) != RESET)
\r
537 ulTIM6_OverflowCount++;
\r
538 TIM_ClearITPendingBit( TIM6, TIM_IT_Update );
\r
541 /*-----------------------------------------------------------*/
\r
543 void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
\r
545 ( void ) pcTaskName;
\r
548 /* Run time stack overflow checking is performed if
\r
549 configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
\r
550 function is called if a stack overflow is detected. */
\r
553 /*-----------------------------------------------------------*/
\r
555 void vApplicationMallocFailedHook( void )
\r
557 /* Called if a call to pvPortMalloc() fails because there is insufficient
\r
558 free memory available in the FreeRTOS heap. pvPortMalloc() is called
\r
559 internally by FreeRTOS API functions that create tasks, queues or
\r
563 /*-----------------------------------------------------------*/
\r
565 void vApplicationIdleHook( void )
\r
567 /* Called on each iteration of the idle task. In this case the idle task
\r
568 just enters a low(ish) power mode. */
\r
569 PWR_EnterSleepMode( PWR_Regulator_ON, PWR_SLEEPEntry_WFI );
\r