mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
shell: disable debug output for now
We don't have a serial console yet, so disable this. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
e73fe08a3e
commit
81ff6afd66
1 changed files with 38 additions and 37 deletions
|
|
@ -39,53 +39,54 @@ pub static mut DEFAULT_UART_ADDR: *mut usize = 0x0000_0000 as *mut usize;
|
||||||
pub const DEFAULT: Uart = Uart {};
|
pub const DEFAULT: Uart = Uart {};
|
||||||
|
|
||||||
impl Uart {
|
impl Uart {
|
||||||
pub fn putc(&self, c: u8) {
|
pub fn putc(&self, _c: u8) {
|
||||||
unsafe {
|
// unsafe {
|
||||||
if DEFAULT_UART_ADDR as usize == 0 {
|
// if DEFAULT_UART_ADDR as usize == 0 {
|
||||||
let uart = xous::syscall::map_memory(
|
// let uart = xous::syscall::map_memory(
|
||||||
xous::MemoryAddress::new(0xf000_1000),
|
// xous::MemoryAddress::new(0xf000_1000),
|
||||||
None,
|
// None,
|
||||||
4096,
|
// 4096,
|
||||||
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
// xous::MemoryFlags::R | xous::MemoryFlags::W,
|
||||||
)
|
// )
|
||||||
.expect("couldn't map uart");
|
// .expect("couldn't map uart");
|
||||||
DEFAULT_UART_ADDR = uart.as_mut_ptr() as _;
|
// DEFAULT_UART_ADDR = uart.as_mut_ptr() as _;
|
||||||
println!("Mapped UART @ {:08x}", uart.addr.get());
|
// println!("Mapped UART @ {:08x}", uart.addr.get());
|
||||||
// core::mem::forget(uart);
|
// // core::mem::forget(uart);
|
||||||
|
|
||||||
println!("Allocating IRQ...");
|
// println!("Allocating IRQ...");
|
||||||
xous::claim_interrupt(2, handle_irq, core::ptr::null_mut::<usize>()).expect("unable to allocate IRQ");
|
// xous::claim_interrupt(2, handle_irq, core::ptr::null_mut::<usize>()).expect("unable to allocate IRQ");
|
||||||
self.enable_rx();
|
// self.enable_rx();
|
||||||
}
|
// }
|
||||||
let base = DEFAULT_UART_ADDR;
|
// let base = DEFAULT_UART_ADDR;
|
||||||
|
|
||||||
// Wait until TXFULL is `0`
|
// // Wait until TXFULL is `0`
|
||||||
while base.add(1).read_volatile() != 0 {}
|
// while base.add(1).read_volatile() != 0 {}
|
||||||
base.add(0).write_volatile(c as usize)
|
// base.add(0).write_volatile(c as usize)
|
||||||
};
|
// };
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn enable_rx(&self) {
|
pub fn enable_rx(&self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let base = DEFAULT_UART_ADDR;
|
// let base = DEFAULT_UART_ADDR;
|
||||||
base.add(5).write_volatile(base.add(5).read_volatile() | 2)
|
// base.add(5).write_volatile(base.add(5).read_volatile() | 2)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getc(&self) -> Option<u8> {
|
pub fn getc(&self) -> Option<u8> {
|
||||||
unsafe {
|
// unsafe {
|
||||||
let base = DEFAULT_UART_ADDR;
|
// let base = DEFAULT_UART_ADDR;
|
||||||
// If EV_PENDING_RX is 1, return the pending character.
|
// // If EV_PENDING_RX is 1, return the pending character.
|
||||||
// Otherwise, return None.
|
// // Otherwise, return None.
|
||||||
match base.add(4).read_volatile() & 2 {
|
// match base.add(4).read_volatile() & 2 {
|
||||||
0 => None,
|
// 0 => None,
|
||||||
ack => {
|
// ack => {
|
||||||
let c = Some(base.add(0).read_volatile() as u8);
|
// let c = Some(base.add(0).read_volatile() as u8);
|
||||||
base.add(4).write_volatile(ack);
|
// base.add(4).write_volatile(ack);
|
||||||
c
|
// c
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue