Skip to content

Commit b6382df

Browse files
committed
Get core ID when interrupts are disabled
1 parent bc1c607 commit b6382df

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tasks.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
807807
{
808808
UBaseType_t uxPrevCriticalNesting;
809809
const TCB_t * pxThisTCB;
810-
const BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID();
810+
BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID();
811811

812812
/* This must only be called from within a task. */
813813
portASSERT_IF_IN_ISR();
@@ -855,6 +855,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
855855
portDISABLE_INTERRUPTS();
856856
portGET_TASK_LOCK();
857857
portGET_ISR_LOCK();
858+
xCoreID = ( BaseType_t ) portGET_CORE_ID();
858859

859860
portSET_CRITICAL_NESTING_COUNT( xCoreID, uxPrevCriticalNesting );
860861

@@ -3868,7 +3869,7 @@ void vTaskSuspendAll( void )
38683869
#else /* #if ( configNUMBER_OF_CORES == 1 ) */
38693870
{
38703871
UBaseType_t ulState;
3871-
const BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID();
3872+
BaseType_t xCoreID;
38723873

38733874
/* This must only be called from within a task. */
38743875
portASSERT_IF_IN_ISR();
@@ -3881,6 +3882,7 @@ void vTaskSuspendAll( void )
38813882
* It is safe to re-enable interrupts after releasing the ISR lock and incrementing
38823883
* uxSchedulerSuspended since that will prevent context switches. */
38833884
ulState = portSET_INTERRUPT_MASK();
3885+
xCoreID = ( BaseType_t ) portGET_CORE_ID();
38843886

38853887
/* This must never be called from inside a critical section. */
38863888
configASSERT( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 0 );
@@ -6996,12 +6998,12 @@ static void prvResetNextTaskUnblockTime( void )
69966998

69976999
void vTaskEnterCritical( void )
69987000
{
6999-
const BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID();
7000-
70017001
traceENTER_vTaskEnterCritical();
70027002

70037003
portDISABLE_INTERRUPTS();
70047004

7005+
const BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID();
7006+
70057007
if( xSchedulerRunning != pdFALSE )
70067008
{
70077009
if( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 0U )
@@ -7049,13 +7051,14 @@ static void prvResetNextTaskUnblockTime( void )
70497051
UBaseType_t vTaskEnterCriticalFromISR( void )
70507052
{
70517053
UBaseType_t uxSavedInterruptStatus = 0;
7052-
const BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID();
7054+
BaseType_t xCoreID;
70537055

70547056
traceENTER_vTaskEnterCriticalFromISR();
70557057

70567058
if( xSchedulerRunning != pdFALSE )
70577059
{
70587060
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
7061+
xCoreID = ( BaseType_t ) portGET_CORE_ID();
70597062

70607063
if( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 0U )
70617064
{

0 commit comments

Comments
 (0)