pub struct VendorIDFormat {
pub format: u8,
pub data: u32,
pub numeric_value: u16,
}
bitfield! {
pub struct PCIMessageFormat(MSB0 [u8]);
u16;
pub vendor_id, set_vendor_id : 15, 0;
}
impl PCIMessageFormat<[u8; 2]> {
pub fn new(vendor_id: u16) -> Self {
let buf = [0; 2];
let mut header = PCIMessageFormat(buf);
header.set_vendor_id(vendor_id);
header
}
pub fn new_from_buf(buf: [u8; 2]) -> Self {
PCIMessageFormat(buf)
}
}
bitfield! {
pub struct IANAMessageFormat(MSB0 [u8]);
u32;
pub vendor_id, set_vendor_id : 31, 0;
}
impl IANAMessageFormat<[u8; 4]> {
pub fn new(vendor_id: u32) -> Self {
let buf = [0; 4];
let mut header = IANAMessageFormat(buf);
header.set_vendor_id(vendor_id);
header
}
pub fn new_from_buf(buf: [u8; 4]) -> Self {
IANAMessageFormat(buf)
}
}