Skip to content

Commit 37a806f

Browse files
authored
Merge pull request #575 from rust-osdev/revert-565
Revert `uart_16550` version bump to 0.6.0
2 parents 16dea75 + 313769e commit 37a806f

33 files changed

Lines changed: 298 additions & 157 deletions

File tree

‎Cargo.lock‎

Lines changed: 64 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ members = [
1919
"tests/runner",
2020
]
2121
exclude = ["examples/basic", "examples/test_framework", "tests/test_kernels/"]
22-
resolver = "3"
2322

2423
[workspace.package]
2524
# don't forget to update `workspace.dependencies` below

‎common/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ xmas-elf = "0.8.0"
1919
raw-cpuid = "10.2.0"
2020
rand = { version = "0.8.6", default-features = false }
2121
rand_hc = "0.3.1"
22-
uart_16550 = "0.6.0"
22+
uart_16550 = "0.3.2"
2323
log = "0.4.17"
2424

2525
[dependencies.noto-sans-mono-bitmap]

‎common/src/serial.rs‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
use core::fmt;
2-
use uart_16550::backend::PioBackend;
32

4-
// TODO this type can be replaced with Uart16550Tty but using it currently panics
5-
// in the new constructor.
63
pub struct SerialPort {
7-
port: uart_16550::Uart16550<PioBackend>,
4+
port: uart_16550::SerialPort,
85
}
96

107
impl SerialPort {
118
/// # Safety
129
///
1310
/// unsafe because this function must only be called once
1411
pub unsafe fn init() -> Self {
15-
let mut port =
16-
unsafe { uart_16550::Uart16550::new_port(0x3F8) }.expect("should be valid port");
17-
port.init(uart_16550::Config::default())
18-
.expect("should init successfully");
12+
let mut port = unsafe { uart_16550::SerialPort::new(0x3F8) };
13+
port.init();
1914
Self { port }
2015
}
2116
}
@@ -24,8 +19,8 @@ impl fmt::Write for SerialPort {
2419
fn write_str(&mut self, s: &str) -> fmt::Result {
2520
for char in s.bytes() {
2621
match char {
27-
b'\n' => self.port.send_bytes_exact(b"\r\n"),
28-
byte => self.port.send_bytes_exact(&[byte]),
22+
b'\n' => self.port.write_str("\r\n").unwrap(),
23+
byte => self.port.send(byte),
2924
}
3025
}
3126
Ok(())

0 commit comments

Comments
 (0)