forked from M-Labs/artiq-zynq
cxp upconn fw: add trigger packet tester
This commit is contained in:
parent
5ed1efc1dc
commit
325fc5a4f9
|
@ -3,6 +3,41 @@ use libboard_zynq::{println, timer::GlobalTimer};
|
||||||
|
|
||||||
use crate::pl::csr;
|
use crate::pl::csr;
|
||||||
|
|
||||||
|
pub fn trigger_test(timer: &mut GlobalTimer) {
|
||||||
|
const LEN: usize = 4 * 8;
|
||||||
|
let mut pak_arr: [u8; LEN] = [0; LEN];
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
csr::cxp::trig_trig_delay_write(0x05);
|
||||||
|
csr::cxp::trig_linktrigger_write(0x05); // mode 0
|
||||||
|
csr::cxp::trig_stb_write(1); // send trig
|
||||||
|
timer.delay_us(1);
|
||||||
|
|
||||||
|
let mut i: usize = 0;
|
||||||
|
while csr::cxp::trig_dout_valid_read() == 1 {
|
||||||
|
pak_arr[i] = csr::cxp::trig_dout_pak_read();
|
||||||
|
// println!("received {:#04X}", pak_arr[i]);
|
||||||
|
csr::cxp::trig_inc_write(1);
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
println!("trigger packet");
|
||||||
|
println!("arr = [");
|
||||||
|
for i in 0..(LEN / 4) {
|
||||||
|
println!(
|
||||||
|
"{:#03} {:#04X} {:#04X} {:#04X} {:#04X},",
|
||||||
|
i + 1,
|
||||||
|
pak_arr[i * 4],
|
||||||
|
pak_arr[i * 4 + 1],
|
||||||
|
pak_arr[i * 4 + 2],
|
||||||
|
pak_arr[i * 4 + 3]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
println!("]");
|
||||||
|
println!("============================================");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn trigger_ack_test(timer: &mut GlobalTimer) {
|
pub fn trigger_ack_test(timer: &mut GlobalTimer) {
|
||||||
const LEN: usize = 4 * 8;
|
const LEN: usize = 4 * 8;
|
||||||
let mut pak_arr: [u8; LEN] = [0; LEN];
|
let mut pak_arr: [u8; LEN] = [0; LEN];
|
||||||
|
@ -18,6 +53,7 @@ pub fn trigger_ack_test(timer: &mut GlobalTimer) {
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
println!("trigger ack packet");
|
||||||
println!("arr = [");
|
println!("arr = [");
|
||||||
for i in 0..(LEN / 4) {
|
for i in 0..(LEN / 4) {
|
||||||
println!(
|
println!(
|
||||||
|
@ -66,6 +102,7 @@ pub fn pipeline_test(timer: &mut GlobalTimer) {
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
println!("data packet");
|
||||||
println!("arr = [");
|
println!("arr = [");
|
||||||
for i in 0..(LEN / 4) {
|
for i in 0..(LEN / 4) {
|
||||||
println!(
|
println!(
|
||||||
|
|
Loading…
Reference in New Issue