pub struct FDT {
__private_field: (),
}Expand description
设备树 通过 DTP 指针解析得到 XXX: 是否需要这个?
Fields§
§__private_field: ()Methods from Deref<Target = Fdt<'static>>§
pub fn aliases(&self) -> Option<Aliases<'_, 'a>>
pub fn aliases(&self) -> Option<Aliases<'_, 'a>>
Return the /aliases node, if one exists
pub fn chosen(&self) -> Chosen<'_, 'a>
pub fn chosen(&self) -> Chosen<'_, 'a>
Searches for the /chosen node, which is always available
pub fn cpus(&self) -> impl Iterator<Item = Cpu<'_, 'a>>
pub fn cpus(&self) -> impl Iterator<Item = Cpu<'_, 'a>>
Return the /cpus node, which is always available
pub fn memory(&self) -> Memory<'_, 'a>
pub fn memory(&self) -> Memory<'_, 'a>
Returns the memory node, which is always available
pub fn memory_reservations(
&self,
) -> impl Iterator<Item = MemoryReservation> + 'a
pub fn memory_reservations( &self, ) -> impl Iterator<Item = MemoryReservation> + 'a
Returns an iterator over the memory reservations
pub fn root(&self) -> Root<'_, 'a>
pub fn root(&self) -> Root<'_, 'a>
Return the root (/) node, which is always available
pub fn find_node(&self, path: &str) -> Option<FdtNode<'_, 'a>>
pub fn find_node(&self, path: &str) -> Option<FdtNode<'_, 'a>>
Returns the first node that matches the node path, if you want all that
match the path, use find_all_nodes. This will automatically attempt to
resolve aliases if path is not found.
Node paths must begin with a leading / and are ASCII only. Passing in
an invalid node path or non-ASCII node name in the path will return
None, as they will not be found within the devicetree structure.
Note: if the address of a node name is left out, the search will find the first node that has a matching name, ignoring the address portion if it exists.
pub fn find_compatible(&self, with: &[&str]) -> Option<FdtNode<'_, 'a>>
pub fn find_compatible(&self, with: &[&str]) -> Option<FdtNode<'_, 'a>>
Searches for a node which contains a compatible property and contains
one of the strings inside of with
pub fn find_phandle(&self, phandle: u32) -> Option<FdtNode<'_, 'a>>
pub fn find_phandle(&self, phandle: u32) -> Option<FdtNode<'_, 'a>>
Searches for the given phandle
pub fn find_all_nodes(
&self,
path: &'a str,
) -> impl Iterator<Item = FdtNode<'_, 'a>>
pub fn find_all_nodes( &self, path: &'a str, ) -> impl Iterator<Item = FdtNode<'_, 'a>>
Returns an iterator over all of the available nodes with the given path.
This does not attempt to find any node with the same name as the
provided path, if you’re looking to do that, [Fdt::all_nodes] will
allow you to iterate over each node’s name and filter for the desired
node(s).
For example:
static MY_FDT: &[u8] = include_bytes!("../dtb/test.dtb");
let fdt = fdt::Fdt::new(MY_FDT).unwrap();
for node in fdt.find_all_nodes("/soc/virtio_mmio") {
println!("{}", node.name);
}prints:
virtio_mmio@10008000
virtio_mmio@10007000
virtio_mmio@10006000
virtio_mmio@10005000
virtio_mmio@10004000
virtio_mmio@10003000
virtio_mmio@10002000
virtio_mmio@10001000pub fn all_nodes(&self) -> impl Iterator<Item = FdtNode<'_, 'a>>
pub fn all_nodes(&self) -> impl Iterator<Item = FdtNode<'_, 'a>>
Returns an iterator over all of the nodes in the devicetree, depth-first
pub fn strings(&self) -> impl Iterator<Item = &'a str>
pub fn strings(&self) -> impl Iterator<Item = &'a str>
Returns an iterator over all of the strings inside of the strings block
pub fn total_size(&self) -> usize
pub fn total_size(&self) -> usize
Total size of the devicetree in bytes