From ef5b06b18735d50e1bfd555ea131a21d99aabd4a Mon Sep 17 00:00:00 2001 From: morgan Date: Mon, 28 Oct 2024 10:57:21 +0800 Subject: [PATCH] downconn fw: update csr & add doc --- src/libboard_artiq/src/cxp_downconn.rs | 29 ++++++++++++++++---------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/libboard_artiq/src/cxp_downconn.rs b/src/libboard_artiq/src/cxp_downconn.rs index b16fba9..44afac5 100644 --- a/src/libboard_artiq/src/cxp_downconn.rs +++ b/src/libboard_artiq/src/cxp_downconn.rs @@ -24,9 +24,9 @@ pub fn loopback_testing(channel: usize, timer: &mut GlobalTimer, speed: cxp_phys while (CXP[channel].downconn_rx_ready_read)() != 1 {} info!("rx ready!"); - (CXP[channel].downconn_tx_stb_write)(1); cxp_proto::downconn_send_test_packet(channel); + // FIXME: why test + trig ack doesn't work well for rx?? cxp_proto::downconn_debug_send_trig_ack(channel); const DATA_MAXSIZE: usize = 253; @@ -51,17 +51,22 @@ pub fn loopback_testing(channel: usize, timer: &mut GlobalTimer, speed: cxp_phys .expect("loopback gtx tx error"); timer.delay_us(1000); // wait packet has arrive at RX async fifo - (CXP[channel].downconn_tx_stb_write)(0); - info!("trig ack = {}", (CXP[channel].downconn_trigger_ack_read)()); - (CXP[channel].downconn_trigger_ack_write)(1); - info!("after clr trig ack = {}", (CXP[channel].downconn_trigger_ack_read)()); + if (CXP[channel].downconn_trigger_ack_read)() == 1 { + (CXP[channel].downconn_trigger_ack_write)(1); + info!("trig ack and cleared"); + } + + if (CXP[channel].downconn_bootstrap_decoder_err_read)() == 1 { + info!("!!!!!!!DECODER ERROR!!!!!!! and cleared"); + (CXP[channel].downconn_bootstrap_decoder_err_write)(1); + } + + if (CXP[channel].downconn_bootstrap_test_err_read)() == 1 { + info!("!!!!!!!TEST ERROR!!!!!!! and cleared"); + (CXP[channel].downconn_bootstrap_test_err_write)(1); + } - info!( - "decoder error = {}", - (CXP[channel].downconn_bootstrap_decoder_err_read)() - ); - info!("test error = {}", (CXP[channel].downconn_bootstrap_test_err_read)()); info!("packet type = {:#06X}", (CXP[channel].downconn_packet_type_read)()); cxp_proto::receive(channel).expect("loopback gtx rx error"); @@ -82,6 +87,8 @@ pub fn loopback_testing(channel: usize, timer: &mut GlobalTimer, speed: cxp_phys break; } } - cxp_proto::print_packetu32(&pak_arr, &k_arr); + + info!("rx ready = {}", (CXP[channel].downconn_rx_ready_read)()); + // cxp_proto::print_packetu32(&pak_arr, &k_arr); } }