From d3d23d0d3bc11336db43f5514dd3a8f70fb56c66 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 10 Jan 2017 16:12:46 -0600 Subject: [PATCH] drtio: report get FIFO space timeouts to log --- artiq/firmware/runtime/rtio_mgt.rs | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/artiq/firmware/runtime/rtio_mgt.rs b/artiq/firmware/runtime/rtio_mgt.rs index 4f828e9b4..bc0d62e23 100644 --- a/artiq/firmware/runtime/rtio_mgt.rs +++ b/artiq/firmware/runtime/rtio_mgt.rs @@ -110,25 +110,23 @@ mod drtio { } } - fn packet_error_present() -> bool { + fn poll_errors() -> bool { unsafe { - csr::drtio::packet_err_present_read() != 0 - } - } - - fn get_packet_error() -> u8 { - unsafe { - let err = csr::drtio::packet_err_code_read(); - csr::drtio::packet_err_present_write(1); - err + if csr::drtio::packet_err_present_read() != 0 { + error!("packet error {}", csr::drtio::packet_err_code_read()); + csr::drtio::packet_err_present_write(1) + } + if csr::drtio::o_fifo_space_timeout_read() != 0 { + error!("timeout attempting to get remote FIFO space"); + csr::drtio::o_fifo_space_timeout_write(1) + } } + false } pub fn error_thread(waiter: Waiter, _spawner: Spawner) { - loop { - waiter.until(packet_error_present).unwrap(); - error!("DRTIO packet error {}", get_packet_error()); - } + // HACK + waiter.until(poll_errors).unwrap(); } }