]> git.proxmox.com Git - mirror_edk2.git/blame - EmbeddedPkg/Include/libfdt_env.h
EmbeddedPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / EmbeddedPkg / Include / libfdt_env.h
CommitLineData
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
15typedef UINT16 fdt16_t;\r
16typedef UINT32 fdt32_t;\r
17typedef UINT64 fdt64_t;\r
18\r
1e57a462 19typedef UINT8 uint8_t;\r
20typedef UINT16 uint16_t;\r
21typedef UINT32 uint32_t;\r
22typedef UINT64 uint64_t;\r
23typedef UINTN uintptr_t;\r
24typedef UINTN size_t;\r
25\r
3e8576dd 26static 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 32static 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 38static 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
44static inline void* memcpy(void* dest, const void* src, size_t len) {\r
45 return CopyMem (dest, src, len);\r
46}\r
47\r
48static inline void *memmove(void *dest, const void *src, size_t n) {\r
49 return CopyMem (dest, src, n);\r
50}\r
51\r
52static inline void *memset(void *s, int c, size_t n) {\r
53 return SetMem (s, n, c);\r
54}\r
55\r
56static inline int memcmp(const void* dest, const void* src, int len) {\r
57 return CompareMem (dest, src, len);\r
58}\r
59\r
60static inline void *memchr(const void *s, int c, size_t n) {\r
61 return ScanMem8 (s, n, c);\r
62}\r
63\r
64static inline size_t strlen (const char* str) {\r
65 return AsciiStrLen (str);\r
66}\r
67\r
68static 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
75static inline size_t strnlen (const char* str, size_t strsz ) {\r
76 return AsciiStrnLenS (str, strsz);\r
77}\r
78\r
1e57a462 79#endif /* _LIBFDT_ENV_H */\r