worked on issue #2
This commit is contained in:
parent
b1bd0cacf6
commit
d69ba91101
|
@ -4,14 +4,25 @@ use core::fmt::Error;
|
||||||
/// Prints to the host through the serial interface.
|
/// Prints to the host through the serial interface.
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! serial_print {
|
macro_rules! serial_print {
|
||||||
($($arg:tt)*) => {};
|
($($arg:tt)*) => {
|
||||||
|
|
||||||
|
crate::arch::drivers::serial::SERIAL.lock().out(format_args!($($arg)*))
|
||||||
|
|
||||||
|
};
|
||||||
}
|
}
|
||||||
/// Prints to the host through the serial interface, appending a newline.
|
/// Prints to the host through the serial interface, appending a newline.
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! serial_println {
|
macro_rules! serial_println {
|
||||||
() => {};
|
() => {
|
||||||
($fmt:expr) => {};
|
crate::arch::drivers::serial::SERIAL
|
||||||
($fmt:expr, $($arg:tt)*) => {};
|
.lock()
|
||||||
|
.out(format_args!("\r\n"))
|
||||||
|
};
|
||||||
|
|
||||||
|
($($arg:tt)*) => ($crate::print!("{}\r\n", format_args!($($arg)*)));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Serial123 {
|
pub struct Serial123 {
|
||||||
|
@ -20,7 +31,7 @@ pub struct Serial123 {
|
||||||
|
|
||||||
impl Serial123 {
|
impl Serial123 {
|
||||||
pub fn out(&mut self, s: ::core::fmt::Arguments) {
|
pub fn out(&mut self, s: ::core::fmt::Arguments) {
|
||||||
let uart_data = 0x10000000 as *mut u8;
|
let uart_data = self.uart_data as *mut u8;
|
||||||
for c in b"Hello, world!\n" {
|
for c in b"Hello, world!\n" {
|
||||||
unsafe { uart_data.write_volatile(*c) };
|
unsafe { uart_data.write_volatile(*c) };
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,11 +31,14 @@ unsafe extern "C" fn _boot() -> ! {
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" fn _start() -> ! {
|
extern "C" fn _start() -> ! {
|
||||||
|
/*
|
||||||
let uart_data = 0x10000000 as *mut u8;
|
let uart_data = 0x10000000 as *mut u8;
|
||||||
for c in b"Hardcoded serial output\n" {
|
for c in b"Hardcoded serial output\n" {
|
||||||
unsafe { uart_data.write_volatile(*c) };
|
unsafe { uart_data.write_volatile(*c) };
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
crate::serial_print!("Hi");
|
||||||
|
crate::kmain::kernel_main();
|
||||||
sloop()
|
sloop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue