mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-09-08 15:17:50 -04:00
Get core ID when interrupts are disabled
This commit is contained in:
parent
bc1c6079d7
commit
b6382df843
1 changed files with 8 additions and 5 deletions
13
tasks.c
13
tasks.c
|
@ -807,7 +807,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
|
||||||
{
|
{
|
||||||
UBaseType_t uxPrevCriticalNesting;
|
UBaseType_t uxPrevCriticalNesting;
|
||||||
const TCB_t * pxThisTCB;
|
const TCB_t * pxThisTCB;
|
||||||
const BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID();
|
BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID();
|
||||||
|
|
||||||
/* This must only be called from within a task. */
|
/* This must only be called from within a task. */
|
||||||
portASSERT_IF_IN_ISR();
|
portASSERT_IF_IN_ISR();
|
||||||
|
@ -855,6 +855,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
|
||||||
portDISABLE_INTERRUPTS();
|
portDISABLE_INTERRUPTS();
|
||||||
portGET_TASK_LOCK();
|
portGET_TASK_LOCK();
|
||||||
portGET_ISR_LOCK();
|
portGET_ISR_LOCK();
|
||||||
|
xCoreID = ( BaseType_t ) portGET_CORE_ID();
|
||||||
|
|
||||||
portSET_CRITICAL_NESTING_COUNT( xCoreID, uxPrevCriticalNesting );
|
portSET_CRITICAL_NESTING_COUNT( xCoreID, uxPrevCriticalNesting );
|
||||||
|
|
||||||
|
@ -3868,7 +3869,7 @@ void vTaskSuspendAll( void )
|
||||||
#else /* #if ( configNUMBER_OF_CORES == 1 ) */
|
#else /* #if ( configNUMBER_OF_CORES == 1 ) */
|
||||||
{
|
{
|
||||||
UBaseType_t ulState;
|
UBaseType_t ulState;
|
||||||
const BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID();
|
BaseType_t xCoreID;
|
||||||
|
|
||||||
/* This must only be called from within a task. */
|
/* This must only be called from within a task. */
|
||||||
portASSERT_IF_IN_ISR();
|
portASSERT_IF_IN_ISR();
|
||||||
|
@ -3881,6 +3882,7 @@ void vTaskSuspendAll( void )
|
||||||
* It is safe to re-enable interrupts after releasing the ISR lock and incrementing
|
* It is safe to re-enable interrupts after releasing the ISR lock and incrementing
|
||||||
* uxSchedulerSuspended since that will prevent context switches. */
|
* uxSchedulerSuspended since that will prevent context switches. */
|
||||||
ulState = portSET_INTERRUPT_MASK();
|
ulState = portSET_INTERRUPT_MASK();
|
||||||
|
xCoreID = ( BaseType_t ) portGET_CORE_ID();
|
||||||
|
|
||||||
/* This must never be called from inside a critical section. */
|
/* This must never be called from inside a critical section. */
|
||||||
configASSERT( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 0 );
|
configASSERT( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 0 );
|
||||||
|
@ -6996,12 +6998,12 @@ static void prvResetNextTaskUnblockTime( void )
|
||||||
|
|
||||||
void vTaskEnterCritical( void )
|
void vTaskEnterCritical( void )
|
||||||
{
|
{
|
||||||
const BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID();
|
|
||||||
|
|
||||||
traceENTER_vTaskEnterCritical();
|
traceENTER_vTaskEnterCritical();
|
||||||
|
|
||||||
portDISABLE_INTERRUPTS();
|
portDISABLE_INTERRUPTS();
|
||||||
|
|
||||||
|
const BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID();
|
||||||
|
|
||||||
if( xSchedulerRunning != pdFALSE )
|
if( xSchedulerRunning != pdFALSE )
|
||||||
{
|
{
|
||||||
if( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 0U )
|
if( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 0U )
|
||||||
|
@ -7049,13 +7051,14 @@ static void prvResetNextTaskUnblockTime( void )
|
||||||
UBaseType_t vTaskEnterCriticalFromISR( void )
|
UBaseType_t vTaskEnterCriticalFromISR( void )
|
||||||
{
|
{
|
||||||
UBaseType_t uxSavedInterruptStatus = 0;
|
UBaseType_t uxSavedInterruptStatus = 0;
|
||||||
const BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID();
|
BaseType_t xCoreID;
|
||||||
|
|
||||||
traceENTER_vTaskEnterCriticalFromISR();
|
traceENTER_vTaskEnterCriticalFromISR();
|
||||||
|
|
||||||
if( xSchedulerRunning != pdFALSE )
|
if( xSchedulerRunning != pdFALSE )
|
||||||
{
|
{
|
||||||
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||||
|
xCoreID = ( BaseType_t ) portGET_CORE_ID();
|
||||||
|
|
||||||
if( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 0U )
|
if( portGET_CRITICAL_NESTING_COUNT( xCoreID ) == 0U )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue