]> git.proxmox.com Git - mirror_edk2.git/blame - EmbeddedPkg/Include/libfdt_env.h
ARM Packages: Fixed line endings
[mirror_edk2.git] / EmbeddedPkg / Include / libfdt_env.h
CommitLineData
1e57a462 1/** @file\r
2*\r
3* Copyright (c) 2011-2012, ARM Limited. All rights reserved.\r
4* \r
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
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
21typedef UINT8 uint8_t;\r
22typedef UINT16 uint16_t;\r
23typedef UINT32 uint32_t;\r
24typedef UINT64 uint64_t;\r
25typedef UINTN uintptr_t;\r
26typedef UINTN size_t;\r
27\r
28static inline uint16_t fdt16_to_cpu(uint16_t x)\r
29{\r
30 return SwapBytes16 (x);\r
31}\r
32#define cpu_to_fdt16(x) fdt16_to_cpu(x)\r
33\r
34static inline uint32_t fdt32_to_cpu(uint32_t x)\r
35{\r
36 return SwapBytes32 (x);\r
37}\r
38#define cpu_to_fdt32(x) fdt32_to_cpu(x)\r
39\r
40static inline uint64_t fdt64_to_cpu(uint64_t x)\r
41{\r
42 return SwapBytes64 (x);\r
43}\r
44#define cpu_to_fdt64(x) fdt64_to_cpu(x)\r
45\r
46static inline void* memcpy(void* dest, const void* src, size_t len) {\r
47 return CopyMem (dest, src, len);\r
48}\r
49\r
50static inline void *memmove(void *dest, const void *src, size_t n) {\r
51 return CopyMem (dest, src, n);\r
52}\r
53\r
54static inline void *memset(void *s, int c, size_t n) {\r
55 return SetMem (s, n, c);\r
56}\r
57\r
58static inline int memcmp(const void* dest, const void* src, int len) {\r
59 return CompareMem (dest, src, len);\r
60}\r
61\r
62static inline void *memchr(const void *s, int c, size_t n) {\r
63 return ScanMem8 (s, n, c);\r
64}\r
65\r
66static inline size_t strlen (const char* str) {\r
67 return AsciiStrLen (str);\r
68}\r
69\r
70static inline char *strchr(const char *s, int c) {\r
71 char pattern[2];\r
72 pattern[0] = c;\r
73 pattern[1] = 0;\r
74 return AsciiStrStr (s, pattern);\r
75}\r
76\r
77#endif /* _LIBFDT_ENV_H */\r