diff options
Diffstat (limited to 'usbh')
-rw-r--r-- | usbh/src/pipe/pck_size.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/usbh/src/pipe/pck_size.rs b/usbh/src/pipe/pck_size.rs index d8fb4cb..9648381 100644 --- a/usbh/src/pipe/pck_size.rs +++ b/usbh/src/pipe/pck_size.rs @@ -340,6 +340,8 @@ pub(crate) struct MultiPacketSizeW<'a> { } impl<'a> MultiPacketSizeW<'a> { pub unsafe fn bits(self, v: u16) -> &'a mut W { + assert!(v < 16_384); + const POS: u8 = 14; const MASK: u16 = 0x3fff; self.w.bits &= !((MASK as u32) << POS); @@ -355,6 +357,8 @@ impl<'a> ByteCountW<'a> { // Documentation is wrong on this field. Actually 14 bits from // offset 0. pub unsafe fn bits(self, v: u16) -> &'a mut W { + assert!(v < 16_384); + const POS: u8 = 0; const MASK: u16 = 0x3fff; self.w.bits &= !((MASK as u32) << POS); |