Remove __builtin_clz from header file

This commit is contained in:
kar-rahul-aws 2024-07-14 22:55:11 +05:30
parent 5652423c66
commit 48acdd2c14
2 changed files with 26 additions and 1 deletions

View file

@ -53,6 +53,7 @@
.global vPortEnableInterrupts .global vPortEnableInterrupts
.global vPortDisableInterrupts .global vPortDisableInterrupts
.global ulPortSetInterruptMaskFromISR .global ulPortSetInterruptMaskFromISR
.global ulPortCountLeadingZeros
.weak vApplicationSVCHandler .weak vApplicationSVCHandler
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -236,6 +237,21 @@ vApplicationSVCHandler:
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/*
* UBaseType_t ulPortCountLeadingZeros( UBaseType_t ulBitmap );
*
* According to the Procedure Call Standard for the ARM Architecture (AAPCS):
* - Parameter ulBitmap is passed in R0.
* - Return value must be in R0.
*/
.align 4
.type ulPortCountLeadingZeros, %function
ulPortCountLeadingZeros:
CLZ R0, R0
BX LR
/*-----------------------------------------------------------*/
/* /*
* SVC handler is used to yield. * SVC handler is used to yield.
*/ */

View file

@ -132,6 +132,15 @@ extern uint32_t ulPortSetInterruptMaskFromISR( void );
* handler for whichever peripheral is used to generate the RTOS tick. */ * handler for whichever peripheral is used to generate the RTOS tick. */
void FreeRTOS_Tick_Handler( void ); void FreeRTOS_Tick_Handler( void );
/**
* @brief Returns the number of leading zeros in a 32 bit variable.
*
* @param[in] ulBitmap 32-Bit number to count leading zeros in.
*
* @return The number of leading zeros in ulBitmap.
*/
UBaseType_t ulPortCountLeadingZeros( UBaseType_t ulBitmap );
/* If configUSE_TASK_FPU_SUPPORT is set to 1 (or left undefined) then tasks are /* If configUSE_TASK_FPU_SUPPORT is set to 1 (or left undefined) then tasks are
* created without an FPU context and must call vPortTaskUsesFPU() to give * created without an FPU context and must call vPortTaskUsesFPU() to give
* themselves an FPU context before using any FPU instructions. If * themselves an FPU context before using any FPU instructions. If
@ -159,7 +168,7 @@ void FreeRTOS_Tick_Handler( void );
/* Store, clear and get the ready priorities in a bit map. */ /* Store, clear and get the ready priorities in a bit map. */
#define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) ) #define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )
#define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) ) #define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) )
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31UL - ( uint32_t ) __builtin_clz( uxReadyPriorities ) ) #define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31UL - ulPortCountLeadingZeros( ( uxTopReadyPriority ) ) )
#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */ #endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */