Skip to content

Commit 11a37a5

Browse files
remove(freertos-smp): Remove support for light-weight critical sections
1 parent a97b076 commit 11a37a5

File tree

3 files changed

+4
-184
lines changed

3 files changed

+4
-184
lines changed

include/FreeRTOS.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2958,10 +2958,6 @@
29582958
#error configUSE_PORT_OPTIMISED_TASK_SELECTION is not supported in SMP FreeRTOS
29592959
#endif
29602960

2961-
#ifndef configLIGHTWEIGHT_CRITICAL_SECTION
2962-
#define configLIGHTWEIGHT_CRITICAL_SECTION 0
2963-
#endif
2964-
29652961
#ifndef configINITIAL_TICK_COUNT
29662962
#define configINITIAL_TICK_COUNT 0
29672963
#endif

include/task.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3914,22 +3914,6 @@ void vTaskInternalSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNC
39143914
void vTaskExitCriticalFromISR( UBaseType_t uxSavedInterruptStatus );
39153915
#endif
39163916

3917-
/*
3918-
* This function is only intended for use when disabling or enabling preemption of a task.
3919-
* This function takes only the kernel ISR lock, not the task lock.
3920-
*/
3921-
#if ( configLIGHTWEIGHT_CRITICAL_SECTION == 1 )
3922-
void vKernelLightWeightEnterCritical( void );
3923-
#endif
3924-
3925-
/*
3926-
* This function is only intended for use when disabling or enabling preemption of a task.
3927-
* This function releases only the kernel ISR lock, not the task lock.
3928-
*/
3929-
#if ( configLIGHTWEIGHT_CRITICAL_SECTION == 1 )
3930-
void vKernelLightWeightExitCritical( void );
3931-
#endif
3932-
39333917
#if ( portUSING_MPU_WRAPPERS == 1 )
39343918

39353919
/*

tasks.c

Lines changed: 4 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -629,15 +629,6 @@ static BaseType_t prvCreateIdleTasks( void );
629629
static void prvCheckForRunStateChange( void );
630630
#endif /* #if ( configNUMBER_OF_CORES > 1 ) */
631631

632-
#if ( configLIGHTWEIGHT_CRITICAL_SECTION == 1 )
633-
634-
/*
635-
* Checks to see if another task moved the current task out of the ready
636-
* list while it was waiting to enter a lightweight critical section and yields, if so.
637-
*/
638-
static void prvLightWeightCheckForRunStateChange( void );
639-
#endif /* #if ( configLIGHTWEIGHT_CRITICAL_SECTION == 1 ) */
640-
641632
#if ( configNUMBER_OF_CORES > 1 )
642633

643634
/*
@@ -976,67 +967,6 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
976967

977968
/*-----------------------------------------------------------*/
978969

979-
#if ( configLIGHTWEIGHT_CRITICAL_SECTION == 1 )
980-
static void prvLightWeightCheckForRunStateChange( void )
981-
{
982-
const TCB_t * pxThisTCB;
983-
BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID();
984-
985-
/* This must only be called from within a task. */
986-
portASSERT_IF_IN_ISR();
987-
988-
/* This function is always called with interrupts disabled
989-
* so this is safe. */
990-
pxThisTCB = pxCurrentTCBs[ xCoreID ];
991-
992-
while( pxThisTCB->xTaskRunState == taskTASK_SCHEDULED_TO_YIELD )
993-
{
994-
UBaseType_t uxPrevCriticalNesting;
995-
996-
/* We are only here if we just entered a critical section
997-
* or if we just suspended the scheduler, and another task
998-
* has requested that we yield.
999-
*
1000-
* This is slightly complicated since we need to save and restore
1001-
* the suspension and critical nesting counts, as well as release
1002-
* and reacquire the correct locks. And then, do it all over again
1003-
* if our state changed again during the reacquisition. */
1004-
uxPrevCriticalNesting = portGET_CRITICAL_NESTING_COUNT( xCoreID );
1005-
1006-
if( uxPrevCriticalNesting > 0U )
1007-
{
1008-
portSET_CRITICAL_NESTING_COUNT( xCoreID, 0U );
1009-
kernelRELEASE_ISR_LOCK( xCoreID );
1010-
}
1011-
else
1012-
{
1013-
/* The scheduler is suspended. uxSchedulerSuspended is updated
1014-
* only when the task is not requested to yield. */
1015-
mtCOVERAGE_TEST_MARKER();
1016-
}
1017-
1018-
portMEMORY_BARRIER();
1019-
1020-
portENABLE_INTERRUPTS();
1021-
1022-
/* Enabling interrupts should cause this core to immediately service
1023-
* the pending interrupt and yield. After servicing the pending interrupt,
1024-
* the task needs to re-evaluate its run state within this loop, as
1025-
* other cores may have requested this task to yield, potentially altering
1026-
* its run state. */
1027-
1028-
portDISABLE_INTERRUPTS();
1029-
1030-
xCoreID = ( BaseType_t ) portGET_CORE_ID();
1031-
kernelGET_ISR_LOCK( xCoreID );
1032-
1033-
portSET_CRITICAL_NESTING_COUNT( xCoreID, uxPrevCriticalNesting );
1034-
}
1035-
}
1036-
#endif /* #if ( configLIGHTWEIGHT_CRITICAL_SECTION == 1 ) */
1037-
1038-
/*-----------------------------------------------------------*/
1039-
1040970
#if ( configNUMBER_OF_CORES > 1 )
1041971
static void prvYieldForTask( const TCB_t * pxTCB )
1042972
{
@@ -3342,11 +3272,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
33423272

33433273
traceENTER_vTaskPreemptionDisable( xTask );
33443274

3345-
#if ( configLIGHTWEIGHT_CRITICAL_SECTION == 1 )
3346-
vKernelLightWeightEnterCritical();
3347-
#else
3348-
kernelENTER_CRITICAL();
3349-
#endif
3275+
kernelENTER_CRITICAL();
33503276
{
33513277
if( xSchedulerRunning != pdFALSE )
33523278
{
@@ -3360,11 +3286,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
33603286
mtCOVERAGE_TEST_MARKER();
33613287
}
33623288
}
3363-
#if ( configLIGHTWEIGHT_CRITICAL_SECTION == 1 )
3364-
vKernelLightWeightExitCritical();
3365-
#else
3366-
kernelEXIT_CRITICAL();
3367-
#endif
3289+
kernelEXIT_CRITICAL();
33683290

33693291
traceRETURN_vTaskPreemptionDisable();
33703292
}
@@ -3380,11 +3302,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
33803302
UBaseType_t uxDeferredAction = 0U;
33813303
BaseType_t xAlreadyYielded = pdFALSE;
33823304

3383-
#if ( configLIGHTWEIGHT_CRITICAL_SECTION == 1 )
3384-
vKernelLightWeightEnterCritical();
3385-
#else
3386-
kernelENTER_CRITICAL();
3387-
#endif
3305+
kernelENTER_CRITICAL();
33883306
{
33893307
if( xSchedulerRunning != pdFALSE )
33903308
{
@@ -3423,11 +3341,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
34233341
mtCOVERAGE_TEST_MARKER();
34243342
}
34253343
}
3426-
#if ( configLIGHTWEIGHT_CRITICAL_SECTION == 1 )
3427-
vKernelLightWeightExitCritical();
3428-
#else
3429-
kernelEXIT_CRITICAL();
3430-
#endif
3344+
kernelEXIT_CRITICAL();
34313345

34323346
if( uxDeferredAction != 0U )
34333347
{
@@ -7848,80 +7762,6 @@ static void prvResetNextTaskUnblockTime( void )
78487762
#endif /* #if ( configNUMBER_OF_CORES > 1 ) */
78497763
/*-----------------------------------------------------------*/
78507764

7851-
#if ( configLIGHTWEIGHT_CRITICAL_SECTION == 1 )
7852-
7853-
void vKernelLightWeightEnterCritical( void )
7854-
{
7855-
if( xSchedulerRunning != pdFALSE )
7856-
{
7857-
portDISABLE_INTERRUPTS();
7858-
{
7859-
const BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID();
7860-
7861-
/* Get only the ISR lock, not the task lock */
7862-
kernelGET_ISR_LOCK( xCoreID );
7863-
7864-
portINCREMENT_CRITICAL_NESTING_COUNT( xCoreID );
7865-
7866-
if( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 1U )
7867-
{
7868-
prvLightWeightCheckForRunStateChange();
7869-
}
7870-
}
7871-
}
7872-
}
7873-
7874-
#endif /* #if ( configLIGHTWEIGHT_CRITICAL_SECTION == 1 ) */
7875-
/*-----------------------------------------------------------*/
7876-
7877-
#if ( configLIGHTWEIGHT_CRITICAL_SECTION == 1 )
7878-
7879-
void vKernelLightWeightExitCritical( void )
7880-
{
7881-
if( xSchedulerRunning != pdFALSE )
7882-
{
7883-
const BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID();
7884-
7885-
if( portGET_CRITICAL_NESTING_COUNT( xCoreID ) > 0U )
7886-
{
7887-
BaseType_t xYieldCurrentTask;
7888-
7889-
if( ( xYieldPendings[ xCoreID ] == pdTRUE ) && ( uxSchedulerSuspended == pdFALSE )
7890-
#if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
7891-
&& ( pxCurrentTCBs[ xCoreID ]->uxPreemptionDisable == 0U ) &&
7892-
( pxCurrentTCBs[ xCoreID ]->uxDeferredStateChange == 0U )
7893-
#endif /* ( configUSE_TASK_PREEMPTION_DISABLE == 1 ) */
7894-
)
7895-
{
7896-
xYieldCurrentTask = pdTRUE;
7897-
}
7898-
else
7899-
{
7900-
xYieldCurrentTask = pdFALSE;
7901-
}
7902-
7903-
/* Release the ISR lock */
7904-
kernelRELEASE_ISR_LOCK( xCoreID );
7905-
7906-
portDECREMENT_CRITICAL_NESTING_COUNT( xCoreID );
7907-
7908-
/* If the critical nesting count is 0, enable interrupts */
7909-
if( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 0U )
7910-
{
7911-
portENABLE_INTERRUPTS();
7912-
7913-
if( xYieldCurrentTask != pdFALSE )
7914-
{
7915-
portYIELD();
7916-
}
7917-
}
7918-
}
7919-
}
7920-
}
7921-
7922-
#endif /* #if ( configLIGHTWEIGHT_CRITICAL_SECTION == 1 ) */
7923-
/*-----------------------------------------------------------*/
7924-
79257765
#if ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 )
79267766

79277767
static char * prvWriteNameToBuffer( char * pcBuffer,

0 commit comments

Comments
 (0)