diff options
author | raj <raj@FreeBSD.org> | 2010-02-28 21:57:35 +0000 |
---|---|---|
committer | raj <raj@FreeBSD.org> | 2010-02-28 21:57:35 +0000 |
commit | 661abc4ccde64bfa5be654487f1e456221d0e3ec (patch) | |
tree | e053cde8c27573ffd8d63c81d9534afa521db747 /sys/contrib/libfdt/libfdt_env.h | |
parent | abfd52212402df81f78a0d24823e9d45b2aaab3f (diff) | |
parent | 0ced8a1da7135fbd44290fe606d83149a0e9450f (diff) | |
download | FreeBSD-src-661abc4ccde64bfa5be654487f1e456221d0e3ec.zip FreeBSD-src-661abc4ccde64bfa5be654487f1e456221d0e3ec.tar.gz |
Merge DTC-d75b33af.
This is a split merge because of non-uniform licensing of the DTC package
contents and the way these components will be used in the FreeBSD environment.
The original DTC package is composed of the following two major pieces:
1. sys/contrib/libfdt (BSD [dual] license)
2. contrib/dtc (GPLv2)
The libfdt component is going to be shared in all aspects of the environment:
- /boot/loader
- kernel
- dtc (the device tree compiler proper, userspace tool)
Diffstat (limited to 'sys/contrib/libfdt/libfdt_env.h')
-rw-r--r-- | sys/contrib/libfdt/libfdt_env.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sys/contrib/libfdt/libfdt_env.h b/sys/contrib/libfdt/libfdt_env.h new file mode 100644 index 0000000..449bf60 --- /dev/null +++ b/sys/contrib/libfdt/libfdt_env.h @@ -0,0 +1,23 @@ +#ifndef _LIBFDT_ENV_H +#define _LIBFDT_ENV_H + +#include <stddef.h> +#include <stdint.h> +#include <string.h> + +#define _B(n) ((unsigned long long)((uint8_t *)&x)[n]) +static inline uint32_t fdt32_to_cpu(uint32_t x) +{ + return (_B(0) << 24) | (_B(1) << 16) | (_B(2) << 8) | _B(3); +} +#define cpu_to_fdt32(x) fdt32_to_cpu(x) + +static inline uint64_t fdt64_to_cpu(uint64_t x) +{ + return (_B(0) << 56) | (_B(1) << 48) | (_B(2) << 40) | (_B(3) << 32) + | (_B(4) << 24) | (_B(5) << 16) | (_B(6) << 8) | _B(7); +} +#define cpu_to_fdt64(x) fdt64_to_cpu(x) +#undef _B + +#endif /* _LIBFDT_ENV_H */ |