Prusa MINI Firmware overview
portmacro.h File Reference

Go to the source code of this file.

Macros

#define portCHAR   char
 
#define portFLOAT   float
 
#define portDOUBLE   double
 
#define portLONG   long
 
#define portSHORT   short
 
#define portSTACK_TYPE   uint32_t
 
#define portBASE_TYPE   long
 
#define portMAX_DELAY   ( TickType_t ) 0xffffffffUL
 
#define portTICK_TYPE_IS_ATOMIC   1
 
#define portSTACK_GROWTH   ( -1 )
 
#define portTICK_PERIOD_MS   ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
 
#define portBYTE_ALIGNMENT   8
 
#define portYIELD()
 
#define portNVIC_INT_CTRL_REG   ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
 
#define portNVIC_PENDSVSET_BIT   ( 1UL << 28UL )
 
#define portEND_SWITCHING_ISR(xSwitchRequired)   if( xSwitchRequired != pdFALSE ) portYIELD()
 
#define portYIELD_FROM_ISR(x)   portEND_SWITCHING_ISR( x )
 
#define portSET_INTERRUPT_MASK_FROM_ISR()   ulPortRaiseBASEPRI()
 
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x)   vPortSetBASEPRI(x)
 
#define portDISABLE_INTERRUPTS()   vPortRaiseBASEPRI()
 
#define portENABLE_INTERRUPTS()   vPortSetBASEPRI(0)
 
#define portENTER_CRITICAL()   vPortEnterCritical()
 
#define portEXIT_CRITICAL()   vPortExitCritical()
 
#define portTASK_FUNCTION_PROTO(vFunction, pvParameters)   void vFunction( void *pvParameters )
 
#define portTASK_FUNCTION(vFunction, pvParameters)   void vFunction( void *pvParameters )
 
#define portSUPPRESS_TICKS_AND_SLEEP(xExpectedIdleTime)   vPortSuppressTicksAndSleep( xExpectedIdleTime )
 
#define configUSE_PORT_OPTIMISED_TASK_SELECTION   1
 
#define portRECORD_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 ) ucPortCountLeadingZeros( ( uxReadyPriorities ) ) )
 
#define portNOP()
 
#define portINLINE   __inline
 
#define portFORCE_INLINE   inline __attribute__(( always_inline))
 

Typedefs

typedef portSTACK_TYPE StackType_t
 
typedef long BaseType_t
 
typedef unsigned long UBaseType_t
 
typedef uint32_t TickType_t
 

Functions

void vPortEnterCritical (void)
 
void vPortExitCritical (void)
 
void vPortSuppressTicksAndSleep (TickType_t xExpectedIdleTime)
 
 __attribute__ ((always_inline)) static inline uint8_t ucPortCountLeadingZeros(uint32_t ulBitmap)
 
static portFORCE_INLINE BaseType_t xPortIsInsideInterrupt (void)
 
static portFORCE_INLINE void vPortRaiseBASEPRI (void)
 
static portFORCE_INLINE uint32_t ulPortRaiseBASEPRI (void)
 
static portFORCE_INLINE void vPortSetBASEPRI (uint32_t ulNewMaskValue)
 

Macro Definition Documentation

◆ portCHAR

#define portCHAR   char

◆ portFLOAT

#define portFLOAT   float

◆ portDOUBLE

#define portDOUBLE   double

◆ portLONG

#define portLONG   long

◆ portSHORT

#define portSHORT   short

◆ portSTACK_TYPE

#define portSTACK_TYPE   uint32_t

◆ portBASE_TYPE

#define portBASE_TYPE   long

◆ portMAX_DELAY

#define portMAX_DELAY   ( TickType_t ) 0xffffffffUL

◆ portTICK_TYPE_IS_ATOMIC

#define portTICK_TYPE_IS_ATOMIC   1

◆ portSTACK_GROWTH

#define portSTACK_GROWTH   ( -1 )

◆ portTICK_PERIOD_MS

#define portTICK_PERIOD_MS   ( ( TickType_t ) 1000 / configTICK_RATE_HZ )

◆ portBYTE_ALIGNMENT

#define portBYTE_ALIGNMENT   8

◆ portYIELD

#define portYIELD ( )
Value:
{ \
/* Set a PendSV to request a context switch. */ \
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; \
\
/* Barriers are normally not required but do ensure the code is completely \
within the specified behaviour for the architecture. */ \
__asm volatile( "dsb" ); \
__asm volatile( "isb" ); \
}

◆ portNVIC_INT_CTRL_REG

#define portNVIC_INT_CTRL_REG   ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )

◆ portNVIC_PENDSVSET_BIT

#define portNVIC_PENDSVSET_BIT   ( 1UL << 28UL )

◆ portEND_SWITCHING_ISR

#define portEND_SWITCHING_ISR (   xSwitchRequired)    if( xSwitchRequired != pdFALSE ) portYIELD()

◆ portYIELD_FROM_ISR

#define portYIELD_FROM_ISR (   x)    portEND_SWITCHING_ISR( x )

◆ portSET_INTERRUPT_MASK_FROM_ISR

#define portSET_INTERRUPT_MASK_FROM_ISR ( )    ulPortRaiseBASEPRI()

◆ portCLEAR_INTERRUPT_MASK_FROM_ISR

#define portCLEAR_INTERRUPT_MASK_FROM_ISR (   x)    vPortSetBASEPRI(x)

◆ portDISABLE_INTERRUPTS

#define portDISABLE_INTERRUPTS ( )    vPortRaiseBASEPRI()

◆ portENABLE_INTERRUPTS

#define portENABLE_INTERRUPTS ( )    vPortSetBASEPRI(0)

◆ portENTER_CRITICAL

#define portENTER_CRITICAL ( )    vPortEnterCritical()

◆ portEXIT_CRITICAL

#define portEXIT_CRITICAL ( )    vPortExitCritical()

◆ portTASK_FUNCTION_PROTO

#define portTASK_FUNCTION_PROTO (   vFunction,
  pvParameters 
)    void vFunction( void *pvParameters )

◆ portTASK_FUNCTION

#define portTASK_FUNCTION (   vFunction,
  pvParameters 
)    void vFunction( void *pvParameters )

◆ portSUPPRESS_TICKS_AND_SLEEP

#define portSUPPRESS_TICKS_AND_SLEEP (   xExpectedIdleTime)    vPortSuppressTicksAndSleep( xExpectedIdleTime )

◆ configUSE_PORT_OPTIMISED_TASK_SELECTION

#define configUSE_PORT_OPTIMISED_TASK_SELECTION   1

◆ portRECORD_READY_PRIORITY

#define portRECORD_READY_PRIORITY (   uxPriority,
  uxReadyPriorities 
)    ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )

◆ portRESET_READY_PRIORITY

#define portRESET_READY_PRIORITY (   uxPriority,
  uxReadyPriorities 
)    ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) )

◆ portGET_HIGHEST_PRIORITY

#define portGET_HIGHEST_PRIORITY (   uxTopPriority,
  uxReadyPriorities 
)    uxTopPriority = ( 31UL - ( uint32_t ) ucPortCountLeadingZeros( ( uxReadyPriorities ) ) )

◆ portNOP

#define portNOP ( )

◆ portINLINE

#define portINLINE   __inline

◆ portFORCE_INLINE

#define portFORCE_INLINE   inline __attribute__(( always_inline))

Typedef Documentation

◆ StackType_t

◆ BaseType_t

typedef long BaseType_t

◆ UBaseType_t

typedef unsigned long UBaseType_t

◆ TickType_t

typedef uint32_t TickType_t

Function Documentation

◆ vPortEnterCritical()

void vPortEnterCritical ( void  )
408 {
411 
412  /* This is not the interrupt safe version of the enter critical function so
413  assert() if it is being called from an interrupt context. Only API
414  functions that end in "FromISR" can be used in an interrupt. Only assert if
415  the critical nesting count is 1 to protect against recursive calls if the
416  assert function also uses a critical section. */
417  if( uxCriticalNesting == 1 )
418  {
420  }
421 }
Here is the caller graph for this function:

◆ vPortExitCritical()

void vPortExitCritical ( void  )
425 {
428  if( uxCriticalNesting == 0 )
429  {
431  }
432 }
Here is the caller graph for this function:

◆ vPortSuppressTicksAndSleep()

void vPortSuppressTicksAndSleep ( TickType_t  xExpectedIdleTime)

◆ __attribute__()

__attribute__ ( (always_inline)  )
173  {
174  uint8_t ucReturn;
175 
176  __asm volatile ( "clz %0, %1" : "=r" ( ucReturn ) : "r" ( ulBitmap ) );
177  return ucReturn;
178  }

◆ xPortIsInsideInterrupt()

static portFORCE_INLINE BaseType_t xPortIsInsideInterrupt ( void  )
static
212 {
213 uint32_t ulCurrentInterrupt;
214 BaseType_t xReturn;
215 
216  /* Obtain the number of the currently executing interrupt. */
217  __asm volatile( "mrs %0, ipsr" : "=r"( ulCurrentInterrupt ) );
218 
219  if( ulCurrentInterrupt == 0 )
220  {
221  xReturn = pdFALSE;
222  }
223  else
224  {
225  xReturn = pdTRUE;
226  }
227 
228  return xReturn;
229 }

◆ vPortRaiseBASEPRI()

static portFORCE_INLINE void vPortRaiseBASEPRI ( void  )
static
234 {
235 uint32_t ulNewBASEPRI;
236 
237  __asm volatile
238  (
239  " mov %0, %1 \n" \
240  " msr basepri, %0 \n" \
241  " isb \n" \
242  " dsb \n" \
243  :"=r" (ulNewBASEPRI) : "i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY )
244  );
245 }

◆ ulPortRaiseBASEPRI()

static portFORCE_INLINE uint32_t ulPortRaiseBASEPRI ( void  )
static
250 {
251 uint32_t ulOriginalBASEPRI, ulNewBASEPRI;
252 
253  __asm volatile
254  (
255  " mrs %0, basepri \n" \
256  " mov %1, %2 \n" \
257  " msr basepri, %1 \n" \
258  " isb \n" \
259  " dsb \n" \
260  :"=r" (ulOriginalBASEPRI), "=r" (ulNewBASEPRI) : "i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY )
261  );
262 
263  /* This return will not be reached but is necessary to prevent compiler
264  warnings. */
265  return ulOriginalBASEPRI;
266 }

◆ vPortSetBASEPRI()

static portFORCE_INLINE void vPortSetBASEPRI ( uint32_t  ulNewMaskValue)
static
270 {
271  __asm volatile
272  (
273  " msr basepri, %0 " :: "r" ( ulNewMaskValue )
274  );
275 }
configASSERT
#define configASSERT(x)
Definition: FreeRTOSConfig.h:162
pdFALSE
#define pdFALSE
Definition: projdefs.h:86
portDISABLE_INTERRUPTS
#define portDISABLE_INTERRUPTS()
Definition: portmacro.h:143
portNVIC_PENDSVSET_BIT
#define portNVIC_PENDSVSET_BIT
Definition: portmacro.h:133
configMAX_SYSCALL_INTERRUPT_PRIORITY
#define configMAX_SYSCALL_INTERRUPT_PRIORITY
Definition: FreeRTOSConfig.h:157
uxCriticalNesting
static UBaseType_t uxCriticalNesting
Definition: port.c:157
uint8_t
const uint8_t[]
Definition: 404_html.c:3
portVECTACTIVE_MASK
#define portVECTACTIVE_MASK
Definition: port.c:124
portENABLE_INTERRUPTS
#define portENABLE_INTERRUPTS()
Definition: portmacro.h:144
BaseType_t
long BaseType_t
Definition: portmacro.h:98
pdTRUE
#define pdTRUE
Definition: projdefs.h:87
portNVIC_INT_CTRL_REG
#define portNVIC_INT_CTRL_REG
Definition: portmacro.h:132