Skip to content

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

Merged
merged 12 commits into from
Jul 12, 2023
Merged

Patch uart #290

merged 12 commits into from
Jul 12, 2023

Conversation

TingSHub
Copy link
Contributor

注册串口设备,创建字符设备框架

Copy link
Collaborator

@YJwu2023 YJwu2023 left a 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()))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里格式不太对劲,可能需要修改一下

Copy link
Collaborator

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");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

出错不要直接panic,做点错误处理(保证不会出错的情况除外)

Copy link
Collaborator

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");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

初始化失败就直接panic是不是不太好

@fslongjin
Copy link
Member

fslongjin commented Jul 11, 2023 via email

@fslongjin fslongjin merged commit 0663027 into DragonOS-Community:master Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants