From f1b22330d34ee328830ff1a6c273c24d6818192c Mon Sep 17 00:00:00 2001 From: mwojcik Date: Tue, 21 Sep 2021 12:02:27 +0200 Subject: [PATCH] runtime: rtio_mgt's async_error_read exists already --- src/runtime/src/main.rs | 6 +++++- src/runtime/src/rtio_mgt.rs | 26 -------------------------- 2 files changed, 5 insertions(+), 27 deletions(-) diff --git a/src/runtime/src/main.rs b/src/runtime/src/main.rs index 4a51099c..d9f3e713 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 57d1af7d..ffe697b4 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) {