1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use core::fmt::Write;
use card10_sys::*;
pub struct Uart;
impl Write for Uart {
fn write_str(&mut self, s: &str) -> core::fmt::Result {
unsafe {
epic_uart_write_str(s.as_ptr(), s.len() as isize);
}
Ok(())
}
}
#[macro_export]
macro_rules! print {
($($arg:tt)*) => ($crate::uart::_print(format_args!($($arg)*)));
}
#[macro_export]
macro_rules! println {
() => ($crate::print!("\r"));
($($arg:tt)*) => ($crate::print!("{}\r\n", format_args!($($arg)*)));
}
#[doc(hidden)]
pub fn _print(args: core::fmt::Arguments) {
crate::UART.write_fmt(args);
}