xref: /optee_os/lib/libutils/ext/include/types_ext.h (revision 88824fa441ddb8671a79b32a175731f48238f649)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2014, STMicroelectronics International N.V.
4  */
5 #ifndef __TYPES_EXT_H
6 #define __TYPES_EXT_H
7 
8 #include <limits.h>
9 #include <stddef.h>
10 #include <inttypes.h>
11 #include <stdbool.h>
12 #include <unistd.h>
13 
14 typedef uintptr_t uaddr_t;
15 #define PRIxUA	PRIxPTR
16 
17 typedef uintptr_t vaddr_t;
18 #define PRIxVA	PRIxPTR
19 
20 #if defined(__ILP32__) && defined(CFG_CORE_LARGE_PHYS_ADDR)
21 typedef uint64_t paddr_t;
22 typedef uint64_t paddr_size_t;
23 #define PADDR_MAX		UINT64_MAX
24 #define PADDR_SIZE_MAX		UINT64_MAX
25 #define PRIxPA			PRIx64
26 #define PRIxPASZ		PRIx64
27 #define __SIZEOF_PADDR__	8
28 #else
29 typedef uintptr_t paddr_t;
30 typedef uintptr_t paddr_size_t;
31 #define PADDR_MAX		UINTPTR_MAX
32 #define PADDR_SIZE_MAX		UINTPTR_MAX
33 #define PRIxPA			PRIxPTR
34 #define PRIxPASZ		PRIxPTR
35 #define __SIZEOF_PADDR__	__SIZEOF_POINTER__
36 #endif
37 
38 #define PRIxVA_WIDTH	((int)(sizeof(vaddr_t) * 2))
39 #define PRIxPA_WIDTH	((int)(sizeof(paddr_t) * 2))
40 
41 #endif /* __TYPES_EXT_H */
42