51 #define portFLOAT float
52 #define portDOUBLE double
54 #define portSHORT short
55 #define portSTACK_TYPE uint32_t
56 #define portBASE_TYPE long
62 #if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
64 #define portMAX_DELAY ( TickType_t ) 0xffff
65 #elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
67 #define portMAX_DELAY ( TickType_t ) 0xffffffffUL
71 #define portTICK_TYPE_IS_ATOMIC 1
72 #elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS )
74 #define portMAX_DELAY ( TickType_t ) 0xffffffffffffffffULL
76 #error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width.
81 #define portSTACK_GROWTH ( -1 )
82 #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
83 #define portBYTE_ALIGNMENT 8
84 #define portDONT_DISCARD __attribute__( ( used ) )
91 portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; \
95 __asm volatile ( "dsb" ::: "memory" ); \
96 __asm volatile ( "isb" ); \
99 #define portNVIC_INT_CTRL_REG ( *( ( volatile uint32_t * ) 0xe000ed04 ) )
100 #define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
101 #define portEND_SWITCHING_ISR( xSwitchRequired ) do { if( xSwitchRequired != pdFALSE ) portYIELD(); } while( 0 )
102 #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
108 #define portSET_INTERRUPT_MASK_FROM_ISR() ulPortRaiseBASEPRI()
109 #define portCLEAR_INTERRUPT_MASK_FROM_ISR( x ) vPortSetBASEPRI( x )
110 #define portDISABLE_INTERRUPTS() vPortRaiseBASEPRI()
111 #define portENABLE_INTERRUPTS() vPortSetBASEPRI( 0 )
112 #define portENTER_CRITICAL() vPortEnterCritical()
113 #define portEXIT_CRITICAL() vPortExitCritical()
120 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters )
121 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )
125 #ifndef portSUPPRESS_TICKS_AND_SLEEP
127 #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime )
132 #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
133 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
136 #if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1
139 __attribute__( ( always_inline ) )
static inline uint8_t ucPortCountLeadingZeros( uint32_t ulBitmap )
143 __asm
volatile (
"clz %0, %1" :
"=r" ( ucReturn ) :
"r" ( ulBitmap ) :
"memory" );
149 #if ( configMAX_PRIORITIES > 32 )
150 #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 difference priorities as tasks that share a priority will time slice.
154 #define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )
155 #define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) )
159 #define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31UL - ( uint32_t ) ucPortCountLeadingZeros( ( uxReadyPriorities ) ) )
166 void vPortValidateInterruptPriority(
void );
167 #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() vPortValidateInterruptPriority()
173 #define portINLINE __inline
175 #ifndef portFORCE_INLINE
176 #define portFORCE_INLINE inline __attribute__( ( always_inline ) )
181 uint32_t ulCurrentInterrupt;
185 __asm
volatile (
"mrs %0, ipsr" :
"=r" ( ulCurrentInterrupt )::
"memory" );
187 if( ulCurrentInterrupt == 0 )
203 uint32_t ulNewBASEPRI;
208 " msr basepri, %0 \n"\
219 uint32_t ulOriginalBASEPRI, ulNewBASEPRI;
223 " mrs %0, basepri \n"\
225 " msr basepri, %1 \n"\
233 return ulOriginalBASEPRI;
241 " msr basepri, %0 "::
"r" ( ulNewMaskValue ) :
"memory"
246 #define portMEMORY_BARRIER() __asm volatile ( "" ::: "memory" )
#define configMAX_SYSCALL_INTERRUPT_PRIORITY
static portFORCE_INLINE uint32_t ulPortRaiseBASEPRI(void)
void vPortEnterCritical(void)
unsigned long UBaseType_t
static portFORCE_INLINE BaseType_t xPortIsInsideInterrupt(void)
portSTACK_TYPE StackType_t
static portFORCE_INLINE void vPortRaiseBASEPRI(void)
__attribute__((always_inline)) static inline uint8_t ucPortCountLeadingZeros(uint32_t ulBitmap)
static portFORCE_INLINE void vPortSetBASEPRI(uint32_t ulNewMaskValue)
void vPortExitCritical(void)
void vPortSuppressTicksAndSleep(TickType_t xExpectedIdleTime)