1
0
Fork 0

proto fw: update csr

This commit is contained in:
morgan 2024-10-17 15:47:18 +08:00
parent 11b3842a7f
commit 66fa70ef3c
1 changed files with 4 additions and 2 deletions

View File

@ -7,7 +7,7 @@ use io::Cursor;
use libboard_zynq::println; use libboard_zynq::println;
use crate::{mem::mem::{CXP_LOOPBACK_MEM, CXP_RX_MEM, CXP_TX_MEM}, use crate::{mem::mem::{CXP_LOOPBACK_MEM, CXP_RX_MEM, CXP_TX_MEM},
pl::csr::CXP}; pl::{csr, csr::CXP}};
const BUF_LEN: usize = 0x800; const BUF_LEN: usize = 0x800;
const DATA_MAXSIZE: usize = 48; const DATA_MAXSIZE: usize = 48;
@ -448,7 +448,7 @@ impl UpConnPacket {
} }
pub fn send(channel: usize, packet: &UpConnPacket) -> Result<(), Error> { pub fn send(channel: usize, packet: &UpConnPacket) -> Result<(), Error> {
if unsafe { (CXP[channel].upconn_tx_enable_read)() } == 0 { if unsafe { csr::cxp_phys::upconn_tx_enable_read() } == 0 {
Err(Error::LinkDown)? Err(Error::LinkDown)?
} }
@ -465,6 +465,8 @@ fn send_data_packet(channel: usize, packet: &UpConnPacket) -> Result<(), Error>
let mut writer = Cursor::new(slice::from_raw_parts_mut(ptr as *mut u8, BUF_LEN)); let mut writer = Cursor::new(slice::from_raw_parts_mut(ptr as *mut u8, BUF_LEN));
packet.write_to(&mut writer)?; packet.write_to(&mut writer)?;
println!("TX MEM after writing");
print_packet(&writer.get_ref()[0..40]);
(CXP[channel].upconn_bootstrap_tx_word_len_write)(writer.position() as u16 / 4); (CXP[channel].upconn_bootstrap_tx_word_len_write)(writer.position() as u16 / 4);
(CXP[channel].upconn_bootstrap_tx_write)(1); (CXP[channel].upconn_bootstrap_tx_write)(1);