2 * FreeRTOS Kernel <DEVELOPMENT BRANCH>
3 * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 * Copyright 2024 Arm Limited and/or its affiliates
5 * <open-source-office@arm.com>
7 * SPDX-License-Identifier: MIT
9 * Permission is hereby granted, free of charge, to any person obtaining a copy of
10 * this software and associated documentation files (the "Software"), to deal in
11 * the Software without restriction, including without limitation the rights to
12 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
13 * the Software, and to permit persons to whom the Software is furnished to do so,
14 * subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included in all
17 * copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
21 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
22 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
23 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 * https://www.FreeRTOS.org
27 * https://github.com/FreeRTOS
31 #ifndef PORTMACROCOMMON_H
32 #define PORTMACROCOMMON_H
40 /*------------------------------------------------------------------------------
41 * Port specific definitions.
43 * The settings in this file configure FreeRTOS correctly for the given hardware
46 * These settings should not be altered.
47 *------------------------------------------------------------------------------
50 #ifndef configENABLE_FPU
51 #error configENABLE_FPU must be defined in FreeRTOSConfig.h. Set configENABLE_FPU to 1 to enable the FPU or 0 to disable the FPU.
52 #endif /* configENABLE_FPU */
54 #ifndef configENABLE_MPU
55 #error configENABLE_MPU must be defined in FreeRTOSConfig.h. Set configENABLE_MPU to 1 to enable the MPU or 0 to disable the MPU.
56 #endif /* configENABLE_MPU */
58 #ifndef configENABLE_TRUSTZONE
59 #error configENABLE_TRUSTZONE must be defined in FreeRTOSConfig.h. Set configENABLE_TRUSTZONE to 1 to enable TrustZone or 0 to disable TrustZone.
60 #endif /* configENABLE_TRUSTZONE */
62 /*-----------------------------------------------------------*/
65 * @brief Type definitions.
68 #define portFLOAT float
69 #define portDOUBLE double
71 #define portSHORT short
72 #define portSTACK_TYPE uint32_t
73 #define portBASE_TYPE long
75 typedef portSTACK_TYPE StackType_t;
76 typedef long BaseType_t;
77 typedef unsigned long UBaseType_t;
79 #if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
80 typedef uint16_t TickType_t;
81 #define portMAX_DELAY ( TickType_t ) 0xffff
82 #elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
83 typedef uint32_t TickType_t;
84 #define portMAX_DELAY ( TickType_t ) 0xffffffffUL
86 /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do
87 * not need to be guarded with a critical section. */
88 #define portTICK_TYPE_IS_ATOMIC 1
90 #error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width.
92 /*-----------------------------------------------------------*/
95 * Architecture specifics.
97 #define portSTACK_GROWTH ( -1 )
98 #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
99 #define portBYTE_ALIGNMENT 8
101 #define portINLINE __inline
102 #ifndef portFORCE_INLINE
103 #define portFORCE_INLINE inline __attribute__( ( always_inline ) )
105 #define portHAS_STACK_OVERFLOW_CHECKING 1
106 /*-----------------------------------------------------------*/
109 * @brief Extern declarations.
111 extern BaseType_t xPortIsInsideInterrupt( void );
113 extern void vPortYield( void ) /* PRIVILEGED_FUNCTION */;
115 extern void vPortEnterCritical( void ) /* PRIVILEGED_FUNCTION */;
116 extern void vPortExitCritical( void ) /* PRIVILEGED_FUNCTION */;
118 extern uint32_t ulSetInterruptMask( void ) /* __attribute__(( naked )) PRIVILEGED_FUNCTION */;
119 extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) PRIVILEGED_FUNCTION */;
121 #if ( configENABLE_TRUSTZONE == 1 )
122 extern void vPortAllocateSecureContext( uint32_t ulSecureStackSize ); /* __attribute__ (( naked )) */
123 extern void vPortFreeSecureContext( uint32_t * pulTCB ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */;
124 #endif /* configENABLE_TRUSTZONE */
126 #if ( configENABLE_MPU == 1 )
127 extern BaseType_t xIsPrivileged( void ) /* __attribute__ (( naked )) */;
128 extern void vResetPrivilege( void ) /* __attribute__ (( naked )) */;
129 #endif /* configENABLE_MPU */
131 #if ( configENABLE_PAC == 1 )
134 * @brief Generates 128-bit task's random PAC key.
136 * @param[out] pulTaskPacKey Pointer to a 4-word (128-bits) array to be
137 * filled with a 128-bit random number.
139 void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey );
141 #endif /* configENABLE_PAC */
142 /*-----------------------------------------------------------*/
145 * @brief MPU specific constants.
147 #if ( configENABLE_MPU == 1 )
148 #define portUSING_MPU_WRAPPERS 1
149 #define portPRIVILEGE_BIT ( 0x80000000UL )
151 #define portPRIVILEGE_BIT ( 0x0UL )
152 #endif /* configENABLE_MPU */
154 /* MPU settings that can be overridden in FreeRTOSConfig.h. */
155 #ifndef configTOTAL_MPU_REGIONS
156 /* Define to 8 for backward compatibility. */
157 #define configTOTAL_MPU_REGIONS ( 8UL )
161 #define portPRIVILEGED_FLASH_REGION ( 0UL )
162 #define portUNPRIVILEGED_FLASH_REGION ( 1UL )
163 #define portUNPRIVILEGED_SYSCALLS_REGION ( 2UL )
164 #define portPRIVILEGED_RAM_REGION ( 3UL )
165 #define portSTACK_REGION ( 4UL )
166 #define portFIRST_CONFIGURABLE_REGION ( 5UL )
167 #define portLAST_CONFIGURABLE_REGION ( configTOTAL_MPU_REGIONS - 1UL )
168 #define portNUM_CONFIGURABLE_REGIONS ( ( portLAST_CONFIGURABLE_REGION - portFIRST_CONFIGURABLE_REGION ) + 1 )
169 #define portTOTAL_NUM_REGIONS ( portNUM_CONFIGURABLE_REGIONS + 1 ) /* Plus one to make space for the stack region. */
171 /* Device memory attributes used in MPU_MAIR registers.
173 * 8-bit values encoded as follows:
174 * Bit[7:4] - 0000 - Device Memory
175 * Bit[3:2] - 00 --> Device-nGnRnE
176 * 01 --> Device-nGnRE
179 * Bit[1:0] - 00, Reserved.
181 #define portMPU_DEVICE_MEMORY_nGnRnE ( 0x00 ) /* 0000 0000 */
182 #define portMPU_DEVICE_MEMORY_nGnRE ( 0x04 ) /* 0000 0100 */
183 #define portMPU_DEVICE_MEMORY_nGRE ( 0x08 ) /* 0000 1000 */
184 #define portMPU_DEVICE_MEMORY_GRE ( 0x0C ) /* 0000 1100 */
186 /* Normal memory attributes used in MPU_MAIR registers. */
187 #define portMPU_NORMAL_MEMORY_NON_CACHEABLE ( 0x44 ) /* Non-cacheable. */
188 #define portMPU_NORMAL_MEMORY_BUFFERABLE_CACHEABLE ( 0xFF ) /* Non-Transient, Write-back, Read-Allocate and Write-Allocate. */
190 /* Attributes used in MPU_RBAR registers. */
191 #define portMPU_REGION_NON_SHAREABLE ( 0UL << 3UL )
192 #define portMPU_REGION_INNER_SHAREABLE ( 1UL << 3UL )
193 #define portMPU_REGION_OUTER_SHAREABLE ( 2UL << 3UL )
195 #define portMPU_REGION_PRIVILEGED_READ_WRITE ( 0UL << 1UL )
196 #define portMPU_REGION_READ_WRITE ( 1UL << 1UL )
197 #define portMPU_REGION_PRIVILEGED_READ_ONLY ( 2UL << 1UL )
198 #define portMPU_REGION_READ_ONLY ( 3UL << 1UL )
200 #define portMPU_REGION_EXECUTE_NEVER ( 1UL )
201 /*-----------------------------------------------------------*/
203 #if ( configENABLE_MPU == 1 )
206 * @brief Settings to define an MPU region.
208 typedef struct MPURegionSettings
210 uint32_t ulRBAR; /**< RBAR for the region. */
211 uint32_t ulRLAR; /**< RLAR for the region. */
212 } MPURegionSettings_t;
214 #if ( configUSE_MPU_WRAPPERS_V1 == 0 )
216 #ifndef configSYSTEM_CALL_STACK_SIZE
217 #error configSYSTEM_CALL_STACK_SIZE must be defined to the desired size of the system call stack in words for using MPU wrappers v2.
220 /* When MPU wrapper v2 is used, the task's context is stored in TCB and
221 * pxTopOfStack member of TCB points to the context location in TCB. We,
222 * therefore, need to read PSP to find the task's current top of stack. */
223 #define portGET_CURRENT_TOP_OF_STACK( pxCurrentTopOfStack ) { __asm volatile ( "mrs %0, psp" : "=r" ( pxCurrentTopOfStack ) ); }
226 * @brief System call stack.
228 typedef struct SYSTEM_CALL_STACK_INFO
230 uint32_t ulSystemCallStackBuffer[ configSYSTEM_CALL_STACK_SIZE ];
231 uint32_t * pulSystemCallStack;
232 uint32_t * pulSystemCallStackLimit;
233 uint32_t * pulTaskStack;
234 uint32_t ulLinkRegisterAtSystemCallEntry;
235 uint32_t ulStackLimitRegisterAtSystemCallEntry;
236 } xSYSTEM_CALL_STACK_INFO;
238 #endif /* configUSE_MPU_WRAPPERS_V1 == 0 */
241 * @brief MPU settings as stored in the TCB.
243 #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
245 #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
248 * +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
249 * | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
250 * | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
251 * +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
253 * <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
256 #define MAX_CONTEXT_SIZE 71
258 #elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
261 * +-----------+---------------+----------+-----------------+------------------------------+-----+
262 * | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
263 * | | | | PC, xPSR | CONTROL, EXC_RETURN | |
264 * +-----------+---------------+----------+-----------------+------------------------------+-----+
266 * <-----------><--------------><---------><----------------><-----------------------------><---->
269 #define MAX_CONTEXT_SIZE 55
271 #elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
274 * +-----------+---------------+----------+-----------------+----------------------+------------+-----+
275 * | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
276 * | | | | PC, xPSR | EXC_RETURN | | |
277 * +-----------+---------------+----------+-----------------+----------------------+------------+-----+
279 * <-----------><--------------><---------><----------------><---------------------><-----------><---->
282 #define MAX_CONTEXT_SIZE 70
284 #else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
287 * +-----------+---------------+----------+-----------------+----------------------+-----+
288 * | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
289 * | | | | PC, xPSR | EXC_RETURN | |
290 * +-----------+---------------+----------+-----------------+----------------------+-----+
292 * <-----------><--------------><---------><----------------><---------------------><---->
295 #define MAX_CONTEXT_SIZE 54
297 #endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
299 #else /* #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */
301 #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
304 * +----------+-----------------+------------------------------+------------+-----+
305 * | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
306 * | | PC, xPSR | CONTROL, EXC_RETURN | | |
307 * +----------+-----------------+------------------------------+------------+-----+
309 * <---------><----------------><------------------------------><-----------><---->
312 #define MAX_CONTEXT_SIZE 38
314 #elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
317 * +----------+-----------------+------------------------------+-----+
318 * | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | |
319 * | | PC, xPSR | CONTROL, EXC_RETURN | |
320 * +----------+-----------------+------------------------------+-----+
322 * <---------><----------------><------------------------------><---->
325 #define MAX_CONTEXT_SIZE 22
327 #elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
330 * +----------+-----------------+----------------------+------------+-----+
331 * | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
332 * | | PC, xPSR | EXC_RETURN | | |
333 * +----------+-----------------+----------------------+------------+-----+
335 * <---------><----------------><----------------------><-----------><---->
338 #define MAX_CONTEXT_SIZE 37
340 #else /* #if( configENABLE_TRUSTZONE == 1 ) */
343 * +----------+-----------------+----------------------+-----+
344 * | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | |
345 * | | PC, xPSR | EXC_RETURN | |
346 * +----------+-----------------+----------------------+-----+
348 * <---------><----------------><----------------------><---->
351 #define MAX_CONTEXT_SIZE 21
353 #endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
355 #endif /* #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */
357 /* Flags used for xMPU_SETTINGS.ulTaskFlags member. */
358 #define portSTACK_FRAME_HAS_PADDING_FLAG ( 1UL << 0UL )
359 #define portTASK_IS_PRIVILEGED_FLAG ( 1UL << 1UL )
361 /* Size of an Access Control List (ACL) entry in bits. */
362 #define portACL_ENTRY_SIZE_BITS ( 32U )
364 typedef struct MPU_SETTINGS
366 uint32_t ulMAIR0; /**< MAIR0 for the task containing attributes for all the 4 per task regions. */
367 MPURegionSettings_t xRegionsSettings[ portTOTAL_NUM_REGIONS ]; /**< Settings for 4 per task regions. */
368 uint32_t ulContext[ MAX_CONTEXT_SIZE ];
369 uint32_t ulTaskFlags;
371 #if ( configUSE_MPU_WRAPPERS_V1 == 0 )
372 xSYSTEM_CALL_STACK_INFO xSystemCallStackInfo;
373 #if ( configENABLE_ACCESS_CONTROL_LIST == 1 )
374 uint32_t ulAccessControlList[ ( configPROTECTED_KERNEL_OBJECT_POOL_SIZE / portACL_ENTRY_SIZE_BITS ) + 1 ];
379 #endif /* configENABLE_MPU == 1 */
380 /*-----------------------------------------------------------*/
383 * @brief Validate priority of ISRs that are allowed to call FreeRTOS
386 #if ( configASSERT_DEFINED == 1 )
387 #if ( portHAS_ARMV8M_MAIN_EXTENSION == 1 )
388 void vPortValidateInterruptPriority( void );
389 #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() vPortValidateInterruptPriority()
394 * @brief SVC numbers.
396 #define portSVC_ALLOCATE_SECURE_CONTEXT 100
397 #define portSVC_FREE_SECURE_CONTEXT 101
398 #define portSVC_START_SCHEDULER 102
399 #define portSVC_RAISE_PRIVILEGE 103
400 #define portSVC_SYSTEM_CALL_EXIT 104
401 #define portSVC_YIELD 105
402 /*-----------------------------------------------------------*/
405 * @brief Scheduler utilities.
407 #if ( configENABLE_MPU == 1 )
408 #define portYIELD() __asm volatile ( "svc %0" ::"i" ( portSVC_YIELD ) : "memory" )
409 #define portYIELD_WITHIN_API() vPortYield()
411 #define portYIELD() vPortYield()
412 #define portYIELD_WITHIN_API() vPortYield()
415 #define portNVIC_INT_CTRL_REG ( *( ( volatile uint32_t * ) 0xe000ed04 ) )
416 #define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
417 #define portEND_SWITCHING_ISR( xSwitchRequired ) \
420 if( xSwitchRequired ) \
422 traceISR_EXIT_TO_SCHEDULER(); \
423 portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; \
430 #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
431 /*-----------------------------------------------------------*/
434 * @brief Critical section management.
436 #define portSET_INTERRUPT_MASK_FROM_ISR() ulSetInterruptMask()
437 #define portCLEAR_INTERRUPT_MASK_FROM_ISR( x ) vClearInterruptMask( x )
438 #define portENTER_CRITICAL() vPortEnterCritical()
439 #define portEXIT_CRITICAL() vPortExitCritical()
440 /*-----------------------------------------------------------*/
443 * @brief Tickless idle/low power functionality.
445 #ifndef portSUPPRESS_TICKS_AND_SLEEP
446 extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime );
447 #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime )
449 /*-----------------------------------------------------------*/
452 * @brief Task function macros as described on the FreeRTOS.org WEB site.
454 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters )
455 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )
456 /*-----------------------------------------------------------*/
458 #if ( configENABLE_TRUSTZONE == 1 )
461 * @brief Allocate a secure context for the task.
463 * Tasks are not created with a secure context. Any task that is going to call
464 * secure functions must call portALLOCATE_SECURE_CONTEXT() to allocate itself a
465 * secure context before it calls any secure function.
467 * @param[in] ulSecureStackSize The size of the secure stack to be allocated.
469 #define portALLOCATE_SECURE_CONTEXT( ulSecureStackSize ) vPortAllocateSecureContext( ulSecureStackSize )
472 * @brief Called when a task is deleted to delete the task's secure context,
475 * @param[in] pxTCB The TCB of the task being deleted.
477 #define portCLEAN_UP_TCB( pxTCB ) vPortFreeSecureContext( ( uint32_t * ) pxTCB )
478 #endif /* configENABLE_TRUSTZONE */
479 /*-----------------------------------------------------------*/
481 #if ( configENABLE_MPU == 1 )
484 * @brief Checks whether or not the processor is privileged.
486 * @return 1 if the processor is already privileged, 0 otherwise.
488 #define portIS_PRIVILEGED() xIsPrivileged()
491 * @brief Raise an SVC request to raise privilege.
493 * The SVC handler checks that the SVC was raised from a system call and only
494 * then it raises the privilege. If this is called from any other place,
495 * the privilege is not raised.
497 #define portRAISE_PRIVILEGE() __asm volatile ( "svc %0 \n" ::"i" ( portSVC_RAISE_PRIVILEGE ) : "memory" );
500 * @brief Lowers the privilege level by setting the bit 0 of the CONTROL
503 #define portRESET_PRIVILEGE() vResetPrivilege()
505 #define portIS_PRIVILEGED()
506 #define portRAISE_PRIVILEGE()
507 #define portRESET_PRIVILEGE()
508 #endif /* configENABLE_MPU */
509 /*-----------------------------------------------------------*/
511 #if ( configENABLE_MPU == 1 )
513 extern BaseType_t xPortIsTaskPrivileged( void );
516 * @brief Checks whether or not the calling task is privileged.
518 * @return pdTRUE if the calling task is privileged, pdFALSE otherwise.
520 #define portIS_TASK_PRIVILEGED() xPortIsTaskPrivileged()
522 #endif /* configENABLE_MPU == 1 */
523 /*-----------------------------------------------------------*/
528 #define portMEMORY_BARRIER() __asm volatile ( "" ::: "memory" )
529 /*-----------------------------------------------------------*/
531 /* Select correct value of configUSE_PORT_OPTIMISED_TASK_SELECTION
532 * based on whether or not Mainline extension is implemented. */
533 #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
534 #if ( portHAS_ARMV8M_MAIN_EXTENSION == 1 )
535 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
537 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
539 #endif /* #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION */
542 * @brief Port-optimised task selection.
544 #if ( configUSE_PORT_OPTIMISED_TASK_SELECTION == 1 )
547 * @brief Count the number of leading zeros in a 32-bit value.
549 static portFORCE_INLINE uint32_t ulPortCountLeadingZeros( uint32_t ulBitmap )
553 __asm volatile ( "clz %0, %1" : "=r" ( ulReturn ) : "r" ( ulBitmap ) : "memory" );
558 /* Check the configuration. */
559 #if ( configMAX_PRIORITIES > 32 )
560 #error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 different priorities as tasks that share a priority will time slice.
563 #if ( portHAS_ARMV8M_MAIN_EXTENSION == 0 )
564 #error ARMv8-M baseline implementations (such as Cortex-M23) do not support port-optimised task selection. Please set configUSE_PORT_OPTIMISED_TASK_SELECTION to 0 or leave it undefined.
568 * @brief Store/clear the ready priorities in a bit map.
570 #define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )
571 #define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) )
574 * @brief Get the priority of the highest-priority task that is ready to execute.
576 #define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31UL - ulPortCountLeadingZeros( ( uxReadyPriorities ) ) )
578 #endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */
579 /*-----------------------------------------------------------*/
587 #endif /* PORTMACROCOMMON_H */