runtime: rtio_mgt's async_error_read exists already

This commit is contained in:
mwojcik 2021-09-21 12:02:27 +02:00
parent 85e7784b91
commit f1b22330d3
2 changed files with 5 additions and 27 deletions

View File

@ -21,7 +21,7 @@ use nb;
use void::Void; use void::Void;
use embedded_hal::blocking::delay::DelayMs; use embedded_hal::blocking::delay::DelayMs;
use libconfig::Config; 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}; use libboard_artiq::{logger, identifier_read, init_gateware, pl};
#[cfg(has_si5324)] #[cfg(has_si5324)]
use libboard_artiq::si5324; use libboard_artiq::si5324;
@ -35,6 +35,7 @@ mod rtio;
#[cfg(ki_impl = "acp")] #[cfg(ki_impl = "acp")]
#[path = "rtio_acp.rs"] #[path = "rtio_acp.rs"]
mod rtio; mod rtio;
mod rtio_mgt;
mod kernel; mod kernel;
mod moninj; mod moninj;
mod eh_artiq; 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<bool> = Mutex::new(false);
#[cfg(has_drtio)] #[cfg(has_drtio)]
let drtio_routing_table = RefCell::new(drtio_routing::config_routing_table(csr::DRTIO.len(), cfg)); let drtio_routing_table = RefCell::new(drtio_routing::config_routing_table(csr::DRTIO.len(), cfg));
#[cfg(not(has_drtio))] #[cfg(not(has_drtio))]
@ -194,6 +197,7 @@ pub fn main_core0() {
#[cfg(has_drtio)] #[cfg(has_drtio)]
init_drtio(&mut timer); init_drtio(&mut timer);
rtio_mgt::startup()
init_rtio(&mut timer, &cfg); init_rtio(&mut timer, &cfg);
task::spawn(report_async_rtio_errors()); task::spawn(report_async_rtio_errors());

View File

@ -324,31 +324,6 @@ pub mod drtio {
pub fn reset(_aux_mutex: &Mutex, _timer: GlobalTimer) {} 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, pub fn startup(aux_mutex: &Mutex,
routing_table: &RefCell<drtio_routing::RoutingTable>, routing_table: &RefCell<drtio_routing::RoutingTable>,
up_destinations: &RefCell<[bool; drtio_routing::DEST_COUNT]>, timer: GlobalTimer) { up_destinations: &RefCell<[bool; drtio_routing::DEST_COUNT]>, timer: GlobalTimer) {
@ -356,7 +331,6 @@ pub fn startup(aux_mutex: &Mutex,
unsafe { unsafe {
csr::rtio_core::reset_phy_write(1); csr::rtio_core::reset_phy_write(1);
} }
task::spawn(async_error_thread);
} }
pub fn reset(aux_mutex: &Mutex, timer: GlobalTimer) { pub fn reset(aux_mutex: &Mutex, timer: GlobalTimer) {