Skip to main content

Crate fdt_raw

Crate fdt_raw 

Source
Expand description

Raw FDT parser without high-level abstractions.

This crate provides a very low-level parser for Flattened Device Tree (FDT) files. It is designed to be a minimal dependency that only handles the binary format of device tree blobs without providing any node or property abstractions.

§Features

  • #![no_std] compatible
  • Zero-copy parsing where possible
  • Direct access to the FDT structure blocks
  • Minimal dependencies

§Example

use fdt_raw::{Fdt, Header};

// Read FDT data from file or memory
let data = std::fs::read("path/to/device.dtb")?;

// Parse the header
let header = Header::from_bytes(&data)?;

println!("FDT version: {}", header.version);
println!("Total size: {} bytes", header.totalsize);

// Create the FDT parser
let fdt = Fdt::from_bytes(&data)?;

// Iterate over memory reservation entries
for rsv in fdt.memory_reservations() {
    println!("Reserved: {:?} - {:?} bytes", rsv.address, rsv.size);
}

Modules§

data
Low-level data access primitives for FDT parsing.

Structs§

Chosen
The /chosen node containing boot parameters.
Fdt
A parsed Flattened Device Tree (FDT).
Header
The FDT header structure.
Memory
Memory node describing physical memory layout.
MemoryRegion
Memory region information.
MemoryReservation
Entry in the memory reservation block.
NodeBase
Base device tree node structure.
Phandle
A phandle (pointer handle) for referencing device tree nodes.
PropIter
Property iterator.
Property
A generic device tree property containing name and raw data.
RangeInfo
Range entry information.
RegInfo
Reg entry information.
RegIter
Reg property iterator.
VecRange
Ranges property wrapper for parsing address translation entries.

Enums§

FdtError
Errors that can occur during FDT parsing.
Node
Device tree node enum supporting specialized node types.
Status
Device tree node status property value.
Token
Token type for parsing the FDT structure block.

Constants§

FDT_MAGIC
The magic number that identifies a valid Flattened Device Tree blob.