完善设备驱动模型&调试串口驱动 (#379)

* 完成了基本架构重构,正在进行兼容

* 重构了所有 Device Driver ,还没有接上具体设备

* 基本把 Uart 接上了,还没有测试

* 初步完成系统设备初始化

* 初步重构 BlockDevice ,使其兼容新的 Device 结构

* 修改文件系统内的部分函数调用以满足重构后的接口

* 测试完 Uart 设备的功能

* 移除了自动添加的文件

* 修复了 warning 和部分格式

* 解决warning,并且修正sysfs初始化的位置

* Patch fix

* 删除了 sysinfo 的默认实现

* 删除了字符设备读写的 offset 参数

* 修复了 warning 和一些小逻辑错误

---------

Co-authored-by: longjin <longjin@RinGoTek.cn>
This commit is contained in:
Chiichen
2023-09-13 18:01:52 +08:00
committed by GitHub
parent 9029414af2
commit b087521e07
45 changed files with 1930 additions and 981 deletions

View File

@ -9,7 +9,11 @@ use smoltcp::{phy, wire};
use virtio_drivers::{device::net::VirtIONet, transport::Transport};
use crate::{
driver::{virtio::virtio_impl::HalImpl, Driver},
driver::{
base::device::{driver::DriverError, Device, DevicePrivateData, DeviceResource, IdTable},
virtio::virtio_impl::HalImpl,
Driver,
},
kerror, kinfo,
libs::spinlock::SpinLock,
net::{generate_iface_id, NET_DRIVERS},
@ -240,6 +244,30 @@ impl<T: Transport> Driver for VirtioInterface<T> {
fn as_any_ref(&'static self) -> &'static dyn core::any::Any {
self
}
fn probe(&self, _data: &DevicePrivateData) -> Result<(), DriverError> {
todo!()
}
fn load(
&self,
_data: DevicePrivateData,
_resource: Option<DeviceResource>,
) -> Result<Arc<dyn Device>, DriverError> {
todo!()
}
fn id_table(&self) -> IdTable {
todo!()
}
fn set_sys_info(&self, _sys_info: Option<Arc<dyn crate::filesystem::vfs::IndexNode>>) {
todo!()
}
fn sys_info(&self) -> Option<Arc<dyn crate::filesystem::vfs::IndexNode>> {
todo!()
}
}
impl<T: Transport> NetDriver for VirtioInterface<T> {