File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
portable/GCC/ARM_CRx_No_GIC Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 53
53
. global vPortEnableInterrupts
54
54
. global vPortDisableInterrupts
55
55
. global ulPortSetInterruptMaskFromISR
56
+ . global ulPortCountLeadingZeros
56
57
57
58
.weak vApplicationSVCHandler
58
59
/ *-----------------------------------------------------------* /
@@ -236,6 +237,21 @@ vApplicationSVCHandler:
236
237
237
238
/ *-----------------------------------------------------------* /
238
239
240
+ / *
241
+ * UBaseType_t ulPortCountLeadingZeros( UBaseType_t ulBitmap ) ;
242
+ *
243
+ * According to the Procedure Call Standard for the ARM Architecture (AAPCS):
244
+ * - Parameter ulBitmap is passed in R0.
245
+ * - Return value must be in R0.
246
+ * /
247
+ . align 4
248
+ .type ulPortCountLeadingZeros , %function
249
+ ulPortCountLeadingZeros:
250
+ CLZ R0 , R0
251
+ BX LR
252
+
253
+ / *-----------------------------------------------------------* /
254
+
239
255
/ *
240
256
* SVC handler is used to yield.
241
257
* /
Original file line number Diff line number Diff line change @@ -132,6 +132,15 @@ extern uint32_t ulPortSetInterruptMaskFromISR( void );
132
132
* handler for whichever peripheral is used to generate the RTOS tick. */
133
133
void FreeRTOS_Tick_Handler ( void );
134
134
135
+ /**
136
+ * @brief Returns the number of leading zeros in a 32 bit variable.
137
+ *
138
+ * @param[in] ulBitmap 32-Bit number to count leading zeros in.
139
+ *
140
+ * @return The number of leading zeros in ulBitmap.
141
+ */
142
+ UBaseType_t ulPortCountLeadingZeros ( UBaseType_t ulBitmap );
143
+
135
144
/* If configUSE_TASK_FPU_SUPPORT is set to 1 (or left undefined) then tasks are
136
145
* created without an FPU context and must call vPortTaskUsesFPU() to give
137
146
* themselves an FPU context before using any FPU instructions. If
@@ -159,7 +168,7 @@ void FreeRTOS_Tick_Handler( void );
159
168
/* Store, clear and get the ready priorities in a bit map. */
160
169
#define portRECORD_READY_PRIORITY ( uxPriority , uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )
161
170
#define portRESET_READY_PRIORITY ( uxPriority , uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) )
162
- #define portGET_HIGHEST_PRIORITY ( uxTopPriority , uxReadyPriorities ) uxTopPriority = ( 31UL - ( uint32_t ) __builtin_clz( uxReadyPriorities ) )
171
+ #define portGET_HIGHEST_PRIORITY ( uxTopPriority , uxReadyPriorities ) uxTopPriority = ( 31UL - ulPortCountLeadingZeros( ( uxTopReadyPriority ) ) )
163
172
164
173
#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */
165
174
You can’t perform that action at this time.
0 commit comments