From d36899b48524e52b61bdc5ad8cdd5a28eba14900 Mon Sep 17 00:00:00 2001 From: Egor Savkin Date: Mon, 9 Jan 2023 16:13:42 +0800 Subject: [PATCH] firmware: unify RTIO error message format Co-authored-by: Egor Savkin Co-committed-by: Egor Savkin --- src/runtime/src/comms.rs | 2 +- src/runtime/src/main.rs | 6 +++--- src/runtime/src/rtio_acp.rs | 16 ++++++++-------- src/runtime/src/rtio_csr.rs | 16 ++++++++-------- src/runtime/src/rtio_mgt.rs | 6 +++--- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/runtime/src/comms.rs b/src/runtime/src/comms.rs index ee77e9f..e14e7c6 100644 --- a/src/runtime/src/comms.rs +++ b/src/runtime/src/comms.rs @@ -252,7 +252,7 @@ async fn handle_run_kernel(stream: Option<&TcpStream>, control: &Rc i64 { if status & RTIO_I_STATUS_OVERFLOW != 0 { artiq_raise!("RTIOOverflow", - format!("RTIO input overflow on channel {}:{}", channel, resolve_channel_name(channel as u32)), + format!("RTIO input overflow on channel 0x{:04x}:{}", channel, resolve_channel_name(channel as u32)), channel as i64, 0, 0); } if status & RTIO_I_STATUS_WAIT_EVENT != 0 { @@ -185,7 +185,7 @@ pub extern fn input_timestamp(timeout: i64, channel: i32) -> i64 { } if status & RTIO_I_STATUS_DESTINATION_UNREACHABLE != 0 { artiq_raise!("RTIODestinationUnreachable", - format!("RTIO destination unreachable, input, on channel {}:{}", channel, resolve_channel_name(channel as u32)), + format!("RTIO destination unreachable, input, on channel 0x{:04x}:{}", channel, resolve_channel_name(channel as u32)), channel as i64, 0, 0); } @@ -215,12 +215,12 @@ pub extern fn input_data(channel: i32) -> i32 { if status & RTIO_I_STATUS_OVERFLOW != 0 { artiq_raise!("RTIOOverflow", - format!("RTIO input overflow on channel {}:{}", channel, resolve_channel_name(channel as u32)), + format!("RTIO input overflow on channel 0x{:04x}:{}", channel, resolve_channel_name(channel as u32)), channel as i64, 0, 0); } if status & RTIO_I_STATUS_DESTINATION_UNREACHABLE != 0 { artiq_raise!("RTIODestinationUnreachable", - format!("RTIO destination unreachable, input, on channel {}:{}", channel, resolve_channel_name(channel as u32)), + format!("RTIO destination unreachable, input, on channel 0x{:04x}:{}", channel, resolve_channel_name(channel as u32)), channel as i64, 0, 0); } @@ -250,12 +250,12 @@ pub extern fn input_timestamped_data(timeout: i64, channel: i32) -> TimestampedD if status & RTIO_I_STATUS_OVERFLOW != 0 { artiq_raise!("RTIOOverflow", - format!("RTIO input overflow on channel {}:{}", channel, resolve_channel_name(channel as u32)), + format!("RTIO input overflow on channel 0x{:04x}:{}", channel, resolve_channel_name(channel as u32)), channel as i64, 0, 0); } if status & RTIO_I_STATUS_DESTINATION_UNREACHABLE != 0 { artiq_raise!("RTIODestinationUnreachable", - format!("RTIO destination unreachable, input, on channel {}:{}", channel, resolve_channel_name(channel as u32)), + format!("RTIO destination unreachable, input, on channel 0x{:04x}:{}", channel, resolve_channel_name(channel as u32)), channel as i64, 0, 0); } diff --git a/src/runtime/src/rtio_csr.rs b/src/runtime/src/rtio_csr.rs index 1fce04f..7534a12 100644 --- a/src/runtime/src/rtio_csr.rs +++ b/src/runtime/src/rtio_csr.rs @@ -73,12 +73,12 @@ unsafe fn process_exceptional_status(channel: i32, status: u8) { } if status & RTIO_O_STATUS_UNDERFLOW != 0 { artiq_raise!("RTIOUnderflow", - format!("RTIO underflow at {{1}} mu, channel {}:{}, slack {{2}} mu", channel, resolve_channel_name(channel as u32)), + format!("RTIO underflow at {{1}} mu, channel 0x{:04x}:{}, slack {{2}} mu", channel, resolve_channel_name(channel as u32)), channel as i64, timestamp, timestamp - get_counter()); } if status & RTIO_O_STATUS_DESTINATION_UNREACHABLE != 0 { artiq_raise!("RTIODestinationUnreachable", - format!("RTIO destination unreachable, output, at {{0}} mu, channel {}:{}", channel, resolve_channel_name(channel as u32)), + format!("RTIO destination unreachable, output, at {{0}} mu, channel 0x{:04x}:{}", channel, resolve_channel_name(channel as u32)), timestamp, channel as i64, 0); } } @@ -121,7 +121,7 @@ pub extern fn input_timestamp(timeout: i64, channel: i32) -> i64 { if status & RTIO_I_STATUS_OVERFLOW != 0 { artiq_raise!("RTIOOverflow", - format!("RTIO input overflow on channel {}:{}", channel, resolve_channel_name(channel as u32)), + format!("RTIO input overflow on channel 0x{:04x}:{}", channel, resolve_channel_name(channel as u32)), channel as i64, 0, 0); } if status & RTIO_I_STATUS_WAIT_EVENT != 0 { @@ -129,7 +129,7 @@ pub extern fn input_timestamp(timeout: i64, channel: i32) -> i64 { } if status & RTIO_I_STATUS_DESTINATION_UNREACHABLE != 0 { artiq_raise!("RTIODestinationUnreachable", - format!("RTIO destination unreachable, input, on channel {}:{}", channel, resolve_channel_name(channel as u32)), + format!("RTIO destination unreachable, input, on channel 0x{:04x}:{}", channel, resolve_channel_name(channel as u32)), channel as i64, 0, 0); } @@ -149,12 +149,12 @@ pub extern fn input_data(channel: i32) -> i32 { if status & RTIO_I_STATUS_OVERFLOW != 0 { artiq_raise!("RTIOOverflow", - format!("RTIO input overflow on channel {}:{}", channel, resolve_channel_name(channel as u32)), + format!("RTIO input overflow on channel 0x{:04x}:{}", channel, resolve_channel_name(channel as u32)), channel as i64, 0, 0); } if status & RTIO_I_STATUS_DESTINATION_UNREACHABLE != 0 { artiq_raise!("RTIODestinationUnreachable", - format!("RTIO destination unreachable, input, on channel {}:{}", channel, resolve_channel_name(channel as u32)), + format!("RTIO destination unreachable, input, on channel 0x{:04x}:{}", channel, resolve_channel_name(channel as u32)), channel as i64, 0, 0); } @@ -174,7 +174,7 @@ pub extern fn input_timestamped_data(timeout: i64, channel: i32) -> TimestampedD if status & RTIO_I_STATUS_OVERFLOW != 0 { artiq_raise!("RTIOOverflow", - format!("RTIO input overflow on channel {}:{}", channel, resolve_channel_name(channel as u32)), + format!("RTIO input overflow on channel 0x{:04x}:{}", channel, resolve_channel_name(channel as u32)), channel as i64, 0, 0); } if status & RTIO_I_STATUS_WAIT_EVENT != 0 { @@ -182,7 +182,7 @@ pub extern fn input_timestamped_data(timeout: i64, channel: i32) -> TimestampedD } if status & RTIO_I_STATUS_DESTINATION_UNREACHABLE != 0 { artiq_raise!("RTIODestinationUnreachable", - format!("RTIO destination unreachable, input, on channel {}:{}", channel, resolve_channel_name(channel as u32)), + format!("RTIO destination unreachable, input, on channel 0x{:04x}:{}", channel, resolve_channel_name(channel as u32)), channel as i64, 0, 0); } diff --git a/src/runtime/src/rtio_mgt.rs b/src/runtime/src/rtio_mgt.rs index fffb90e..a0b149b 100644 --- a/src/runtime/src/rtio_mgt.rs +++ b/src/runtime/src/rtio_mgt.rs @@ -226,15 +226,15 @@ pub mod drtio { 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, resolve_channel_name(channel), channel); + error!("[DEST#{}] RTIO sequence error involving channel 0x{:04x}:{}", destination, channel, resolve_channel_name(channel)); unsafe { SEEN_ASYNC_ERRORS |= ASYNC_ERROR_SEQUENCE_ERROR }; } Ok(Packet::DestinationCollisionReply { channel }) =>{ - error!("[DEST#{}] RTIO collision involving channel {} 0x{:04x}", destination, resolve_channel_name(channel), channel); + error!("[DEST#{}] RTIO collision involving channel 0x{:04x}:{}", destination, channel, resolve_channel_name(channel)); unsafe { SEEN_ASYNC_ERRORS |= ASYNC_ERROR_COLLISION }; } Ok(Packet::DestinationBusyReply { channel }) =>{ - error!("[DEST#{}] RTIO busy error involving channel {} 0x{:04x}", destination, resolve_channel_name(channel), channel); + error!("[DEST#{}] RTIO busy error involving channel 0x{:04x}:{}", destination, channel, resolve_channel_name(channel)); unsafe { SEEN_ASYNC_ERRORS |= ASYNC_ERROR_BUSY }; } Ok(packet) => error!("[DEST#{}] received unexpected aux packet: {:?}", destination, packet),