From 5090f2814d8172f9f0464afa82a66a84e95806ac Mon Sep 17 00:00:00 2001 From: morgan Date: Fri, 4 Oct 2024 12:24:47 +0800 Subject: [PATCH] proto fw: add debug mem print --- src/libboard_artiq/src/cxp_proto.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/libboard_artiq/src/cxp_proto.rs b/src/libboard_artiq/src/cxp_proto.rs index 0c03445..3339077 100644 --- a/src/libboard_artiq/src/cxp_proto.rs +++ b/src/libboard_artiq/src/cxp_proto.rs @@ -216,7 +216,6 @@ impl UpConnPacket { pub fn receive(channel: usize) -> Result<(), Error> { unsafe { - // let ptr = CXP_LOOPBACK_MEM[0].base as *mut u32; let ptr = CXP_RX_MEM[channel].base as *mut u32; let mut reader = Cursor::new(slice::from_raw_parts_mut(ptr as *mut u8, MEM_LEN)); let packet_type = (CXP[channel].downconn_packet_type_read)(); @@ -227,8 +226,6 @@ pub fn receive(channel: usize) -> Result<(), Error> { _ => return Err(Error::UnknownPacket(packet_type)), }; println!("{:?}", packet); - - print_packet(slice::from_raw_parts_mut(ptr as *mut u8, MEM_LEN)); } Ok(()) } @@ -309,7 +306,11 @@ pub fn write_u64(channel: usize, addr: u32, data: u64) -> Result<(), Error> { Ok(()) } +// // DEBUG: use only +// +// +// pub fn print_packet(pak: &[u8]) { println!("pak = ["); for i in 0..(pak.len() / 4) { @@ -360,6 +361,13 @@ pub fn downconn_debug_send(channel: usize, packet: &UpConnPacket) -> Result<(), Ok(()) } +pub fn downconn_debug_mem_print(channel: usize) { + unsafe { + let ptr = CXP_RX_MEM[channel].base as *mut u32; + print_packet(slice::from_raw_parts_mut(ptr as *mut u8, MEM_LEN)); + } +} + pub fn downconn_debug_send_trig_ack(channel: usize) { unsafe { (CXP[channel].downconn_ack_write)(1);