format xous-pio

This commit is contained in:
bunnie 2024-01-14 19:22:37 +08:00
parent f00293a3a8
commit ee2c7ef140

View file

@ -1,8 +1,8 @@
pub mod adder;
pub mod i2c;
pub mod nec;
pub mod spi;
pub mod units;
pub mod adder;
pub mod nec;
#[cfg(not(any(target_os = "xous", feature = "rp2040")))]
mod duart {
@ -19,32 +19,29 @@ mod duart {
#[cfg(not(any(target_os = "xous", feature = "rp2040")))]
use utralib::CSR;
#[cfg(not(any(target_os = "xous", feature = "rp2040")))]
pub struct Uart {
}
pub struct Uart {}
#[cfg(not(any(target_os = "xous", feature = "rp2040")))]
impl Uart {
fn put_digit(&mut self, d: u8) {
let nyb = d & 0xF;
let c = if nyb < 10 {
nyb + 0x30
} else {
nyb + 0x61 - 10
};
let c = if nyb < 10 { nyb + 0x30 } else { nyb + 0x61 - 10 };
assert!(c >= 0x30, "conversion failed!");
self.putc(c);
}
pub fn put_hex(&mut self, c: u8) {
self.put_digit(c >> 4);
self.put_digit(c & 0xF);
}
pub fn newline(&mut self) {
self.putc(0xd);
}
pub fn newline(&mut self) { self.putc(0xd); }
pub fn print_hex_word(&mut self, word: u32) {
for &byte in word.to_be_bytes().iter() {
self.put_hex(byte);
}
}
pub fn putc(&self, c: u8) {
let base = duart::HW_DUART_BASE as *mut u32;
let mut uart = CSR::new(base);
@ -66,12 +63,10 @@ impl Uart {
self.putc(c);
}
}
}
#[cfg(not(any(target_os = "xous", feature = "rp2040")))]
pub fn setup_reporting(_rep_adr: *mut u32) {
}
pub fn setup_reporting(_rep_adr: *mut u32) {}
pub fn report_api(d: u32) {
#[cfg(not(any(target_os = "xous", feature = "rp2040")))]