1
0
Fork 0

proto FW: add K code printing

This commit is contained in:
morgan 2024-09-19 14:41:21 +08:00
parent c74c1c2ac4
commit 610b53e7f7
1 changed files with 12 additions and 3 deletions

View File

@ -192,17 +192,18 @@ pub fn print_packet(pak: &[u8]) {
println!("============================================");
}
pub fn print_packetu32(pak: &[u32]) {
pub fn print_packetu32(pak: &[u32], k: &[u8]) {
println!("pak = [");
for i in 0..(pak.len()) {
let data: [u8; 4] = pak[i].to_be_bytes();
println!(
"{:#03} {:#04X} {:#04X} {:#04X} {:#04X},",
"{:#03} {:#04X} {:#04X} {:#04X} {:#04X} | K {:04b},",
i + 1,
data[0],
data[1],
data[2],
data[3]
data[3],
k[i],
)
}
println!("]");
@ -216,6 +217,7 @@ pub fn downconn_debug_send(packet: &Packet) -> Result<(), Error> {
packet.write_to(&mut writer)?;
unsafe {
csr::cxp::downconn_mux_sel_write(0);
let len = writer.position();
csr::cxp::downconn_debug_src_len_write(len as u8);
for data in writer.get_ref()[..len].iter() {
@ -227,3 +229,10 @@ pub fn downconn_debug_send(packet: &Packet) -> Result<(), Error> {
Ok(())
}
pub fn downconn_debug_send_trig_ack() {
unsafe {
csr::cxp::downconn_mux_sel_write(1);
csr::cxp::downconn_ack_write(1);
}
}