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