[−][src]Module fdt_rs::base
Basic device tree parsing utils that operate directly on the FDT.
Overview
This module provides basic utilities which can operate on a FDT through in-order parsing. These utilites will simply parse the device tree on the fly.
See the crate::index
module for more advanced and performant utilites.
Examples
Initialization
use fdt_rs::prelude::*; use fdt_rs::base::*; // Get access to a flattened device tree buffer. let fdt: &[u8] = FDT; // Create the device tree parser let devtree = unsafe { DevTree::new(fdt) } .expect("Buffer does not contain a device tree.");
Compatible Search
Find all DevTreeNode
objects which have their compatible
property defined as
"ns16550a"
:
// Get the compatible node iterator let mut iter = index.compatible_nodes("ns16550a"); // Get a signle node from that iterator let node = iter.next().expect("No node found!"); // Iterate through all remaining nodes for node in iter { println!{"Found node: {}", node.name().unwrap()}; }
Custom Search
Find all DevTreeNode
objects which have their compatible
property defined as
"ns16550a"
:
// Get the compatible node iterator let mut iter = index.compatible_nodes("ns16550a"); // Get a signle node from that iterator let node = iter.next().expect("No node found!"); // Iterate through all remaining nodes for node in iter { println!{"Found node: {}", node.name().unwrap()}; }
Modules
iters | Iterative parsers of a |
parse | Low level flattened device tree parsing functions. |
Structs
DevTree | A parseable Flattened Device Tree. |
DevTreeNode | A handle to a Device Tree Node within the device tree. |
DevTreeProp | A handle to a |
Enums
DevTreeItem | An enum which contains either a |