Skip to content

Commit

Permalink
Code review suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
  • Loading branch information
aggarg committed Dec 30, 2024
1 parent f59c1da commit 730310e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
8 changes: 4 additions & 4 deletions portable/CCRH/F1Kx/portmacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@
extern void vPortRecursiveLockAcquire( BaseType_t xCoreID, BaseType_t xFromIsr );
extern void vPortRecursiveLockRelease( BaseType_t xCoreID, BaseType_t xFromIsr );

#define portGET_ISR_LOCK( xCoreID ) vPortRecursiveLockAcquire( xCoreID, pdTRUE )
#define portRELEASE_ISR_LOCK( xCoreID ) vPortRecursiveLockRelease( xCoreID, pdTRUE )
#define portGET_TASK_LOCK( xCoreID ) vPortRecursiveLockAcquire( xCoreID, pdFALSE )
#define portRELEASE_TASK_LOCK( xCoreID ) vPortRecursiveLockRelease( xCoreID, pdFALSE )
#define portGET_ISR_LOCK( xCoreID ) vPortRecursiveLockAcquire( ( xCoreID ), pdTRUE )
#define portRELEASE_ISR_LOCK( xCoreID ) vPortRecursiveLockRelease( ( xCoreID ), pdTRUE )
#define portGET_TASK_LOCK( xCoreID ) vPortRecursiveLockAcquire( ( xCoreID ), pdFALSE )
#define portRELEASE_TASK_LOCK( xCoreID ) vPortRecursiveLockRelease( ( xCoreID ), pdFALSE )
#endif /* if ( configNUMBER_OF_CORES == 1 ) */

/*-----------------------------------------------------------*/
Expand Down
8 changes: 4 additions & 4 deletions portable/ThirdParty/GCC/RP2040/include/portmacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,10 @@ static inline void vPortRecursiveLock( BaseType_t xCoreID,
#define portGET_TASK_LOCK( xCoreID )
#define portRELEASE_TASK_LOCK( xCoreID )
#else
#define portGET_ISR_LOCK( xCoreID ) vPortRecursiveLock( xCoreID, 0, spin_lock_instance( configSMP_SPINLOCK_0 ), pdTRUE )
#define portRELEASE_ISR_LOCK( xCoreID ) vPortRecursiveLock( xCoreID, 0, spin_lock_instance( configSMP_SPINLOCK_0 ), pdFALSE )
#define portGET_TASK_LOCK( xCoreID ) vPortRecursiveLock( xCoreID, 1, spin_lock_instance( configSMP_SPINLOCK_1 ), pdTRUE )
#define portRELEASE_TASK_LOCK( xCoreID ) vPortRecursiveLock( xCoreID, 1, spin_lock_instance( configSMP_SPINLOCK_1 ), pdFALSE )
#define portGET_ISR_LOCK( xCoreID ) vPortRecursiveLock( ( xCoreID ), 0, spin_lock_instance( configSMP_SPINLOCK_0 ), pdTRUE )
#define portRELEASE_ISR_LOCK( xCoreID ) vPortRecursiveLock( ( xCoreID ), 0, spin_lock_instance( configSMP_SPINLOCK_0 ), pdFALSE )
#define portGET_TASK_LOCK( xCoreID ) vPortRecursiveLock( ( xCoreID ), 1, spin_lock_instance( configSMP_SPINLOCK_1 ), pdTRUE )
#define portRELEASE_TASK_LOCK( xCoreID ) vPortRecursiveLock( ( xCoreID ), 1, spin_lock_instance( configSMP_SPINLOCK_1 ), pdFALSE )
#endif

/*-----------------------------------------------------------*/
Expand Down
8 changes: 4 additions & 4 deletions portable/ThirdParty/xClang/XCOREAI/portmacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@

#define portASSERT_IF_IN_ISR() configASSERT( portCHECK_IF_IN_ISR() == 0 )

#define portGET_ISR_LOCK( xCoreID ) do{ ( void )( xCoreID ); rtos_lock_acquire( 0 ) ); } while( 0 )
#define portRELEASE_ISR_LOCK( xCoreID ) do{ ( void )( xCoreID ); rtos_lock_release( 0 ) ); } while( 0 )
#define portGET_TASK_LOCK( xCoreID ) do{ ( void )( xCoreID ); rtos_lock_acquire( 1 ) ); } while( 0 )
#define portRELEASE_TASK_LOCK( xCoreID ) do{ ( void )( xCoreID ); rtos_lock_release( 1 ) ); } while( 0 )
#define portGET_ISR_LOCK( xCoreID ) do{ ( void )( xCoreID ); rtos_lock_acquire( 0 ); } while( 0 )
#define portRELEASE_ISR_LOCK( xCoreID ) do{ ( void )( xCoreID ); rtos_lock_release( 0 ); } while( 0 )
#define portGET_TASK_LOCK( xCoreID ) do{ ( void )( xCoreID ); rtos_lock_acquire( 1 ); } while( 0 )
#define portRELEASE_TASK_LOCK( xCoreID ) do{ ( void )( xCoreID ); rtos_lock_release( 1 ); } while( 0 )


void vTaskEnterCritical( void );
Expand Down
5 changes: 5 additions & 0 deletions tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -3892,6 +3892,11 @@ void vTaskSuspendAll( void )
mtCOVERAGE_TEST_MARKER();
}

/* Query the coreID again as prvCheckForRunStateChange may have
* caused the task to get scheduled on a different core. The correct
* task lock for the core is acquired in prvCheckForRunStateChange. */
xCoreID = ( BaseType_t ) portGET_CORE_ID();

portGET_ISR_LOCK( xCoreID );

/* The scheduler is suspended if uxSchedulerSuspended is non-zero. An increment
Expand Down

0 comments on commit 730310e

Please sign in to comment.