Skip to content

Commit 2b1e66e

Browse files
committed
deps: bump uart_16550 to 0.6.0 + streamline as workspace dep
1 parent 5d97b89 commit 2b1e66e

29 files changed

Lines changed: 116 additions & 131 deletions

File tree

‎Cargo.lock‎

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

‎Cargo.toml‎

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

2324
[workspace.package]
2425
# don't forget to update `workspace.dependencies` below
@@ -31,6 +32,7 @@ bootloader_api = { version = "0.11.15", path = "api" }
3132
bootloader-x86_64-common = { version = "0.11.15", path = "common" }
3233
bootloader-boot-config = { version = "0.11.15", path = "common/config" }
3334
bootloader-x86_64-bios-common = { version = "0.11.15", path = "bios/common" }
35+
uart_16550 = "0.6.0"
3436

3537
[features]
3638
default = ["bios", "uefi"]

‎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.3.2"
22+
uart_16550.workspace = true
2323
log = "0.4.17"
2424

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

‎common/src/serial.rs‎

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

34
pub struct SerialPort {
4-
port: uart_16550::SerialPort,
5+
port: uart_16550::Uart16550<PioBackend>,
56
}
67

78
impl SerialPort {
89
/// # Safety
910
///
1011
/// unsafe because this function must only be called once
1112
pub unsafe fn init() -> Self {
12-
let mut port = unsafe { uart_16550::SerialPort::new(0x3F8) };
13-
port.init();
13+
let mut port =
14+
unsafe { uart_16550::Uart16550::new_port(0x3F8) }.expect("should be valid port");
15+
port.init(uart_16550::Config::default())
16+
.expect("should init successfully");
1417
Self { port }
1518
}
1619
}
@@ -19,8 +22,8 @@ impl fmt::Write for SerialPort {
1922
fn write_str(&mut self, s: &str) -> fmt::Result {
2023
for char in s.bytes() {
2124
match char {
22-
b'\n' => self.port.write_str("\r\n").unwrap(),
23-
byte => self.port.send(byte),
25+
b'\n' => self.port.send_bytes_exact(b"\r\n"),
26+
byte => self.port.send_bytes_exact(&[byte]),
2427
}
2528
}
2629
Ok(())

‎examples/basic/kernel/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ edition = "2024"
55

66
[dependencies]
77
bootloader_api = "0.11.12"
8-
uart_16550 = "0.4.0"
8+
uart_16550.workspace = true
99
x86_64 = "0.15.2"

‎tests/test_kernels/config_file/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ bootloader_api = { path = "../../../api" }
99
x86_64 = { version = "0.15.2", default-features = false, features = [
1010
"instructions",
1111
] }
12-
uart_16550 = "0.2.10"
12+
uart_16550 = { version = "0.6.0" }

‎tests/test_kernels/config_file/src/lib.rs‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#![no_std]
22

3+
use uart_16550::backend::PioBackend;
4+
use uart_16550::{Config, Uart16550Tty};
5+
36
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
47
#[repr(u32)]
58
pub enum QemuExitCode {
@@ -20,8 +23,7 @@ pub fn exit_qemu(exit_code: QemuExitCode) -> ! {
2023
}
2124
}
2225

23-
pub fn serial() -> uart_16550::SerialPort {
24-
let mut port = unsafe { uart_16550::SerialPort::new(0x3F8) };
25-
port.init();
26-
port
26+
pub fn serial() -> Uart16550Tty<PioBackend> {
27+
unsafe { Uart16550Tty::new_port(0x3F8, Config::default()) }
28+
.expect("should initialize serial device from valid config and valid port")
2729
}

‎tests/test_kernels/default_settings/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ bootloader_api = { path = "../../../api" }
99
x86_64 = { version = "0.15.2", default-features = false, features = [
1010
"instructions",
1111
] }
12-
uart_16550 = "0.2.10"
12+
uart_16550 = { version = "0.6.0" }

‎tests/test_kernels/default_settings/src/lib.rs‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#![no_std]
22

3+
use uart_16550::backend::PioBackend;
4+
use uart_16550::{Config, Uart16550Tty};
5+
36
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
47
#[repr(u32)]
58
pub enum QemuExitCode {
@@ -20,8 +23,7 @@ pub fn exit_qemu(exit_code: QemuExitCode) -> ! {
2023
}
2124
}
2225

23-
pub fn serial() -> uart_16550::SerialPort {
24-
let mut port = unsafe { uart_16550::SerialPort::new(0x3F8) };
25-
port.init();
26-
port
26+
pub fn serial() -> Uart16550Tty<PioBackend> {
27+
unsafe { Uart16550Tty::new_port(0x3F8, Config::default()) }
28+
.expect("should initialize serial device from valid config and valid port")
2729
}

‎tests/test_kernels/fixed_kernel_address/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ bootloader_api = { path = "../../../api" }
88
x86_64 = { version = "0.15.2", default-features = false, features = [
99
"instructions",
1010
] }
11-
uart_16550 = "0.2.10"
11+
uart_16550 = { version = "0.6.0" }

0 commit comments

Comments
 (0)