Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Toggle main menu visibility
Loading...
Searching...
No Matches
sapi_types.h
Go to the documentation of this file.
1
15
#ifndef SAFEAPI_COMMON_TYPES_H
16
#define SAFEAPI_COMMON_TYPES_H
17
18
#include <stdbool.h>
19
#include <stddef.h>
20
#include <stdint.h>
21
22
#ifdef __cplusplus
23
extern
"C"
{
24
#endif
25
27
typedef
uint32_t
sapi_duration_ms_t
;
28
30
typedef
uint64_t
sapi_timestamp_ms_t
;
31
36
#define SAFEAPI_STORAGE_ALIGN 8U
37
38
/* Portable alignment specifier: prefer C11 _Alignas, fall back to compiler
39
* builtins so the headers remain usable from strict C99 toolchains. */
50
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
51
#include <stdalign.h>
52
#define SAFEAPI_ALIGNED_(n) _Alignas(n)
53
#elif defined(_MSC_VER)
54
#define SAFEAPI_ALIGNED_(n) __declspec(align(n))
55
#elif defined(__GNUC__) || defined(__clang__)
56
#define SAFEAPI_ALIGNED_(n) __attribute__((aligned(n)))
57
#else
58
#define SAFEAPI_ALIGNED_(n)
/* no portable alignment available */
59
#endif
60
69
#define SAFEAPI_DECLARE_STORAGE(type_name, byte_size) \
70
typedef struct \
71
{ \
72
SAFEAPI_ALIGNED_(SAFEAPI_STORAGE_ALIGN) \
73
unsigned char reserved_[(byte_size)]; \
74
} type_name
75
76
#ifdef __cplusplus
77
}
78
#endif
79
80
#endif
/* SAFEAPI_COMMON_TYPES_H */
81
/* TYPES */
sapi_duration_ms_t
uint32_t sapi_duration_ms_t
Definition
sapi_types.h:27
sapi_timestamp_ms_t
uint64_t sapi_timestamp_ms_t
Definition
sapi_types.h:30
include
safeapi
utils
types
sapi_types.h
Generated by
1.18.0