1 use super::{ 2 super::device::driver::{Driver, DriverError}, 3 platform_device::PlatformDevice, 4 CompatibleTable, 5 }; 6 use alloc::sync::Arc; 7 8 /// @brief: 实现该trait的设备驱动实例应挂载在platform总线上, 9 /// 同时应该实现Driver trait 10 pub trait PlatformDriver: Driver { 11 /// @brief: 设备驱动探测函数,此函数在设备和驱动匹配成功后调用 12 /// @parameter device: 匹配成功的设备实例 13 /// @return: 成功驱动设备,返回Ok(()),否则,返回DriverError probe(&self, device: Arc<dyn PlatformDevice>) -> Result<(), DriverError>14 fn probe(&self, device: Arc<dyn PlatformDevice>) -> Result<(), DriverError>; 15 16 /// @brief: 获取驱动匹配表 17 /// @parameter: None 18 /// @return: 驱动匹配表 compatible_table(&self) -> CompatibleTable19 fn compatible_table(&self) -> CompatibleTable; 20 } 21