FDT

Struct FDT 

Source
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>>

Return the /aliases node, if one exists

pub fn chosen(&self) -> Chosen<'_, 'a>

Searches for the /chosen node, which is always available

pub fn cpus(&self) -> impl Iterator<Item = Cpu<'_, 'a>>

Return the /cpus node, which is always available

pub fn memory(&self) -> Memory<'_, 'a>

Returns the memory node, which is always available

pub fn memory_reservations( &self, ) -> impl Iterator<Item = MemoryReservation> + 'a

Returns an iterator over the memory reservations

pub fn root(&self) -> Root<'_, 'a>

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

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

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

Searches for the given phandle

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

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>

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

pub fn total_size(&self) -> usize

Total size of the devicetree in bytes

Trait Implementations§

Source§

impl Deref for FDT

Source§

type Target = Fdt<'static>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Fdt<'static>

Dereferences the value.
Source§

impl LazyStatic for FDT

Auto Trait Implementations§

§

impl Freeze for FDT

§

impl RefUnwindSafe for FDT

§

impl Send for FDT

§

impl Sync for FDT

§

impl Unpin for FDT

§

impl UnwindSafe for FDT

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.