From b638fce069b71d62aad0cb67ca7c20413546f1cd Mon Sep 17 00:00:00 2001 From: kk105 Date: Mon, 20 Jun 2022 17:41:08 +0800 Subject: [PATCH] update SEEN_ASYNC_ERRORS in destination_survey (#195) Co-authored-by: kk105 Reviewed-on: https://git.m-labs.hk/M-Labs/artiq-zynq/pulls/195 Co-authored-by: kk105 Co-committed-by: kk105 --- src/runtime/src/main.rs | 10 +++++++--- src/runtime/src/rtio_mgt.rs | 19 +++++++++++++------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/runtime/src/main.rs b/src/runtime/src/main.rs index 1a30357..a08c979 100644 --- a/src/runtime/src/main.rs +++ b/src/runtime/src/main.rs @@ -22,6 +22,10 @@ use libconfig::Config; use libcortex_a9::l2c::enable_l2_cache; use libboard_artiq::{logger, identifier_read, init_gateware, pl}; +const ASYNC_ERROR_COLLISION: u8 = 1 << 0; +const ASYNC_ERROR_BUSY: u8 = 1 << 1; +const ASYNC_ERROR_SEQUENCE_ERROR: u8 = 1 << 2; + mod proto_async; mod comms; mod rpc; @@ -65,15 +69,15 @@ async fn report_async_rtio_errors() { let _ = block_async!(wait_for_async_rtio_error()).await; unsafe { let errors = pl::csr::rtio_core::async_error_read(); - if errors & 1 != 0 { + if errors & ASYNC_ERROR_COLLISION != 0 { error!("RTIO collision involving channel {}", pl::csr::rtio_core::collision_channel_read()); } - if errors & 2 != 0 { + if errors & ASYNC_ERROR_BUSY != 0 { error!("RTIO busy error involving channel {}", pl::csr::rtio_core::busy_channel_read()); } - if errors & 4 != 0 { + if errors & ASYNC_ERROR_SEQUENCE_ERROR != 0 { error!("RTIO sequence error involving channel {}", pl::csr::rtio_core::sequence_error_channel_read()); } diff --git a/src/runtime/src/rtio_mgt.rs b/src/runtime/src/rtio_mgt.rs index a77f2e0..e6cb5b5 100644 --- a/src/runtime/src/rtio_mgt.rs +++ b/src/runtime/src/rtio_mgt.rs @@ -8,6 +8,7 @@ use libcortex_a9::mutex::Mutex; #[cfg(has_drtio)] pub mod drtio { use super::*; + use crate::{SEEN_ASYNC_ERRORS, ASYNC_ERROR_BUSY, ASYNC_ERROR_SEQUENCE_ERROR, ASYNC_ERROR_COLLISION}; use libboard_artiq::drtioaux_async; use libboard_artiq::drtioaux_async::Packet; use libboard_artiq::drtioaux::Error; @@ -217,12 +218,18 @@ pub mod drtio { Ok(Packet::DestinationDownReply) => destination_set_up(routing_table, up_destinations, destination, false).await, Ok(Packet::DestinationOkReply) => (), - Ok(Packet::DestinationSequenceErrorReply { channel }) => - error!("[DEST#{}] RTIO sequence error involving channel 0x{:04x}", destination, channel), - Ok(Packet::DestinationCollisionReply { channel }) => - error!("[DEST#{}] RTIO collision involving channel 0x{:04x}", destination, channel), - Ok(Packet::DestinationBusyReply { channel }) => - error!("[DEST#{}] RTIO busy error involving channel 0x{:04x}", destination, channel), + Ok(Packet::DestinationSequenceErrorReply { channel }) =>{ + error!("[DEST#{}] RTIO sequence error involving channel 0x{:04x}", destination, channel); + unsafe { SEEN_ASYNC_ERRORS |= ASYNC_ERROR_SEQUENCE_ERROR }; + } + Ok(Packet::DestinationCollisionReply { channel }) =>{ + error!("[DEST#{}] RTIO collision involving channel 0x{:04x}", destination, channel); + unsafe { SEEN_ASYNC_ERRORS |= ASYNC_ERROR_COLLISION }; + } + Ok(Packet::DestinationBusyReply { channel }) =>{ + error!("[DEST#{}] RTIO busy error involving channel 0x{:04x}", destination, channel); + unsafe { SEEN_ASYNC_ERRORS |= ASYNC_ERROR_BUSY }; + } Ok(packet) => error!("[DEST#{}] received unexpected aux packet: {:?}", destination, packet), Err(e) => error!("[DEST#{}] communication failed ({})", destination, e) }