#[derive(Debug, Clone, Copy, Default)]
pub struct RxOps(u8);
impl RxOps {
pub const REQUEST: u8 = 0x01;
pub const RW: u8 = 0x02;
pub const RESPONSE: u8 = 0x04;
pub const CREDIT_UPDATE: u8 = 0x08;
pub const RESET: u8 = 0x10;
pub const CREDIT_REQUEST: u8 = 0x20;
pub fn pending(&self) -> bool {
self.0 != 0
}
pub fn enqueue(&mut self, op: u8) {
self.0 |= op;
}
pub fn dequeue(&mut self) -> u8 {
if self.0 == 0 {
return 0;
}
let op = self.0 & self.0.wrapping_neg();
self.0 &= !op;
op
}
pub fn peek(&self) -> u8 {
if self.0 == 0 {
return 0;
}
self.0 & self.0.wrapping_neg()
}
}