Disable UART since writing to it seems to cause troubles - INVESTIGATE
This commit is contained in:
parent
7974c645a2
commit
351d77d4dc
|
@ -45,9 +45,10 @@ use platform::{
|
||||||
fn kmain() -> ! {
|
fn kmain() -> ! {
|
||||||
let mut uart = MiniUart::new();
|
let mut uart = MiniUart::new();
|
||||||
uart.init();
|
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.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, 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);
|
// 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);
|
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()
|
// qemu_aarch64_exit()
|
||||||
endless_sleep()
|
endless_sleep()
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ use core::{fmt::Write, ops::Deref};
|
||||||
use platform::{
|
use platform::{
|
||||||
display::Size2d,
|
display::Size2d,
|
||||||
rpi3::{phys2bus, PERIPHERAL_BASE},
|
rpi3::{phys2bus, PERIPHERAL_BASE},
|
||||||
uart::MiniUart,
|
// uart::MiniUart,
|
||||||
};
|
};
|
||||||
use register::mmio::*;
|
use register::mmio::*;
|
||||||
|
|
||||||
|
@ -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();
|
||||||
writeln!(uart, "Mailbox::write {:x}/{:x}", 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;
|
||||||
|
@ -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 => {
|
||||||
writeln!(uart, "\n######\nMailbox::returning SUCCESS");
|
// writeln!(uart, "\n######\nMailbox::returning SUCCESS");
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
response::ERROR => {
|
response::ERROR => {
|
||||||
writeln!(uart, "\n######\nMailbox::returning ResponseError");
|
// writeln!(uart, "\n######\nMailbox::returning ResponseError");
|
||||||
Err(MboxError::ResponseError)
|
Err(MboxError::ResponseError)
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
writeln!(uart, "\n######\nMailbox::returning UnknownError");
|
// writeln!(uart, "\n######\nMailbox::returning UnknownError");
|
||||||
Err(MboxError::UnknownError)
|
Err(MboxError::UnknownError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,21 +2,21 @@ use core::fmt::Write;
|
||||||
use platform::display::{Display, PixelOrder, Size2d, CHARSIZE_X, CHARSIZE_Y};
|
use platform::display::{Display, PixelOrder, Size2d, CHARSIZE_X, CHARSIZE_Y};
|
||||||
use platform::mailbox::{self, channel, response::VAL_LEN_FLAG, tag, GpuFb, Mailbox};
|
use platform::mailbox::{self, channel, response::VAL_LEN_FLAG, tag, GpuFb, Mailbox};
|
||||||
use platform::rpi3::bus2phys;
|
use platform::rpi3::bus2phys;
|
||||||
use platform::uart::MiniUart;
|
// use platform::uart::MiniUart;
|
||||||
|
|
||||||
pub struct VC;
|
pub struct VC;
|
||||||
|
|
||||||
impl VC {
|
impl VC {
|
||||||
// Use mailbox framebuffer interface to initialize
|
// 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);
|
let mut fb_info = GpuFb::new(size, 32);
|
||||||
|
|
||||||
writeln!(uart, "initing fb_info");
|
// writeln!(uart, "initing fb_info");
|
||||||
fb_info.call().map_err(|_| {
|
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();
|
let mut mbox = Mailbox::new();
|
||||||
|
|
||||||
|
@ -61,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;
|
||||||
writeln!(uart, "inited fb_info #2");
|
// writeln!(uart, "inited fb_info #2");
|
||||||
|
|
||||||
Some(Display::new(
|
Some(Display::new(
|
||||||
bus2phys(fb_info.pointer),
|
bus2phys(fb_info.pointer),
|
||||||
|
|
Loading…
Reference in New Issue