DragonOS/kernel/src/driver/base/platform/platform_device.rs
TingHuang 0663027b11
注册串口设备,创建字符设备框架(#290)
* 按照rust规范修改两个函数名称

* 修改一些函数句柄以符合rust规范

* 添加字符设备相关

* 添加字符设备相关文件

* 添加字符设备驱动框架代码

* 将串口注册

* 规范代码
2023-07-12 12:49:45 +08:00

31 lines
954 B
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},
platform_driver::PlatformDriver,
CompatibleTable,
};
use alloc::sync::Arc;
/// @brief: 实现该trait的设备实例应挂载在platform总线上
/// 同时应该实现Device trait
pub trait PlatformDevice: Device {
/// @brief: 获取设备匹配表
/// @parameter: None
/// @return: 设备匹配表
fn 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>>);
}