-
-
Notifications
You must be signed in to change notification settings - Fork 159
Patch uart #290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Patch uart #290
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有点小问题,再沟通一下
.0 | ||
.lock() | ||
.0 | ||
.get_mut(Self::major_to_index(device_number.major())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里格式不太对劲,可能需要修改一下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里倒是无所谓,应该是cargo fmt自动换行的,改了可能美观一点,不改也行
/// @return 初始化成功,返回(),失败,返回错误码 | ||
pub fn uart_init() -> Result<(), SystemError> { | ||
let device_inode = bus_device_register("platform:0", &UART_DEV.id_table().to_name()) | ||
.expect("uart device register error"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
出错不要直接panic,做点错误处理(保证不会出错的情况除外)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
考虑一下错误层层上报,最顶层打印出来
@@ -138,6 +138,8 @@ impl SysFS { | |||
} | |||
// 初始化platform总线 | |||
crate::driver::base::platform::platform_bus_init().expect("platform bus init failed"); | |||
// 初始化串口 | |||
crate::driver::uart::uart::uart_init().expect("initilize uart error"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
初始化失败就直接panic是不是不太好
笑死,我突然发现这里的chrdev没改成chardev
|
注册串口设备,创建字符设备框架