summaryrefslogtreecommitdiffstats
path: root/EmbeddedPkg/Include/libfdt_env.h
diff options
context:
space:
mode:
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2012-09-27 16:53:57 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2012-09-27 16:53:57 +0000
commitfa4a70633868ce5a59e3bc3c98c137952a6c4ccb (patch)
treec29d5d77b7b05b194377b77c068147cc6cc09f5d /EmbeddedPkg/Include/libfdt_env.h
parent8213627ef73ea5cac96c9eaeaed8dd8169ec3431 (diff)
downloadedk2-fa4a70633868ce5a59e3bc3c98c137952a6c4ccb.tar.gz
edk2-fa4a70633868ce5a59e3bc3c98c137952a6c4ccb.tar.bz2
edk2-fa4a70633868ce5a59e3bc3c98c137952a6c4ccb.zip
EmbeddedPkg: Added support to libfdt
Use the library libdt from the Device Tree Compiler project. The used version is from Wednesday 22nd August 2012 (commit: 8716901d2215a3) The Device Tree Compiler project is under dual BSD/GPL license (it means the license is either BSD or GPL). The BSD license is the license that fits to the Tianocore contribution requirements. The use of libfdt into Tianocore has been authorised by David Gibson the author of libfdt and its current maintainer Jon Loeliger (email thread on 7th September 2011). Signed-off-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13760 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EmbeddedPkg/Include/libfdt_env.h')
-rw-r--r--EmbeddedPkg/Include/libfdt_env.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/EmbeddedPkg/Include/libfdt_env.h b/EmbeddedPkg/Include/libfdt_env.h
new file mode 100644
index 0000000000..d35b8692c6
--- /dev/null
+++ b/EmbeddedPkg/Include/libfdt_env.h
@@ -0,0 +1,77 @@
+/** @file
+*
+* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
+*
+* This program and the accompanying materials
+* are licensed and made available under the terms and conditions of the BSD License
+* which accompanies this distribution. The full text of the license may be found at
+* http://opensource.org/licenses/bsd-license.php
+*
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+*
+**/
+
+#ifndef _LIBFDT_ENV_H
+#define _LIBFDT_ENV_H
+
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+
+typedef UINT8 uint8_t;
+typedef UINT16 uint16_t;
+typedef UINT32 uint32_t;
+typedef UINT64 uint64_t;
+typedef UINTN uintptr_t;
+typedef UINTN size_t;
+
+static inline uint16_t fdt16_to_cpu(uint16_t x)
+{
+ return SwapBytes16 (x);
+}
+#define cpu_to_fdt16(x) fdt16_to_cpu(x)
+
+static inline uint32_t fdt32_to_cpu(uint32_t x)
+{
+ return SwapBytes32 (x);
+}
+#define cpu_to_fdt32(x) fdt32_to_cpu(x)
+
+static inline uint64_t fdt64_to_cpu(uint64_t x)
+{
+ return SwapBytes64 (x);
+}
+#define cpu_to_fdt64(x) fdt64_to_cpu(x)
+
+static inline void* memcpy(void* dest, const void* src, size_t len) {
+ return CopyMem (dest, src, len);
+}
+
+static inline void *memmove(void *dest, const void *src, size_t n) {
+ return CopyMem (dest, src, n);
+}
+
+static inline void *memset(void *s, int c, size_t n) {
+ return SetMem (s, n, c);
+}
+
+static inline int memcmp(const void* dest, const void* src, int len) {
+ return CompareMem (dest, src, len);
+}
+
+static inline void *memchr(const void *s, int c, size_t n) {
+ return ScanMem8 (s, n, c);
+}
+
+static inline size_t strlen (const char* str) {
+ return AsciiStrLen (str);
+}
+
+static inline char *strchr(const char *s, int c) {
+ char pattern[2];
+ pattern[0] = c;
+ pattern[1] = 0;
+ return AsciiStrStr (s, pattern);
+}
+
+#endif /* _LIBFDT_ENV_H */