]> git.proxmox.com Git - mirror_edk2.git/blob - EmbeddedPkg/Include/libfdt_env.h
ArmPkg: only attempt buildin MmCommunicationDxe for AArch64
[mirror_edk2.git] / EmbeddedPkg / Include / libfdt_env.h
1 /** @file
2 *
3 * Copyright (c) 2011-2014, ARM Limited. All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-2-Clause-Patent
6 *
7 **/
8
9 #ifndef _LIBFDT_ENV_H
10 #define _LIBFDT_ENV_H
11
12 #include <Library/BaseLib.h>
13 #include <Library/BaseMemoryLib.h>
14
15 typedef UINT16 fdt16_t;
16 typedef UINT32 fdt32_t;
17 typedef UINT64 fdt64_t;
18
19 typedef UINT8 uint8_t;
20 typedef UINT16 uint16_t;
21 typedef UINT32 uint32_t;
22 typedef UINT64 uint64_t;
23 typedef UINTN uintptr_t;
24 typedef UINTN size_t;
25
26 static inline uint16_t fdt16_to_cpu(fdt16_t x)
27 {
28 return SwapBytes16 (x);
29 }
30 #define cpu_to_fdt16(x) fdt16_to_cpu(x)
31
32 static inline uint32_t fdt32_to_cpu(fdt32_t x)
33 {
34 return SwapBytes32 (x);
35 }
36 #define cpu_to_fdt32(x) fdt32_to_cpu(x)
37
38 static inline uint64_t fdt64_to_cpu(fdt64_t x)
39 {
40 return SwapBytes64 (x);
41 }
42 #define cpu_to_fdt64(x) fdt64_to_cpu(x)
43
44 static inline void* memcpy(void* dest, const void* src, size_t len) {
45 return CopyMem (dest, src, len);
46 }
47
48 static inline void *memmove(void *dest, const void *src, size_t n) {
49 return CopyMem (dest, src, n);
50 }
51
52 static inline void *memset(void *s, int c, size_t n) {
53 return SetMem (s, n, c);
54 }
55
56 static inline int memcmp(const void* dest, const void* src, int len) {
57 return CompareMem (dest, src, len);
58 }
59
60 static inline void *memchr(const void *s, int c, size_t n) {
61 return ScanMem8 (s, n, c);
62 }
63
64 static inline size_t strlen (const char* str) {
65 return AsciiStrLen (str);
66 }
67
68 static inline char *strchr(const char *s, int c) {
69 char pattern[2];
70 pattern[0] = c;
71 pattern[1] = 0;
72 return AsciiStrStr (s, pattern);
73 }
74
75 static inline size_t strnlen (const char* str, size_t strsz ) {
76 return AsciiStrnLenS (str, strsz);
77 }
78
79 #endif /* _LIBFDT_ENV_H */