aboutsummaryrefslogtreecommitdiffstats
path: root/usbh/src
diff options
context:
space:
mode:
Diffstat (limited to 'usbh/src')
-rw-r--r--usbh/src/pipe/pck_size.rs20
1 files changed, 12 insertions, 8 deletions
diff --git a/usbh/src/pipe/pck_size.rs b/usbh/src/pipe/pck_size.rs
index 5133005..d8fb4cb 100644
--- a/usbh/src/pipe/pck_size.rs
+++ b/usbh/src/pipe/pck_size.rs
@@ -73,11 +73,13 @@ impl R {
MultiPacketSizeR(bits)
}
+ // Documentation is wrong on this field. Actually 14 bits from
+ // offset 0.
pub fn byte_count(&self) -> ByteCountR {
let bits = {
- const POS: u8 = 8;
- const MASK: u32 = 0x3f;
- ((self.bits >> POS) & MASK) as u8
+ const POS: u8 = 0;
+ const MASK: u32 = 0x3fff;
+ ((self.bits >> POS) & MASK) as u16
};
ByteCountR(bits)
@@ -205,9 +207,9 @@ impl MultiPacketSizeR {
/// sent in the last OUT or SETUP transaction for an OUT pipe, or of
/// the number of bytes to be received in the next IN transaction for
/// an input pipe.
-pub(crate) struct ByteCountR(u8);
+pub(crate) struct ByteCountR(u16);
impl ByteCountR {
- pub fn bits(&self) -> u8 {
+ pub fn bits(&self) -> u16 {
self.0
}
}
@@ -350,9 +352,11 @@ pub(crate) struct ByteCountW<'a> {
w: &'a mut W,
}
impl<'a> ByteCountW<'a> {
- pub unsafe fn bits(self, v: u8) -> &'a mut W {
- const POS: u8 = 8;
- const MASK: u8 = 0x3f;
+ // Documentation is wrong on this field. Actually 14 bits from
+ // offset 0.
+ pub unsafe fn bits(self, v: u16) -> &'a mut W {
+ const POS: u8 = 0;
+ const MASK: u16 = 0x3fff;
self.w.bits &= !((MASK as u32) << POS);
self.w.bits |= ((v & MASK) as u32) << POS;
self.w