forked from M-Labs/artiq-zynq
downconn FW: add trig ack testing
This commit is contained in:
parent
610b53e7f7
commit
925237face
|
@ -37,27 +37,33 @@ pub fn loopback_testing(timer: &mut GlobalTimer, speed: CXP_SPEED) {
|
||||||
while csr::cxp::downconn_phy_rx_ready_read() != 1 {}
|
while csr::cxp::downconn_phy_rx_ready_read() != 1 {}
|
||||||
info!("rx ready!");
|
info!("rx ready!");
|
||||||
|
|
||||||
|
cxp_proto::downconn_debug_send_trig_ack();
|
||||||
|
|
||||||
cxp_proto::downconn_debug_send(&cxp_proto::Packet::CtrlRead {
|
cxp_proto::downconn_debug_send(&cxp_proto::Packet::CtrlRead {
|
||||||
addr: 0x00,
|
addr: 0x00,
|
||||||
length: 0x04,
|
length: 0x04,
|
||||||
});
|
});
|
||||||
|
|
||||||
timer.delay_us(200); // wait packet has arrive at async fifo in
|
timer.delay_us(200); // wait packet has arrive at async fifo in
|
||||||
unsafe {
|
|
||||||
csr::cxp::downconn_phy_tx_stb_write(1);
|
csr::cxp::downconn_phy_tx_stb_write(1);
|
||||||
timer.delay_us(200);
|
timer.delay_us(200);
|
||||||
csr::cxp::downconn_phy_tx_stb_write(0);
|
csr::cxp::downconn_phy_tx_stb_write(0);
|
||||||
}
|
|
||||||
|
info!("trig ack = {}", csr::cxp::downconn_trig_ack_read());
|
||||||
|
csr::cxp::downconn_trig_clr_write(1);
|
||||||
|
info!("after clr trig ack = {}", csr::cxp::downconn_trig_ack_read());
|
||||||
|
|
||||||
// TODO: investigate how to make my packet appear
|
// TODO: investigate how to make my packet appear
|
||||||
// TODO: discard idle word
|
// TODO: discard idle word
|
||||||
|
|
||||||
|
// DEBUG: print loopback packets
|
||||||
const LEN: usize = 20;
|
const LEN: usize = 20;
|
||||||
let mut pak_arr: [u32; LEN] = [0; LEN];
|
let mut pak_arr: [u32; LEN] = [0; LEN];
|
||||||
|
let mut k_arr: [u8; LEN] = [0; LEN];
|
||||||
let mut i: usize = 0;
|
let mut i: usize = 0;
|
||||||
unsafe {
|
|
||||||
while csr::cxp::downconn_debug_out_dout_valid_read() == 1 {
|
while csr::cxp::downconn_debug_out_dout_valid_read() == 1 {
|
||||||
pak_arr[i] = csr::cxp::downconn_debug_out_dout_pak_read();
|
pak_arr[i] = csr::cxp::downconn_debug_out_dout_pak_read();
|
||||||
|
k_arr[i] = csr::cxp::downconn_debug_out_kout_pak_read();
|
||||||
// println!("received {:#04X}", pak_arr[i]);
|
// println!("received {:#04X}", pak_arr[i]);
|
||||||
csr::cxp::downconn_debug_out_inc_write(1);
|
csr::cxp::downconn_debug_out_inc_write(1);
|
||||||
i += 1;
|
i += 1;
|
||||||
|
@ -65,8 +71,7 @@ pub fn loopback_testing(timer: &mut GlobalTimer, speed: CXP_SPEED) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
cxp_proto::print_packetu32(&pak_arr, &k_arr);
|
||||||
cxp_proto::print_packetu32(&pak_arr)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue