diff --git a/src/runtime/src/main.rs b/src/runtime/src/main.rs index 4a51099..d9f3e71 100644 --- a/src/runtime/src/main.rs +++ b/src/runtime/src/main.rs @@ -21,7 +21,7 @@ use nb; use void::Void; use embedded_hal::blocking::delay::DelayMs; use libconfig::Config; -use libcortex_a9::l2c::enable_l2_cache; +use libcortex_a9::{l2c::enable_l2_cache, mutex::Mutex}; use libboard_artiq::{logger, identifier_read, init_gateware, pl}; #[cfg(has_si5324)] use libboard_artiq::si5324; @@ -35,6 +35,7 @@ mod rtio; #[cfg(ki_impl = "acp")] #[path = "rtio_acp.rs"] mod rtio; +mod rtio_mgt; mod kernel; mod moninj; mod eh_artiq; @@ -184,6 +185,8 @@ pub fn main_core0() { } }; + // before, mutex was on io, but now that io isn't used...? + let aux_mutex: Mutex = Mutex::new(false); #[cfg(has_drtio)] let drtio_routing_table = RefCell::new(drtio_routing::config_routing_table(csr::DRTIO.len(), cfg)); #[cfg(not(has_drtio))] @@ -194,6 +197,7 @@ pub fn main_core0() { #[cfg(has_drtio)] init_drtio(&mut timer); + rtio_mgt::startup() init_rtio(&mut timer, &cfg); task::spawn(report_async_rtio_errors()); diff --git a/src/runtime/src/rtio_mgt.rs b/src/runtime/src/rtio_mgt.rs index 57d1af7..ffe697b 100644 --- a/src/runtime/src/rtio_mgt.rs +++ b/src/runtime/src/rtio_mgt.rs @@ -324,31 +324,6 @@ pub mod drtio { pub fn reset(_aux_mutex: &Mutex, _timer: GlobalTimer) {} } -fn async_error_thread() { - loop { - unsafe { - // replaced io.until with spinlock - // could potentially put a sleep in there? - while csr::rtio_core::async_error_read() == 0 {} - - let errors = csr::rtio_core::async_error_read(); - if errors & 1 != 0 { - error!("RTIO collision involving channel {}", - csr::rtio_core::collision_channel_read()); - } - if errors & 2 != 0 { - error!("RTIO busy error involving channel {}", - csr::rtio_core::busy_channel_read()); - } - if errors & 4 != 0 { - error!("RTIO sequence error involving channel {}", - csr::rtio_core::sequence_error_channel_read()); - } - csr::rtio_core::async_error_write(errors); - } - } -} - pub fn startup(aux_mutex: &Mutex, routing_table: &RefCell, up_destinations: &RefCell<[bool; drtio_routing::DEST_COUNT]>, timer: GlobalTimer) { @@ -356,7 +331,6 @@ pub fn startup(aux_mutex: &Mutex, unsafe { csr::rtio_core::reset_phy_write(1); } - task::spawn(async_error_thread); } pub fn reset(aux_mutex: &Mutex, timer: GlobalTimer) {