diff --git a/kernel/src/debug/shell.rs b/kernel/src/debug/shell.rs index d54922089..bf8552792 100644 --- a/kernel/src/debug/shell.rs +++ b/kernel/src/debug/shell.rs @@ -7,10 +7,9 @@ use core::fmt; -use crate::{ - args::KernelArguments, - io::{SerialRead, SerialWrite}, -}; +use crate::io::SerialWrite; +#[cfg(not(feature = "bao1x"))] +use crate::{args::KernelArguments, io::SerialRead}; /// Instance of the shell output. pub static mut OUTPUT: Option = None; @@ -59,6 +58,7 @@ impl fmt::Write for Output { /// Initialize the kernel shell. /// /// This should be called in platform initialization code. +#[cfg(not(feature = "bao1x"))] pub fn init(serial: &'static mut dyn SerialWrite) { unsafe { OUTPUT = Some(Output::new(serial)) } @@ -78,6 +78,7 @@ pub fn init(serial: &'static mut dyn SerialWrite) { /// /// This should be called when a serial interface has new data, for example, /// on an interrupt. +#[cfg(not(feature = "bao1x"))] pub fn process_characters(serial: &mut R) { while let Some(b) = serial.getc() { println!("> {}", b as char); @@ -85,6 +86,7 @@ pub fn process_characters(serial: &mut R) { } } +#[cfg(not(feature = "bao1x"))] fn handle_character(b: u8) { use crate::services::ArchProcess; @@ -222,6 +224,7 @@ fn handle_character(b: u8) { } } +#[cfg(not(feature = "bao1x"))] fn print_help() { println!("Xous Kernel Debug"); println!("key | command"); diff --git a/kernel/src/platform/bao1x/uart.rs b/kernel/src/platform/bao1x/uart.rs index b796cb436..acebf21e6 100644 --- a/kernel/src/platform/bao1x/uart.rs +++ b/kernel/src/platform/bao1x/uart.rs @@ -12,12 +12,7 @@ use utralib::generated::*; use xous_kernel::{MemoryFlags, MemoryType}; #[cfg(feature = "bao1x")] -use crate::{ - PID, - debug::shell::process_characters, - io::{SerialRead, SerialWrite}, - mem::MemoryManager, -}; +use crate::{PID, io::SerialWrite, mem::MemoryManager}; /// UART virtual address. /// @@ -48,11 +43,12 @@ pub fn init() { ) .expect("unable to map serial port") }); - let mut uart = Uart::new(UART_ADDR, IRQ0_ADDR, process_characters); + let mut uart = Uart::new(UART_ADDR, IRQ0_ADDR); uart.init(); unsafe { UART = Some(uart); - crate::debug::shell::init((&mut *(&raw mut UART)).as_mut().unwrap()); + // inaccessible because DUART is tx-only + // crate::debug::shell::init((&mut *(&raw mut UART)).as_mut().unwrap()); } } @@ -63,9 +59,7 @@ pub struct Uart { #[cfg(feature = "bao1x")] impl Uart { - pub fn new(addr: usize, _irq_addr: usize, _callback: fn(&mut Self)) -> Uart { - Uart { uart_csr: CSR::new(addr as *mut u32) } - } + pub fn new(addr: usize, _irq_addr: usize) -> Uart { Uart { uart_csr: CSR::new(addr as *mut u32) } } pub fn init(&mut self) { // duart requires no special initializations @@ -79,8 +73,3 @@ impl SerialWrite for Uart { self.uart_csr.wo(utra::duart::SFR_TXD, c as u32); } } - -#[cfg(feature = "bao1x")] -impl SerialRead for Uart { - fn getc(&mut self) -> Option { None } -}