1 /*
2  * FreeRTOS Kernel <DEVELOPMENT BRANCH>
3  * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * SPDX-License-Identifier: MIT
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a copy of
8  * this software and associated documentation files (the "Software"), to deal in
9  * the Software without restriction, including without limitation the rights to
10  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11  * the Software, and to permit persons to whom the Software is furnished to do so,
12  * subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in all
15  * copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  *
24  * https://www.FreeRTOS.org
25  * https://github.com/FreeRTOS
26  *
27  */
28 
29 
30 #ifndef PORTMACRO_H
31 #define PORTMACRO_H
32 
33 
34 /* *INDENT-OFF* */
35 #ifdef __cplusplus
36     extern "C" {
37 #endif
38 /* *INDENT-ON* */
39 
40 /*-----------------------------------------------------------
41  * Port specific definitions.
42  *
43  * The settings in this file configure FreeRTOS correctly for the
44  * given hardware and compiler.
45  *
46  * These settings should not be altered.
47  *-----------------------------------------------------------
48  */
49 
50 /* Type definitions. */
51 #define portCHAR          char
52 #define portFLOAT         float
53 #define portDOUBLE        double
54 #define portLONG          long
55 #define portSHORT         short
56 #define portSTACK_TYPE    uint32_t
57 #define portBASE_TYPE     long
58 
59 typedef portSTACK_TYPE   StackType_t;
60 typedef long             BaseType_t;
61 typedef unsigned long    UBaseType_t;
62 
63 #if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
64     typedef uint16_t     TickType_t;
65     #define portMAX_DELAY              ( TickType_t ) 0xffff
66 #elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
67     typedef uint32_t     TickType_t;
68     #define portMAX_DELAY              ( TickType_t ) 0xffffffffUL
69 
70 /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do
71  * not need to be guarded with a critical section. */
72     #define portTICK_TYPE_IS_ATOMIC    1
73 #else
74     #error "configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width."
75 #endif
76 
77 /* Errata 837070 workaround must be enabled on Cortex-M7 r0p0
78  * and r0p1 cores. */
79 #ifndef configENABLE_ERRATA_837070_WORKAROUND
80     #define configENABLE_ERRATA_837070_WORKAROUND    0
81 #endif
82 /*-----------------------------------------------------------*/
83 
84 /* MPU specific constants. */
85 #define portUSING_MPU_WRAPPERS                                   1
86 #define portPRIVILEGE_BIT                                        ( 0x80000000UL )
87 
88 #define portMPU_REGION_READ_WRITE                                ( 0x03UL << 24UL )
89 #define portMPU_REGION_PRIVILEGED_READ_ONLY                      ( 0x05UL << 24UL )
90 #define portMPU_REGION_READ_ONLY                                 ( 0x06UL << 24UL )
91 #define portMPU_REGION_PRIVILEGED_READ_WRITE                     ( 0x01UL << 24UL )
92 #define portMPU_REGION_PRIVILEGED_READ_WRITE_UNPRIV_READ_ONLY    ( 0x02UL << 24UL )
93 #define portMPU_REGION_CACHEABLE_BUFFERABLE                      ( 0x07UL << 16UL )
94 #define portMPU_REGION_EXECUTE_NEVER                             ( 0x01UL << 28UL )
95 
96 /* Location of the TEX,S,C,B bits in the MPU Region Attribute and Size
97  * Register (RASR). */
98 #define portMPU_RASR_TEX_S_C_B_LOCATION                          ( 16UL )
99 #define portMPU_RASR_TEX_S_C_B_MASK                              ( 0x3FUL )
100 
101 /* MPU settings that can be overridden in FreeRTOSConfig.h. */
102 #ifndef configTOTAL_MPU_REGIONS
103     /* Define to 8 for backward compatibility. */
104     #define configTOTAL_MPU_REGIONS    ( 8UL )
105 #endif
106 
107 /*
108  * The TEX, Shareable (S), Cacheable (C) and Bufferable (B) bits define the
109  * memory type, and where necessary the cacheable and shareable properties
110  * of the memory region.
111  *
112  * The TEX, C, and B bits together indicate the memory type of the region,
113  * and:
114  * - For Normal memory, the cacheable properties of the region.
115  * - For Device memory, whether the region is shareable.
116  *
117  * For Normal memory regions, the S bit indicates whether the region is
118  * shareable. For Strongly-ordered and Device memory, the S bit is ignored.
119  *
120  * See the following two tables for setting TEX, S, C and B bits for
121  * unprivileged flash, privileged flash and privileged RAM regions.
122  *
123  +-----+---+---+------------------------+--------------------------------------------------------+-------------------------+
124  | TEX | C | B | Memory type            |  Description or Normal region cacheability             |  Shareable?             |
125  +-----+---+---+------------------------+--------------------------------------------------------+-------------------------+
126  | 000 | 0 | 0 | Strongly-ordered       |  Strongly ordered                                      |  Shareable              |
127  +-----+---+---+------------------------+--------------------------------------------------------+-------------------------+
128  | 000 | 0 | 1 | Device                 |  Shared device                                         |  Shareable              |
129  +-----+---+---+------------------------+--------------------------------------------------------+-------------------------+
130  | 000 | 1 | 0 | Normal                 |  Outer and inner   write-through; no write allocate    |  S bit                  |
131  +-----+---+---+------------------------+--------------------------------------------------------+-------------------------+
132  | 000 | 1 | 1 | Normal                 |  Outer and inner   write-back; no write allocate       |  S bit                  |
133  +-----+---+---+------------------------+--------------------------------------------------------+-------------------------+
134  | 001 | 0 | 0 | Normal                 |  Outer and inner   Non-cacheable                       |  S bit                  |
135  +-----+---+---+------------------------+--------------------------------------------------------+-------------------------+
136  | 001 | 0 | 1 | Reserved               |  Reserved                                              |  Reserved               |
137  +-----+---+---+------------------------+--------------------------------------------------------+-------------------------+
138  | 001 | 1 | 0 | IMPLEMENTATION DEFINED |  IMPLEMENTATION DEFINED                                |  IMPLEMENTATION DEFINED |
139  +-----+---+---+------------------------+--------------------------------------------------------+-------------------------+
140  | 001 | 1 | 1 | Normal                 |  Outer and inner   write-back; write and read allocate |  S bit                  |
141  +-----+---+---+------------------------+--------------------------------------------------------+-------------------------+
142  | 010 | 0 | 0 | Device                 |  Non-shared device                                     |  Not shareable          |
143  +-----+---+---+------------------------+--------------------------------------------------------+-------------------------+
144  | 010 | 0 | 1 | Reserved               |  Reserved                                              |  Reserved               |
145  +-----+---+---+------------------------+--------------------------------------------------------+-------------------------+
146  | 010 | 1 | X | Reserved               |  Reserved                                              |  Reserved               |
147  +-----+---+---+------------------------+--------------------------------------------------------+-------------------------+
148  | 011 | X | X | Reserved               |  Reserved                                              |  Reserved               |
149  +-----+---+---+------------------------+--------------------------------------------------------+-------------------------+
150  | 1BB | A | A | Normal                 | Cached memory, with AA and BB indicating the inner and |  Reserved               |
151  |     |   |   |                        | outer cacheability rules that must be exported on the  |                         |
152  |     |   |   |                        | bus. See the table below for the cacheability policy   |                         |
153  |     |   |   |                        | encoding. memory, BB=Outer policy, AA=Inner policy.    |                         |
154  +-----+---+---+------------------------+--------------------------------------------------------+-------------------------+
155  |
156  +-----------------------------------------+----------------------------------------+
157  | AA or BB subfield of {TEX,C,B} encoding |  Cacheability policy                   |
158  +-----------------------------------------+----------------------------------------+
159  | 00                                      |  Non-cacheable                         |
160  +-----------------------------------------+----------------------------------------+
161  | 01                                      |  Write-back, write and   read allocate |
162  +-----------------------------------------+----------------------------------------+
163  | 10                                      |  Write-through, no write   allocate    |
164  +-----------------------------------------+----------------------------------------+
165  | 11                                      |  Write-back, no write   allocate       |
166  +-----------------------------------------+----------------------------------------+
167  */
168 
169 /* TEX, Shareable (S), Cacheable (C) and Bufferable (B) bits for flash
170  * region. */
171 #ifndef configTEX_S_C_B_FLASH
172     /* Default to TEX=000, S=1, C=1, B=1 for backward compatibility. */
173     #define configTEX_S_C_B_FLASH    ( 0x07UL )
174 #endif
175 
176 /* TEX, Shareable (S), Cacheable (C) and Bufferable (B) bits for RAM
177  * region. */
178 #ifndef configTEX_S_C_B_SRAM
179     /* Default to TEX=000, S=1, C=1, B=1 for backward compatibility. */
180     #define configTEX_S_C_B_SRAM          ( 0x07UL )
181 #endif
182 
183 #define portSTACK_REGION                  ( configTOTAL_MPU_REGIONS - 5UL )
184 #define portGENERAL_PERIPHERALS_REGION    ( configTOTAL_MPU_REGIONS - 4UL )
185 #define portUNPRIVILEGED_FLASH_REGION     ( configTOTAL_MPU_REGIONS - 3UL )
186 #define portPRIVILEGED_FLASH_REGION       ( configTOTAL_MPU_REGIONS - 2UL )
187 #define portPRIVILEGED_RAM_REGION         ( configTOTAL_MPU_REGIONS - 1UL )
188 #define portFIRST_CONFIGURABLE_REGION     ( 0UL )
189 #define portLAST_CONFIGURABLE_REGION      ( configTOTAL_MPU_REGIONS - 6UL )
190 #define portNUM_CONFIGURABLE_REGIONS      ( configTOTAL_MPU_REGIONS - 5UL )
191 #define portTOTAL_NUM_REGIONS_IN_TCB      ( portNUM_CONFIGURABLE_REGIONS + 1 ) /* Plus 1 to create space for the stack region. */
192 
193 typedef struct MPU_REGION_REGISTERS
194 {
195     uint32_t ulRegionBaseAddress;
196     uint32_t ulRegionAttribute;
197 } xMPU_REGION_REGISTERS;
198 
199 typedef struct MPU_REGION_SETTINGS
200 {
201     uint32_t ulRegionStartAddress;
202     uint32_t ulRegionEndAddress;
203     uint32_t ulRegionPermissions;
204 } xMPU_REGION_SETTINGS;
205 
206 #if ( configUSE_MPU_WRAPPERS_V1 == 0 )
207 
208     #ifndef configSYSTEM_CALL_STACK_SIZE
209         #error "configSYSTEM_CALL_STACK_SIZE must be defined to the desired size of the system call stack in words for using MPU wrappers v2."
210     #endif
211 
212     typedef struct SYSTEM_CALL_STACK_INFO
213     {
214         uint32_t ulSystemCallStackBuffer[ configSYSTEM_CALL_STACK_SIZE ];
215         uint32_t * pulSystemCallStack;
216         uint32_t * pulTaskStack;
217         uint32_t ulLinkRegisterAtSystemCallEntry;
218     } xSYSTEM_CALL_STACK_INFO;
219 
220 #endif /* configUSE_MPU_WRAPPERS_V1 == 0 */
221 
222 /*
223  * +---------+---------------+-----------------+-----------------+-----+
224  * | s16-s31 | s0-s15, FPSCR | CONTROL, r4-r11 | PSP, r0-r3, r12 |     |
225  * |         |               | EXC_RETURN      | LR, PC, xPSR    |     |
226  * +---------+---------------+-----------------+-----------------+-----+
227  *
228  * <--------><---------------><----------------><----------------><---->
229  *     16           17               10                 9           1
230  */
231 #define MAX_CONTEXT_SIZE                    ( 53 )
232 
233 /* Size of an Access Control List (ACL) entry in bits. */
234 #define portACL_ENTRY_SIZE_BITS             ( 32U )
235 
236 /* Flags used for xMPU_SETTINGS.ulTaskFlags member. */
237 #define portSTACK_FRAME_HAS_PADDING_FLAG    ( 1UL << 0UL )
238 #define portTASK_IS_PRIVILEGED_FLAG         ( 1UL << 1UL )
239 
240 typedef struct MPU_SETTINGS
241 {
242     xMPU_REGION_REGISTERS xRegion[ portTOTAL_NUM_REGIONS_IN_TCB ];
243     xMPU_REGION_SETTINGS xRegionSettings[ portTOTAL_NUM_REGIONS_IN_TCB ];
244     uint32_t ulContext[ MAX_CONTEXT_SIZE ];
245     uint32_t ulTaskFlags;
246 
247     #if ( configUSE_MPU_WRAPPERS_V1 == 0 )
248         xSYSTEM_CALL_STACK_INFO xSystemCallStackInfo;
249         #if ( configENABLE_ACCESS_CONTROL_LIST == 1 )
250             uint32_t ulAccessControlList[ ( configPROTECTED_KERNEL_OBJECT_POOL_SIZE / portACL_ENTRY_SIZE_BITS ) + 1 ];
251         #endif
252     #endif
253 } xMPU_SETTINGS;
254 
255 /* Architecture specifics. */
256 #define portSTACK_GROWTH      ( -1 )
257 #define portTICK_PERIOD_MS    ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
258 #define portBYTE_ALIGNMENT    8
259 #define portDONT_DISCARD      __attribute__( ( used ) )
260 /*-----------------------------------------------------------*/
261 
262 /* SVC numbers for various services. */
263 #define portSVC_START_SCHEDULER        100
264 #define portSVC_YIELD                  101
265 #define portSVC_RAISE_PRIVILEGE        102
266 #define portSVC_SYSTEM_CALL_EXIT       103
267 
268 /* Scheduler utilities. */
269 
270 #define portYIELD()    __asm volatile ( "   SVC %0  \n" ::"i" ( portSVC_YIELD ) : "memory" )
271 #define portYIELD_WITHIN_API()                          \
272     {                                                   \
273         /* Set a PendSV to request a context switch. */ \
274         portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; \
275                                                         \
276         /* Barriers are normally not required but do ensure the code is completely \
277          * within the specified behaviour for the architecture. */ \
278         __asm volatile ( "dsb" ::: "memory" );                     \
279         __asm volatile ( "isb" );                                  \
280     }
281 
282 #define portNVIC_INT_CTRL_REG     ( *( ( volatile uint32_t * ) 0xe000ed04 ) )
283 #define portNVIC_PENDSVSET_BIT    ( 1UL << 28UL )
284 #define portEND_SWITCHING_ISR( xSwitchRequired )            \
285     do                                                      \
286     {                                                       \
287         if( xSwitchRequired )                               \
288         {                                                   \
289             traceISR_EXIT_TO_SCHEDULER();                   \
290             portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; \
291         }                                                   \
292         else                                                \
293         {                                                   \
294             traceISR_EXIT();                                \
295         }                                                   \
296     } while( 0 )
297 #define portYIELD_FROM_ISR( x )    portEND_SWITCHING_ISR( x )
298 /*-----------------------------------------------------------*/
299 
300 /* Critical section management. */
301 extern void vPortEnterCritical( void );
302 extern void vPortExitCritical( void );
303 #define portSET_INTERRUPT_MASK_FROM_ISR()         ulPortRaiseBASEPRI()
304 #define portCLEAR_INTERRUPT_MASK_FROM_ISR( x )    vPortSetBASEPRI( x )
305 #define portDISABLE_INTERRUPTS()                  vPortRaiseBASEPRI()
306 #define portENABLE_INTERRUPTS()                   vPortSetBASEPRI( 0 )
307 #define portENTER_CRITICAL()                      vPortEnterCritical()
308 #define portEXIT_CRITICAL()                       vPortExitCritical()
309 
310 /*-----------------------------------------------------------*/
311 
312 /* Task function macros as described on the FreeRTOS.org WEB site.  These are
313  * not necessary for to use this port.  They are defined so the common demo files
314  * (which build with all the ports) will build. */
315 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters )    void vFunction( void * pvParameters )
316 #define portTASK_FUNCTION( vFunction, pvParameters )          void vFunction( void * pvParameters )
317 /*-----------------------------------------------------------*/
318 
319 /* Architecture specific optimisations. */
320 #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
321     #define configUSE_PORT_OPTIMISED_TASK_SELECTION    1
322 #endif
323 
324 #if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1
325 
326 /* Generic helper function. */
ucPortCountLeadingZeros(uint32_t ulBitmap)327     __attribute__( ( always_inline ) ) static inline uint8_t ucPortCountLeadingZeros( uint32_t ulBitmap )
328     {
329         uint8_t ucReturn;
330 
331         __asm volatile ( "clz %0, %1" : "=r" ( ucReturn ) : "r" ( ulBitmap ) : "memory" );
332 
333         return ucReturn;
334     }
335 
336 /* Check the configuration. */
337     #if ( configMAX_PRIORITIES > 32 )
338         #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."
339     #endif
340 
341 /* Store/clear the ready priorities in a bit map. */
342     #define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities )    ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )
343     #define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities )     ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) )
344 
345 /*-----------------------------------------------------------*/
346 
347     #define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities )    uxTopPriority = ( 31UL - ( uint32_t ) ucPortCountLeadingZeros( ( uxReadyPriorities ) ) )
348 
349 #endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */
350 
351 /*-----------------------------------------------------------*/
352 
353 #if ( configASSERT_DEFINED == 1 )
354     void vPortValidateInterruptPriority( void );
355     #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()    vPortValidateInterruptPriority()
356 #endif
357 
358 /* portNOP() is not required by this port. */
359 #define portNOP()
360 
361 #define portINLINE              __inline
362 
363 #ifndef portFORCE_INLINE
364     #define portFORCE_INLINE    inline __attribute__( ( always_inline ) )
365 #endif
366 /*-----------------------------------------------------------*/
367 
368 extern BaseType_t xIsPrivileged( void );
369 extern void vResetPrivilege( void );
370 extern void vPortSwitchToUserMode( void );
371 
372 /**
373  * @brief Checks whether or not the processor is privileged.
374  *
375  * @return 1 if the processor is already privileged, 0 otherwise.
376  */
377 #define portIS_PRIVILEGED()          xIsPrivileged()
378 
379 /**
380  * @brief Raise an SVC request to raise privilege.
381  */
382 #define portRAISE_PRIVILEGE()        __asm volatile ( "svc %0 \n" ::"i" ( portSVC_RAISE_PRIVILEGE ) : "memory" );
383 
384 /**
385  * @brief Lowers the privilege level by setting the bit 0 of the CONTROL
386  * register.
387  */
388 #define portRESET_PRIVILEGE()        vResetPrivilege()
389 
390 /**
391  * @brief Make a task unprivileged.
392  *
393  * It must be called from privileged tasks only. Calling it from unprivileged
394  * task will result in a memory protection fault.
395  */
396 #define portSWITCH_TO_USER_MODE()    vPortSwitchToUserMode()
397 /*-----------------------------------------------------------*/
398 
399 extern BaseType_t xPortIsTaskPrivileged( void );
400 
401 /**
402  * @brief Checks whether or not the calling task is privileged.
403  *
404  * @return pdTRUE if the calling task is privileged, pdFALSE otherwise.
405  */
406 #define portIS_TASK_PRIVILEGED()    xPortIsTaskPrivileged()
407 /*-----------------------------------------------------------*/
408 
xPortIsInsideInterrupt(void)409 portFORCE_INLINE static BaseType_t xPortIsInsideInterrupt( void )
410 {
411     uint32_t ulCurrentInterrupt;
412     BaseType_t xReturn;
413 
414     /* Obtain the number of the currently executing interrupt. */
415     __asm volatile ( "mrs %0, ipsr" : "=r" ( ulCurrentInterrupt )::"memory" );
416 
417     if( ulCurrentInterrupt == 0 )
418     {
419         xReturn = pdFALSE;
420     }
421     else
422     {
423         xReturn = pdTRUE;
424     }
425 
426     return xReturn;
427 }
428 
429 /*-----------------------------------------------------------*/
430 
vPortRaiseBASEPRI(void)431 portFORCE_INLINE static void vPortRaiseBASEPRI( void )
432 {
433     uint32_t ulNewBASEPRI;
434 
435     __asm volatile
436     (
437         "   mov %0, %1                                              \n"
438         #if ( configENABLE_ERRATA_837070_WORKAROUND == 1 )
439             "   cpsid i                                             \n" /* ARM Cortex-M7 r0p1 Errata 837070 workaround. */
440         #endif
441         "   msr basepri, %0                                         \n"
442         "   isb                                                     \n"
443         "   dsb                                                     \n"
444         #if ( configENABLE_ERRATA_837070_WORKAROUND == 1 )
445             "   cpsie i                                             \n" /* ARM Cortex-M7 r0p1 Errata 837070 workaround. */
446         #endif
447         : "=r" ( ulNewBASEPRI ) : "i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY ) : "memory"
448     );
449 }
450 
451 /*-----------------------------------------------------------*/
452 
ulPortRaiseBASEPRI(void)453 portFORCE_INLINE static uint32_t ulPortRaiseBASEPRI( void )
454 {
455     uint32_t ulOriginalBASEPRI, ulNewBASEPRI;
456 
457     __asm volatile
458     (
459         "   mrs %0, basepri                                         \n"
460         "   mov %1, %2                                              \n"
461         #if ( configENABLE_ERRATA_837070_WORKAROUND == 1 )
462             "   cpsid i                                             \n" /* ARM Cortex-M7 r0p1 Errata 837070 workaround. */
463         #endif
464         "   msr basepri, %1                                         \n"
465         "   isb                                                     \n"
466         "   dsb                                                     \n"
467         #if ( configENABLE_ERRATA_837070_WORKAROUND == 1 )
468             "   cpsie i                                             \n" /* ARM Cortex-M7 r0p1 Errata 837070 workaround. */
469         #endif
470         : "=r" ( ulOriginalBASEPRI ), "=r" ( ulNewBASEPRI ) : "i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY ) : "memory"
471     );
472 
473     /* This return will not be reached but is necessary to prevent compiler
474      * warnings. */
475     return ulOriginalBASEPRI;
476 }
477 /*-----------------------------------------------------------*/
478 
vPortSetBASEPRI(uint32_t ulNewMaskValue)479 portFORCE_INLINE static void vPortSetBASEPRI( uint32_t ulNewMaskValue )
480 {
481     __asm volatile
482     (
483         "   msr basepri, %0 " ::"r" ( ulNewMaskValue ) : "memory"
484     );
485 }
486 /*-----------------------------------------------------------*/
487 
488 #define portMEMORY_BARRIER()    __asm volatile ( "" ::: "memory" )
489 
490 #ifndef configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY
491     #warning "configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY is not defined. We recommend defining it to 1 in FreeRTOSConfig.h for better security. www.FreeRTOS.org/FreeRTOS-V10.3.x.html"
492     #define configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY    0
493 #endif
494 /*-----------------------------------------------------------*/
495 
496 /* *INDENT-OFF* */
497     #ifdef __cplusplus
498         }
499     #endif
500 /* *INDENT-ON* */
501 
502 #endif /* PORTMACRO_H */
503