TianoCore EDK2 master
Loading...
Searching...
No Matches
libfdt_env.h
Go to the documentation of this file.
1
9#ifndef _LIBFDT_ENV_H
10#define _LIBFDT_ENV_H
11
12#include <Library/BaseLib.h>
14
15typedef UINT16 fdt16_t;
16typedef UINT32 fdt32_t;
17typedef UINT64 fdt64_t;
18
19typedef UINT8 uint8_t;
20typedef UINT16 uint16_t;
21typedef UINT32 uint32_t;
22typedef UINT64 uint64_t;
23typedef UINTN uintptr_t;
24typedef UINTN size_t;
25
26static inline uint16_t
27fdt16_to_cpu (
28 fdt16_t x
29 )
30{
31 return SwapBytes16 (x);
32}
33
34#define cpu_to_fdt16(x) fdt16_to_cpu(x)
35
36static inline uint32_t
37fdt32_to_cpu (
38 fdt32_t x
39 )
40{
41 return SwapBytes32 (x);
42}
43
44#define cpu_to_fdt32(x) fdt32_to_cpu(x)
45
46static inline uint64_t
47fdt64_to_cpu (
48 fdt64_t x
49 )
50{
51 return SwapBytes64 (x);
52}
53
54#define cpu_to_fdt64(x) fdt64_to_cpu(x)
55
56static inline void *
57memcpy (
58 void *dest,
59 const void *src,
60 size_t len
61 )
62{
63 return CopyMem (dest, src, len);
64}
65
66static inline void *
67memmove (
68 void *dest,
69 const void *src,
70 size_t n
71 )
72{
73 return CopyMem (dest, src, n);
74}
75
76static inline void *
77memset (
78 void *s,
79 int c,
80 size_t n
81 )
82{
83 return SetMem (s, n, c);
84}
85
86static inline int
87memcmp (
88 const void *dest,
89 const void *src,
90 int len
91 )
92{
93 return CompareMem (dest, src, len);
94}
95
96static inline void *
97memchr (
98 const void *s,
99 int c,
100 size_t n
101 )
102{
103 return ScanMem8 (s, n, c);
104}
105
106static inline size_t
107strlen (
108 const char *str
109 )
110{
111 return AsciiStrLen (str);
112}
113
114static inline char *
115strchr (
116 const char *s,
117 int c
118 )
119{
120 char pattern[2];
121
122 pattern[0] = c;
123 pattern[1] = 0;
124 return AsciiStrStr (s, pattern);
125}
126
127static inline size_t
128strnlen (
129 const char *str,
130 size_t strsz
131 )
132{
133 return AsciiStrnLenS (str, strsz);
134}
135
136static inline size_t
137strcmp (
138 const char *str1,
139 const char *str2
140 )
141{
142 return AsciiStrCmp (str1, str2);
143}
144
145static inline size_t
146strncmp (
147 const char *str1,
148 const char *str2,
149 size_t strsz
150 )
151{
152 return AsciiStrnCmp (str1, str2, strsz);
153}
154
155static inline size_t
156strncpy (
157 char *dest,
158 const char *source,
159 size_t dest_max
160 )
161{
162 return AsciiStrCpyS (dest, dest_max, source);
163}
164
165#endif /* _LIBFDT_ENV_H */
UINT64 UINTN
UINTN EFIAPI AsciiStrnLenS(IN CONST CHAR8 *String, IN UINTN MaxSize)
Definition: SafeString.c:1696
UINT16 EFIAPI SwapBytes16(IN UINT16 Value)
Definition: SwapBytes16.c:25
UINTN EFIAPI AsciiStrLen(IN CONST CHAR8 *String)
Definition: String.c:641
INTN EFIAPI AsciiStrCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString)
Definition: String.c:716
INTN EFIAPI AsciiStrnCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString, IN UINTN Length)
Definition: String.c:872
UINT32 EFIAPI SwapBytes32(IN UINT32 Value)
Definition: SwapBytes32.c:25
UINT64 EFIAPI SwapBytes64(IN UINT64 Value)
Definition: SwapBytes64.c:25
CHAR8 *EFIAPI AsciiStrStr(IN CONST CHAR8 *String, IN CONST CHAR8 *SearchString)
Definition: String.c:931
RETURN_STATUS EFIAPI AsciiStrCpyS(OUT CHAR8 *Destination, IN UINTN DestMax, IN CONST CHAR8 *Source)
Definition: SafeString.c:1797
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI SetMem(OUT VOID *Buffer, IN UINTN Length, IN UINT8 Value)
Definition: SetMemWrapper.c:38
VOID *EFIAPI ScanMem8(IN CONST VOID *Buffer, IN UINTN Length, IN UINT8 Value)