2021-01-12 18:22:11 +00:00
|
|
|
/* SPDX-License-Identifier: MIT */
|
|
|
|
|
|
|
|
#ifndef TYPES_H
|
|
|
|
#define TYPES_H
|
|
|
|
|
2021-05-08 12:54:07 +00:00
|
|
|
#ifndef __ASSEMBLER__
|
|
|
|
|
2021-03-07 16:31:14 +00:00
|
|
|
#include <limits.h>
|
2021-04-15 13:45:58 +00:00
|
|
|
#include <stdbool.h>
|
2021-01-12 18:22:11 +00:00
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
typedef uint8_t u8;
|
|
|
|
typedef uint16_t u16;
|
|
|
|
typedef uint32_t u32;
|
|
|
|
typedef uint64_t u64;
|
|
|
|
|
|
|
|
typedef int8_t s8;
|
|
|
|
typedef int16_t s16;
|
|
|
|
typedef int32_t s32;
|
|
|
|
typedef int64_t s64;
|
|
|
|
|
|
|
|
typedef u64 uintptr_t;
|
|
|
|
typedef s64 ptrdiff_t;
|
|
|
|
|
2021-04-15 13:45:58 +00:00
|
|
|
typedef s64 ssize_t;
|
|
|
|
|
2021-05-08 12:54:07 +00:00
|
|
|
#endif
|
|
|
|
|
2021-01-28 06:27:35 +00:00
|
|
|
#define UNUSED(x) (void)(x)
|
2021-01-12 18:22:11 +00:00
|
|
|
#define ALIGNED(x) __attribute__((aligned(x)))
|
2021-01-28 06:27:35 +00:00
|
|
|
#define PACKED __attribute__((packed))
|
|
|
|
|
|
|
|
#define STACK_ALIGN(type, name, cnt, alignment) \
|
|
|
|
u8 _al__##name[((sizeof(type) * (cnt)) + (alignment) + \
|
|
|
|
(((sizeof(type) * (cnt)) % (alignment)) > 0 \
|
|
|
|
? ((alignment) - ((sizeof(type) * (cnt)) % (alignment))) \
|
|
|
|
: 0))]; \
|
|
|
|
type *name = \
|
|
|
|
(type *)(((u32)(_al__##name)) + ((alignment) - (((u32)(_al__##name)) & ((alignment)-1))))
|
|
|
|
|
2021-01-12 18:22:11 +00:00
|
|
|
#define HAVE_PTRDIFF_T 1
|
|
|
|
#define HAVE_UINTPTR_T 1
|
2021-01-28 06:27:35 +00:00
|
|
|
#define UPTRDIFF_T uintptr_t
|
2021-01-12 18:22:11 +00:00
|
|
|
|
2021-04-09 06:13:19 +00:00
|
|
|
#define SZ_2K (1 << 11)
|
|
|
|
#define SZ_16K (1 << 14)
|
|
|
|
#define SZ_1M (1 << 20)
|
|
|
|
|
2021-05-25 10:51:08 +00:00
|
|
|
#ifdef __ASSEMBLER__
|
|
|
|
|
2021-05-08 12:54:07 +00:00
|
|
|
#define sys_reg(op0, op1, CRn, CRm, op2) s##op0##_##op1##_c##CRn##_c##CRm##_##op2
|
|
|
|
|
2021-05-25 10:51:08 +00:00
|
|
|
#else
|
|
|
|
|
|
|
|
#define sys_reg(op0, op1, CRn, CRm, op2) , _S, op0, op1, CRn, CRm, op2
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2021-01-12 18:22:11 +00:00
|
|
|
#endif
|