Skip to content

Commit

Permalink
Merge pull request betrusted-io#266 from Foundation-Devices/driver-re…
Browse files Browse the repository at this point in the history
…factor

kernel: Drivers refactor.
  • Loading branch information
bunnie authored Nov 2, 2022
2 parents ebc0739 + 6332bf1 commit f59bbc2
Show file tree
Hide file tree
Showing 17 changed files with 555 additions and 431 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion kernel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description = "Core kernel for Xous, including task switching and memory managem
license = "MIT OR Apache-2.0"
edition = "2018"
name = "xous-kernel"
version = "0.9.17"
version = "0.9.18"
resolver = "2"

# Dependency versions enforced by Cargo.lock.
Expand Down
2 changes: 0 additions & 2 deletions kernel/src/arch/riscv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ pub mod exception;
pub mod irq;
pub mod mem;
pub mod process;
pub mod rand;
pub mod syscall;

pub use process::Thread;
Expand Down Expand Up @@ -49,7 +48,6 @@ pub fn init() {
sie::set_ssoft();
sie::set_sext();
}
rand::init();
}

/// Put the core to sleep until an interrupt hits. Returns `true`
Expand Down
69 changes: 0 additions & 69 deletions kernel/src/arch/riscv/rand.rs

This file was deleted.

53 changes: 53 additions & 0 deletions kernel/src/debug/macros.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// SPDX-FileCopyrightText: 2020 Sean Cross <sean@xobs.io>
// SPDX-FileCopyrightText: 2022 Foundation Devices, Inc. <hello@foundationdevices.com>
// SPDX-License-Identifier: Apache-2.0

/// Prints to the debug output directly.
#[cfg(baremetal)]
#[macro_export]
macro_rules! print {
($($args:tt)+) => {{
#[allow(unused_unsafe)]
unsafe {
use core::fmt::Write;
if let Some(stream) = crate::debug::shell::OUTPUT.as_mut() {
write!(stream, $($args)+).unwrap();
}
}
}};
}

/// Prints to the debug output directly, with a newline.
#[cfg(baremetal)]
#[macro_export]
macro_rules! println {
() => ({
print!("\r\n")
});
($fmt:expr) => ({
print!(concat!($fmt, "\r\n"))
});
($fmt:expr, $($args:tt)+) => ({
print!(concat!($fmt, "\r\n"), $($args)+)
});
}

#[cfg(feature = "debug-print")]
#[macro_export]
macro_rules! klog {
() => ({
print!(" [{}:{}]", file!(), line!())
});
($fmt:expr) => ({
print!(concat!(" [{}:{} ", $fmt, "]"), file!(), line!())
});
($fmt:expr, $($args:tt)+) => ({
print!(concat!(" [{}:{} ", $fmt, "]"), file!(), line!(), $($args)+)
});
}

#[cfg(not(feature = "debug-print"))]
#[macro_export]
macro_rules! klog {
($($args:tt)+) => {{}};
}
Loading

0 comments on commit f59bbc2

Please sign in to comment.