1 /*
2  * FreeRTOS Kernel V11.1.0
3  * license and copyright intentionally withheld to promote copying into user code.
4  */
5 
6 #ifndef PORTMACRO_H
7 #define PORTMACRO_H
8 
9 /*-----------------------------------------------------------
10  * Port specific definitions.
11  *
12  * The settings in this file configure FreeRTOS correctly for the
13  * given hardware and compiler.
14  *
15  * These settings should not be altered.
16  *-----------------------------------------------------------
17  */
18 
19 /* Type definitions. */
20 #define portCHAR                 char
21 #define portFLOAT                float
22 #define portDOUBLE               double
23 #define portLONG                 long
24 #define portSHORT                int
25 #define portSTACK_TYPE           uint8_t
26 #define portBASE_TYPE            char
27 
28 #define portSTACK_GROWTH         ( -1 )
29 #define portBYTE_ALIGNMENT       4
30 #define portPOINTER_SIZE_TYPE    size_t
31 typedef portSTACK_TYPE   StackType_t;
32 typedef signed char      BaseType_t;
33 typedef unsigned char    UBaseType_t;
34 
35 #if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
36     typedef uint16_t     TickType_t;
37     #define portMAX_DELAY    ( TickType_t ) 0xffffU
38 #elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
39     typedef uint32_t     TickType_t;
40     #define portMAX_DELAY    ( TickType_t ) 0xffffffffU
41 #elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS )
42     typedef uint64_t     TickType_t;
43     #define portMAX_DELAY    ( TickType_t ) 0xffffffffffffffffU
44 #else
45     #error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width.
46 #endif
47 
48 /* Architecture specific optimisations. */
49 #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
50     #define configUSE_PORT_OPTIMISED_TASK_SELECTION    1
51 #endif
52 
53 #if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1
54 
55 /* Check the configuration. */
56     #if ( configMAX_PRIORITIES > 32 )
57         #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.
58     #endif
59 
60 /* Store/clear the ready priorities in a bit map. */
61     #define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities )    ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )
62     #define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities )     ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) )
63 
64 /*-----------------------------------------------------------*/
65 
66     #define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) \
67     do {                                                                 \
68         uxTopPriority = 0;                                               \
69     } while( 0 )
70 
71 #endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */
72 
73 /* Disable the interrupts */
74 #define portDISABLE_INTERRUPTS()    do {} while( 0 )
75 
76 /* Enable the interrupts */
77 #define portENABLE_INTERRUPTS()     do {} while( 0 )
78 
79 #if ( configNUMBER_OF_CORES == 1 )
80 /* preserve current interrupt state and then disable interrupts */
81     #define portENTER_CRITICAL()    do {} while( 0 )
82 
83 /* restore previously preserved interrupt state */
84     #define portEXIT_CRITICAL()     do {} while( 0 )
85 #else
86 
87 /* The port can maintain the critical nesting count in TCB or maintain the critical
88  * nesting count in the port. */
89     #define portCRITICAL_NESTING_IN_TCB    1
90 
91 /* vTaskEnterCritical and vTaskExitCritical should be used in the implementation
92  * of portENTER/EXIT_CRITICAL if the number of cores is more than 1 in the system. */
93     #define portENTER_CRITICAL             vTaskEnterCritical
94     #define portEXIT_CRITICAL              vTaskExitCritical
95 
96 /* vTaskEnterCriticalFromISR and vTaskExitCriticalFromISR should be used in the
97  * implementation of portENTER/EXIT_CRITICAL_FROM_ISR if the number of cores is
98  * more than 1 in the system. */
99     #define portENTER_CRITICAL_FROM_ISR    vTaskEnterCriticalFromISR
100     #define portEXIT_CRITICAL_FROM_ISR     vTaskExitCriticalFromISR
101 
102 #endif /* if ( configNUMBER_OF_CORES == 1 ) */
103 
104 extern void vPortYield( void );
105 #define portYIELD()                                           vPortYield()
106 
107 /* Task function macros as described on the FreeRTOS.org WEB site. */
108 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters )    void vFunction( void * pvParameters )
109 #define portTASK_FUNCTION( vFunction, pvParameters )          void vFunction( void * pvParameters )
110 
111 #if ( configNUMBER_OF_CORES > 1 )
112     /* Return the core ID on which the code is running. */
113     #define portGET_CORE_ID()                0
114 
115 /* Set the interrupt mask. */
116     #define portSET_INTERRUPT_MASK()         0
117 
118 /* Clear the interrupt mask. */
119     #define portCLEAR_INTERRUPT_MASK( x )    ( ( void ) ( x ) )
120 
121 /* Request the core ID x to yield. */
122     #define portYIELD_CORE( x )              do {} while( 0 )
123 
124 /* Acquire the TASK lock. TASK lock is a recursive lock.
125  * It should be able to be locked by the same core multiple times. */
126     #define portGET_TASK_LOCK()              do {} while( 0 )
127 
128 /* Release the TASK lock. If a TASK lock is locked by the same core multiple times,
129  * it should be released as many times as it is locked. */
130     #define portRELEASE_TASK_LOCK()          do {} while( 0 )
131 
132 /* Acquire the ISR lock. ISR lock is a recursive lock.
133  * It should be able to be locked by the same core multiple times. */
134     #define portGET_ISR_LOCK()               do {} while( 0 )
135 
136 /* Release the ISR lock. If a ISR lock is locked by the same core multiple times, \
137  * it should be released as many times as it is locked. */
138     #define portRELEASE_ISR_LOCK()           do {} while( 0 )
139 
140 #endif /* if ( configNUMBER_OF_CORES > 1 ) */
141 
142 #endif /* PORTMACRO_H */
143