mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
format xous-pio
This commit is contained in:
parent
f00293a3a8
commit
ee2c7ef140
1 changed files with 19 additions and 24 deletions
|
|
@ -1,8 +1,8 @@
|
||||||
|
pub mod adder;
|
||||||
pub mod i2c;
|
pub mod i2c;
|
||||||
|
pub mod nec;
|
||||||
pub mod spi;
|
pub mod spi;
|
||||||
pub mod units;
|
pub mod units;
|
||||||
pub mod adder;
|
|
||||||
pub mod nec;
|
|
||||||
|
|
||||||
#[cfg(not(any(target_os = "xous", feature = "rp2040")))]
|
#[cfg(not(any(target_os = "xous", feature = "rp2040")))]
|
||||||
mod duart {
|
mod duart {
|
||||||
|
|
@ -19,32 +19,29 @@ mod duart {
|
||||||
#[cfg(not(any(target_os = "xous", feature = "rp2040")))]
|
#[cfg(not(any(target_os = "xous", feature = "rp2040")))]
|
||||||
use utralib::CSR;
|
use utralib::CSR;
|
||||||
#[cfg(not(any(target_os = "xous", feature = "rp2040")))]
|
#[cfg(not(any(target_os = "xous", feature = "rp2040")))]
|
||||||
pub struct Uart {
|
pub struct Uart {}
|
||||||
}
|
|
||||||
#[cfg(not(any(target_os = "xous", feature = "rp2040")))]
|
#[cfg(not(any(target_os = "xous", feature = "rp2040")))]
|
||||||
impl Uart {
|
impl Uart {
|
||||||
fn put_digit(&mut self, d: u8) {
|
fn put_digit(&mut self, d: u8) {
|
||||||
let nyb = d & 0xF;
|
let nyb = d & 0xF;
|
||||||
let c = if nyb < 10 {
|
let c = if nyb < 10 { nyb + 0x30 } else { nyb + 0x61 - 10 };
|
||||||
nyb + 0x30
|
|
||||||
} else {
|
|
||||||
nyb + 0x61 - 10
|
|
||||||
};
|
|
||||||
assert!(c >= 0x30, "conversion failed!");
|
assert!(c >= 0x30, "conversion failed!");
|
||||||
self.putc(c);
|
self.putc(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn put_hex(&mut self, c: u8) {
|
pub fn put_hex(&mut self, c: u8) {
|
||||||
self.put_digit(c >> 4);
|
self.put_digit(c >> 4);
|
||||||
self.put_digit(c & 0xF);
|
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) {
|
pub fn print_hex_word(&mut self, word: u32) {
|
||||||
for &byte in word.to_be_bytes().iter() {
|
for &byte in word.to_be_bytes().iter() {
|
||||||
self.put_hex(byte);
|
self.put_hex(byte);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn putc(&self, c: u8) {
|
pub fn putc(&self, c: u8) {
|
||||||
let base = duart::HW_DUART_BASE as *mut u32;
|
let base = duart::HW_DUART_BASE as *mut u32;
|
||||||
let mut uart = CSR::new(base);
|
let mut uart = CSR::new(base);
|
||||||
|
|
@ -66,12 +63,10 @@ impl Uart {
|
||||||
self.putc(c);
|
self.putc(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(any(target_os = "xous", feature = "rp2040")))]
|
#[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) {
|
pub fn report_api(d: u32) {
|
||||||
#[cfg(not(any(target_os = "xous", feature = "rp2040")))]
|
#[cfg(not(any(target_os = "xous", feature = "rp2040")))]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue