Crates.io | fdt-parser |
lib.rs | fdt-parser |
version | |
source | src |
created_at | 2024-10-18 08:06:21.091597 |
updated_at | 2024-12-05 14:08:48.705141 |
description | A crate for parsing FDT |
homepage | |
repository | https://github.com/qclic/fdt-parser |
max_upload_size | |
id | 1413995 |
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` |
size | 0 |
Base on devicetree-specification-v0.4
reg
address by range
aliases
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);
}
}
}