VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Include/libfdt_env.h

Last change on this file was 99404, checked in by vboxsync, 2 years ago

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • Property svn:eol-style set to native
File size: 2.2 KB
Line 
1/** @file
2*
3* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
4*
5* SPDX-License-Identifier: BSD-2-Clause-Patent
6*
7**/
8
9#ifndef _LIBFDT_ENV_H
10#define _LIBFDT_ENV_H
11
12#include <Library/BaseLib.h>
13#include <Library/BaseMemoryLib.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 */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette