From 10aacd76c4a88242e245e8a149c5083c55257297 Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 13 Oct 2020 04:38:21 +0800 Subject: [PATCH] move to utra --- loader/src/debug.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/loader/src/debug.rs b/loader/src/debug.rs index 917dd4c05..b6ba29b6e 100644 --- a/loader/src/debug.rs +++ b/loader/src/debug.rs @@ -1,14 +1,16 @@ +use utralib::generated::*; pub struct Uart { pub base: *mut u32, } impl Uart { pub fn putc(&self, c: u8) { + let mut uart = CSR::new(self.base); unsafe { // Wait until TXFULL is `0` - while self.base.add(1).read_volatile() != 0 { + while uart.r(utra::uart::TXFULL) != 0 { } - self.base.add(0).write_volatile(c as u32) + uart.wo(utra::uart::RXTX, c as u32) }; } } @@ -28,7 +30,7 @@ impl Write for Uart { pub mod debug_print_hardware { use crate::debug::*; pub const SUPERVISOR_UART: Uart = Uart { - base: 0xF000_4000 as *mut u32, + base: utra::uart::HW_UART_BASE as *mut u32, }; #[macro_export]