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