fdt-parser

Crates.iofdt-parser
lib.rsfdt-parser
version
sourcesrc
created_at2024-10-18 08:06:21.091597
updated_at2024-12-05 14:08:48.705141
descriptionA crate for parsing FDT
homepage
repositoryhttps://github.com/qclic/fdt-parser
max_upload_size
id1413995
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
周睿 (ZR233)

documentation

https://docs.rs/fdt-parser

README

FDT Parser

Build & Check CI Latest version Documentation License

Base on devicetree-specification-v0.4

Advance features

  • [√] Parse device tree blob
  • [√] Fix reg address by range
  • [√] Find interrupt parent
  • [√] Find clocks
  • [√] Handle aliases
  • [√] PCI bus

Usage

use fdt_parser::Fdt;

let bytes = include_bytes!("../../dtb/bcm2711-rpi-4-b.dtb");

let fdt = Fdt::from_bytes(bytes).unwrap();
println!("version: {}", fdt.version());
for region in fdt.memory_reservation_block() {
    println!("region: {:?}", region);
}

for node in fdt.all_nodes() {
    let space = " ".repeat((node.level - 1) * 4);
    println!("{}{}", space, node.name());

    if let Some(cap) = node.compatible() {
        println!("{} -compatible: ", space);
        for cap in cap {
            println!("{}     {:?}", space, cap);
        }
    }

    if let Some(reg) = node.reg() {
        println!("{} - reg: ", space);
        for cell in reg {
            println!("{}     {:?}", space, cell);
        }
    }
}

Commit count: 45

cargo fmt