1
0
Fork 0

proto FW: fix endian packet printout

proto FW: cleanup & add downconn loopback test pak
This commit is contained in:
morgan 2024-09-24 10:12:48 +08:00
parent 9178ca4576
commit 7530d7e49a
1 changed files with 9 additions and 2 deletions

View File

@ -137,7 +137,6 @@ fn send_test_packet() -> Result<(), Error> {
unsafe { unsafe {
while csr::cxp::upconn_tx_busy_read() == 1 {} while csr::cxp::upconn_tx_busy_read() == 1 {}
csr::cxp::upconn_tx_testmode_en_write(1); csr::cxp::upconn_tx_testmode_en_write(1);
// timer.delay_us(2);
csr::cxp::upconn_testseq_stb_write(1); csr::cxp::upconn_testseq_stb_write(1);
while csr::cxp::upconn_testseq_busy_read() == 1 {} while csr::cxp::upconn_testseq_busy_read() == 1 {}
csr::cxp::upconn_tx_testmode_en_write(0); csr::cxp::upconn_tx_testmode_en_write(0);
@ -195,7 +194,7 @@ pub fn print_packet(pak: &[u8]) {
pub fn print_packetu32(pak: &[u32], k: &[u8]) { pub fn print_packetu32(pak: &[u32], k: &[u8]) {
println!("pak = ["); println!("pak = [");
for i in 0..(pak.len()) { for i in 0..(pak.len()) {
let data: [u8; 4] = pak[i].to_be_bytes(); let data: [u8; 4] = pak[i].to_le_bytes();
println!( println!(
"{:#03} {:#04X} {:#04X} {:#04X} {:#04X} | K {:04b},", "{:#03} {:#04X} {:#04X} {:#04X} {:#04X} | K {:04b},",
i + 1, i + 1,
@ -236,3 +235,11 @@ pub fn downconn_debug_send_trig_ack() {
csr::cxp::downconn_ack_write(1); csr::cxp::downconn_ack_write(1);
} }
} }
pub fn downconn_send_test_packet() {
unsafe {
csr::cxp::downconn_mux_sel_write(2);
csr::cxp::downconn_testseq_stb_write(1);
while csr::cxp::downconn_testseq_busy_read() == 1 {}
}
}