Skip to content

Commit 3e78a84

Browse files
committed
zephyr: Fill in some missing doc comments
Fix doc build errors by filling in missing documentation comments. Signed-off-by: David Brown <[email protected]>
1 parent 1ac6809 commit 3e78a84

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

zephyr/src/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ fn panic(info :&PanicInfo) -> ! {
8282
}
8383
}
8484

85+
/// Set the logger that the log crate will use to a printk-based logger within Zephyr.
8586
#[cfg(CONFIG_PRINTK)]
8687
pub fn set_logger() {
8788
printk::set_printk_logger();
@@ -111,6 +112,11 @@ pub mod alloc_impl;
111112
// If we have allocation, we can also support logging.
112113
#[cfg(CONFIG_RUST_ALLOC)]
113114
pub mod log {
115+
//! A simple logging system using printk.
116+
//!
117+
//! As a stopgap for full logging, this allows Rust's logging to be transmitted via printk
118+
//! messages.
119+
114120
#[cfg(CONFIG_LOG)]
115121
compile_error!("Rust with CONFIG_LOG is not yet supported");
116122

zephyr/src/log/log_printk.rs

+1-11
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,10 @@ extern "C" {
2020
fn printk(fmt: *const i8, ...);
2121
}
2222

23+
#[doc(hidden)]
2324
pub fn log_message(message: &str) {
2425
let raw = CString::new(message).expect("CString::new failed");
2526
unsafe {
2627
printk(c"%s\n".as_ptr(), raw.as_ptr());
2728
}
2829
}
29-
30-
// We assume the log message is accessible at $crate::log::log_message.
31-
#[macro_export]
32-
macro_rules! println {
33-
($($arg:tt)+) => {
34-
{
35-
let message = $crate::log::format!($($arg)+);
36-
$crate::log::log_message(&message);
37-
}
38-
};
39-
}

zephyr/src/printk.rs

+2
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,14 @@ static PRINTK_LOGGER: PrintkLogger = PrintkLogger;
7474

7575
// The cfg matches what is in the log crate, which doesn't use portable atomic, and assumes the
7676
// racy init when not the case.
77+
#[doc(hidden)]
7778
#[cfg(target_has_atomic = "ptr")]
7879
pub fn set_printk_logger() {
7980
log::set_logger(&PRINTK_LOGGER).unwrap();
8081
log::set_max_level(LevelFilter::Info);
8182
}
8283

84+
#[doc(hidden)]
8385
#[cfg(not(target_has_atomic = "ptr"))]
8486
pub fn set_printk_logger() {
8587
unsafe {

zephyr/src/sys.rs

+6
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ pub mod flash {
145145
146146
use crate::raw;
147147

148+
/// A flash controller
149+
///
150+
/// This is a wrapper around the `struct device` in Zephyr that represents a flash controller.
151+
/// Using the flash controller allows flash operations on the entire device. See
152+
/// [`FlashPartition`] for a wrapper that limits the operation to a partition as defined in the
153+
/// DT.
148154
#[allow(dead_code)]
149155
pub struct FlashController {
150156
pub(crate) device: *const raw::device,

0 commit comments

Comments
 (0)