forked from M-Labs/artiq
1
0
Fork 0

drtio: print packet error descriptions in log

This commit is contained in:
Sebastien Bourdeauducq 2017-01-10 18:03:01 -06:00
parent 7af152ed22
commit c25186fae1
2 changed files with 14 additions and 1 deletions

View File

@ -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 {

View File

@ -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,