complete RTIO exceptions

This commit is contained in:
Sebastien Bourdeauducq 2020-07-13 15:47:34 +08:00
parent 62f39e2c08
commit b42ab0634b

View File

@ -1,6 +1,5 @@
use core::ptr::{read_volatile, write_volatile}; use core::ptr::{read_volatile, write_volatile};
use cslice::CSlice; use cslice::CSlice;
use log::error;
use crate::artiq_raise; use crate::artiq_raise;
use crate::pl::csr; use crate::pl::csr;
@ -125,15 +124,17 @@ pub extern fn input_timestamp(timeout: i64, channel: i32) -> i64 {
if status & RTIO_I_STATUS_OVERFLOW != 0 { if status & RTIO_I_STATUS_OVERFLOW != 0 {
csr::rtio::i_overflow_reset_write(1); csr::rtio::i_overflow_reset_write(1);
error!("RTIO input overflow on channel {0}", artiq_raise!("RTIOOverflow",
channel as i64); "RTIO input overflow on channel {0}",
channel as i64, 0, 0);
} }
if status & RTIO_I_STATUS_WAIT_EVENT != 0 { if status & RTIO_I_STATUS_WAIT_EVENT != 0 {
return -1 return -1
} }
if status & RTIO_I_STATUS_DESTINATION_UNREACHABLE != 0 { if status & RTIO_I_STATUS_DESTINATION_UNREACHABLE != 0 {
error!("RTIO destination unreachable, input, on channel {0}", artiq_raise!("RTIODestinationUnreachable",
channel as i64); "RTIO destination unreachable, input, on channel {0}",
channel as i64, 0, 0);
} }
csr::rtio::i_timestamp_read() as i64 csr::rtio::i_timestamp_read() as i64
@ -152,12 +153,14 @@ pub extern fn input_data(channel: i32) -> i32 {
if status & RTIO_I_STATUS_OVERFLOW != 0 { if status & RTIO_I_STATUS_OVERFLOW != 0 {
csr::rtio::i_overflow_reset_write(1); csr::rtio::i_overflow_reset_write(1);
error!("RTIO input overflow on channel {0}", artiq_raise!("RTIOOverflow",
channel as i64); "RTIO input overflow on channel {0}",
channel as i64, 0, 0);
} }
if status & RTIO_I_STATUS_DESTINATION_UNREACHABLE != 0 { if status & RTIO_I_STATUS_DESTINATION_UNREACHABLE != 0 {
error!("RTIO destination unreachable, input, on channel {0}", artiq_raise!("RTIODestinationUnreachable",
channel as i64); "RTIO destination unreachable, input, on channel {0}",
channel as i64, 0, 0);
} }
rtio_i_data_read(0) as i32 rtio_i_data_read(0) as i32
@ -176,15 +179,17 @@ pub extern fn input_timestamped_data(timeout: i64, channel: i32) -> TimestampedD
if status & RTIO_I_STATUS_OVERFLOW != 0 { if status & RTIO_I_STATUS_OVERFLOW != 0 {
csr::rtio::i_overflow_reset_write(1); csr::rtio::i_overflow_reset_write(1);
error!("RTIO input overflow on channel {0}", artiq_raise!("RTIOOverflow",
channel as i64); "RTIO input overflow on channel {0}",
channel as i64, 0, 0);
} }
if status & RTIO_I_STATUS_WAIT_EVENT != 0 { if status & RTIO_I_STATUS_WAIT_EVENT != 0 {
return TimestampedData { timestamp: -1, data: 0 } return TimestampedData { timestamp: -1, data: 0 }
} }
if status & RTIO_I_STATUS_DESTINATION_UNREACHABLE != 0 { if status & RTIO_I_STATUS_DESTINATION_UNREACHABLE != 0 {
error!("RTIO destination unreachable, input, on channel {0}", artiq_raise!("RTIODestinationUnreachable",
channel as i64); "RTIO destination unreachable, input, on channel {0}",
channel as i64, 0, 0);
} }
TimestampedData { TimestampedData {