2 * FreeRTOS Kernel V10.4.4
3 * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5 * SPDX-License-Identifier: MIT
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:
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
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.
24 * https://www.FreeRTOS.org
25 * https://github.com/FreeRTOS
29 #ifndef __PORTMACRO_H__
30 #define __PORTMACRO_H__
32 /*-----------------------------------------------------------
33 * Port specific definitions.
35 * The settings in this file configure FreeRTOS correctly for the
36 * given hardware and compiler.
38 * These settings should not be altered.
39 *-----------------------------------------------------------
42 /* Type definitions. */
44 #define portFLOAT float
45 #define portDOUBLE double
47 #define portSHORT short
48 #define portSTACK_TYPE uint32_t
49 #define portBASE_TYPE long
51 typedef portSTACK_TYPE StackType_t;
52 typedef long BaseType_t;
53 typedef unsigned long UBaseType_t;
55 #if (configUSE_16_BIT_TICKS == 1)
56 typedef uint16_t TickType_t;
57 #define portMAX_DELAY (TickType_t) 0xFFFF
59 typedef uint32_t TickType_t;
60 #define portMAX_DELAY (TickType_t) 0xFFFFFFFFF
62 /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do
63 not need to be guarded with a critical section. */
64 #define portTICK_TYPE_IS_ATOMIC 1
68 /* Architecture specifics. */
69 #define portSTACK_GROWTH (-1)
70 #define portTICK_PERIOD_MS ((TickType_t) 1000 / configTICK_RATE_HZ)
71 #define portBYTE_ALIGNMENT 8
73 /* Critical section handling. */
74 extern void vPortEnterCritical(void);
75 extern void vPortExitCritical(void);
76 #define portENTER_CRITICAL() vPortEnterCritical()
77 #define portEXIT_CRITICAL() vPortExitCritical()
78 #define portDISABLE_INTERRUPTS() asm( " CPSID I" )
79 #define portENABLE_INTERRUPTS() asm( " CPSIE I" )
81 /* Scheduler utilities. */
82 #pragma SWI_ALIAS( vPortYield, 0 )
83 extern void vPortYield( void );
84 #define portYIELD() vPortYield()
85 #define portSYS_SSIR1_REG ( * ( ( volatile uint32_t * ) 0xFFFFFFB0 ) )
86 #define portSYS_SSIR1_SSKEY ( 0x7500UL )
87 #define portYIELD_WITHIN_API() { portSYS_SSIR1_REG = portSYS_SSIR1_SSKEY; asm( " DSB " ); asm( " ISB " ); }
88 #define portYIELD_FROM_ISR( x ) do { if( x != pdFALSE ) { portSYS_SSIR1_REG = portSYS_SSIR1_SSKEY; ( void ) portSYS_SSIR1_REG; } } while( 0 )
90 #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
91 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
94 /* Architecture specific optimisations. */
95 #if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1
97 /* Check the configuration. */
98 #if( configMAX_PRIORITIES > 32 )
99 #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.
102 /* Store/clear the ready priorities in a bit map. */
103 #define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )
104 #define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) )
106 /*-----------------------------------------------------------*/
108 #define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31 - __clz( ( uxReadyPriorities ) ) )
110 #endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */
113 /* Task function macros as described on the FreeRTOS.org WEB site. */
114 #define portTASK_FUNCTION(vFunction, pvParameters) void vFunction(void *pvParameters)
115 #define portTASK_FUNCTION_PROTO(vFunction, pvParameters) void vFunction(void *pvParameters)
117 #endif /* __PORTMACRO_H__ */