mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
move to utra
This commit is contained in:
parent
d5668be9b6
commit
10aacd76c4
1 changed files with 5 additions and 3 deletions
|
|
@ -1,14 +1,16 @@
|
||||||
|
use utralib::generated::*;
|
||||||
pub struct Uart {
|
pub struct Uart {
|
||||||
pub base: *mut u32,
|
pub base: *mut u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Uart {
|
impl Uart {
|
||||||
pub fn putc(&self, c: u8) {
|
pub fn putc(&self, c: u8) {
|
||||||
|
let mut uart = CSR::new(self.base);
|
||||||
unsafe {
|
unsafe {
|
||||||
// Wait until TXFULL is `0`
|
// 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 {
|
pub mod debug_print_hardware {
|
||||||
use crate::debug::*;
|
use crate::debug::*;
|
||||||
pub const SUPERVISOR_UART: Uart = Uart {
|
pub const SUPERVISOR_UART: Uart = Uart {
|
||||||
base: 0xF000_4000 as *mut u32,
|
base: utra::uart::HW_UART_BASE as *mut u32,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue