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