forked from M-Labs/artiq-zynq
cxp upconn fw: update csr name
This commit is contained in:
parent
bacb446e6a
commit
20de7b0a0c
|
@ -93,10 +93,10 @@ pub fn tx_test(timer: &mut GlobalTimer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum Command<T> {
|
pub enum Command<T> {
|
||||||
ControlRead { addr: u32 },
|
Read { addr: u32 },
|
||||||
ControlWrite { addr: u32, data: T },
|
Write { addr: u32, data: T },
|
||||||
ControlReadWithTag { addr: u32, tag: u8 },
|
ReadWithTag { addr: u32, tag: u8 },
|
||||||
ControlWriteWithTag { addr: u32, data: T, tag: u8 },
|
WriteWithTag { addr: u32, data: T, tag: u8 },
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum Packet {
|
pub enum Packet {
|
||||||
|
@ -109,24 +109,24 @@ impl Packet {
|
||||||
where W: Write {
|
where W: Write {
|
||||||
match self {
|
match self {
|
||||||
Packet::ControlU32Reg(cmd) => match cmd {
|
Packet::ControlU32Reg(cmd) => match cmd {
|
||||||
Command::ControlRead { addr } => {
|
Command::Read { addr } => {
|
||||||
writer.write(&[0x02; 4])?;
|
writer.write(&[0x02; 4])?;
|
||||||
writer.write(&[0x00, 0x00, 0x00, 0x04])?;
|
writer.write(&[0x00, 0x00, 0x00, 0x04])?;
|
||||||
writer.write(&addr.to_be_bytes())?;
|
writer.write(&addr.to_be_bytes())?;
|
||||||
}
|
}
|
||||||
Command::ControlWrite { addr, data } => {
|
Command::Write { addr, data } => {
|
||||||
writer.write(&[0x02; 4])?;
|
writer.write(&[0x02; 4])?;
|
||||||
writer.write(&[0x01, 0x00, 0x00, 0x04])?;
|
writer.write(&[0x01, 0x00, 0x00, 0x04])?;
|
||||||
writer.write(&addr.to_be_bytes())?;
|
writer.write(&addr.to_be_bytes())?;
|
||||||
writer.write(&data.to_be_bytes())?;
|
writer.write(&data.to_be_bytes())?;
|
||||||
}
|
}
|
||||||
Command::ControlReadWithTag { addr, tag } => {
|
Command::ReadWithTag { addr, tag } => {
|
||||||
writer.write(&[0x05; 4])?;
|
writer.write(&[0x05; 4])?;
|
||||||
writer.write(&[*tag; 4])?;
|
writer.write(&[*tag; 4])?;
|
||||||
writer.write(&[0x00, 0x00, 0x00, 0x04])?;
|
writer.write(&[0x00, 0x00, 0x00, 0x04])?;
|
||||||
writer.write(&addr.to_be_bytes())?;
|
writer.write(&addr.to_be_bytes())?;
|
||||||
}
|
}
|
||||||
Command::ControlWriteWithTag { addr, data, tag } => {
|
Command::WriteWithTag { addr, data, tag } => {
|
||||||
writer.write(&[0x05; 4])?;
|
writer.write(&[0x05; 4])?;
|
||||||
writer.write(&[*tag; 4])?;
|
writer.write(&[*tag; 4])?;
|
||||||
writer.write(&[0x01, 0x00, 0x00, 0x04])?;
|
writer.write(&[0x01, 0x00, 0x00, 0x04])?;
|
||||||
|
@ -135,24 +135,24 @@ impl Packet {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Packet::ControlU64Reg(cmd) => match cmd {
|
Packet::ControlU64Reg(cmd) => match cmd {
|
||||||
Command::ControlRead { addr } => {
|
Command::Read { addr } => {
|
||||||
writer.write(&[0x02; 4])?;
|
writer.write(&[0x02; 4])?;
|
||||||
writer.write(&[0x00, 0x00, 0x00, 0x08])?;
|
writer.write(&[0x00, 0x00, 0x00, 0x08])?;
|
||||||
writer.write(&addr.to_be_bytes())?;
|
writer.write(&addr.to_be_bytes())?;
|
||||||
}
|
}
|
||||||
Command::ControlWrite { addr, data } => {
|
Command::Write { addr, data } => {
|
||||||
writer.write(&[0x02; 4])?;
|
writer.write(&[0x02; 4])?;
|
||||||
writer.write(&[0x01, 0x00, 0x00, 0x08])?;
|
writer.write(&[0x01, 0x00, 0x00, 0x08])?;
|
||||||
writer.write(&addr.to_be_bytes())?;
|
writer.write(&addr.to_be_bytes())?;
|
||||||
writer.write(&data.to_be_bytes())?;
|
writer.write(&data.to_be_bytes())?;
|
||||||
}
|
}
|
||||||
Command::ControlReadWithTag { addr, tag } => {
|
Command::ReadWithTag { addr, tag } => {
|
||||||
writer.write(&[0x05; 4])?;
|
writer.write(&[0x05; 4])?;
|
||||||
writer.write(&[*tag; 4])?;
|
writer.write(&[*tag; 4])?;
|
||||||
writer.write(&[0x00, 0x00, 0x00, 0x08])?;
|
writer.write(&[0x00, 0x00, 0x00, 0x08])?;
|
||||||
writer.write(&addr.to_be_bytes())?;
|
writer.write(&addr.to_be_bytes())?;
|
||||||
}
|
}
|
||||||
Command::ControlWriteWithTag { addr, data, tag } => {
|
Command::WriteWithTag { addr, data, tag } => {
|
||||||
writer.write(&[0x05; 4])?;
|
writer.write(&[0x05; 4])?;
|
||||||
writer.write(&[*tag; 4])?;
|
writer.write(&[*tag; 4])?;
|
||||||
writer.write(&[0x01, 0x00, 0x00, 0x08])?;
|
writer.write(&[0x01, 0x00, 0x00, 0x08])?;
|
||||||
|
@ -180,10 +180,10 @@ pub fn send(packet: &Packet) -> Result<(), IoError> {
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let len = writer.position();
|
let len = writer.position();
|
||||||
csr::cxp::upconn_command_din_len_write(len as u8);
|
csr::cxp::upconn_command_len_write(len as u8);
|
||||||
for data in writer.get_ref()[..len].iter() {
|
for data in writer.get_ref()[..len].iter() {
|
||||||
while csr::cxp::upconn_command_din_ready_read() == 0 {}
|
while csr::cxp::upconn_command_writeable_read() == 0 {}
|
||||||
csr::cxp::upconn_command_din_data_write(*data);
|
csr::cxp::upconn_command_data_write(*data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ pub fn send(packet: &Packet) -> Result<(), IoError> {
|
||||||
|
|
||||||
pub fn pipeline_test(timer: &mut GlobalTimer) {
|
pub fn pipeline_test(timer: &mut GlobalTimer) {
|
||||||
// CXP CRC example
|
// CXP CRC example
|
||||||
send(&Packet::ControlU32Reg(Command::ControlRead { addr: 0x00 })).expect("Cannot send CoaXpress packet");
|
send(&Packet::ControlU32Reg(Command::Read { addr: 0x00 })).expect("Cannot send CoaXpress packet");
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
timer.delay_us(1);
|
timer.delay_us(1);
|
||||||
|
|
Loading…
Reference in New Issue