1
0
Fork 0

cxp up conn fw: update test case

This commit is contained in:
morgan 2024-08-26 11:57:57 +08:00
parent 679b430d74
commit 94d569502b
1 changed files with 33 additions and 26 deletions

View File

@ -28,10 +28,10 @@ pub fn tx_test(timer: &mut GlobalTimer) {
// the 8bit shift is k symbol // the 8bit shift is k symbol
// const K28_1: u16 = 0x3C | (1 << 8); // const K28_1: u16 = 0x3C | (1 << 8);
// const K28_5: u16 = 0xBC | (1 << 8); // const K28_5: u16 = 0xBC | (1 << 8);
const D31_1: u16 = 0x3F;
const D01_1: u16 = 0x21; const D01_1: u16 = 0x21;
const D31_1: u16 = 0x3F;
const LEN: usize = 100; const LEN: usize = 200;
let mut arr: [u16; LEN] = [0; LEN]; let mut arr: [u16; LEN] = [0; LEN];
unsafe { unsafe {
@ -40,40 +40,47 @@ pub fn tx_test(timer: &mut GlobalTimer) {
csr::cxp::upconn_clk_reset_write(0); csr::cxp::upconn_clk_reset_write(0);
loop { loop {
// TODO: verify the char & word boundary thingy // TODO: verify the char & word boundary thingy
for _ in 0..8 { for _ in 0..12 {
csr::cxp::upconn_symbol1_write(D01_1);
}
for _ in 0..4 {
csr::cxp::upconn_symbol2_write(D31_1); csr::cxp::upconn_symbol2_write(D31_1);
} }
timer.delay_us(1);
csr::cxp::upconn_tx_enable_write(1); csr::cxp::upconn_tx_enable_write(1);
timer.delay_us(1);
for _ in 0..3 {
csr::cxp::upconn_symbol0_write(D01_1);
}
for i in 0..LEN { for i in 0..LEN {
arr[i] = get_encoded(); arr[i] = get_encoded();
} }
let mut last_encoded: u16 = 0;
for i in 0..LEN { for i in 0..LEN {
match arr[i] { if last_encoded != arr[i] {
0b1010111001 | 0b0101001001 => { match arr[i] {
println!("encoded = {:#012b} D31.1", arr[i]) 0b1010111001 | 0b0101001001 => {
} println!("D31.1")
0b0111011001 | 0b1000101001 => { }
println!("encoded = {:#012b} D01.1", arr[i]) 0b0111011001 | 0b1000101001 => {
} println!("D01.1")
0b0011111010 | 0b1100000101 => { }
println!("encoded = {:#012b} K28.5 start idling....", arr[i]) 0b1101010010 | 0b0010101101 => {
} println!("D04.4")
0b0011111001 | 0b1100000110 => { }
println!("encoded = {:#012b} K28.1 idling...", arr[i]) 0b0011111010 | 0b1100000101 => {
} println!("K28.5 start idling....")
0b0011101010 => { }
println!("encoded = {:#012b} D28.5 END idle", arr[i]) 0b0011111001 | 0b1100000110 => {
} println!("K28.1 idling...")
_ => { }
println!("encoded = {:#012b}", arr[i]) 0b0011101010 => {
println!("D28.5 END idle")
}
_ => {
println!("encoded = {:#012b}", arr[i])
}
} }
last_encoded = arr[i]
} }
} }
println!("-------------------------------------"); println!("-------------------------------------");