xref: /DragonOS/kernel/src/driver/base/platform/platform_driver.rs (revision 13776c114b15c406b1e0aaeeb71812ea6e471d2e)
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
14     fn probe(&self, device: Arc<dyn PlatformDevice>) -> Result<(), DriverError>;
15 
16     /// @brief: 获取驱动匹配表
17     /// @parameter: None
18     /// @return: 驱动匹配表
19     fn get_compatible_table(&self) -> CompatibleTable;
20 }
21