DragonOS/kernel/src/driver/base/platform/platform_device.rs
YJwu2023 78bf93f02f
pci重构+pcie支持 (#235)
* pci重构+pcie支持

* pci重构测试完成

* 修正makefile的问题

* 小修改

* 修改函数名字
2023-04-09 12:30:02 +08:00

35 lines
1.0 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

use super::{
super::device::{Device, DeviceState, DeviceType},
platform_driver::PlatformDriver,
CompatibleTable,
};
use alloc::sync::Arc;
/// @brief: 实现该trait的设备实例应挂载在platform总线上
/// 同时应该实现Device trait
pub trait PlatformDevice: Device {
fn get_type(&self) -> DeviceType {
DeviceType::PlatformDev
}
/// @brief: 获取设备匹配表
/// @parameter: None
/// @return: 设备匹配表
fn get_compatible_table(&self) -> CompatibleTable;
/// @brief: 判断设备是否初始化
/// @parameter: None
/// @return: 如果已经初始化返回true否则返回false
fn is_initialized(&self) -> bool;
/// @brief: 设置设备状态
/// @parameter set_state: 设备状态
/// @return: None
fn set_state(&self, set_state: DeviceState);
/// @brief: 设置platform设备驱动
/// @parameter driver: platform设备驱动
/// @return: None
fn set_driver(&self, driver: Option<Arc<dyn PlatformDriver>>);
}