add udmaglobal implementation for xous environment

This commit is contained in:
bunnie 2024-10-04 13:08:46 +08:00
parent 68828cf9ce
commit 84c79a313b
2 changed files with 15 additions and 2 deletions

View file

@ -4,7 +4,7 @@ pub mod keyboard;
pub mod trng;
use api::Opcode;
use cramium_hal::udma::{EventChannel, PeriphEventType, PeriphId};
use cramium_hal::udma::{EventChannel, PeriphEventType, PeriphId, UdmaGlobalConfig};
pub use iox_lib::*;
use num_traits::*;
@ -64,3 +64,16 @@ impl UdmaGlobal {
.expect("Couldn't setup UDMA event mapping");
}
}
impl UdmaGlobalConfig for UdmaGlobal {
fn clock(&self, peripheral: PeriphId, enable: bool) { self.udma_clock_config(peripheral, enable); }
unsafe fn udma_event_map(
&self,
peripheral: PeriphId,
event_type: PeriphEventType,
to_channel: EventChannel,
) {
self.udma_event_map(peripheral, event_type, to_channel);
}
}

View file

@ -137,7 +137,7 @@ fn main() {
xous::MemoryFlags::R | xous::MemoryFlags::W,
)
.expect("couldn't map UDMA global control");
let mut udma_global = GlobalConfig::new(udma_global_csr.as_mut_ptr() as *mut u32);
let udma_global = GlobalConfig::new(udma_global_csr.as_mut_ptr() as *mut u32);
let mut pio_ss = xous_pio::PioSharedState::new();
// map and enable the interrupt for the PIO system timer