-
-
Notifications
You must be signed in to change notification settings - Fork 143
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 #99
Patch uart #99
Conversation
kernel/src/driver/mod.rs
Outdated
@@ -0,0 +1 @@ | |||
pub mod uart; |
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.
文件末尾要新增一行
kernel/src/driver/uart/mod.rs
Outdated
@@ -0,0 +1 @@ | |||
pub mod uart; |
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.
文件末尾要新增一行
#define UART_SUCCESS 0 | ||
#define E_UART_BITS_RATE_ERROR 1 | ||
#define E_UART_SERIAL_FAULT 2 | ||
enum uart_port_io_addr |
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.
建议仍保留原来的这个enum
kernel/src/driver/uart/uart.rs
Outdated
/// baud_rate error: "uart init." | ||
/// device falty: "uart faulty." | ||
#[allow(dead_code)] | ||
pub fn uart_init(uart_port: &UartPort, baud_rate: u32) -> Result<(), &'static str> { |
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.
成功时返回i32
也就是Ok(0)
kernel/src/driver/uart/uart.rs
Outdated
#[allow(dead_code)] | ||
pub fn uart_init(uart_port: &UartPort, baud_rate: u32) -> Result<(), &'static str> { | ||
let message: &'static str = "uart init."; | ||
let port = UartPort::to_u16(&uart_port); |
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.
可以直接uart_port.to_u16
#99使用rust重写串口驱动