Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use INFINITE_LOOP macro for loop control in unit test #783

Merged
merged 13 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions include/FreeRTOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -2872,6 +2872,12 @@
#define configRUN_ADDITIONAL_TESTS 0
#endif

/* The following config allows infinite loop control. For example, control the
* infinite loop in idle task function when performing unit tests. */
#ifndef configCONTROL_INFINITE_LOOP
#define configCONTROL_INFINITE_LOOP()
#endif

/* Sometimes the FreeRTOSConfig.h settings only allow a task to be created using
* dynamically allocated RAM, in which case when any task is deleted it is known
* that both the task's stack and TCB need to be freed. Sometimes the
Expand Down
10 changes: 2 additions & 8 deletions tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,6 @@
#define portDECREMENT_CRITICAL_NESTING_COUNT() ( pxCurrentTCBs[ portGET_CORE_ID() ]->uxCriticalNesting-- )
#endif /* #if ( ( configNUMBER_OF_CORES > 1 ) && ( portCRITICAL_NESTING_IN_TCB == 1 ) ) */

/* Code below here allows infinite loop controlling, especially for the infinite loop
* in idle task function (for example when performing unit tests). */
#ifndef INFINITE_LOOP
#define INFINITE_LOOP() 1
#endif

#define taskBITS_PER_BYTE ( ( size_t ) 8 )

#if ( configNUMBER_OF_CORES > 1 )
Expand Down Expand Up @@ -5374,7 +5368,7 @@ void vTaskMissedYield( void )

taskYIELD();

for( ; INFINITE_LOOP(); )
for( ; configCONTROL_INFINITE_LOOP(); )
{
#if ( configUSE_PREEMPTION == 0 )
{
Expand Down Expand Up @@ -5459,7 +5453,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
}
#endif /* #if ( configNUMBER_OF_CORES > 1 ) */

for( ; INFINITE_LOOP(); )
for( ; configCONTROL_INFINITE_LOOP(); )
{
/* See if any tasks have deleted themselves - if so then the idle task
* is responsible for freeing the deleted task's TCB and stack. */
Expand Down
2 changes: 1 addition & 1 deletion timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@
}
#endif /* configUSE_DAEMON_TASK_STARTUP_HOOK */

for( ; ; )
for( ; configCONTROL_INFINITE_LOOP(); )
{
/* Query the timers list to see if it contains any timers, and if so,
* obtain the time at which the next timer will expire. */
Expand Down
Loading