aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2019-07-25 16:51:09 -0400
committerBrian Cully <bjc@kublai.com>2019-07-25 16:51:09 -0400
commit2cfdcc6771958b510f770e28651b869c52b8c943 (patch)
tree08f67fb99c5f56f0c9c75ed232572a72f57ec977
parent4fd18684b6233e7e0030d65f4419a9741468add3 (diff)
downloadsamd21-demo-2cfdcc6771958b510f770e28651b869c52b8c943.tar.gz
samd21-demo-2cfdcc6771958b510f770e28651b869c52b8c943.zip
Update PCKSIZE for correct BYTE_COUNT offset and length.
-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