Expand description
Platform device driver module.
This module provides the implementation of platform device drivers, including
device information and driver management. It defines the PlatformDeviceInfo
and
PlatformDeviceDriver
structs, which represent the device information and driver
respectively.
The module implements the Device
and DeviceDriver
traits for platform devices,
allowing them to be integrated into the device management system.
§Components
-
PlatformDeviceInfo
: Stores information about a platform device, including its name, ID, and compatible device strings. -
PlatformDeviceDriver
: Implements a driver for platform devices, containing resources, probe and remove functions, and compatibility information.
§Submodules
resource
: Defines platform-specific device resources.
§Examples
// Creating a platform device info
let device_info = PlatformDeviceInfo::new(
"example_device",
1,
vec!["example,device-v1", "example,device-v2"],
Vec::new() // Add resources as an empty vector
);
// Creating a platform device driver
let driver = PlatformDeviceDriver::new(
"example_driver",
|device_info| { /* probe implementation */ Ok(()) },
|device_info| { /* remove implementation */ Ok(()) },
vec!["example,device-v1", "example,device-v2"]
);
§Implementation Details
Platform devices are hardware components that are directly connected to the system bus or integrated into the SoC. They are typically discovered during boot time through firmware tables (like ACPI or Device Tree).
The driver model allows for dynamic matching between devices and their drivers
based on the compatible strings, enabling a flexible plug-and-play architecture.
respectively. The module also includes the Device
and DeviceDriver
traits,
which define the interface for device information and drivers.
Modules§
- resource
- Platform device resource management module.
Structs§
- Platform
Device Driver - Platform
Device Info - Struct representing platform device information.