1use zerocopy::BigEndian;
5use zerocopy::FromBytes;
6use zerocopy::Immutable;
7use zerocopy::IntoBytes;
8use zerocopy::KnownLayout;
9
10pub type U32b = zerocopy::U32<BigEndian>;
11pub type U64b = zerocopy::U64<BigEndian>;
12
13#[repr(C)]
15#[derive(Debug, IntoBytes, Immutable, KnownLayout, FromBytes)]
16pub struct Header {
17 pub magic: U32b,
18 pub totalsize: U32b,
19 pub off_dt_struct: U32b,
20 pub off_dt_strings: U32b,
21 pub off_mem_rsvmap: U32b,
22 pub version: U32b,
23 pub last_comp_version: U32b,
24 pub boot_cpuid_phys: U32b,
25 pub size_dt_strings: U32b,
26 pub size_dt_struct: U32b,
27}
28
29#[repr(C)]
30#[derive(Debug, IntoBytes, Immutable, KnownLayout, FromBytes, PartialEq, Eq, Clone, Copy)]
31pub struct ReserveEntry {
33 pub address: U64b,
35 pub size: U64b,
37}
38
39#[repr(C)]
40#[derive(Debug, IntoBytes, Immutable, KnownLayout, FromBytes)]
41pub struct PropHeader {
42 pub len: U32b,
43 pub nameoff: U32b,
44}
45
46pub const BEGIN_NODE: u32 = 1;
47pub const END_NODE: u32 = 2;
48pub const PROP: u32 = 3;
49pub const NOP: u32 = 4;
50pub const END: u32 = 9;
51
52pub const MAGIC: u32 = 0xd00dfeed;
53
54pub const CURRENT_VERSION: u32 = 17;
55pub const COMPAT_VERSION: u32 = 16;