[wip] more uart output
This commit is contained in:
parent
4367a53b91
commit
94f61b6a8a
|
@ -28,6 +28,7 @@ pub mod arch;
|
|||
pub use arch::*;
|
||||
pub mod platform;
|
||||
|
||||
use core::fmt::Write;
|
||||
use platform::{
|
||||
display::{Color, Size2d},
|
||||
uart::MiniUart,
|
||||
|
@ -49,11 +50,11 @@ fn panic(_info: &PanicInfo) -> ! {
|
|||
// Kernel entry point
|
||||
// arch crate is responsible for calling this
|
||||
pub fn kmain() -> ! {
|
||||
let uart = MiniUart::new();
|
||||
let mut uart = MiniUart::new();
|
||||
uart.init();
|
||||
uart.puts("Hey there, mini uart talking!");
|
||||
write!(uart, "Hey there, mini uart talking!\n");
|
||||
|
||||
if let Some(mut display) = VC::init_fb(Size2d { x: 800, y: 600 }) {
|
||||
if let Some(mut display) = VC::init_fb(Size2d { x: 800, y: 600 }, &mut uart) {
|
||||
display.rect(100, 100, 200, 200, Color::rgb(255, 255, 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);
|
||||
|
@ -63,6 +64,6 @@ pub fn kmain() -> ! {
|
|||
display.draw_text(170, 70, "BLUE", Color::rgb(0, 0, 255).0);
|
||||
}
|
||||
|
||||
uart.puts("Bye, going to sleep now");
|
||||
write!(uart, "Bye, going to sleep now\n");
|
||||
endless_sleep()
|
||||
}
|
||||
|
|
|
@ -1,15 +1,20 @@
|
|||
use core::fmt::Write;
|
||||
use platform::display::{Display, PixelOrder, Size2d, CHARSIZE_X, CHARSIZE_Y};
|
||||
use platform::mailbox::{self, channel, tag, GpuFb, Mailbox, response::VAL_LEN_FLAG};
|
||||
use platform::rpi3::bus2phys;
|
||||
use platform::uart::MiniUart;
|
||||
|
||||
pub struct VC;
|
||||
|
||||
impl VC {
|
||||
// Use mailbox framebuffer interface to initialize
|
||||
pub fn init_fb(size: Size2d) -> Option<Display> {
|
||||
pub fn init_fb(size: Size2d, uart: &mut MiniUart) -> Option<Display> {
|
||||
let mut fb_info: GpuFb = GpuFb::new(size, 24);
|
||||
|
||||
fb_info.call().map_err(|_| ());
|
||||
uart.puts("initing fb_info\n");
|
||||
fb_info.call().map_err(|_| {uart.puts("fb_info error\n");()});
|
||||
|
||||
write!(uart, "inited fb_info: {}\n", fb_info);
|
||||
|
||||
// let mut pixel_order = Mailbox::new();
|
||||
//
|
||||
|
@ -25,6 +30,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;
|
||||
uart.puts("inited fb_info #2\n");
|
||||
|
||||
Some(Display::new(
|
||||
bus2phys(fb_info.pointer),
|
||||
|
|
Loading…
Reference in New Issue