Skip to content

Commit d442d79

Browse files
chinglee-iotSkptakkar-rahul-aws
authored
Add configCONTROL_INFINITE_LOOP for loop control in unit test (#783)
* Add configCONTROL_INFINITE_LOOP in FreeRTOS.h * Use configCONTROL_INFINITE_LOOP in tasks.c and timer.c --------- Co-authored-by: Soren Ptak <[email protected]> Co-authored-by: kar-rahul-aws <[email protected]>
1 parent 97d48ba commit d442d79

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

include/FreeRTOS.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2872,6 +2872,12 @@
28722872
#define configRUN_ADDITIONAL_TESTS 0
28732873
#endif
28742874

2875+
/* The following config allows infinite loop control. For example, control the
2876+
* infinite loop in idle task function when performing unit tests. */
2877+
#ifndef configCONTROL_INFINITE_LOOP
2878+
#define configCONTROL_INFINITE_LOOP()
2879+
#endif
2880+
28752881
/* Sometimes the FreeRTOSConfig.h settings only allow a task to be created using
28762882
* dynamically allocated RAM, in which case when any task is deleted it is known
28772883
* that both the task's stack and TCB need to be freed. Sometimes the

tasks.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -317,12 +317,6 @@
317317
#define portDECREMENT_CRITICAL_NESTING_COUNT() ( pxCurrentTCBs[ portGET_CORE_ID() ]->uxCriticalNesting-- )
318318
#endif /* #if ( ( configNUMBER_OF_CORES > 1 ) && ( portCRITICAL_NESTING_IN_TCB == 1 ) ) */
319319

320-
/* Code below here allows infinite loop controlling, especially for the infinite loop
321-
* in idle task function (for example when performing unit tests). */
322-
#ifndef INFINITE_LOOP
323-
#define INFINITE_LOOP() 1
324-
#endif
325-
326320
#define taskBITS_PER_BYTE ( ( size_t ) 8 )
327321

328322
#if ( configNUMBER_OF_CORES > 1 )
@@ -5374,7 +5368,7 @@ void vTaskMissedYield( void )
53745368

53755369
taskYIELD();
53765370

5377-
for( ; INFINITE_LOOP(); )
5371+
for( ; configCONTROL_INFINITE_LOOP(); )
53785372
{
53795373
#if ( configUSE_PREEMPTION == 0 )
53805374
{
@@ -5459,7 +5453,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
54595453
}
54605454
#endif /* #if ( configNUMBER_OF_CORES > 1 ) */
54615455

5462-
for( ; INFINITE_LOOP(); )
5456+
for( ; configCONTROL_INFINITE_LOOP(); )
54635457
{
54645458
/* See if any tasks have deleted themselves - if so then the idle task
54655459
* is responsible for freeing the deleted task's TCB and stack. */

timers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@
709709
}
710710
#endif /* configUSE_DAEMON_TASK_STARTUP_HOOK */
711711

712-
for( ; ; )
712+
for( ; configCONTROL_INFINITE_LOOP(); )
713713
{
714714
/* Query the timers list to see if it contains any timers, and if so,
715715
* obtain the time at which the next timer will expire. */

0 commit comments

Comments
 (0)