1 use super::{
2     super::device::{Device, DeviceState},
3     platform_driver::PlatformDriver,
4     CompatibleTable,
5 };
6 use alloc::sync::Arc;
7 
8 /// @brief: 实现该trait的设备实例应挂载在platform总线上,
9 ///         同时应该实现Device trait
10 pub trait PlatformDevice: Device {
11     /// @brief: 获取设备匹配表
12     /// @parameter: None
13     /// @return: 设备匹配表
compatible_table(&self) -> CompatibleTable14     fn compatible_table(&self) -> CompatibleTable;
15 
16     /// @brief: 判断设备是否初始化
17     /// @parameter: None
18     /// @return: 如果已经初始化,返回true,否则,返回false
is_initialized(&self) -> bool19     fn is_initialized(&self) -> bool;
20 
21     /// @brief: 设置设备状态
22     /// @parameter set_state: 设备状态
23     /// @return: None
set_state(&self, set_state: DeviceState)24     fn set_state(&self, set_state: DeviceState);
25 
26     /// @brief: 设置platform设备驱动
27     /// @parameter driver: platform设备驱动
28     /// @return: None
set_driver(&self, driver: Option<Arc<dyn PlatformDriver>>)29     fn set_driver(&self, driver: Option<Arc<dyn PlatformDriver>>);
30 }
31