Disable UART since writing to it seems to cause troubles - INVESTIGATE

This commit is contained in:
Berkus Decker 2019-01-19 02:52:33 +02:00
parent 7974c645a2
commit 351d77d4dc
3 changed files with 21 additions and 20 deletions

View File

@ -45,9 +45,10 @@ use platform::{
fn kmain() -> ! {
let mut uart = MiniUart::new();
uart.init();
writeln!(uart, "Hey there, mini uart talking!");
// Crashes if uncommenting next line: vvv
// writeln!(uart, "Hey there, mini uart talking!");
if let Some(mut display) = VC::init_fb(Size2d { x: 800, y: 600 }, &mut uart) {
if let Some(mut display) = VC::init_fb(Size2d { x: 800, y: 600 } /*, &mut uart*/) {
display.rect(10, 10, 250, 250, Color::rgb(32, 96, 64).0);
display.draw_text(50, 50, "Hello there!", Color::rgb(128, 192, 255).0);
// display.draw_text(50, 150, core::fmt("Display width {}", display.width), Color::rgb(255,0,0).0);
@ -57,7 +58,7 @@ fn kmain() -> ! {
display.draw_text(170, 70, "BLUE", Color::rgb(0, 0, 255).0);
}
writeln!(uart, "Bye, going to sleep now");
// writeln!(uart, "Bye, going to sleep now");
// qemu_aarch64_exit()
endless_sleep()
}

View File

@ -4,7 +4,7 @@ use core::{fmt::Write, ops::Deref};
use platform::{
display::Size2d,
rpi3::{phys2bus, PERIPHERAL_BASE},
uart::MiniUart,
// uart::MiniUart,
};
use register::mmio::*;
@ -193,11 +193,11 @@ pub mod alpha_mode {
fn write(regs: &RegisterBlock, buf_ptr: u32, channel: u32) -> Result<()> {
let mut count: u32 = 0;
{
let mut uart = MiniUart::new();
uart.init();
writeln!(uart, "Mailbox::write {:x}/{:x}", buf_ptr, channel);
}
// {
// let mut uart = MiniUart::new();
// uart.init();
// writeln!(uart, "Mailbox::write {:x}/{:x}", buf_ptr, channel);
// }
while regs.STATUS.is_set(STATUS::FULL) {
count += 1;
@ -289,20 +289,20 @@ impl Mailbox {
pub fn read(&self, channel: u32) -> Result<()> {
read(self, phys2bus(self.buffer.as_ptr() as u32), channel)?;
let mut uart = MiniUart::new();
uart.init();
// let mut uart = MiniUart::new();
// uart.init();
match self.buffer[1] {
response::SUCCESS => {
writeln!(uart, "\n######\nMailbox::returning SUCCESS");
// writeln!(uart, "\n######\nMailbox::returning SUCCESS");
Ok(())
}
response::ERROR => {
writeln!(uart, "\n######\nMailbox::returning ResponseError");
// writeln!(uart, "\n######\nMailbox::returning ResponseError");
Err(MboxError::ResponseError)
}
_ => {
writeln!(uart, "\n######\nMailbox::returning UnknownError");
// writeln!(uart, "\n######\nMailbox::returning UnknownError");
Err(MboxError::UnknownError)
}
}

View File

@ -2,21 +2,21 @@ use core::fmt::Write;
use platform::display::{Display, PixelOrder, Size2d, CHARSIZE_X, CHARSIZE_Y};
use platform::mailbox::{self, channel, response::VAL_LEN_FLAG, tag, GpuFb, Mailbox};
use platform::rpi3::bus2phys;
use platform::uart::MiniUart;
// use platform::uart::MiniUart;
pub struct VC;
impl VC {
// Use mailbox framebuffer interface to initialize
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);
writeln!(uart, "initing fb_info");
// writeln!(uart, "initing fb_info");
fb_info.call().map_err(|_| {
writeln!(uart, "fb_info error");
// writeln!(uart, "fb_info error");
});
writeln!(uart, "inited fb_info: {}", fb_info);
// writeln!(uart, "inited fb_info: {}", fb_info);
let mut mbox = Mailbox::new();
@ -61,7 +61,7 @@ impl VC {
/* Need to set up max_x/max_y before using Display::write */
let max_x = fb_info.vwidth / CHARSIZE_X;
let max_y = fb_info.vheight / CHARSIZE_Y;
writeln!(uart, "inited fb_info #2");
// writeln!(uart, "inited fb_info #2");
Some(Display::new(
bus2phys(fb_info.pointer),