mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-22 09:23:16 +00:00
format libs/xous-pl230
This commit is contained in:
parent
ee2c7ef140
commit
59c6d6ae77
3 changed files with 27 additions and 33 deletions
|
|
@ -8,22 +8,21 @@ pub struct Uart {
|
|||
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(0xa);
|
||||
self.putc(0xd);
|
||||
}
|
||||
|
||||
pub fn print_hex_word(&mut self, word: u32) {
|
||||
for &byte in word.to_be_bytes().iter() {
|
||||
self.put_hex(byte);
|
||||
|
|
@ -42,7 +41,6 @@ impl Uart {
|
|||
self.putc(c);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
use core::fmt::{Error, Write};
|
||||
|
|
@ -74,9 +72,7 @@ mod debug_print_hardware {
|
|||
#[macro_export]
|
||||
#[allow(unused_variables)]
|
||||
macro_rules! print {
|
||||
($($args:tt)+) => ({
|
||||
()
|
||||
});
|
||||
($($args:tt)+) => {{ () }};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ mod debug;
|
|||
#[cfg(feature = "tests")]
|
||||
pub mod pl230_tests;
|
||||
|
||||
use utralib::*;
|
||||
use bitfield::bitfield;
|
||||
use utralib::*;
|
||||
|
||||
#[repr(C, align(16))]
|
||||
#[derive(Default)]
|
||||
|
|
@ -24,7 +24,6 @@ struct ControlChannels {
|
|||
pub channels: [ChannelControl; 8],
|
||||
}
|
||||
|
||||
|
||||
pub struct Pl230 {
|
||||
pub csr: CSR<u32>,
|
||||
pub mdma: CSR<u32>,
|
||||
|
|
@ -38,6 +37,7 @@ impl Pl230 {
|
|||
mdma: CSR::new(utralib::HW_MDMA_BASE as *mut u32),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "xous")]
|
||||
pub fn new() -> Self {
|
||||
let csr = xous::syscall::map_memory(
|
||||
|
|
@ -55,10 +55,7 @@ impl Pl230 {
|
|||
)
|
||||
.unwrap();
|
||||
|
||||
Pl230 {
|
||||
csr: CSR::new(csr.as_mut_ptr() as *mut u32),
|
||||
mdma: CSR::new(mdma.as_mut_ptr() as *mut u32),
|
||||
}
|
||||
Pl230 { csr: CSR::new(csr.as_mut_ptr() as *mut u32), mdma: CSR::new(mdma.as_mut_ptr() as *mut u32) }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -70,6 +67,7 @@ pub enum DmaWidth {
|
|||
NoInc = 0b11,
|
||||
}
|
||||
#[repr(u32)]
|
||||
#[rustfmt::skip]
|
||||
pub enum ArbitrateAfter {
|
||||
XferEach = 0b0000,
|
||||
Xfer2 = 0b0001,
|
||||
|
|
|
|||
Loading…
Reference in a new issue