ChibiOS  21.6.0
chtypes.h
Go to the documentation of this file.
1 /*
2  ChibiOS - Copyright (C) 2006,2007,2008,2009,2010,2011,2012,2013,2014,
3  2015,2016,2017,2018,2019,2020,2021 Giovanni Di Sirio.
4 
5  This file is part of ChibiOS.
6 
7  ChibiOS is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation version 3 of the License.
10 
11  ChibiOS is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 /**
21  * @file templates/chtypes.h
22  * @brief Template port system types.
23  *
24  * @addtogroup port_types
25  * @{
26  */
27 
28 #ifndef CHTYPES_H
29 #define CHTYPES_H
30 
31 #include <stddef.h>
32 #include <stdint.h>
33 #include <stdbool.h>
34 
35 #include "ccportab.h"
36 
37 /**
38  * @name Architecture data constraints
39  * @{
40  */
41 #define PORT_ARCH_SIZEOF_DATA_PTR 4
42 #define PORT_ARCH_SIZEOF_CODE_PTR 4
43 #define PORT_ARCH_REGISTERS_WIDTH 32
44 #define PORT_ARCH_REVERSE_ORDER 1
45 /** @} */
46 
47 /**
48  * @name Port types
49  * @{
50  */
51 /**
52  * @brief Realtime counter.
53  */
54 typedef uint32_t port_rtcnt_t;
55 
56 /**
57  * @brief Realtime accumulator.
58  */
59 typedef uint64_t port_rttime_t;
60 
61 /**
62  * @brief System status word.
63  */
64 typedef uint32_t port_syssts_t;
65 
66 /**
67  * @brief Type of stack and memory alignment enforcement.
68  * @note In this architecture the stack alignment is enforced to 64 bits,
69  * 32 bits alignment is supported by hardware but deprecated by ARM,
70  * the implementation choice is to not offer the option.
71  */
72 typedef uint64_t port_stkalign_t;
73 /** @} */
74 
75 /**
76  * @brief This port does not define OS-related types.
77  */
78 #define PORT_DOES_NOT_PROVIDE_TYPES
79 
80 /**
81  * @brief ROM constant modifier.
82  * @note It is set to use the "const" keyword in this port.
83  */
84 #define ROMCONST CC_ROMCONST
85 
86 /**
87  * @brief Makes functions not inlineable.
88  * @note If the compiler does not support such attribute then some
89  * time-dependent services could be degraded.
90  */
91 #define NOINLINE CC_NO_INLINE
92 
93 /**
94  * @brief Memory alignment enforcement for variables.
95  */
96 #define ALIGNED_VAR(n) CC_ALIGN_DATA(n)
97 
98 /**
99  * @brief Size of a pointer.
100  * @note To be used where the sizeof operator cannot be used, preprocessor
101  * expressions for example.
102  */
103 #define SIZEOF_PTR PORT_ARCH_SIZEOF_DATA_PTR
104 
105 #endif /* CHTYPES_H */
106 
107 /** @} */
port_stkalign_t
uint64_t port_stkalign_t
Type of stack and memory alignment enforcement.
Definition: chtypes.h:72
port_rtcnt_t
uint32_t port_rtcnt_t
Realtime counter.
Definition: chtypes.h:54
port_rttime_t
uint64_t port_rttime_t
Realtime accumulator.
Definition: chtypes.h:59
port_syssts_t
uint32_t port_syssts_t
System status word.
Definition: chtypes.h:64