Share print! and println! between architectures

This commit is contained in:
bjorn3
2025-09-10 18:40:30 +02:00
parent 1268472103
commit 786c9eabcb
7 changed files with 3 additions and 56 deletions
-3
View File
@@ -1,6 +1,3 @@
#[macro_use]
pub mod macros;
/// Constants like memory locations
pub mod consts;
-16
View File
@@ -1,16 +0,0 @@
/// Print to console
#[macro_export]
macro_rules! print {
($($arg:tt)*) => ({
use core::fmt::Write;
let _ = write!($crate::arch::debug::Writer::new(), $($arg)*);
});
}
/// Print with new line to console
#[macro_export]
macro_rules! println {
() => (print!("\n"));
($fmt:expr_2021) => (print!(concat!($fmt, "\n")));
($fmt:expr_2021, $($arg:tt)*) => (print!(concat!($fmt, "\n"), $($arg)*));
}
-3
View File
@@ -1,6 +1,3 @@
#[macro_use]
pub mod macros;
pub mod consts;
pub mod debug;
pub mod device;
-17
View File
@@ -1,20 +1,3 @@
/// Print to console
#[macro_export]
macro_rules! print {
($($arg:tt)*) => ({
use core::fmt::Write;
let _ = write!($crate::arch::debug::Writer::new(), $($arg)*);
});
}
/// Print with new line to console
#[macro_export]
macro_rules! println {
() => (print!("\n"));
($fmt:expr_2021) => (print!(concat!($fmt, "\n")));
($fmt:expr_2021, $($arg:tt)*) => (print!(concat!($fmt, "\n"), $($arg)*));
}
#[macro_export]
macro_rules! irqs(
( [ $( ($idt:expr_2021, $number:literal, $name:ident) ,)* ], $submac:ident ) => {
-17
View File
@@ -1,20 +1,3 @@
/// Print to console
#[macro_export]
macro_rules! print {
($($arg:tt)*) => ({
use core::fmt::Write;
let _ = write!($crate::arch::debug::Writer::new(), $($arg)*);
});
}
/// Print with new line to console
#[macro_export]
macro_rules! println {
() => (print!("\n"));
($fmt:expr_2021) => (print!(concat!($fmt, "\n")));
($fmt:expr_2021, $($arg:tt)*) => (print!(concat!($fmt, "\n"), $($arg)*));
}
macro_rules! expand_bool(
($value:expr_2021) => {
concat!($value)
+3
View File
@@ -69,6 +69,9 @@ use crate::consts::*;
/// Shared data structures
mod common;
#[macro_use]
mod macros;
/// Architecture-dependent stuff
#[macro_use]
#[allow(dead_code)] // TODO