⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

DriverFramework

Struct DriverFramework 

Source
pub struct DriverFramework { /* private fields */ }
Expand description

Driver framework

Implementations§

Source§

impl DriverFramework

Source

pub fn new() -> Self

Create a new driver framework

Source§

impl DriverFramework

Source

pub fn register_driver( &self, driver: Box<dyn Driver>, ) -> Result<(), KernelError>

Register a driver

Source

pub fn unregister_driver(&self, name: &str) -> Result<(), KernelError>

Unregister a driver

Source

pub fn register_bus(&self, bus: Box<dyn Bus>) -> Result<(), KernelError>

Register a bus

Source

pub fn scan_buses(&self) -> Result<usize, KernelError>

Scan all buses for devices

Source

pub fn handle_interrupt(&self, irq: u8) -> Result<(), KernelError>

Handle interrupt

Source

pub fn get_device(&self, device_id: u64) -> Option<DeviceInfo>

Get device information

Source

pub fn list_devices(&self) -> Vec<DeviceInfo>

List all devices

Source

pub fn get_device_driver(&self, device_id: u64) -> Option<String>

Get driver for device

Source

pub fn enable_device(&self, device_id: u64) -> Result<(), KernelError>

Enable device

Source

pub fn disable_device(&self, device_id: u64) -> Result<(), KernelError>

Disable device

Source

pub fn get_drivers(&self) -> Vec<String>

Get all registered drivers

Source

pub fn register_event_listener(&self, listener: Arc<dyn DeviceEventListener>)

Register an event listener for device hot-plug notifications.

Source

pub fn clear_event_listeners(&self)

Unregister all event listeners (used during shutdown).

Source

pub fn add_device(&self, device: DeviceInfo) -> Result<u64, KernelError>

Add a new device to the system (hot-plug).

Assigns a unique device ID, registers the device, fires an Added event, and attempts to auto-probe a matching driver.

Source

pub fn remove_device(&self, device_id: u64) -> Result<(), KernelError>

Remove a device from the system (hot-unplug).

Unbinds any attached driver, fires a Removed event, and removes the device from the registry.

Source

pub fn update_device_status( &self, device_id: u64, new_status: DeviceStatus, ) -> Result<(), KernelError>

Update a device’s status and fire a StateChanged event.

Source

pub fn read_device( &self, device_id: u64, offset: u64, buffer: &mut [u8], ) -> Result<usize, KernelError>

Read from a device through its bound driver.

Source

pub fn write_device( &self, device_id: u64, offset: u64, data: &[u8], ) -> Result<usize, KernelError>

Write to a device through its bound driver.

Source

pub fn get_statistics(&self) -> DriverFrameworkStats

Get statistics

Trait Implementations§

Source§

impl Default for DriverFramework

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !Freeze for DriverFramework

§

impl !RefUnwindSafe for DriverFramework

§

impl Send for DriverFramework

§

impl Sync for DriverFramework

§

impl Unpin for DriverFramework

§

impl !UnwindSafe for DriverFramework

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.