Crate psi_device_tree
source ·Expand description
Parse flattened linux device trees
Device trees are used to describe a lot of hardware, especially in the ARM embedded world and are also used to boot Linux on these device. A device tree describes addresses and other attributes for many parts on these boards
This library allows parsing the so-called flattened device trees, which are the compiled binary forms of these trees.
To read more about device trees, check out the kernel docs. Some example device trees to try out are [the Raspberry Pi ones] (https://github.com/raspberrypi/firmware/tree/master/boot).
The library does not use std
, just core
.
Examples
use psi_device_tree::DeviceTree;
fn main() {
// read file into memory
let mut input = fs::File::open("examples/bcm2709-rpi-2-b.dtb").unwrap();
let mut buf = Vec::new();
input.read_to_end(&mut buf).unwrap();
let dt = DeviceTree::load(buf.as_slice ()).unwrap();
println!("{:?}", dt);
}
Modules
Structs
- Device tree structure.
- A single node in the device tree.
Enums
- An error describe parsing problems when creating device trees.
- Represents property errors.
Type Aliases
- Convenience alias for the
Result
type.