forked from M-Labs/artiq-zynq
cxp upconn fw: cleanup tx_test
This commit is contained in:
parent
33fd84cadd
commit
e9419a5958
|
@ -47,13 +47,7 @@ pub fn pipeline_test(timer: &mut GlobalTimer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tx_test(timer: &mut GlobalTimer) {
|
pub fn tx_test(timer: &mut GlobalTimer) {
|
||||||
// the 8bit shift is k symbol
|
const LEN: usize = 4 * 30;
|
||||||
// const K28_1: u16 = 0x3C | (1 << 8);
|
|
||||||
// const K28_5: u16 = 0xBC | (1 << 8);
|
|
||||||
const D01_1: u16 = 0x21;
|
|
||||||
const D31_1: u16 = 0x3F;
|
|
||||||
|
|
||||||
const LEN: usize = 4 * 100;
|
|
||||||
let mut pak_arr: [u8; LEN] = [0; LEN];
|
let mut pak_arr: [u8; LEN] = [0; LEN];
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -64,17 +58,20 @@ pub fn tx_test(timer: &mut GlobalTimer) {
|
||||||
|
|
||||||
// TODO: verify the char & word boundary thingy
|
// TODO: verify the char & word boundary thingy
|
||||||
for _ in 0..12 {
|
for _ in 0..12 {
|
||||||
csr::cxp::upconn_symbol2_write(D31_1);
|
csr::cxp::upconn_symbol2_write(0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
csr::cxp::upconn_tx_enable_write(1);
|
csr::cxp::upconn_tx_enable_write(1);
|
||||||
|
// Give some time for symbol2 to send b4 sending priority zero packet
|
||||||
timer.delay_us(1);
|
timer.delay_us(1);
|
||||||
|
|
||||||
for _ in 0..3 {
|
for i in 0..6 {
|
||||||
csr::cxp::upconn_symbol0_write(D01_1);
|
csr::cxp::upconn_symbol0_write(i + 1);
|
||||||
}
|
}
|
||||||
timer.delay_us(10);
|
timer.delay_us(20);
|
||||||
|
|
||||||
|
csr::cxp::upconn_tx_enable_write(0);
|
||||||
|
// Collect data
|
||||||
let mut i: usize = 0;
|
let mut i: usize = 0;
|
||||||
while csr::cxp::upconn_upconn_phy_debug_buf_dout_valid_read() == 1 {
|
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();
|
pak_arr[i] = csr::cxp::upconn_upconn_phy_debug_buf_dout_pak_read();
|
||||||
|
@ -89,7 +86,8 @@ pub fn tx_test(timer: &mut GlobalTimer) {
|
||||||
println!("arr = [");
|
println!("arr = [");
|
||||||
for i in 0..(LEN / 4) {
|
for i in 0..(LEN / 4) {
|
||||||
println!(
|
println!(
|
||||||
" {:#04X} {:#04X} {:#04X} {:#04X},",
|
"{:#03} {:#04X} {:#04X} {:#04X} {:#04X},",
|
||||||
|
i + 1,
|
||||||
pak_arr[i * 4],
|
pak_arr[i * 4],
|
||||||
pak_arr[i * 4 + 1],
|
pak_arr[i * 4 + 1],
|
||||||
pak_arr[i * 4 + 2],
|
pak_arr[i * 4 + 2],
|
||||||
|
@ -97,47 +95,7 @@ pub fn tx_test(timer: &mut GlobalTimer) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
println!("]");
|
println!("]");
|
||||||
// for i in 0..LEN {
|
|
||||||
// arr[i] = get_encoded();
|
|
||||||
// // if csr::cxp::upconn_tx_busy_read() == 0 {
|
|
||||||
// // break;
|
|
||||||
// // };
|
|
||||||
// }
|
|
||||||
// let mut last_encoded: u16 = 0;
|
|
||||||
// for i in 0..LEN {
|
|
||||||
// if last_encoded != arr[i] {
|
|
||||||
// match arr[i] {
|
|
||||||
// 0b1010111001 | 0b0101001001 => {
|
|
||||||
// println!("D31.1")
|
|
||||||
// }
|
|
||||||
// 0b0111011001 | 0b1000101001 => {
|
|
||||||
// println!("D01.1")
|
|
||||||
// }
|
|
||||||
// 0b1101010010 | 0b0010101101 => {
|
|
||||||
// println!("D04.4")
|
|
||||||
// }
|
|
||||||
// 0b0011111010 | 0b1100000101 => {
|
|
||||||
// println!("K28.5 start idling...")
|
|
||||||
// }
|
|
||||||
// 0b0011111001 | 0b1100000110 => {
|
|
||||||
// println!("K28.1 idling...")
|
|
||||||
// }
|
|
||||||
// 0b1010101010 => {
|
|
||||||
// println!("D21.5 END idle")
|
|
||||||
// }
|
|
||||||
// _ => {
|
|
||||||
// println!("encoded = {:#012b}", arr[i])
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// last_encoded = arr[i]
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// println!("-------------------------------------");
|
|
||||||
|
|
||||||
timer.delay_us(2_000_000);
|
timer.delay_us(2_000_000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn get_encoded() -> u16 {
|
|
||||||
unsafe { csr::cxp::upconn_encoded_data_read().reverse_bits() >> 6 }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue