forked from M-Labs/artiq-zynq
cxp upconn fw: connect tx command to phy
This commit is contained in:
parent
4f733ffafb
commit
29cca139b3
|
@ -50,45 +50,33 @@ pub fn trigger_ack_test(timer: &mut GlobalTimer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tx_test(timer: &mut GlobalTimer) {
|
pub fn tx_test(timer: &mut GlobalTimer) {
|
||||||
const LEN: usize = 4 * 30;
|
const LEN: usize = 4 * 20;
|
||||||
let mut pak_arr: [u8; LEN] = [0; LEN];
|
let mut pak_arr: [u8; LEN] = [0; LEN];
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
loop {
|
csr::cxp::upconn_clk_reset_write(1);
|
||||||
csr::cxp::upconn_clk_reset_write(1);
|
// csr::cxp::upconn_bitrate2x_enable_write(1);
|
||||||
// csr::cxp::upconn_bitrate2x_enable_write(1);
|
csr::cxp::upconn_clk_reset_write(0);
|
||||||
csr::cxp::upconn_clk_reset_write(0);
|
|
||||||
|
|
||||||
// TODO: verify the char & word boundary thingy
|
send(&Packet::ControlU32Reg(Command::Read { addr: 0x00 })).expect("Cannot send CoaXpress packet");
|
||||||
for _ in 0..12 {
|
|
||||||
csr::cxp::upconn_symbol2_write(0xFF);
|
csr::cxp::upconn_tx_enable_write(1);
|
||||||
|
timer.delay_us(20);
|
||||||
|
csr::cxp::upconn_tx_enable_write(0);
|
||||||
|
|
||||||
|
// Collect data
|
||||||
|
let mut i: usize = 0;
|
||||||
|
while csr::cxp::upconn_upconn_phy_debug_buf_dout_valid_read() == 1 {
|
||||||
|
pak_arr[i] = csr::cxp::upconn_upconn_phy_debug_buf_dout_pak_read();
|
||||||
|
// println!("received {:#04X}", pak_arr[i]);
|
||||||
|
csr::cxp::upconn_upconn_phy_debug_buf_inc_write(1);
|
||||||
|
i += 1;
|
||||||
|
if i == LEN {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
csr::cxp::upconn_tx_enable_write(1);
|
|
||||||
// Give some time for symbol2 to send b4 sending priority zero packet
|
|
||||||
timer.delay_us(1);
|
|
||||||
|
|
||||||
for i in 0..6 {
|
|
||||||
csr::cxp::upconn_symbol0_write(i + 1);
|
|
||||||
}
|
|
||||||
timer.delay_us(20);
|
|
||||||
|
|
||||||
csr::cxp::upconn_tx_enable_write(0);
|
|
||||||
// Collect data
|
|
||||||
let mut i: usize = 0;
|
|
||||||
while csr::cxp::upconn_upconn_phy_debug_buf_dout_valid_read() == 1 {
|
|
||||||
pak_arr[i] = csr::cxp::upconn_upconn_phy_debug_buf_dout_pak_read();
|
|
||||||
// println!("received {:#04X}", pak_arr[i]);
|
|
||||||
csr::cxp::upconn_upconn_phy_debug_buf_inc_write(1);
|
|
||||||
i += 1;
|
|
||||||
if i == LEN {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print_packet(&pak_arr);
|
|
||||||
timer.delay_us(2_000_000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print_packet(&pak_arr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,31 +178,6 @@ pub fn send(packet: &Packet) -> Result<(), IoError> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn pipeline_test(timer: &mut GlobalTimer) {
|
|
||||||
// CXP CRC example
|
|
||||||
send(&Packet::ControlU32Reg(Command::Read { addr: 0x00 })).expect("Cannot send CoaXpress packet");
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
timer.delay_us(1);
|
|
||||||
const LEN: usize = 4 * 8;
|
|
||||||
let mut pak_arr: [u8; LEN] = [0; LEN];
|
|
||||||
|
|
||||||
let mut i: usize = 0;
|
|
||||||
while csr::cxp::upconn_command_dout_valid_read() == 1 {
|
|
||||||
pak_arr[i] = csr::cxp::upconn_command_dout_pak_read();
|
|
||||||
// println!("received {:#04X}", pak_arr[i]);
|
|
||||||
csr::cxp::upconn_command_inc_write(1);
|
|
||||||
i += 1;
|
|
||||||
if i == LEN {
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
println!("data packet");
|
|
||||||
print_packet(&pak_arr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn print_packet(pak: &[u8]) {
|
fn print_packet(pak: &[u8]) {
|
||||||
println!("pak = [");
|
println!("pak = [");
|
||||||
for i in 0..(pak.len() / 4) {
|
for i in 0..(pak.len() / 4) {
|
||||||
|
|
Loading…
Reference in New Issue