File tree Expand file tree Collapse file tree 4 files changed +15
-11
lines changed Expand file tree Collapse file tree 4 files changed +15
-11
lines changed Original file line number Diff line number Diff 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 ) ]
8687pub 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 ) ]
113114pub 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
Original file line number Diff line number Diff line change @@ -20,20 +20,10 @@ extern "C" {
2020 fn printk ( fmt : * const i8 , ...) ;
2121}
2222
23+ #[ doc( hidden) ]
2324pub 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- }
Original file line number Diff line number Diff 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" ) ]
7879pub 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" ) ) ]
8486pub fn set_printk_logger ( ) {
8587 unsafe {
Original file line number Diff line number Diff 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 ,
You can’t perform that action at this time.
0 commit comments