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