Skip to content

Commit 4c4089b

Browse files
authored
Remove tickless idle mode dependency with include v task suspend (#422)
* Fix Remove tickless idle feature dependency with INCLUDE_vTaskSuspend * fix unused variable warning * Fix CI fomatting check Signed-off-by: Gaurav Aggarwal <[email protected]> Authored-by: pramithkv <[email protected]>
1 parent 052e364 commit 4c4089b

File tree

3 files changed

+21
-22
lines changed

3 files changed

+21
-22
lines changed

include/FreeRTOS.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -924,12 +924,6 @@
924924
#endif
925925

926926
/* Sanity check the configuration. */
927-
#if ( configUSE_TICKLESS_IDLE != 0 )
928-
#if ( INCLUDE_vTaskSuspend != 1 )
929-
#error INCLUDE_vTaskSuspend must be set to 1 if configUSE_TICKLESS_IDLE is not set to 0
930-
#endif /* INCLUDE_vTaskSuspend */
931-
#endif /* configUSE_TICKLESS_IDLE */
932-
933927
#if ( ( configSUPPORT_STATIC_ALLOCATION == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) )
934928
#error configSUPPORT_STATIC_ALLOCATION and configSUPPORT_DYNAMIC_ALLOCATION cannot both be 0, but can both be 1.
935929
#endif

include/task.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,11 @@ typedef struct xTASK_STATUS
167167
/* Possible return values for eTaskConfirmSleepModeStatus(). */
168168
typedef enum
169169
{
170-
eAbortSleep = 0, /* A task has been made ready or a context switch pended since portSUPPRESS_TICKS_AND_SLEEP() was called - abort entering a sleep mode. */
171-
eStandardSleep, /* Enter a sleep mode that will not last any longer than the expected idle time. */
172-
eNoTasksWaitingTimeout /* No tasks are waiting for a timeout so it is safe to enter a sleep mode that can only be exited by an external interrupt. */
170+
eAbortSleep = 0, /* A task has been made ready or a context switch pended since portSUPPRESS_TICKS_AND_SLEEP() was called - abort entering a sleep mode. */
171+
eStandardSleep, /* Enter a sleep mode that will not last any longer than the expected idle time. */
172+
#if ( INCLUDE_vTaskSuspend == 1 )
173+
eNoTasksWaitingTimeout /* No tasks are waiting for a timeout so it is safe to enter a sleep mode that can only be exited by an external interrupt. */
174+
#endif /* INCLUDE_vTaskSuspend */
173175
} eSleepModeStatus;
174176

175177
/**

tasks.c

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3529,8 +3529,11 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
35293529

35303530
eSleepModeStatus eTaskConfirmSleepModeStatus( void )
35313531
{
3532-
/* The idle task exists in addition to the application tasks. */
3533-
const UBaseType_t uxNonApplicationTasks = 1;
3532+
#if ( INCLUDE_vTaskSuspend == 1 )
3533+
/* The idle task exists in addition to the application tasks. */
3534+
const UBaseType_t uxNonApplicationTasks = 1;
3535+
#endif /* INCLUDE_vTaskSuspend */
3536+
35343537
eSleepModeStatus eReturn = eStandardSleep;
35353538

35363539
/* This function must be called from a critical section. */
@@ -3551,20 +3554,20 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
35513554
* because the scheduler is suspended. */
35523555
eReturn = eAbortSleep;
35533556
}
3554-
else
3555-
{
3556-
/* If all the tasks are in the suspended list (which might mean they
3557-
* have an infinite block time rather than actually being suspended)
3558-
* then it is safe to turn all clocks off and just wait for external
3559-
* interrupts. */
3560-
if( listCURRENT_LIST_LENGTH( &xSuspendedTaskList ) == ( uxCurrentNumberOfTasks - uxNonApplicationTasks ) )
3557+
3558+
#if ( INCLUDE_vTaskSuspend == 1 )
3559+
else if( listCURRENT_LIST_LENGTH( &xSuspendedTaskList ) == ( uxCurrentNumberOfTasks - uxNonApplicationTasks ) )
35613560
{
3561+
/* If all the tasks are in the suspended list (which might mean they
3562+
* have an infinite block time rather than actually being suspended)
3563+
* then it is safe to turn all clocks off and just wait for external
3564+
* interrupts. */
35623565
eReturn = eNoTasksWaitingTimeout;
35633566
}
3564-
else
3565-
{
3566-
mtCOVERAGE_TEST_MARKER();
3567-
}
3567+
#endif /* INCLUDE_vTaskSuspend */
3568+
else
3569+
{
3570+
mtCOVERAGE_TEST_MARKER();
35683571
}
35693572

35703573
return eReturn;

0 commit comments

Comments
 (0)