forked from M-Labs/artiq-zynq
proto fw: add print u32 packet helper function
This commit is contained in:
parent
a87208effe
commit
dddea53d26
|
@ -192,13 +192,30 @@ pub fn print_packet(pak: &[u8]) {
|
|||
println!("============================================");
|
||||
}
|
||||
|
||||
pub fn print_packetu32(pak: &[u32]) {
|
||||
println!("pak = [");
|
||||
for i in 0..(pak.len()) {
|
||||
let data: [u8; 4] = pak[i].to_be_bytes();
|
||||
println!(
|
||||
"{:#03} {:#04X} {:#04X} {:#04X} {:#04X},",
|
||||
i + 1,
|
||||
data[0],
|
||||
data[1],
|
||||
data[2],
|
||||
data[3]
|
||||
)
|
||||
}
|
||||
println!("]");
|
||||
println!("============================================");
|
||||
}
|
||||
|
||||
pub fn downconn_debug_main() {
|
||||
downconn_debug_send(&Packet::CtrlRead {
|
||||
addr: 0x00,
|
||||
length: 0x04,
|
||||
});
|
||||
|
||||
const LEN: usize = 100;
|
||||
const LEN: usize = 40;
|
||||
let mut pak_arr: [u32; LEN] = [0; LEN];
|
||||
let mut i: usize = 0;
|
||||
unsafe {
|
||||
|
@ -213,9 +230,7 @@ pub fn downconn_debug_main() {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: turn the u32 slice back to u8
|
||||
|
||||
println!("{:#010X?}", pak_arr)
|
||||
print_packetu32(&pak_arr)
|
||||
}
|
||||
|
||||
pub fn downconn_debug_send(packet: &Packet) -> Result<(), Error> {
|
||||
|
|
Loading…
Reference in New Issue