summaryrefslogtreecommitdiff
path: root/scripts/dtc/dtc.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2020-07-08 12:38:59 +0300
committerPeter Zijlstra <peterz@infradead.org>2020-07-08 12:38:59 +0300
commitfaa2fd7cbad4609d06d7904c0a80cf2f8cd23678 (patch)
tree3a5bfcc8879b719aec97cb73ed6e020cde502546 /scripts/dtc/dtc.h
parent01e377c539ca52a6c753d0fdbe93b3b8fcd66a1c (diff)
parentce3614daabea8a2d01c1dd17ae41d1ec5e5ae7db (diff)
downloadlinux-faa2fd7cbad4609d06d7904c0a80cf2f8cd23678.tar.xz
Merge branch 'sched/urgent'
Diffstat (limited to 'scripts/dtc/dtc.h')
-rw-r--r--scripts/dtc/dtc.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h
index 6e74ecea55a3..a08f4159cd03 100644
--- a/scripts/dtc/dtc.h
+++ b/scripts/dtc/dtc.h
@@ -51,6 +51,37 @@ extern int annotate; /* annotate .dts with input source location */
typedef uint32_t cell_t;
+static inline uint16_t dtb_ld16(const void *p)
+{
+ const uint8_t *bp = (const uint8_t *)p;
+
+ return ((uint16_t)bp[0] << 8)
+ | bp[1];
+}
+
+static inline uint32_t dtb_ld32(const void *p)
+{
+ const uint8_t *bp = (const uint8_t *)p;
+
+ return ((uint32_t)bp[0] << 24)
+ | ((uint32_t)bp[1] << 16)
+ | ((uint32_t)bp[2] << 8)
+ | bp[3];
+}
+
+static inline uint64_t dtb_ld64(const void *p)
+{
+ const uint8_t *bp = (const uint8_t *)p;
+
+ return ((uint64_t)bp[0] << 56)
+ | ((uint64_t)bp[1] << 48)
+ | ((uint64_t)bp[2] << 40)
+ | ((uint64_t)bp[3] << 32)
+ | ((uint64_t)bp[4] << 24)
+ | ((uint64_t)bp[5] << 16)
+ | ((uint64_t)bp[6] << 8)
+ | bp[7];
+}
#define streq(a, b) (strcmp((a), (b)) == 0)
#define strstarts(s, prefix) (strncmp((s), (prefix), strlen(prefix)) == 0)