2 * FreeRTOS Kernel V10.3.0
\r
3 * Copyright (C) 2020 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
92 * "Reg test" tasks - These fill the registers with known values, then check
\r
93 * that each register still contains its expected value. Each task uses
\r
94 * different values. The tasks run with very low priority so get preempted
\r
95 * very frequently. A check variable is incremented on each iteration of the
\r
96 * test loop. A register containing an unexpected value is indicative of an
\r
97 * error in the context switching mechanism and will result in a branch to a
\r
98 * null loop - which in turn will prevent the check variable from incrementing
\r
99 * any further and allow the check task (described a above) to determine that an
\r
100 * error has occurred. The nature of the reg test tasks necessitates that they
\r
101 * are written in assembly code.
\r
103 * *NOTE 1* vApplicationSetupTimerInterrupt() is called by the kernel to let
\r
104 * the application set up a timer to generate the tick interrupt. In this
\r
105 * example a timer A0 is used for this purpose.
\r
109 /* Standard includes. */
\r
112 /* FreeRTOS includes. */
\r
113 #include "FreeRTOS.h"
\r
117 /* Hardware includes. */
\r
118 #include "msp430.h"
\r
119 #include "hal_MSP-EXP430F5438.h"
\r
121 /* Standard demo includes. */
\r
122 #include "ParTest.h"
\r
123 #include "dynamic.h"
\r
124 #include "comtest2.h"
\r
125 #include "GenQTest.h"
\r
127 /* Codes sent within messages to the LCD task so the LCD task can interpret
\r
128 exactly what the message it just received was. These are sent in the
\r
129 cMessageID member of the message structure (defined below). */
\r
130 #define mainMESSAGE_BUTTON_UP ( 1 )
\r
131 #define mainMESSAGE_BUTTON_SEL ( 2 )
\r
132 #define mainMESSAGE_STATUS ( 3 )
\r
134 /* When the cMessageID member of the message sent to the LCD task is
\r
135 mainMESSAGE_STATUS then these definitions are sent in the ulMessageValue member
\r
136 of the same message and indicate what the status actually is. */
\r
137 #define mainERROR_DYNAMIC_TASKS ( pdPASS + 1 )
\r
138 #define mainERROR_COM_TEST ( pdPASS + 2 )
\r
139 #define mainERROR_GEN_QUEUE_TEST ( pdPASS + 3 )
\r
140 #define mainERROR_REG_TEST ( pdPASS + 4 )
\r
142 /* The length of the queue (the number of items the queue can hold) that is used
\r
143 to send messages from tasks and interrupts the the LCD task. */
\r
144 #define mainQUEUE_LENGTH ( 5 )
\r
146 /* Priorities used by the test and demo tasks. */
\r
147 #define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
\r
148 #define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 )
\r
149 #define mainGENERIC_QUEUE_TEST_PRIORITY ( tskIDLE_PRIORITY )
\r
151 /* The LED used by the comtest tasks. See the comtest.c file for more
\r
153 #define mainCOM_TEST_LED ( 1 )
\r
155 /* The baud rate used by the comtest tasks described at the top of this file. */
\r
156 #define mainCOM_TEST_BAUD_RATE ( 38400 )
\r
158 /* The maximum number of lines of text that can be displayed on the LCD. */
\r
159 #define mainMAX_LCD_LINES ( 8 )
\r
161 /* Just used to ensure parameters are passed into tasks correctly. */
\r
162 #define mainTASK_PARAMETER_CHECK_VALUE ( ( void * ) 0xDEAD )
\r
163 /*-----------------------------------------------------------*/
\r
166 * The reg test tasks as described at the top of this file.
\r
168 extern void vRegTest1Task( void *pvParameters );
\r
169 extern void vRegTest2Task( void *pvParameters );
\r
172 * Configures clocks, LCD, port pints, etc. necessary to execute this demo.
\r
174 static void prvSetupHardware( void );
\r
177 * Definition of the LCD/controller task described in the comments at the top
\r
180 static void prvLCDTask( void *pvParameters );
\r
183 * Definition of the button poll task described in the comments at the top of
\r
186 static void prvButtonPollTask( void *pvParameters );
\r
189 * Converts a status message value into an appropriate string for display on
\r
190 * the LCD. The string is written to pcBuffer.
\r
192 static void prvGenerateStatusMessage( char *pcBuffer, long lStatusValue );
\r
194 /*-----------------------------------------------------------*/
\r
196 /* Variables that are incremented on each iteration of the reg test tasks -
\r
197 provided the tasks have not reported any errors. The check task inspects these
\r
198 variables to ensure they are still incrementing as expected. If a variable
\r
199 stops incrementing then it is likely that its associate task has stalled. */
\r
200 volatile unsigned short usRegTest1Counter = 0, usRegTest2Counter = 0;
\r
202 /* The handle of the queue used to send messages from tasks and interrupts to
\r
204 static QueueHandle_t xLCDQueue = NULL;
\r
206 /* The definition of each message sent from tasks and interrupts to the LCD
\r
210 char cMessageID; /* << States what the message is. */
\r
211 unsigned long ulMessageValue; /* << States the message value (can be an integer, string pointer, etc. depending on the value of cMessageID). */
\r
214 /*-----------------------------------------------------------*/
\r
216 /* The linker script can be used to test the FreeRTOS ports use of 20bit
\r
217 addresses by locating all code in high memory. The following pragma ensures
\r
218 that main remains in low memory when that is done. The ISR_CODE segment is used
\r
219 for convenience as ISR functions are always placed in low memory. */
\r
220 #pragma location="ISR_CODE"
\r
223 /* Configure the peripherals used by this demo application. This includes
\r
224 configuring the joystick input select button to generate interrupts. */
\r
225 prvSetupHardware();
\r
227 /* Create the queue used by tasks and interrupts to send strings to the LCD
\r
229 xLCDQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( xQueueMessage ) );
\r
231 /* If the queue could not be created then don't create any tasks that might
\r
232 attempt to use the queue. */
\r
233 if( xLCDQueue != NULL )
\r
235 /* Add the created queue to the queue registry so it can be viewed in
\r
236 the IAR FreeRTOS state viewer plug-in. */
\r
237 vQueueAddToRegistry( xLCDQueue, "LCDQueue" );
\r
239 /* Create the standard demo tasks. */
\r
240 vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
\r
241 vStartDynamicPriorityTasks();
\r
242 vStartGenericQueueTasks( mainGENERIC_QUEUE_TEST_PRIORITY );
\r
244 /* Create the LCD, button poll and register test tasks, as described at
\r
245 the top of this file. */
\r
246 xTaskCreate( prvLCDTask, "LCD", configMINIMAL_STACK_SIZE * 2, mainTASK_PARAMETER_CHECK_VALUE, mainLCD_TASK_PRIORITY, NULL );
\r
247 xTaskCreate( prvButtonPollTask, "BPoll", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
\r
248 xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, NULL, 0, NULL );
\r
249 xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, NULL, 0, NULL );
\r
251 /* Start the scheduler. */
\r
252 vTaskStartScheduler();
\r
255 /* If all is well then this line will never be reached. If it is reached
\r
256 then it is likely that there was insufficient (FreeRTOS) heap memory space
\r
257 to create the idle task. This may have been trapped by the malloc() failed
\r
258 hook function, if one is configured. */
\r
261 /*-----------------------------------------------------------*/
\r
263 static void prvLCDTask( void *pvParameters )
\r
265 xQueueMessage xReceivedMessage;
\r
267 /* Buffer into which strings are formatted and placed ready for display on the
\r
268 LCD. Note this is a static variable to prevent it being allocated on the task
\r
269 stack, which is too small to hold such a variable. The stack size is configured
\r
270 when the task is created. */
\r
271 static char cBuffer[ 512 ];
\r
272 unsigned char ucLine = 1;
\r
275 /* This function is the only function that uses printf(). If printf() is
\r
276 used from any other function then some sort of mutual exclusion on stdout
\r
279 This is also the only function that is permitted to access the LCD.
\r
281 First print out the number of bytes that remain in the FreeRTOS heap. This
\r
282 can be viewed in the terminal IO window within the IAR Embedded Workbench. */
\r
283 printf( "%d bytes of heap space remain unallocated\n", ( int ) xPortGetFreeHeapSize() );
\r
285 /* Just as a test of the port, and for no functional reason, check the task
\r
286 parameter contains its expected value. */
\r
287 if( pvParameters != mainTASK_PARAMETER_CHECK_VALUE )
\r
289 halLcdPrintLine( "Invalid parameter", ucLine, OVERWRITE_TEXT );
\r
295 /* Wait for a message to be received. Using portMAX_DELAY as the block
\r
296 time will result in an indefinite wait provided INCLUDE_vTaskSuspend is
\r
297 set to 1 in FreeRTOSConfig.h, therefore there is no need to check the
\r
298 function return value and the function will only return when a value
\r
299 has been received. */
\r
300 xQueueReceive( xLCDQueue, &xReceivedMessage, portMAX_DELAY );
\r
302 /* Clear the LCD if no room remains for any more text output. */
\r
303 if( ucLine > mainMAX_LCD_LINES )
\r
305 halLcdClearScreen();
\r
309 /* What is this message? What does it contain? */
\r
310 switch( xReceivedMessage.cMessageID )
\r
312 case mainMESSAGE_BUTTON_UP : /* The button poll task has just
\r
313 informed this task that the up
\r
314 button on the joystick input has
\r
315 been pressed or released. */
\r
316 sprintf( cBuffer, "Button up = %d", ( int ) xReceivedMessage.ulMessageValue );
\r
319 case mainMESSAGE_BUTTON_SEL : /* The select button interrupt
\r
320 just informed this task that the
\r
321 select button was pressed.
\r
322 Generate a table of task run time
\r
323 statistics and output this to
\r
324 the terminal IO window in the IAR
\r
325 embedded workbench. */
\r
326 printf( "\nTask\t Abs Time\t %%Time\n*****************************************" );
\r
327 vTaskGetRunTimeStats( cBuffer );
\r
330 /* Also print out a message to
\r
331 the LCD - in this case the
\r
332 pointer to the string to print
\r
333 is sent directly in the
\r
334 ulMessageValue member of the
\r
335 message. This just demonstrates
\r
336 a different communication
\r
338 sprintf( cBuffer, "%s", ( char * ) xReceivedMessage.ulMessageValue );
\r
341 case mainMESSAGE_STATUS : /* The tick interrupt hook
\r
342 function has just informed this
\r
343 task of the system status.
\r
344 Generate a string in accordance
\r
345 with the status value. */
\r
346 prvGenerateStatusMessage( cBuffer, xReceivedMessage.ulMessageValue );
\r
349 default : sprintf( cBuffer, "Unknown message" );
\r
353 /* Output the message that was placed into the cBuffer array within the
\r
354 switch statement above, then move onto the next line ready for the next
\r
355 message to arrive on the queue. */
\r
356 halLcdPrintLine( cBuffer, ucLine, OVERWRITE_TEXT );
\r
360 /*-----------------------------------------------------------*/
\r
362 static void prvGenerateStatusMessage( char *pcBuffer, long lStatusValue )
\r
364 /* Just a utility function to convert a status value into a meaningful
\r
365 string for output onto the LCD. */
\r
366 switch( lStatusValue )
\r
368 case pdPASS : sprintf( pcBuffer, "Status = PASS" );
\r
370 case mainERROR_DYNAMIC_TASKS : sprintf( pcBuffer, "Err: Dynamic tsks" );
\r
372 case mainERROR_COM_TEST : sprintf( pcBuffer, "Err: COM test" );
\r
374 case mainERROR_GEN_QUEUE_TEST : sprintf( pcBuffer, "Error: Gen Q test" );
\r
376 case mainERROR_REG_TEST : sprintf( pcBuffer, "Error: Reg test" );
\r
378 default : sprintf( pcBuffer, "Unknown status" );
\r
382 /*-----------------------------------------------------------*/
\r
384 static void prvButtonPollTask( void *pvParameters )
\r
386 unsigned char ucLastState = pdFALSE, ucState;
\r
387 xQueueMessage xMessage;
\r
389 /* This tasks performs the button polling functionality as described at the
\r
390 top of this file. */
\r
393 /* Check the button state. */
\r
394 ucState = ( halButtonsPressed() & BUTTON_UP );
\r
398 /* The button was pressed. */
\r
402 if( ucState != ucLastState )
\r
404 /* The state has changed, send a message to the LCD task. */
\r
405 xMessage.cMessageID = mainMESSAGE_BUTTON_UP;
\r
406 xMessage.ulMessageValue = ( unsigned long ) ucState;
\r
407 ucLastState = ucState;
\r
408 xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY );
\r
411 /* Block for 10 milliseconds so this task does not utilise all the CPU
\r
412 time and debouncing of the button is not necessary. */
\r
413 vTaskDelay( 10 / portTICK_PERIOD_MS );
\r
416 /*-----------------------------------------------------------*/
\r
418 static void prvSetupHardware( void )
\r
422 LFXT_Start( XT1DRIVE_0 );
\r
423 hal430SetSystemClock( configCPU_CLOCK_HZ, configLFXT_CLOCK_HZ );
\r
425 halButtonsInit( BUTTON_ALL );
\r
426 halButtonsInterruptEnable( BUTTON_SELECT );
\r
428 /* Initialise the LCD, but note that the backlight is not used as the
\r
429 library function uses timer A0 to modulate the backlight, and this file
\r
430 defines vApplicationSetupTimerInterrupt() to also use timer A0 to generate
\r
431 the tick interrupt. If the backlight is required, then change either the
\r
432 halLCD library or vApplicationSetupTimerInterrupt() to use a different
\r
433 timer. Timer A1 is used for the run time stats time base6. */
\r
435 halLcdSetContrast( 100 );
\r
436 halLcdClearScreen();
\r
438 halLcdPrintLine( " www.FreeRTOS.org", 0, OVERWRITE_TEXT );
\r
440 /*-----------------------------------------------------------*/
\r
442 void vApplicationTickHook( void )
\r
444 static unsigned short usLastRegTest1Counter = 0, usLastRegTest2Counter = 0;
\r
445 static unsigned long ulCounter = 0;
\r
446 static const unsigned long ulCheckFrequency = 5000UL / portTICK_PERIOD_MS;
\r
447 portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
\r
449 /* Define the status message that is sent to the LCD task. By default the
\r
451 static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS };
\r
453 /* This is called from within the tick interrupt and performs the 'check'
\r
454 functionality as described in the comments at the top of this file.
\r
456 Is it time to perform the 'check' functionality again? */
\r
458 if( ulCounter >= ulCheckFrequency )
\r
460 /* See if the standard demo tasks are executing as expected, changing
\r
461 the message that is sent to the LCD task from PASS to an error code if
\r
462 any tasks set reports an error. */
\r
463 if( xAreComTestTasksStillRunning() != pdPASS )
\r
465 xStatusMessage.ulMessageValue = mainERROR_COM_TEST;
\r
468 if( xAreDynamicPriorityTasksStillRunning() != pdPASS )
\r
470 xStatusMessage.ulMessageValue = mainERROR_DYNAMIC_TASKS;
\r
473 if( xAreGenericQueueTasksStillRunning() != pdPASS )
\r
475 xStatusMessage.ulMessageValue = mainERROR_GEN_QUEUE_TEST;
\r
478 /* Check the reg test tasks are still cycling. They will stop
\r
479 incrementing their loop counters if they encounter an error. */
\r
480 if( usRegTest1Counter == usLastRegTest1Counter )
\r
482 xStatusMessage.ulMessageValue = mainERROR_REG_TEST;
\r
485 if( usRegTest2Counter == usLastRegTest2Counter )
\r
487 xStatusMessage.ulMessageValue = mainERROR_REG_TEST;
\r
490 usLastRegTest1Counter = usRegTest1Counter;
\r
491 usLastRegTest2Counter = usRegTest2Counter;
\r
493 /* As this is the tick hook the lHigherPriorityTaskWoken parameter is not
\r
494 needed (a context switch is going to be performed anyway), but it must
\r
495 still be provided. */
\r
496 xQueueSendFromISR( xLCDQueue, &xStatusMessage, &xHigherPriorityTaskWoken );
\r
500 /* Just periodically toggle an LED to show that the tick interrupt is
\r
501 running. Note that this access LED_PORT_OUT in a non-atomic way, so tasks
\r
502 that access the same port must do so from a critical section. */
\r
503 if( ( ulCounter & 0xff ) == 0 )
\r
505 if( ( LED_PORT_OUT & LED_1 ) == 0 )
\r
507 LED_PORT_OUT |= LED_1;
\r
511 LED_PORT_OUT &= ~LED_1;
\r
515 /*-----------------------------------------------------------*/
\r
517 #pragma vector=PORT2_VECTOR
\r
518 __interrupt static void prvSelectButtonInterrupt(void)
\r
520 /* Define the message sent to the LCD task from this interrupt. */
\r
521 static const xQueueMessage xMessage = { mainMESSAGE_BUTTON_SEL, ( unsigned long ) "Select Interrupt" };
\r
522 portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
\r
524 /* This is the interrupt handler for the joystick select button input.
\r
525 The button has been pushed, write a message to the LCD via the LCD task. */
\r
526 xQueueSendFromISR( xLCDQueue, &xMessage, &xHigherPriorityTaskWoken );
\r
530 /* If writing to xLCDQueue caused a task to unblock, and the unblocked task
\r
531 has a priority equal to or above the task that this interrupt interrupted,
\r
532 then lHigherPriorityTaskWoken will have been set to pdTRUE internally within
\r
533 xQueuesendFromISR(), and portEND_SWITCHING_ISR() will ensure that this
\r
534 interrupt returns directly to the higher priority unblocked task. */
\r
535 portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
\r
537 /*-----------------------------------------------------------*/
\r
539 /* The MSP430X port uses this callback function to configure its tick interrupt.
\r
540 This allows the application to choose the tick interrupt source.
\r
541 configTICK_VECTOR must also be set in FreeRTOSConfig.h to the correct
\r
542 interrupt vector for the chosen tick interrupt source. This implementation of
\r
543 vApplicationSetupTimerInterrupt() generates the tick from timer A0, so in this
\r
544 case configTICK_VECTOR is set to TIMER0_A0_VECTOR. */
\r
545 void vApplicationSetupTimerInterrupt( void )
\r
547 const unsigned short usACLK_Frequency_Hz = 32768;
\r
549 /* Ensure the timer is stopped. */
\r
552 /* Run the timer from the ACLK. */
\r
555 /* Clear everything to start with. */
\r
558 /* Set the compare match value according to the tick rate we want. */
\r
559 TA0CCR0 = usACLK_Frequency_Hz / configTICK_RATE_HZ;
\r
561 /* Enable the interrupts. */
\r
564 /* Start up clean. */
\r
570 /*-----------------------------------------------------------*/
\r
572 void vApplicationIdleHook( void )
\r
574 /* Called on each iteration of the idle task. In this case the idle task
\r
575 just enters a low power mode. */
\r
576 __bis_SR_register( LPM3_bits + GIE );
\r
578 /*-----------------------------------------------------------*/
\r
580 void vApplicationMallocFailedHook( void )
\r
582 /* Called if a call to pvPortMalloc() fails because there is insufficient
\r
583 free memory available in the FreeRTOS heap. pvPortMalloc() is called
\r
584 internally by FreeRTOS API functions that create tasks, queues or
\r
586 taskDISABLE_INTERRUPTS();
\r
589 /*-----------------------------------------------------------*/
\r
591 void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
\r
594 ( void ) pcTaskName;
\r
596 /* Run time stack overflow checking is performed if
\r
597 configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
\r
598 function is called if a stack overflow is detected. */
\r
599 taskDISABLE_INTERRUPTS();
\r
602 /*-----------------------------------------------------------*/
\r