Commit | Line | Data |
---|---|---|
1e57a462 | 1 | /** @file\r |
2 | *\r | |
3e8576dd | 3 | * Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r |
1e57a462 | 4 | *\r |
3402aac7 RC |
5 | * This program and the accompanying materials\r |
6 | * are licensed and made available under the terms and conditions of the BSD License\r | |
7 | * which accompanies this distribution. The full text of the license may be found at\r | |
8 | * http://opensource.org/licenses/bsd-license.php\r | |
9 | *\r | |
10 | * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
1e57a462 | 12 | *\r |
13 | **/\r | |
14 | \r | |
15 | #ifndef _LIBFDT_ENV_H\r | |
16 | #define _LIBFDT_ENV_H\r | |
17 | \r | |
18 | #include <Library/BaseLib.h>\r | |
19 | #include <Library/BaseMemoryLib.h>\r | |
20 | \r | |
3e8576dd OM |
21 | typedef UINT16 fdt16_t;\r |
22 | typedef UINT32 fdt32_t;\r | |
23 | typedef UINT64 fdt64_t;\r | |
24 | \r | |
1e57a462 | 25 | typedef UINT8 uint8_t;\r |
26 | typedef UINT16 uint16_t;\r | |
27 | typedef UINT32 uint32_t;\r | |
28 | typedef UINT64 uint64_t;\r | |
29 | typedef UINTN uintptr_t;\r | |
30 | typedef UINTN size_t;\r | |
31 | \r | |
3e8576dd | 32 | static inline uint16_t fdt16_to_cpu(fdt16_t x)\r |
1e57a462 | 33 | {\r |
34 | return SwapBytes16 (x);\r | |
35 | }\r | |
36 | #define cpu_to_fdt16(x) fdt16_to_cpu(x)\r | |
37 | \r | |
3e8576dd | 38 | static inline uint32_t fdt32_to_cpu(fdt32_t x)\r |
1e57a462 | 39 | {\r |
40 | return SwapBytes32 (x);\r | |
41 | }\r | |
42 | #define cpu_to_fdt32(x) fdt32_to_cpu(x)\r | |
43 | \r | |
3e8576dd | 44 | static inline uint64_t fdt64_to_cpu(fdt64_t x)\r |
1e57a462 | 45 | {\r |
46 | return SwapBytes64 (x);\r | |
47 | }\r | |
48 | #define cpu_to_fdt64(x) fdt64_to_cpu(x)\r | |
49 | \r | |
50 | static inline void* memcpy(void* dest, const void* src, size_t len) {\r | |
51 | return CopyMem (dest, src, len);\r | |
52 | }\r | |
53 | \r | |
54 | static inline void *memmove(void *dest, const void *src, size_t n) {\r | |
55 | return CopyMem (dest, src, n);\r | |
56 | }\r | |
57 | \r | |
58 | static inline void *memset(void *s, int c, size_t n) {\r | |
59 | return SetMem (s, n, c);\r | |
60 | }\r | |
61 | \r | |
62 | static inline int memcmp(const void* dest, const void* src, int len) {\r | |
63 | return CompareMem (dest, src, len);\r | |
64 | }\r | |
65 | \r | |
66 | static inline void *memchr(const void *s, int c, size_t n) {\r | |
67 | return ScanMem8 (s, n, c);\r | |
68 | }\r | |
69 | \r | |
70 | static inline size_t strlen (const char* str) {\r | |
71 | return AsciiStrLen (str);\r | |
72 | }\r | |
73 | \r | |
74 | static inline char *strchr(const char *s, int c) {\r | |
75 | char pattern[2];\r | |
76 | pattern[0] = c;\r | |
77 | pattern[1] = 0;\r | |
78 | return AsciiStrStr (s, pattern);\r | |
79 | }\r | |
80 | \r | |
81 | #endif /* _LIBFDT_ENV_H */\r |