forked from M-Labs/artiq-zynq
downconn fw: add event packet test
This commit is contained in:
parent
b7278af56e
commit
cbbf6f72f9
|
@ -43,24 +43,26 @@ pub fn loopback_testing(channel: usize, timer: &mut GlobalTimer, speed: CXP_SPEE
|
||||||
|
|
||||||
cxp_proto::downconn_debug_send_trig_ack(channel);
|
cxp_proto::downconn_debug_send_trig_ack(channel);
|
||||||
|
|
||||||
const SEND_TIMES: usize = 4;
|
const DATA_MAXSIZE: usize = 253;
|
||||||
const DATA_MAXSIZE: usize = 48;
|
let data_size = 4; // no. of bytes
|
||||||
let mut data_slice: [u8; DATA_MAXSIZE] = [0; DATA_MAXSIZE];
|
|
||||||
|
|
||||||
for i in 0..SEND_TIMES {
|
let data: u32 = 0xDADA as u32;
|
||||||
let data: u32 = i as u32;
|
let mut data_slice: [u8; DATA_MAXSIZE] = [0; DATA_MAXSIZE];
|
||||||
data_slice[..4].clone_from_slice(&data.to_be_bytes());
|
data_slice[..4].clone_from_slice(&data.to_be_bytes());
|
||||||
cxp_proto::downconn_debug_send(
|
cxp_proto::downconn_debug_send(
|
||||||
channel,
|
channel,
|
||||||
&cxp_proto::UpConnPacket::CtrlAckLoopback {
|
&cxp_proto::UpConnPacket::Event {
|
||||||
ackcode: 0x00,
|
conn_id: 0x1234_5678_u32,
|
||||||
length: 0x04,
|
packet_tag: 0x69_u8,
|
||||||
data: data_slice,
|
length: data_size + 3,
|
||||||
},
|
event_size: data_size,
|
||||||
)
|
namespace: 0x02_u8,
|
||||||
.expect("loopback gtx tx error");
|
event_id: 0x00_6969u16,
|
||||||
timer.delay_us(10);
|
timestamp: 0x1234_5678u64,
|
||||||
}
|
data: data_slice,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.expect("loopback gtx tx error");
|
||||||
|
|
||||||
timer.delay_us(1000); // wait packet has arrive at RX async fifo
|
timer.delay_us(1000); // wait packet has arrive at RX async fifo
|
||||||
(CXP[channel].downconn_tx_stb_write)(0);
|
(CXP[channel].downconn_tx_stb_write)(0);
|
||||||
|
@ -73,9 +75,7 @@ pub fn loopback_testing(channel: usize, timer: &mut GlobalTimer, speed: CXP_SPEE
|
||||||
info!("test error = {}", (CXP[channel].downconn_test_error_read)());
|
info!("test error = {}", (CXP[channel].downconn_test_error_read)());
|
||||||
info!("packet type = {:#06X}", (CXP[channel].downconn_packet_type_read)());
|
info!("packet type = {:#06X}", (CXP[channel].downconn_packet_type_read)());
|
||||||
|
|
||||||
for _ in 0..SEND_TIMES {
|
cxp_proto::receive(channel).expect("loopback gtx rx error");
|
||||||
cxp_proto::receive(channel).expect("loopback gtx rx error");
|
|
||||||
}
|
|
||||||
// cxp_proto::downconn_debug_mem_print(channel);
|
// cxp_proto::downconn_debug_mem_print(channel);
|
||||||
|
|
||||||
// DEBUG: print loopback packets
|
// DEBUG: print loopback packets
|
||||||
|
|
Loading…
Reference in New Issue