Skip to content

Commit

Permalink
Use pl011-uart crate for aarch64 example.
Browse files Browse the repository at this point in the history
  • Loading branch information
qwandor committed Nov 26, 2024
1 parent a6c23a1 commit 9368f5f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 68 deletions.
1 change: 1 addition & 0 deletions examples/aarch64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ edition = "2021"
buddy_system_allocator = "0.10.0"
flat_device_tree = "3.1.1"
log = "0.4.22"
pl011-uart = "0.1.0"
smccc = "0.1.1"
spin = "0.9.8"
virtio-drivers = { path = "../.." }
Expand Down
8 changes: 3 additions & 5 deletions examples/aarch64/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ mod exceptions;
mod hal;
mod logger;
#[cfg(platform = "qemu")]
mod pl011;
#[cfg(platform = "qemu")]
use pl011 as uart;
use pl011_uart as uart;
#[cfg(platform = "crosvm")]
mod uart8250;
#[cfg(platform = "crosvm")]
Expand Down Expand Up @@ -50,11 +48,11 @@ use virtio_drivers::{

/// Base memory-mapped address of the primary PL011 UART device.
#[cfg(platform = "qemu")]
pub const UART_BASE_ADDRESS: usize = 0x900_0000;
pub const UART_BASE_ADDRESS: *mut u32 = 0x900_0000 as _;

/// The base address of the first 8250 UART.
#[cfg(platform = "crosvm")]
pub const UART_BASE_ADDRESS: usize = 0x3f8;
pub const UART_BASE_ADDRESS: *mut u32 = 0x3f8 as _;

#[global_allocator]
static HEAP_ALLOCATOR: LockedHeap<32> = LockedHeap::new();
Expand Down
61 changes: 0 additions & 61 deletions examples/aarch64/src/pl011.rs

This file was deleted.

4 changes: 2 additions & 2 deletions examples/aarch64/src/uart8250.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ impl Uart {
/// The given base address must point to the 8 MMIO control registers of an appropriate UART
/// device, which must be mapped into the address space of the process as device memory and not
/// have any other aliases.
pub unsafe fn new(base_address: usize) -> Self {
pub unsafe fn new(base_address: *mut u32) -> Self {
Self {
base_address: base_address as *mut u8,
base_address: base_address.cast(),
}
}

Expand Down

0 comments on commit 9368f5f

Please sign in to comment.