runtime: report asynchronous RTIO errors (collision, busy) in log. Closes #681

This commit is contained in:
Sebastien Bourdeauducq 2017-03-27 17:14:14 +08:00
parent ea3af1e20e
commit 2c3f720301
1 changed files with 18 additions and 1 deletions

View File

@ -186,6 +186,22 @@ mod drtio {
pub fn init() {} pub fn init() {}
} }
fn async_error_thread(io: Io) {
loop {
unsafe {
io.until(|| csr::rtio_core::async_error_read() != 0).unwrap();
let errors = csr::rtio_core::async_error_read();
if errors & 1 != 0 {
error!("RTIO collision");
}
if errors & 2 != 0 {
error!("RTIO busy");
}
csr::rtio_core::async_error_write(errors);
}
}
}
pub fn startup(io: &Io) { pub fn startup(io: &Io) {
crg::init(); crg::init();
@ -214,7 +230,8 @@ pub fn startup(io: &Io) {
} }
drtio::startup(io); drtio::startup(io);
init_core() init_core();
io.spawn(4096, async_error_thread);
} }
pub fn init_core() { pub fn init_core() {