From c25186fae1d7d4094694a7fb62384df23055081b Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 10 Jan 2017 18:03:01 -0600 Subject: [PATCH] drtio: print packet error descriptions in log --- artiq/firmware/runtime/rtio_mgt.rs | 14 +++++++++++++- artiq/gateware/drtio/rt_packets.py | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/artiq/firmware/runtime/rtio_mgt.rs b/artiq/firmware/runtime/rtio_mgt.rs index 309f87fe6..1184491fa 100644 --- a/artiq/firmware/runtime/rtio_mgt.rs +++ b/artiq/firmware/runtime/rtio_mgt.rs @@ -110,10 +110,22 @@ mod drtio { } } + // keep this in sync with error_codes in rt_packets.py + fn str_packet_error(err_code: u8) -> &'static str { + match err_code { + 0 => "Received packet of an unknown type", + 1 => "Satellite reported reception of a packet of an unknown type", + 2 => "Satellite reported write overflow", + 3 => "Satellite reported write underflow", + _ => "Unknown error code" + } + } + fn poll_errors() -> bool { unsafe { if csr::drtio::packet_err_present_read() != 0 { - error!("packet error {}", csr::drtio::packet_err_code_read()); + let err_code = csr::drtio::packet_err_code_read(); + error!("packet error {} ({})", err_code, str_packet_error(err_code)); csr::drtio::packet_err_present_write(1) } if csr::drtio::o_fifo_space_timeout_read() != 0 { diff --git a/artiq/gateware/drtio/rt_packets.py b/artiq/gateware/drtio/rt_packets.py index efd411e1f..1c795685e 100644 --- a/artiq/gateware/drtio/rt_packets.py +++ b/artiq/gateware/drtio/rt_packets.py @@ -64,6 +64,7 @@ def get_s2m_layouts(alignment): return plm +# keep this in sync with str_packet_error in rtio_mgt.rs error_codes = { "unknown_type_local": 0, "unknown_type_remote": 1,