forked from M-Labs/artiq-zynq
proto fw: add debug mem print
This commit is contained in:
parent
b75ebdd2e7
commit
5090f2814d
|
@ -216,7 +216,6 @@ impl UpConnPacket {
|
||||||
|
|
||||||
pub fn receive(channel: usize) -> Result<(), Error> {
|
pub fn receive(channel: usize) -> Result<(), Error> {
|
||||||
unsafe {
|
unsafe {
|
||||||
// let ptr = CXP_LOOPBACK_MEM[0].base as *mut u32;
|
|
||||||
let ptr = CXP_RX_MEM[channel].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 mut reader = Cursor::new(slice::from_raw_parts_mut(ptr as *mut u8, MEM_LEN));
|
||||||
let packet_type = (CXP[channel].downconn_packet_type_read)();
|
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)),
|
_ => return Err(Error::UnknownPacket(packet_type)),
|
||||||
};
|
};
|
||||||
println!("{:?}", packet);
|
println!("{:?}", packet);
|
||||||
|
|
||||||
print_packet(slice::from_raw_parts_mut(ptr as *mut u8, MEM_LEN));
|
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -309,7 +306,11 @@ pub fn write_u64(channel: usize, addr: u32, data: u64) -> Result<(), Error> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
// DEBUG: use only
|
// DEBUG: use only
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
pub fn print_packet(pak: &[u8]) {
|
pub fn print_packet(pak: &[u8]) {
|
||||||
println!("pak = [");
|
println!("pak = [");
|
||||||
for i in 0..(pak.len() / 4) {
|
for i in 0..(pak.len() / 4) {
|
||||||
|
@ -360,6 +361,13 @@ pub fn downconn_debug_send(channel: usize, packet: &UpConnPacket) -> Result<(),
|
||||||
Ok(())
|
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) {
|
pub fn downconn_debug_send_trig_ack(channel: usize) {
|
||||||
unsafe {
|
unsafe {
|
||||||
(CXP[channel].downconn_ack_write)(1);
|
(CXP[channel].downconn_ack_write)(1);
|
||||||
|
|
Loading…
Reference in New Issue