1 /*
2  * FreeRTOS Kernel V10.2.0
3  * Copyright (C) 2019 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy
6  * of this software and associated documentation files (the "Software"), to deal
7  * in the Software without restriction, including without limitation the rights
8  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9  * copies of the Software, and to permit persons to whom the Software is
10  * furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21  * SOFTWARE.
22  *
23  * http://www.FreeRTOS.org
24  * http://aws.amazon.com/freertos
25  *
26  * 1 tab == 4 spaces!
27  */
28 
29 #ifndef PORTMACRO_H
30 #define PORTMACRO_H
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /*-----------------------------------------------------------
37  * Port specific definitions.
38  *
39  * The settings in this file configure FreeRTOS correctly for the given hardware
40  * and compiler.
41  *
42  * These settings should not be altered.
43  *-----------------------------------------------------------
44  */
45 
46 /* Type definitions. */
47 #define portCHAR char
48 #define portFLOAT float
49 #define portDOUBLE double
50 #define portLONG long
51 #define portSHORT short
52 #define portSTACK_TYPE size_t
53 #define portBASE_TYPE long
54 
55 typedef portSTACK_TYPE StackType_t;
56 typedef portBASE_TYPE BaseType_t;
57 typedef uint64_t UBaseType_t;
58 
59 typedef uint64_t TickType_t;
60 #define portMAX_DELAY ((TickType_t)0xffffffffffffffff)
61 
62 /*-----------------------------------------------------------*/
63 
64 /* Task utilities. */
65 
66 #define portYIELD() __asm volatile("SVC 0" ::: "memory")
67 
68 /*-----------------------------------------------------------
69  * Critical section control
70  *----------------------------------------------------------*/
71 
72 extern void vPortEnterCritical(void);
73 extern void vPortExitCritical(void);
74 
75 #define portDISABLE_INTERRUPTS() \
76     __asm volatile("MSR DAIFSET, #1" ::: "memory"); \
77     __asm volatile("DSB SY"); \
78     __asm volatile("ISB SY");
79 
80 #define portENABLE_INTERRUPTS() \
81     __asm volatile("MSR DAIFCLR, #1" ::: "memory"); \
82     __asm volatile("DSB SY"); \
83     __asm volatile("ISB SY");
84 
85 /* These macros do not globally disable/enable interrupts.  They do mask off
86 interrupts that have a priority below configMAX_API_CALL_INTERRUPT_PRIORITY. */
87 #define portENTER_CRITICAL() vPortEnterCritical();
88 #define portEXIT_CRITICAL() vPortExitCritical();
89 
90 /*-----------------------------------------------------------*/
91 
92 /* Task function macros as described on the FreeRTOS.org WEB site.  These are
93 not required for this port but included in case common demo code that uses these
94 macros is used. */
95 #define portTASK_FUNCTION_PROTO(vFunction, pvParameters) \
96     void vFunction(void *pvParameters)
97 #define portTASK_FUNCTION(vFunction, pvParameters) \
98     void vFunction(void *pvParameters)
99 
100 /* Prototype of the FreeRTOS tick handler.  This must be installed as the
101 handler for whichever peripheral is used to generate the RTOS tick. */
102 void FreeRTOS_Tick_Handler(void);
103 
104 /*-----------------------------------------------------------*/
105 
106 /* Hardware specifics. */
107 #define portSTACK_GROWTH (-1)
108 #define portTICK_PERIOD_MS ((TickType_t)1000 / configTICK_RATE_HZ)
109 #define portBYTE_ALIGNMENT 16
110 #define portPOINTER_SIZE_TYPE uint64_t
111 
112 #ifdef __cplusplus
113 } /* extern C */
114 #endif
115 
116 #endif /* PORTMACRO_H */
117