Skip to content

Commit

Permalink
Add configCONTROL_INFINITE_LOOP in FreeRTOS.h
Browse files Browse the repository at this point in the history
  • Loading branch information
chinglee-iot committed Oct 5, 2023
1 parent 3efa03a commit 024fc35
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 25 deletions.
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
14 changes: 4 additions & 10 deletions queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@
* correct privileged Vs unprivileged linkage and placement. */
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750 !e9021. */

/* 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()
#endif

/* Constants used with the cRxLock and cTxLock structure members. */
#define queueUNLOCKED ( ( int8_t ) -1 )
#define queueLOCKED_UNMODIFIED ( ( int8_t ) 0 )
Expand Down Expand Up @@ -961,7 +955,7 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue,
/*lint -save -e904 This function relaxes the coding standard somewhat to
* allow return statements within the function itself. This is done in the
* interest of execution time efficiency. */
for( ; INFINITE_LOOP(); )
for( ; configCONTROL_INFINITE_LOOP(); )
{
taskENTER_CRITICAL();
{
Expand Down Expand Up @@ -1525,7 +1519,7 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue,
/*lint -save -e904 This function relaxes the coding standard somewhat to
* allow return statements within the function itself. This is done in the
* interest of execution time efficiency. */
for( ; INFINITE_LOOP(); )
for( ; configCONTROL_INFINITE_LOOP(); )
{
taskENTER_CRITICAL();
{
Expand Down Expand Up @@ -1681,7 +1675,7 @@ BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue,
/*lint -save -e904 This function relaxes the coding standard somewhat to allow return
* statements within the function itself. This is done in the interest
* of execution time efficiency. */
for( ; INFINITE_LOOP(); )
for( ; configCONTROL_INFINITE_LOOP(); )

Check warning on line 1678 in queue.c

View check run for this annotation

Codecov / codecov/patch

queue.c#L1678

Added line #L1678 was not covered by tests
{
taskENTER_CRITICAL();
{
Expand Down Expand Up @@ -1899,7 +1893,7 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue,
/*lint -save -e904 This function relaxes the coding standard somewhat to
* allow return statements within the function itself. This is done in the
* interest of execution time efficiency. */
for( ; INFINITE_LOOP(); )
for( ; configCONTROL_INFINITE_LOOP(); )
{
taskENTER_CRITICAL();
{
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()
#endif

#define taskBITS_PER_BYTE ( ( size_t ) 8 )

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

taskYIELD();

for( ; INFINITE_LOOP(); )
for( ; configCONTROL_INFINITE_LOOP(); )
{
#if ( configUSE_PREEMPTION == 0 )
{
Expand Down Expand Up @@ -5444,7 +5438,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
8 changes: 1 addition & 7 deletions timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@
* correct privileged Vs unprivileged linkage and placement. */
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e9021 !e961 !e750. */

/* 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()
#endif

/* This entire source file will be skipped if the application is not configured
* to include software timer functionality. This #if is closed at the very bottom
* of this file. If you want to include software timer functionality then ensure
Expand Down Expand Up @@ -714,7 +708,7 @@
}
#endif /* configUSE_DAEMON_TASK_STARTUP_HOOK */

for( ; INFINITE_LOOP(); )
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

0 comments on commit 024fc35

Please sign in to comment.