Struct fdt::Fdt[][src]

pub struct Fdt<'a> { /* fields omitted */ }
Expand description

A flattened devicetree located somewhere in memory

Implementations

Construct a new Fdt from a byte buffer

Note: this function does not require that the data be 4-byte aligned

Safety

This function performs a read to verify the magic value. If the pointer is invalid this can result in undefined behavior.

Note: this function does not require that the data be 4-byte aligned

Return the /aliases node, if one exists

Searches for the /chosen node, which is always available

Return the /cpus node, which is always available

Returns the memory node, which is always available

Returns an iterator over the memory reservations

Return the root (/) node, which is always available

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.

Searches for a node which contains a compatible property and contains one of the strings inside of with

Searches for the given phandle

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@10001000

Returns an iterator over all of the nodes in the devicetree, depth-first

Returns an iterator over all of the strings inside of the strings block

Total size of the devicetree in bytes

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.