forked from M-Labs/artiq-zynq
proto fw: cleanup
This commit is contained in:
parent
744fdd7040
commit
d9ddd25dc4
@ -6,8 +6,7 @@ use crc::crc32::checksum_ieee;
|
|||||||
use io::Cursor;
|
use io::Cursor;
|
||||||
use libboard_zynq::println;
|
use libboard_zynq::println;
|
||||||
|
|
||||||
const EV_MAXSIZE: usize = 253;
|
pub const CTRL_PACKET_MAXSIZE: usize = 128; // for compatibility with version1.x compliant Devices - Section 12.1.6 (CXP-001-2021)
|
||||||
const CTRL_PACKET_MAXSIZE: usize = 128; // for compatibility with version1.x compliant Devices - Section 12.1.6 (CXP-001-2021)
|
|
||||||
pub const DATA_MAXSIZE: usize =
|
pub const DATA_MAXSIZE: usize =
|
||||||
CTRL_PACKET_MAXSIZE - /*packet start KCodes, data packet types, CMD, Tag, Addr, CRC, packet end KCode*/4*7;
|
CTRL_PACKET_MAXSIZE - /*packet start KCodes, data packet types, CMD, Tag, Addr, CRC, packet end KCode*/4*7;
|
||||||
|
|
||||||
@ -165,7 +164,7 @@ pub enum RXPacket {
|
|||||||
namespace: NameSpace,
|
namespace: NameSpace,
|
||||||
event_id: u16,
|
event_id: u16,
|
||||||
timestamp: u64,
|
timestamp: u64,
|
||||||
ev: [u8; EV_MAXSIZE],
|
ev: [u8; DATA_MAXSIZE],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +238,7 @@ impl RXPacket {
|
|||||||
|
|
||||||
let timestamp = reader.read_u64()?;
|
let timestamp = reader.read_u64()?;
|
||||||
|
|
||||||
let mut ev: [u8; EV_MAXSIZE] = [0; EV_MAXSIZE];
|
let mut ev: [u8; DATA_MAXSIZE] = [0; DATA_MAXSIZE];
|
||||||
reader.read(&mut ev[0..ev_size as usize])?;
|
reader.read(&mut ev[0..ev_size as usize])?;
|
||||||
|
|
||||||
let checksum = get_cxp_crc(&reader.get_ref()[0..reader.position()]);
|
let checksum = get_cxp_crc(&reader.get_ref()[0..reader.position()]);
|
||||||
|
Loading…
Reference in New Issue
Block a user