Struct FdtManager

Source
pub struct FdtManager<'a> {
    fdt: Option<Fdt<'a>>,
    relocated: bool,
}

Fields§

§fdt: Option<Fdt<'a>>§relocated: bool

Implementations§

Source§

impl<'a> FdtManager<'a>

Source

const fn new() -> Self

Source

pub fn init(&mut self, ptr: *const u8) -> Result<(), FdtError>

Source

pub unsafe fn set_fdt_addr(addr: usize)

Sets the FDT address.

§Safety

This function modifies a static variable that holds the FDT address. Ensure that this function is called before any other FDT-related functions to avoid undefined behavior.

§Arguments
  • addr: The address of the FDT.
§Notes

This function must be called before initializing the FDT manager. After once FdtManager is initialized, you cannot change the address.

Source

pub fn get_fdt(&self) -> Option<&Fdt<'a>>

Source

pub unsafe fn get_mut_manager() -> &'static mut FdtManager<'a>

Returns a mutable reference to the FdtManager. This is unsafe because it allows mutable access to a static variable. It should be used with caution to avoid data races.

§Safety

This function provides mutable access to the static FdtManager instance. Ensure that no other references to the manager are active to prevent data races.

§Returns

A mutable reference to the static FdtManager instance.

Source

pub fn get_manager() -> &'static FdtManager<'a>

Returns a reference to the FdtManager.

§Returns

A reference to the static FdtManager instance.

Source

unsafe fn relocate_fdt(&mut self, ptr: *mut u8)

Relocates the FDT to a new address.

§Safety

This function modifies the static FDT address and reinitializes the FdtManager. Ensure that the new address is valid and does not cause memory corruption.

§Parameters
  • ptr: The pointer to the new FDT address.
§Panics

This function will panic if the FDT has already been relocated.

Source

pub fn get_initramfs(&self) -> Option<MemoryArea>

Get the initramfs memory area from the device tree

This function searches for the initramfs memory region in the device tree. It looks for the initrd-start/end or linux,initrd-start/end properties in the /chosen node.

§Returns

Option: If the initramfs region is found, returns Some(MemoryArea), otherwise returns None.

Source

pub fn get_dram_memoryarea(&self) -> Option<MemoryArea>

Auto Trait Implementations§

§

impl<'a> Freeze for FdtManager<'a>

§

impl<'a> RefUnwindSafe for FdtManager<'a>

§

impl<'a> Send for FdtManager<'a>

§

impl<'a> Sync for FdtManager<'a>

§

impl<'a> Unpin for FdtManager<'a>

§

impl<'a> UnwindSafe for FdtManager<'a>

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