Replace uart.puts() with writeln!()

This commit is contained in:
Berkus Decker 2019-01-17 19:40:01 +02:00
parent 67b3b95d9a
commit 3831a411b9
2 changed files with 26 additions and 27 deletions

View File

@ -193,11 +193,11 @@ pub mod alpha_mode {
fn write(regs: &RegisterBlock, buf_ptr: u32, channel: u32) -> Result<()> { fn write(regs: &RegisterBlock, buf_ptr: u32, channel: u32) -> Result<()> {
let mut count: u32 = 0; let mut count: u32 = 0;
// { {
// let mut uart = MiniUart::new(); let mut uart = MiniUart::new();
// uart.init(); uart.init();
// write!(uart, "Mailbox::write {:x}/{:x}\n", buf_ptr, channel); writeln!(uart, "Mailbox::write {:x}/{:x}", buf_ptr, channel);
// } }
while regs.STATUS.is_set(STATUS::FULL) { while regs.STATUS.is_set(STATUS::FULL) {
count += 1; count += 1;
@ -237,7 +237,7 @@ fn read(regs: &RegisterBlock, expected: u32, channel: u32) -> Result<()> {
// is it a valid successful response? // is it a valid successful response?
return Ok(()); return Ok(());
} else { } else {
return Err(MboxError::ResponseError); //@fixme ignore invalid responses and loop again? // return Err(MboxError::ResponseError); //@fixme ignore invalid responses and loop again?
} }
} }
} }
@ -289,20 +289,20 @@ impl Mailbox {
pub fn read(&self, channel: u32) -> Result<()> { pub fn read(&self, channel: u32) -> Result<()> {
read(self, phys2bus(self.buffer.as_ptr() as u32), channel)?; read(self, phys2bus(self.buffer.as_ptr() as u32), channel)?;
//let mut uart = MiniUart::new(); let mut uart = MiniUart::new();
//uart.init(); uart.init();
match self.buffer[1] { match self.buffer[1] {
response::SUCCESS => { response::SUCCESS => {
//uart.puts("\n######\nMailbox::returning SUCCESS\n"); writeln!(uart, "\n######\nMailbox::returning SUCCESS");
Ok(()) Ok(())
} }
response::ERROR => { response::ERROR => {
//uart.puts("\n######\nMailbox::returning ResponseError\n"); writeln!(uart, "\n######\nMailbox::returning ResponseError");
Err(MboxError::ResponseError) Err(MboxError::ResponseError)
} }
_ => { _ => {
//uart.puts("\n######\nMailbox::returning UnknownError\n"); writeln!(uart, "\n######\nMailbox::returning UnknownError");
Err(MboxError::UnknownError) Err(MboxError::UnknownError)
} }
} }

View File

@ -11,13 +11,12 @@ impl VC {
pub fn init_fb(size: Size2d, uart: &mut MiniUart) -> Option<Display> { pub fn init_fb(size: Size2d, uart: &mut MiniUart) -> Option<Display> {
let mut fb_info = GpuFb::new(size, 32); let mut fb_info = GpuFb::new(size, 32);
uart.puts("initing fb_info\n"); writeln!(uart, "initing fb_info");
fb_info.call().map_err(|_| { fb_info.call().map_err(|_| {
uart.puts("fb_info error\n"); writeln!(uart, "fb_info error");
()
}); });
// write!(uart, "inited fb_info: {}\n", fb_info); writeln!(uart, "inited fb_info: {}", fb_info);
let mut mbox = Mailbox::new(); let mut mbox = Mailbox::new();
@ -62,7 +61,7 @@ impl VC {
/* Need to set up max_x/max_y before using Display::write */ /* Need to set up max_x/max_y before using Display::write */
let max_x = fb_info.vwidth / CHARSIZE_X; let max_x = fb_info.vwidth / CHARSIZE_X;
let max_y = fb_info.vheight / CHARSIZE_Y; let max_y = fb_info.vheight / CHARSIZE_Y;
uart.puts("inited fb_info #2\n"); writeln!(uart, "inited fb_info #2");
Some(Display::new( Some(Display::new(
bus2phys(fb_info.pointer), bus2phys(fb_info.pointer),