From ca6a494e497a2ab7428a81a60d4fd1035d906977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Sat, 27 Jan 2018 17:06:50 +0100 Subject: [PATCH] Make EPnR into an array. I would preferably use a cluster here, but svd2rust doesn't yet have that feature. See japaric/svd2rust#149 and japaric/svd2rust#107 closes #16 --- STM32F103xx.patch | 864 +++++--- src/lib.rs | 4760 +-------------------------------------------- 2 files changed, 573 insertions(+), 5051 deletions(-) diff --git a/STM32F103xx.patch b/STM32F103xx.patch index 50fe45d..67a78dd 100644 --- a/STM32F103xx.patch +++ b/STM32F103xx.patch @@ -1,5 +1,5 @@ ---- STM32F103xx.svd.raw 2017-10-22 10:46:47.419016630 +0300 -+++ STM32F103xx.svd 2017-10-24 16:58:11.333306273 +0300 +--- STM32F103xx.svd.raw 2018-01-27 16:49:54.160000001 +0100 ++++ STM32F103xx.svd 2018-01-27 16:52:09.116666668 +0100 @@ -3,6 +3,16 @@ xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD_Schema_1_1.xsd"> @@ -2854,7 +2854,23 @@ PRFTBS -@@ -24060,6 +25401,12 @@ +@@ -24047,9 +25388,12 @@ + + + +- EP0R +- EP0R +- endpoint 0 register ++ EP%sR ++ EPnR ++ 8 ++ 0-7 ++ 0x4 ++ endpoint register array + 0x0 + 0x20 + read-write +@@ -24060,6 +25404,12 @@ Endpoint address 0 4 @@ -2867,304 +2883,556 @@ STAT_TX -@@ -24093,6 +25440,28 @@ - Endpoint type - 9 - 2 -+ -+ -+ BULK -+ This endpoint is a bulk endpoint -+ 0 -+ -+ -+ CONTROL -+ This endpoint is a control endpoint -+ 1 -+ -+ -+ ISO -+ This endpoint is an isochronous endpoint -+ 2 -+ -+ -+ INTERRUPT -+ This endpoint is an interrupt endpoint -+ 3 -+ -+ - - - SETUP -@@ -24138,6 +25507,12 @@ - Endpoint address - 0 - 4 -+ -+ -+ 0 -+ 15 -+ -+ - - - STAT_TX -@@ -24171,6 +25546,28 @@ - Endpoint type - 9 - 2 -+ -+ -+ BULK -+ This endpoint is a bulk endpoint -+ 0 -+ -+ -+ CONTROL -+ This endpoint is a control endpoint -+ 1 -+ -+ -+ ISO -+ This endpoint is an isochronous endpoint -+ 2 -+ -+ -+ INTERRUPT -+ This endpoint is an interrupt endpoint -+ 3 -+ -+ - - - SETUP -@@ -24216,6 +25613,12 @@ - Endpoint address - 0 - 4 -+ -+ -+ 0 -+ 15 -+ -+ - - - STAT_TX -@@ -24249,6 +25652,28 @@ - Endpoint type - 9 - 2 -+ -+ -+ BULK -+ This endpoint is a bulk endpoint -+ 0 -+ -+ -+ CONTROL -+ This endpoint is a control endpoint -+ 1 -+ -+ -+ ISO -+ This endpoint is an isochronous endpoint -+ 2 -+ -+ -+ INTERRUPT -+ This endpoint is an interrupt endpoint -+ 3 -+ -+ - - - SETUP -@@ -24294,6 +25719,12 @@ - Endpoint address - 0 - 4 -+ -+ -+ 0 -+ 15 -+ -+ - - - STAT_TX -@@ -24327,6 +25758,28 @@ - Endpoint type - 9 - 2 -+ -+ -+ BULK -+ This endpoint is a bulk endpoint -+ 0 -+ -+ -+ CONTROL -+ This endpoint is a control endpoint -+ 1 -+ -+ -+ ISO -+ This endpoint is an isochronous endpoint -+ 2 -+ -+ -+ INTERRUPT -+ This endpoint is an interrupt endpoint -+ 3 -+ -+ - - - SETUP -@@ -24372,6 +25825,12 @@ - Endpoint address - 0 - 4 -+ -+ -+ 0 -+ 15 -+ -+ - - - STAT_TX -@@ -24405,6 +25864,28 @@ - Endpoint type - 9 - 2 -+ -+ -+ BULK -+ This endpoint is a bulk endpoint -+ 0 -+ -+ -+ CONTROL -+ This endpoint is a control endpoint -+ 1 -+ -+ -+ ISO -+ This endpoint is an isochronous endpoint -+ 2 -+ -+ -+ INTERRUPT -+ This endpoint is an interrupt endpoint -+ 3 -+ -+ - - - SETUP -@@ -24450,6 +25931,12 @@ - Endpoint address - 0 - 4 -+ -+ -+ 0 -+ 15 -+ -+ - - - STAT_TX -@@ -24483,6 +25970,28 @@ - Endpoint type - 9 - 2 -+ -+ -+ BULK -+ This endpoint is a bulk endpoint -+ 0 -+ -+ -+ CONTROL -+ This endpoint is a control endpoint -+ 1 -+ -+ -+ ISO -+ This endpoint is an isochronous endpoint -+ 2 -+ -+ -+ INTERRUPT -+ This endpoint is an interrupt endpoint -+ 3 -+ -+ - - - SETUP -@@ -24528,6 +26037,12 @@ - Endpoint address - 0 - 4 -+ -+ -+ 0 -+ 15 -+ -+ - - - STAT_TX -@@ -24561,6 +26076,28 @@ - Endpoint type - 9 - 2 -+ -+ -+ BULK -+ This endpoint is a bulk endpoint -+ 0 -+ -+ -+ CONTROL -+ This endpoint is a control endpoint -+ 1 -+ -+ -+ ISO -+ This endpoint is an isochronous endpoint -+ 2 -+ -+ -+ INTERRUPT -+ This endpoint is an interrupt endpoint -+ 3 -+ -+ - - - SETUP -@@ -24606,6 +26143,12 @@ - Endpoint address - 0 - 4 -+ -+ -+ 0 -+ 15 -+ -+ - - - STAT_TX -@@ -24639,6 +26182,28 @@ +@@ -24093,552 +25443,28 @@ Endpoint type 9 2 +- +- +- SETUP +- Setup transaction +- completed +- 11 +- 1 +- +- +- STAT_RX +- Status bits, for reception +- transfers +- 12 +- 2 +- +- +- DTOG_RX +- Data Toggle, for reception +- transfers +- 14 +- 1 +- +- +- CTR_RX +- Correct transfer for +- reception +- 15 +- 1 +- +- +- +- +- EP1R +- EP1R +- endpoint 1 register +- 0x4 +- 0x20 +- read-write +- 0x00000000 +- +- +- EA +- Endpoint address +- 0 +- 4 +- +- +- STAT_TX +- Status bits, for transmission +- transfers +- 4 +- 2 +- +- +- DTOG_TX +- Data Toggle, for transmission +- transfers +- 6 +- 1 +- +- +- CTR_TX +- Correct Transfer for +- transmission +- 7 +- 1 +- +- +- EP_KIND +- Endpoint kind +- 8 +- 1 +- +- +- EP_TYPE +- Endpoint type +- 9 +- 2 +- +- +- SETUP +- Setup transaction +- completed +- 11 +- 1 +- +- +- STAT_RX +- Status bits, for reception +- transfers +- 12 +- 2 +- +- +- DTOG_RX +- Data Toggle, for reception +- transfers +- 14 +- 1 +- +- +- CTR_RX +- Correct transfer for +- reception +- 15 +- 1 +- +- +- +- +- EP2R +- EP2R +- endpoint 2 register +- 0x8 +- 0x20 +- read-write +- 0x00000000 +- +- +- EA +- Endpoint address +- 0 +- 4 +- +- +- STAT_TX +- Status bits, for transmission +- transfers +- 4 +- 2 +- +- +- DTOG_TX +- Data Toggle, for transmission +- transfers +- 6 +- 1 +- +- +- CTR_TX +- Correct Transfer for +- transmission +- 7 +- 1 +- +- +- EP_KIND +- Endpoint kind +- 8 +- 1 +- +- +- EP_TYPE +- Endpoint type +- 9 +- 2 +- +- +- SETUP +- Setup transaction +- completed +- 11 +- 1 +- +- +- STAT_RX +- Status bits, for reception +- transfers +- 12 +- 2 +- +- +- DTOG_RX +- Data Toggle, for reception +- transfers +- 14 +- 1 +- +- +- CTR_RX +- Correct transfer for +- reception +- 15 +- 1 +- +- +- +- +- EP3R +- EP3R +- endpoint 3 register +- 0xC +- 0x20 +- read-write +- 0x00000000 +- +- +- EA +- Endpoint address +- 0 +- 4 +- +- +- STAT_TX +- Status bits, for transmission +- transfers +- 4 +- 2 +- +- +- DTOG_TX +- Data Toggle, for transmission +- transfers +- 6 +- 1 +- +- +- CTR_TX +- Correct Transfer for +- transmission +- 7 +- 1 +- +- +- EP_KIND +- Endpoint kind +- 8 +- 1 +- +- +- EP_TYPE +- Endpoint type +- 9 +- 2 +- +- +- SETUP +- Setup transaction +- completed +- 11 +- 1 +- +- +- STAT_RX +- Status bits, for reception +- transfers +- 12 +- 2 +- +- +- DTOG_RX +- Data Toggle, for reception +- transfers +- 14 +- 1 +- +- +- CTR_RX +- Correct transfer for +- reception +- 15 +- 1 +- +- +- +- +- EP4R +- EP4R +- endpoint 4 register +- 0x10 +- 0x20 +- read-write +- 0x00000000 +- +- +- EA +- Endpoint address +- 0 +- 4 +- +- +- STAT_TX +- Status bits, for transmission +- transfers +- 4 +- 2 +- +- +- DTOG_TX +- Data Toggle, for transmission +- transfers +- 6 +- 1 +- +- +- CTR_TX +- Correct Transfer for +- transmission +- 7 +- 1 +- +- +- EP_KIND +- Endpoint kind +- 8 +- 1 +- +- +- EP_TYPE +- Endpoint type +- 9 +- 2 +- +- +- SETUP +- Setup transaction +- completed +- 11 +- 1 +- +- +- STAT_RX +- Status bits, for reception +- transfers +- 12 +- 2 +- +- +- DTOG_RX +- Data Toggle, for reception +- transfers +- 14 +- 1 +- +- +- CTR_RX +- Correct transfer for +- reception +- 15 +- 1 +- +- +- +- +- EP5R +- EP5R +- endpoint 5 register +- 0x14 +- 0x20 +- read-write +- 0x00000000 +- +- +- EA +- Endpoint address +- 0 +- 4 +- +- +- STAT_TX +- Status bits, for transmission +- transfers +- 4 +- 2 +- +- +- DTOG_TX +- Data Toggle, for transmission +- transfers +- 6 +- 1 +- +- +- CTR_TX +- Correct Transfer for +- transmission +- 7 +- 1 +- +- +- EP_KIND +- Endpoint kind +- 8 +- 1 +- +- +- EP_TYPE +- Endpoint type +- 9 +- 2 +- +- +- SETUP +- Setup transaction +- completed +- 11 +- 1 +- +- +- STAT_RX +- Status bits, for reception +- transfers +- 12 +- 2 +- +- +- DTOG_RX +- Data Toggle, for reception +- transfers +- 14 +- 1 +- +- +- CTR_RX +- Correct transfer for +- reception +- 15 +- 1 +- +- +- +- +- EP6R +- EP6R +- endpoint 6 register +- 0x18 +- 0x20 +- read-write +- 0x00000000 +- +- +- EA +- Endpoint address +- 0 +- 4 +- +- +- STAT_TX +- Status bits, for transmission +- transfers +- 4 +- 2 +- +- +- DTOG_TX +- Data Toggle, for transmission +- transfers +- 6 +- 1 +- +- +- CTR_TX +- Correct Transfer for +- transmission +- 7 +- 1 +- +- +- EP_KIND +- Endpoint kind +- 8 +- 1 +- +- +- EP_TYPE +- Endpoint type +- 9 +- 2 +- +- +- SETUP +- Setup transaction +- completed +- 11 +- 1 +- +- +- STAT_RX +- Status bits, for reception +- transfers +- 12 +- 2 +- +- +- DTOG_RX +- Data Toggle, for reception +- transfers +- 14 +- 1 +- +- +- CTR_RX +- Correct transfer for +- reception +- 15 +- 1 +- +- +- +- +- EP7R +- EP7R +- endpoint 7 register +- 0x1C +- 0x20 +- read-write +- 0x00000000 +- +- +- EA +- Endpoint address +- 0 +- 4 +- +- +- STAT_TX +- Status bits, for transmission +- transfers +- 4 +- 2 +- +- +- DTOG_TX +- Data Toggle, for transmission +- transfers +- 6 +- 1 +- +- +- CTR_TX +- Correct Transfer for +- transmission +- 7 +- 1 +- +- +- EP_KIND +- Endpoint kind +- 8 +- 1 +- +- +- EP_TYPE +- Endpoint type +- 9 +- 2 + + + BULK diff --git a/src/lib.rs b/src/lib.rs index dddda31..05adfef 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -180365,22 +180365,8 @@ pub mod usb { #[doc = r" Register block"] #[repr(C)] pub struct RegisterBlock { - #[doc = "0x00 - endpoint 0 register"] - pub ep0r: EP0R, - #[doc = "0x04 - endpoint 1 register"] - pub ep1r: EP1R, - #[doc = "0x08 - endpoint 2 register"] - pub ep2r: EP2R, - #[doc = "0x0c - endpoint 3 register"] - pub ep3r: EP3R, - #[doc = "0x10 - endpoint 4 register"] - pub ep4r: EP4R, - #[doc = "0x14 - endpoint 5 register"] - pub ep5r: EP5R, - #[doc = "0x18 - endpoint 6 register"] - pub ep6r: EP6R, - #[doc = "0x1c - endpoint 7 register"] - pub ep7r: EP7R, + #[doc = "0x00 - endpoint register array"] + pub epr: [EPR; 8], _reserved0: [u8; 32usize], #[doc = "0x40 - control register"] pub cntr: CNTR, @@ -180393,12 +180379,12 @@ pub mod usb { #[doc = "0x50 - Buffer table address"] pub btable: BTABLE, } - #[doc = "endpoint 0 register"] - pub struct EP0R { + #[doc = "endpoint register array"] + pub struct EPR { register: VolatileCell, } - #[doc = "endpoint 0 register"] - pub mod ep0r { + #[doc = "endpoint register array"] + pub mod epr { #[doc = r" Value read from the register"] pub struct R { bits: u32, @@ -180407,4739 +180393,7 @@ pub mod usb { pub struct W { bits: u32, } - impl super::EP0R { - #[doc = r" Modifies the contents of the register"] - #[inline] - pub fn modify(&self, f: F) - where - for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W, - { - let bits = self.register.get(); - let r = R { bits: bits }; - let mut w = W { bits: bits }; - f(&r, &mut w); - self.register.set(w.bits); - } - #[doc = r" Reads the contents of the register"] - #[inline] - pub fn read(&self) -> R { - R { - bits: self.register.get(), - } - } - #[doc = r" Writes to the register"] - #[inline] - pub fn write(&self, f: F) - where - F: FnOnce(&mut W) -> &mut W, - { - let mut w = W::reset_value(); - f(&mut w); - self.register.set(w.bits); - } - #[doc = r" Writes the reset value to the register"] - #[inline] - pub fn reset(&self) { - self.write(|w| w) - } - } - #[doc = r" Value of the field"] - pub struct EAR { - bits: u8, - } - impl EAR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - self.bits - } - } - #[doc = r" Value of the field"] - pub struct STAT_TXR { - bits: u8, - } - impl STAT_TXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - self.bits - } - } - #[doc = r" Value of the field"] - pub struct DTOG_TXR { - bits: bool, - } - impl DTOG_TXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct CTR_TXR { - bits: bool, - } - impl CTR_TXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct EP_KINDR { - bits: bool, - } - impl EP_KINDR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = "Possible values of the field `EP_TYPE`"] - #[derive(Clone, Copy, Debug, PartialEq)] - pub enum EP_TYPER { - #[doc = "This endpoint is a bulk endpoint"] BULK, - #[doc = "This endpoint is a control endpoint"] CONTROL, - #[doc = "This endpoint is an isochronous endpoint"] ISO, - #[doc = "This endpoint is an interrupt endpoint"] INTERRUPT, - } - impl EP_TYPER { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - match *self { - EP_TYPER::BULK => 0, - EP_TYPER::CONTROL => 0x01, - EP_TYPER::ISO => 0x02, - EP_TYPER::INTERRUPT => 0x03, - } - } - #[allow(missing_docs)] - #[doc(hidden)] - #[inline] - pub fn _from(value: u8) -> EP_TYPER { - match value { - 0 => EP_TYPER::BULK, - 1 => EP_TYPER::CONTROL, - 2 => EP_TYPER::ISO, - 3 => EP_TYPER::INTERRUPT, - _ => unreachable!(), - } - } - #[doc = "Checks if the value of the field is `BULK`"] - #[inline] - pub fn is_bulk(&self) -> bool { - *self == EP_TYPER::BULK - } - #[doc = "Checks if the value of the field is `CONTROL`"] - #[inline] - pub fn is_control(&self) -> bool { - *self == EP_TYPER::CONTROL - } - #[doc = "Checks if the value of the field is `ISO`"] - #[inline] - pub fn is_iso(&self) -> bool { - *self == EP_TYPER::ISO - } - #[doc = "Checks if the value of the field is `INTERRUPT`"] - #[inline] - pub fn is_interrupt(&self) -> bool { - *self == EP_TYPER::INTERRUPT - } - } - #[doc = r" Value of the field"] - pub struct SETUPR { - bits: bool, - } - impl SETUPR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct STAT_RXR { - bits: u8, - } - impl STAT_RXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - self.bits - } - } - #[doc = r" Value of the field"] - pub struct DTOG_RXR { - bits: bool, - } - impl DTOG_RXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct CTR_RXR { - bits: bool, - } - impl CTR_RXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Proxy"] - pub struct _EAW<'a> { - w: &'a mut W, - } - impl<'a> _EAW<'a> { - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x0f; - const OFFSET: u8 = 0; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _STAT_TXW<'a> { - w: &'a mut W, - } - impl<'a> _STAT_TXW<'a> { - #[doc = r" Writes raw bits to the field"] - #[inline] - pub unsafe fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x03; - const OFFSET: u8 = 4; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _DTOG_TXW<'a> { - w: &'a mut W, - } - impl<'a> _DTOG_TXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 6; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _CTR_TXW<'a> { - w: &'a mut W, - } - impl<'a> _CTR_TXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 7; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _EP_KINDW<'a> { - w: &'a mut W, - } - impl<'a> _EP_KINDW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 8; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = "Values that can be written to the field `EP_TYPE`"] - pub enum EP_TYPEW { - #[doc = "This endpoint is a bulk endpoint"] BULK, - #[doc = "This endpoint is a control endpoint"] CONTROL, - #[doc = "This endpoint is an isochronous endpoint"] ISO, - #[doc = "This endpoint is an interrupt endpoint"] INTERRUPT, - } - impl EP_TYPEW { - #[allow(missing_docs)] - #[doc(hidden)] - #[inline] - pub fn _bits(&self) -> u8 { - match *self { - EP_TYPEW::BULK => 0, - EP_TYPEW::CONTROL => 1, - EP_TYPEW::ISO => 2, - EP_TYPEW::INTERRUPT => 3, - } - } - } - #[doc = r" Proxy"] - pub struct _EP_TYPEW<'a> { - w: &'a mut W, - } - impl<'a> _EP_TYPEW<'a> { - #[doc = r" Writes `variant` to the field"] - #[inline] - pub fn variant(self, variant: EP_TYPEW) -> &'a mut W { - { - self.bits(variant._bits()) - } - } - #[doc = "This endpoint is a bulk endpoint"] - #[inline] - pub fn bulk(self) -> &'a mut W { - self.variant(EP_TYPEW::BULK) - } - #[doc = "This endpoint is a control endpoint"] - #[inline] - pub fn control(self) -> &'a mut W { - self.variant(EP_TYPEW::CONTROL) - } - #[doc = "This endpoint is an isochronous endpoint"] - #[inline] - pub fn iso(self) -> &'a mut W { - self.variant(EP_TYPEW::ISO) - } - #[doc = "This endpoint is an interrupt endpoint"] - #[inline] - pub fn interrupt(self) -> &'a mut W { - self.variant(EP_TYPEW::INTERRUPT) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x03; - const OFFSET: u8 = 9; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _SETUPW<'a> { - w: &'a mut W, - } - impl<'a> _SETUPW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 11; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _STAT_RXW<'a> { - w: &'a mut W, - } - impl<'a> _STAT_RXW<'a> { - #[doc = r" Writes raw bits to the field"] - #[inline] - pub unsafe fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x03; - const OFFSET: u8 = 12; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _DTOG_RXW<'a> { - w: &'a mut W, - } - impl<'a> _DTOG_RXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 14; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _CTR_RXW<'a> { - w: &'a mut W, - } - impl<'a> _CTR_RXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 15; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - impl R { - #[doc = r" Value of the register as raw bits"] - #[inline] - pub fn bits(&self) -> u32 { - self.bits - } - #[doc = "Bits 0:3 - Endpoint address"] - #[inline] - pub fn ea(&self) -> EAR { - let bits = { - const MASK: u8 = 0x0f; - const OFFSET: u8 = 0; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }; - EAR { bits } - } - #[doc = "Bits 4:5 - Status bits, for transmission transfers"] - #[inline] - pub fn stat_tx(&self) -> STAT_TXR { - let bits = { - const MASK: u8 = 0x03; - const OFFSET: u8 = 4; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }; - STAT_TXR { bits } - } - #[doc = "Bit 6 - Data Toggle, for transmission transfers"] - #[inline] - pub fn dtog_tx(&self) -> DTOG_TXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 6; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - DTOG_TXR { bits } - } - #[doc = "Bit 7 - Correct Transfer for transmission"] - #[inline] - pub fn ctr_tx(&self) -> CTR_TXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 7; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - CTR_TXR { bits } - } - #[doc = "Bit 8 - Endpoint kind"] - #[inline] - pub fn ep_kind(&self) -> EP_KINDR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 8; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - EP_KINDR { bits } - } - #[doc = "Bits 9:10 - Endpoint type"] - #[inline] - pub fn ep_type(&self) -> EP_TYPER { - EP_TYPER::_from({ - const MASK: u8 = 0x03; - const OFFSET: u8 = 9; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }) - } - #[doc = "Bit 11 - Setup transaction completed"] - #[inline] - pub fn setup(&self) -> SETUPR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 11; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - SETUPR { bits } - } - #[doc = "Bits 12:13 - Status bits, for reception transfers"] - #[inline] - pub fn stat_rx(&self) -> STAT_RXR { - let bits = { - const MASK: u8 = 0x03; - const OFFSET: u8 = 12; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }; - STAT_RXR { bits } - } - #[doc = "Bit 14 - Data Toggle, for reception transfers"] - #[inline] - pub fn dtog_rx(&self) -> DTOG_RXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 14; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - DTOG_RXR { bits } - } - #[doc = "Bit 15 - Correct transfer for reception"] - #[inline] - pub fn ctr_rx(&self) -> CTR_RXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 15; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - CTR_RXR { bits } - } - } - impl W { - #[doc = r" Reset value of the register"] - #[inline] - pub fn reset_value() -> W { - W { bits: 0 } - } - #[doc = r" Writes raw bits to the register"] - #[inline] - pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { - self.bits = bits; - self - } - #[doc = "Bits 0:3 - Endpoint address"] - #[inline] - pub fn ea(&mut self) -> _EAW { - _EAW { w: self } - } - #[doc = "Bits 4:5 - Status bits, for transmission transfers"] - #[inline] - pub fn stat_tx(&mut self) -> _STAT_TXW { - _STAT_TXW { w: self } - } - #[doc = "Bit 6 - Data Toggle, for transmission transfers"] - #[inline] - pub fn dtog_tx(&mut self) -> _DTOG_TXW { - _DTOG_TXW { w: self } - } - #[doc = "Bit 7 - Correct Transfer for transmission"] - #[inline] - pub fn ctr_tx(&mut self) -> _CTR_TXW { - _CTR_TXW { w: self } - } - #[doc = "Bit 8 - Endpoint kind"] - #[inline] - pub fn ep_kind(&mut self) -> _EP_KINDW { - _EP_KINDW { w: self } - } - #[doc = "Bits 9:10 - Endpoint type"] - #[inline] - pub fn ep_type(&mut self) -> _EP_TYPEW { - _EP_TYPEW { w: self } - } - #[doc = "Bit 11 - Setup transaction completed"] - #[inline] - pub fn setup(&mut self) -> _SETUPW { - _SETUPW { w: self } - } - #[doc = "Bits 12:13 - Status bits, for reception transfers"] - #[inline] - pub fn stat_rx(&mut self) -> _STAT_RXW { - _STAT_RXW { w: self } - } - #[doc = "Bit 14 - Data Toggle, for reception transfers"] - #[inline] - pub fn dtog_rx(&mut self) -> _DTOG_RXW { - _DTOG_RXW { w: self } - } - #[doc = "Bit 15 - Correct transfer for reception"] - #[inline] - pub fn ctr_rx(&mut self) -> _CTR_RXW { - _CTR_RXW { w: self } - } - } - } - #[doc = "endpoint 1 register"] - pub struct EP1R { - register: VolatileCell, - } - #[doc = "endpoint 1 register"] - pub mod ep1r { - #[doc = r" Value read from the register"] - pub struct R { - bits: u32, - } - #[doc = r" Value to write to the register"] - pub struct W { - bits: u32, - } - impl super::EP1R { - #[doc = r" Modifies the contents of the register"] - #[inline] - pub fn modify(&self, f: F) - where - for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W, - { - let bits = self.register.get(); - let r = R { bits: bits }; - let mut w = W { bits: bits }; - f(&r, &mut w); - self.register.set(w.bits); - } - #[doc = r" Reads the contents of the register"] - #[inline] - pub fn read(&self) -> R { - R { - bits: self.register.get(), - } - } - #[doc = r" Writes to the register"] - #[inline] - pub fn write(&self, f: F) - where - F: FnOnce(&mut W) -> &mut W, - { - let mut w = W::reset_value(); - f(&mut w); - self.register.set(w.bits); - } - #[doc = r" Writes the reset value to the register"] - #[inline] - pub fn reset(&self) { - self.write(|w| w) - } - } - #[doc = r" Value of the field"] - pub struct EAR { - bits: u8, - } - impl EAR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - self.bits - } - } - #[doc = r" Value of the field"] - pub struct STAT_TXR { - bits: u8, - } - impl STAT_TXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - self.bits - } - } - #[doc = r" Value of the field"] - pub struct DTOG_TXR { - bits: bool, - } - impl DTOG_TXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct CTR_TXR { - bits: bool, - } - impl CTR_TXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct EP_KINDR { - bits: bool, - } - impl EP_KINDR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = "Possible values of the field `EP_TYPE`"] - #[derive(Clone, Copy, Debug, PartialEq)] - pub enum EP_TYPER { - #[doc = "This endpoint is a bulk endpoint"] BULK, - #[doc = "This endpoint is a control endpoint"] CONTROL, - #[doc = "This endpoint is an isochronous endpoint"] ISO, - #[doc = "This endpoint is an interrupt endpoint"] INTERRUPT, - } - impl EP_TYPER { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - match *self { - EP_TYPER::BULK => 0, - EP_TYPER::CONTROL => 0x01, - EP_TYPER::ISO => 0x02, - EP_TYPER::INTERRUPT => 0x03, - } - } - #[allow(missing_docs)] - #[doc(hidden)] - #[inline] - pub fn _from(value: u8) -> EP_TYPER { - match value { - 0 => EP_TYPER::BULK, - 1 => EP_TYPER::CONTROL, - 2 => EP_TYPER::ISO, - 3 => EP_TYPER::INTERRUPT, - _ => unreachable!(), - } - } - #[doc = "Checks if the value of the field is `BULK`"] - #[inline] - pub fn is_bulk(&self) -> bool { - *self == EP_TYPER::BULK - } - #[doc = "Checks if the value of the field is `CONTROL`"] - #[inline] - pub fn is_control(&self) -> bool { - *self == EP_TYPER::CONTROL - } - #[doc = "Checks if the value of the field is `ISO`"] - #[inline] - pub fn is_iso(&self) -> bool { - *self == EP_TYPER::ISO - } - #[doc = "Checks if the value of the field is `INTERRUPT`"] - #[inline] - pub fn is_interrupt(&self) -> bool { - *self == EP_TYPER::INTERRUPT - } - } - #[doc = r" Value of the field"] - pub struct SETUPR { - bits: bool, - } - impl SETUPR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct STAT_RXR { - bits: u8, - } - impl STAT_RXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - self.bits - } - } - #[doc = r" Value of the field"] - pub struct DTOG_RXR { - bits: bool, - } - impl DTOG_RXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct CTR_RXR { - bits: bool, - } - impl CTR_RXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Proxy"] - pub struct _EAW<'a> { - w: &'a mut W, - } - impl<'a> _EAW<'a> { - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x0f; - const OFFSET: u8 = 0; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _STAT_TXW<'a> { - w: &'a mut W, - } - impl<'a> _STAT_TXW<'a> { - #[doc = r" Writes raw bits to the field"] - #[inline] - pub unsafe fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x03; - const OFFSET: u8 = 4; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _DTOG_TXW<'a> { - w: &'a mut W, - } - impl<'a> _DTOG_TXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 6; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _CTR_TXW<'a> { - w: &'a mut W, - } - impl<'a> _CTR_TXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 7; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _EP_KINDW<'a> { - w: &'a mut W, - } - impl<'a> _EP_KINDW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 8; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = "Values that can be written to the field `EP_TYPE`"] - pub enum EP_TYPEW { - #[doc = "This endpoint is a bulk endpoint"] BULK, - #[doc = "This endpoint is a control endpoint"] CONTROL, - #[doc = "This endpoint is an isochronous endpoint"] ISO, - #[doc = "This endpoint is an interrupt endpoint"] INTERRUPT, - } - impl EP_TYPEW { - #[allow(missing_docs)] - #[doc(hidden)] - #[inline] - pub fn _bits(&self) -> u8 { - match *self { - EP_TYPEW::BULK => 0, - EP_TYPEW::CONTROL => 1, - EP_TYPEW::ISO => 2, - EP_TYPEW::INTERRUPT => 3, - } - } - } - #[doc = r" Proxy"] - pub struct _EP_TYPEW<'a> { - w: &'a mut W, - } - impl<'a> _EP_TYPEW<'a> { - #[doc = r" Writes `variant` to the field"] - #[inline] - pub fn variant(self, variant: EP_TYPEW) -> &'a mut W { - { - self.bits(variant._bits()) - } - } - #[doc = "This endpoint is a bulk endpoint"] - #[inline] - pub fn bulk(self) -> &'a mut W { - self.variant(EP_TYPEW::BULK) - } - #[doc = "This endpoint is a control endpoint"] - #[inline] - pub fn control(self) -> &'a mut W { - self.variant(EP_TYPEW::CONTROL) - } - #[doc = "This endpoint is an isochronous endpoint"] - #[inline] - pub fn iso(self) -> &'a mut W { - self.variant(EP_TYPEW::ISO) - } - #[doc = "This endpoint is an interrupt endpoint"] - #[inline] - pub fn interrupt(self) -> &'a mut W { - self.variant(EP_TYPEW::INTERRUPT) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x03; - const OFFSET: u8 = 9; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _SETUPW<'a> { - w: &'a mut W, - } - impl<'a> _SETUPW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 11; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _STAT_RXW<'a> { - w: &'a mut W, - } - impl<'a> _STAT_RXW<'a> { - #[doc = r" Writes raw bits to the field"] - #[inline] - pub unsafe fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x03; - const OFFSET: u8 = 12; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _DTOG_RXW<'a> { - w: &'a mut W, - } - impl<'a> _DTOG_RXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 14; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _CTR_RXW<'a> { - w: &'a mut W, - } - impl<'a> _CTR_RXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 15; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - impl R { - #[doc = r" Value of the register as raw bits"] - #[inline] - pub fn bits(&self) -> u32 { - self.bits - } - #[doc = "Bits 0:3 - Endpoint address"] - #[inline] - pub fn ea(&self) -> EAR { - let bits = { - const MASK: u8 = 0x0f; - const OFFSET: u8 = 0; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }; - EAR { bits } - } - #[doc = "Bits 4:5 - Status bits, for transmission transfers"] - #[inline] - pub fn stat_tx(&self) -> STAT_TXR { - let bits = { - const MASK: u8 = 0x03; - const OFFSET: u8 = 4; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }; - STAT_TXR { bits } - } - #[doc = "Bit 6 - Data Toggle, for transmission transfers"] - #[inline] - pub fn dtog_tx(&self) -> DTOG_TXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 6; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - DTOG_TXR { bits } - } - #[doc = "Bit 7 - Correct Transfer for transmission"] - #[inline] - pub fn ctr_tx(&self) -> CTR_TXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 7; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - CTR_TXR { bits } - } - #[doc = "Bit 8 - Endpoint kind"] - #[inline] - pub fn ep_kind(&self) -> EP_KINDR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 8; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - EP_KINDR { bits } - } - #[doc = "Bits 9:10 - Endpoint type"] - #[inline] - pub fn ep_type(&self) -> EP_TYPER { - EP_TYPER::_from({ - const MASK: u8 = 0x03; - const OFFSET: u8 = 9; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }) - } - #[doc = "Bit 11 - Setup transaction completed"] - #[inline] - pub fn setup(&self) -> SETUPR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 11; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - SETUPR { bits } - } - #[doc = "Bits 12:13 - Status bits, for reception transfers"] - #[inline] - pub fn stat_rx(&self) -> STAT_RXR { - let bits = { - const MASK: u8 = 0x03; - const OFFSET: u8 = 12; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }; - STAT_RXR { bits } - } - #[doc = "Bit 14 - Data Toggle, for reception transfers"] - #[inline] - pub fn dtog_rx(&self) -> DTOG_RXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 14; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - DTOG_RXR { bits } - } - #[doc = "Bit 15 - Correct transfer for reception"] - #[inline] - pub fn ctr_rx(&self) -> CTR_RXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 15; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - CTR_RXR { bits } - } - } - impl W { - #[doc = r" Reset value of the register"] - #[inline] - pub fn reset_value() -> W { - W { bits: 0 } - } - #[doc = r" Writes raw bits to the register"] - #[inline] - pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { - self.bits = bits; - self - } - #[doc = "Bits 0:3 - Endpoint address"] - #[inline] - pub fn ea(&mut self) -> _EAW { - _EAW { w: self } - } - #[doc = "Bits 4:5 - Status bits, for transmission transfers"] - #[inline] - pub fn stat_tx(&mut self) -> _STAT_TXW { - _STAT_TXW { w: self } - } - #[doc = "Bit 6 - Data Toggle, for transmission transfers"] - #[inline] - pub fn dtog_tx(&mut self) -> _DTOG_TXW { - _DTOG_TXW { w: self } - } - #[doc = "Bit 7 - Correct Transfer for transmission"] - #[inline] - pub fn ctr_tx(&mut self) -> _CTR_TXW { - _CTR_TXW { w: self } - } - #[doc = "Bit 8 - Endpoint kind"] - #[inline] - pub fn ep_kind(&mut self) -> _EP_KINDW { - _EP_KINDW { w: self } - } - #[doc = "Bits 9:10 - Endpoint type"] - #[inline] - pub fn ep_type(&mut self) -> _EP_TYPEW { - _EP_TYPEW { w: self } - } - #[doc = "Bit 11 - Setup transaction completed"] - #[inline] - pub fn setup(&mut self) -> _SETUPW { - _SETUPW { w: self } - } - #[doc = "Bits 12:13 - Status bits, for reception transfers"] - #[inline] - pub fn stat_rx(&mut self) -> _STAT_RXW { - _STAT_RXW { w: self } - } - #[doc = "Bit 14 - Data Toggle, for reception transfers"] - #[inline] - pub fn dtog_rx(&mut self) -> _DTOG_RXW { - _DTOG_RXW { w: self } - } - #[doc = "Bit 15 - Correct transfer for reception"] - #[inline] - pub fn ctr_rx(&mut self) -> _CTR_RXW { - _CTR_RXW { w: self } - } - } - } - #[doc = "endpoint 2 register"] - pub struct EP2R { - register: VolatileCell, - } - #[doc = "endpoint 2 register"] - pub mod ep2r { - #[doc = r" Value read from the register"] - pub struct R { - bits: u32, - } - #[doc = r" Value to write to the register"] - pub struct W { - bits: u32, - } - impl super::EP2R { - #[doc = r" Modifies the contents of the register"] - #[inline] - pub fn modify(&self, f: F) - where - for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W, - { - let bits = self.register.get(); - let r = R { bits: bits }; - let mut w = W { bits: bits }; - f(&r, &mut w); - self.register.set(w.bits); - } - #[doc = r" Reads the contents of the register"] - #[inline] - pub fn read(&self) -> R { - R { - bits: self.register.get(), - } - } - #[doc = r" Writes to the register"] - #[inline] - pub fn write(&self, f: F) - where - F: FnOnce(&mut W) -> &mut W, - { - let mut w = W::reset_value(); - f(&mut w); - self.register.set(w.bits); - } - #[doc = r" Writes the reset value to the register"] - #[inline] - pub fn reset(&self) { - self.write(|w| w) - } - } - #[doc = r" Value of the field"] - pub struct EAR { - bits: u8, - } - impl EAR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - self.bits - } - } - #[doc = r" Value of the field"] - pub struct STAT_TXR { - bits: u8, - } - impl STAT_TXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - self.bits - } - } - #[doc = r" Value of the field"] - pub struct DTOG_TXR { - bits: bool, - } - impl DTOG_TXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct CTR_TXR { - bits: bool, - } - impl CTR_TXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct EP_KINDR { - bits: bool, - } - impl EP_KINDR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = "Possible values of the field `EP_TYPE`"] - #[derive(Clone, Copy, Debug, PartialEq)] - pub enum EP_TYPER { - #[doc = "This endpoint is a bulk endpoint"] BULK, - #[doc = "This endpoint is a control endpoint"] CONTROL, - #[doc = "This endpoint is an isochronous endpoint"] ISO, - #[doc = "This endpoint is an interrupt endpoint"] INTERRUPT, - } - impl EP_TYPER { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - match *self { - EP_TYPER::BULK => 0, - EP_TYPER::CONTROL => 0x01, - EP_TYPER::ISO => 0x02, - EP_TYPER::INTERRUPT => 0x03, - } - } - #[allow(missing_docs)] - #[doc(hidden)] - #[inline] - pub fn _from(value: u8) -> EP_TYPER { - match value { - 0 => EP_TYPER::BULK, - 1 => EP_TYPER::CONTROL, - 2 => EP_TYPER::ISO, - 3 => EP_TYPER::INTERRUPT, - _ => unreachable!(), - } - } - #[doc = "Checks if the value of the field is `BULK`"] - #[inline] - pub fn is_bulk(&self) -> bool { - *self == EP_TYPER::BULK - } - #[doc = "Checks if the value of the field is `CONTROL`"] - #[inline] - pub fn is_control(&self) -> bool { - *self == EP_TYPER::CONTROL - } - #[doc = "Checks if the value of the field is `ISO`"] - #[inline] - pub fn is_iso(&self) -> bool { - *self == EP_TYPER::ISO - } - #[doc = "Checks if the value of the field is `INTERRUPT`"] - #[inline] - pub fn is_interrupt(&self) -> bool { - *self == EP_TYPER::INTERRUPT - } - } - #[doc = r" Value of the field"] - pub struct SETUPR { - bits: bool, - } - impl SETUPR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct STAT_RXR { - bits: u8, - } - impl STAT_RXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - self.bits - } - } - #[doc = r" Value of the field"] - pub struct DTOG_RXR { - bits: bool, - } - impl DTOG_RXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct CTR_RXR { - bits: bool, - } - impl CTR_RXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Proxy"] - pub struct _EAW<'a> { - w: &'a mut W, - } - impl<'a> _EAW<'a> { - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x0f; - const OFFSET: u8 = 0; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _STAT_TXW<'a> { - w: &'a mut W, - } - impl<'a> _STAT_TXW<'a> { - #[doc = r" Writes raw bits to the field"] - #[inline] - pub unsafe fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x03; - const OFFSET: u8 = 4; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _DTOG_TXW<'a> { - w: &'a mut W, - } - impl<'a> _DTOG_TXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 6; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _CTR_TXW<'a> { - w: &'a mut W, - } - impl<'a> _CTR_TXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 7; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _EP_KINDW<'a> { - w: &'a mut W, - } - impl<'a> _EP_KINDW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 8; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = "Values that can be written to the field `EP_TYPE`"] - pub enum EP_TYPEW { - #[doc = "This endpoint is a bulk endpoint"] BULK, - #[doc = "This endpoint is a control endpoint"] CONTROL, - #[doc = "This endpoint is an isochronous endpoint"] ISO, - #[doc = "This endpoint is an interrupt endpoint"] INTERRUPT, - } - impl EP_TYPEW { - #[allow(missing_docs)] - #[doc(hidden)] - #[inline] - pub fn _bits(&self) -> u8 { - match *self { - EP_TYPEW::BULK => 0, - EP_TYPEW::CONTROL => 1, - EP_TYPEW::ISO => 2, - EP_TYPEW::INTERRUPT => 3, - } - } - } - #[doc = r" Proxy"] - pub struct _EP_TYPEW<'a> { - w: &'a mut W, - } - impl<'a> _EP_TYPEW<'a> { - #[doc = r" Writes `variant` to the field"] - #[inline] - pub fn variant(self, variant: EP_TYPEW) -> &'a mut W { - { - self.bits(variant._bits()) - } - } - #[doc = "This endpoint is a bulk endpoint"] - #[inline] - pub fn bulk(self) -> &'a mut W { - self.variant(EP_TYPEW::BULK) - } - #[doc = "This endpoint is a control endpoint"] - #[inline] - pub fn control(self) -> &'a mut W { - self.variant(EP_TYPEW::CONTROL) - } - #[doc = "This endpoint is an isochronous endpoint"] - #[inline] - pub fn iso(self) -> &'a mut W { - self.variant(EP_TYPEW::ISO) - } - #[doc = "This endpoint is an interrupt endpoint"] - #[inline] - pub fn interrupt(self) -> &'a mut W { - self.variant(EP_TYPEW::INTERRUPT) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x03; - const OFFSET: u8 = 9; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _SETUPW<'a> { - w: &'a mut W, - } - impl<'a> _SETUPW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 11; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _STAT_RXW<'a> { - w: &'a mut W, - } - impl<'a> _STAT_RXW<'a> { - #[doc = r" Writes raw bits to the field"] - #[inline] - pub unsafe fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x03; - const OFFSET: u8 = 12; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _DTOG_RXW<'a> { - w: &'a mut W, - } - impl<'a> _DTOG_RXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 14; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _CTR_RXW<'a> { - w: &'a mut W, - } - impl<'a> _CTR_RXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 15; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - impl R { - #[doc = r" Value of the register as raw bits"] - #[inline] - pub fn bits(&self) -> u32 { - self.bits - } - #[doc = "Bits 0:3 - Endpoint address"] - #[inline] - pub fn ea(&self) -> EAR { - let bits = { - const MASK: u8 = 0x0f; - const OFFSET: u8 = 0; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }; - EAR { bits } - } - #[doc = "Bits 4:5 - Status bits, for transmission transfers"] - #[inline] - pub fn stat_tx(&self) -> STAT_TXR { - let bits = { - const MASK: u8 = 0x03; - const OFFSET: u8 = 4; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }; - STAT_TXR { bits } - } - #[doc = "Bit 6 - Data Toggle, for transmission transfers"] - #[inline] - pub fn dtog_tx(&self) -> DTOG_TXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 6; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - DTOG_TXR { bits } - } - #[doc = "Bit 7 - Correct Transfer for transmission"] - #[inline] - pub fn ctr_tx(&self) -> CTR_TXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 7; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - CTR_TXR { bits } - } - #[doc = "Bit 8 - Endpoint kind"] - #[inline] - pub fn ep_kind(&self) -> EP_KINDR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 8; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - EP_KINDR { bits } - } - #[doc = "Bits 9:10 - Endpoint type"] - #[inline] - pub fn ep_type(&self) -> EP_TYPER { - EP_TYPER::_from({ - const MASK: u8 = 0x03; - const OFFSET: u8 = 9; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }) - } - #[doc = "Bit 11 - Setup transaction completed"] - #[inline] - pub fn setup(&self) -> SETUPR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 11; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - SETUPR { bits } - } - #[doc = "Bits 12:13 - Status bits, for reception transfers"] - #[inline] - pub fn stat_rx(&self) -> STAT_RXR { - let bits = { - const MASK: u8 = 0x03; - const OFFSET: u8 = 12; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }; - STAT_RXR { bits } - } - #[doc = "Bit 14 - Data Toggle, for reception transfers"] - #[inline] - pub fn dtog_rx(&self) -> DTOG_RXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 14; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - DTOG_RXR { bits } - } - #[doc = "Bit 15 - Correct transfer for reception"] - #[inline] - pub fn ctr_rx(&self) -> CTR_RXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 15; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - CTR_RXR { bits } - } - } - impl W { - #[doc = r" Reset value of the register"] - #[inline] - pub fn reset_value() -> W { - W { bits: 0 } - } - #[doc = r" Writes raw bits to the register"] - #[inline] - pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { - self.bits = bits; - self - } - #[doc = "Bits 0:3 - Endpoint address"] - #[inline] - pub fn ea(&mut self) -> _EAW { - _EAW { w: self } - } - #[doc = "Bits 4:5 - Status bits, for transmission transfers"] - #[inline] - pub fn stat_tx(&mut self) -> _STAT_TXW { - _STAT_TXW { w: self } - } - #[doc = "Bit 6 - Data Toggle, for transmission transfers"] - #[inline] - pub fn dtog_tx(&mut self) -> _DTOG_TXW { - _DTOG_TXW { w: self } - } - #[doc = "Bit 7 - Correct Transfer for transmission"] - #[inline] - pub fn ctr_tx(&mut self) -> _CTR_TXW { - _CTR_TXW { w: self } - } - #[doc = "Bit 8 - Endpoint kind"] - #[inline] - pub fn ep_kind(&mut self) -> _EP_KINDW { - _EP_KINDW { w: self } - } - #[doc = "Bits 9:10 - Endpoint type"] - #[inline] - pub fn ep_type(&mut self) -> _EP_TYPEW { - _EP_TYPEW { w: self } - } - #[doc = "Bit 11 - Setup transaction completed"] - #[inline] - pub fn setup(&mut self) -> _SETUPW { - _SETUPW { w: self } - } - #[doc = "Bits 12:13 - Status bits, for reception transfers"] - #[inline] - pub fn stat_rx(&mut self) -> _STAT_RXW { - _STAT_RXW { w: self } - } - #[doc = "Bit 14 - Data Toggle, for reception transfers"] - #[inline] - pub fn dtog_rx(&mut self) -> _DTOG_RXW { - _DTOG_RXW { w: self } - } - #[doc = "Bit 15 - Correct transfer for reception"] - #[inline] - pub fn ctr_rx(&mut self) -> _CTR_RXW { - _CTR_RXW { w: self } - } - } - } - #[doc = "endpoint 3 register"] - pub struct EP3R { - register: VolatileCell, - } - #[doc = "endpoint 3 register"] - pub mod ep3r { - #[doc = r" Value read from the register"] - pub struct R { - bits: u32, - } - #[doc = r" Value to write to the register"] - pub struct W { - bits: u32, - } - impl super::EP3R { - #[doc = r" Modifies the contents of the register"] - #[inline] - pub fn modify(&self, f: F) - where - for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W, - { - let bits = self.register.get(); - let r = R { bits: bits }; - let mut w = W { bits: bits }; - f(&r, &mut w); - self.register.set(w.bits); - } - #[doc = r" Reads the contents of the register"] - #[inline] - pub fn read(&self) -> R { - R { - bits: self.register.get(), - } - } - #[doc = r" Writes to the register"] - #[inline] - pub fn write(&self, f: F) - where - F: FnOnce(&mut W) -> &mut W, - { - let mut w = W::reset_value(); - f(&mut w); - self.register.set(w.bits); - } - #[doc = r" Writes the reset value to the register"] - #[inline] - pub fn reset(&self) { - self.write(|w| w) - } - } - #[doc = r" Value of the field"] - pub struct EAR { - bits: u8, - } - impl EAR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - self.bits - } - } - #[doc = r" Value of the field"] - pub struct STAT_TXR { - bits: u8, - } - impl STAT_TXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - self.bits - } - } - #[doc = r" Value of the field"] - pub struct DTOG_TXR { - bits: bool, - } - impl DTOG_TXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct CTR_TXR { - bits: bool, - } - impl CTR_TXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct EP_KINDR { - bits: bool, - } - impl EP_KINDR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = "Possible values of the field `EP_TYPE`"] - #[derive(Clone, Copy, Debug, PartialEq)] - pub enum EP_TYPER { - #[doc = "This endpoint is a bulk endpoint"] BULK, - #[doc = "This endpoint is a control endpoint"] CONTROL, - #[doc = "This endpoint is an isochronous endpoint"] ISO, - #[doc = "This endpoint is an interrupt endpoint"] INTERRUPT, - } - impl EP_TYPER { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - match *self { - EP_TYPER::BULK => 0, - EP_TYPER::CONTROL => 0x01, - EP_TYPER::ISO => 0x02, - EP_TYPER::INTERRUPT => 0x03, - } - } - #[allow(missing_docs)] - #[doc(hidden)] - #[inline] - pub fn _from(value: u8) -> EP_TYPER { - match value { - 0 => EP_TYPER::BULK, - 1 => EP_TYPER::CONTROL, - 2 => EP_TYPER::ISO, - 3 => EP_TYPER::INTERRUPT, - _ => unreachable!(), - } - } - #[doc = "Checks if the value of the field is `BULK`"] - #[inline] - pub fn is_bulk(&self) -> bool { - *self == EP_TYPER::BULK - } - #[doc = "Checks if the value of the field is `CONTROL`"] - #[inline] - pub fn is_control(&self) -> bool { - *self == EP_TYPER::CONTROL - } - #[doc = "Checks if the value of the field is `ISO`"] - #[inline] - pub fn is_iso(&self) -> bool { - *self == EP_TYPER::ISO - } - #[doc = "Checks if the value of the field is `INTERRUPT`"] - #[inline] - pub fn is_interrupt(&self) -> bool { - *self == EP_TYPER::INTERRUPT - } - } - #[doc = r" Value of the field"] - pub struct SETUPR { - bits: bool, - } - impl SETUPR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct STAT_RXR { - bits: u8, - } - impl STAT_RXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - self.bits - } - } - #[doc = r" Value of the field"] - pub struct DTOG_RXR { - bits: bool, - } - impl DTOG_RXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct CTR_RXR { - bits: bool, - } - impl CTR_RXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Proxy"] - pub struct _EAW<'a> { - w: &'a mut W, - } - impl<'a> _EAW<'a> { - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x0f; - const OFFSET: u8 = 0; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _STAT_TXW<'a> { - w: &'a mut W, - } - impl<'a> _STAT_TXW<'a> { - #[doc = r" Writes raw bits to the field"] - #[inline] - pub unsafe fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x03; - const OFFSET: u8 = 4; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _DTOG_TXW<'a> { - w: &'a mut W, - } - impl<'a> _DTOG_TXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 6; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _CTR_TXW<'a> { - w: &'a mut W, - } - impl<'a> _CTR_TXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 7; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _EP_KINDW<'a> { - w: &'a mut W, - } - impl<'a> _EP_KINDW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 8; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = "Values that can be written to the field `EP_TYPE`"] - pub enum EP_TYPEW { - #[doc = "This endpoint is a bulk endpoint"] BULK, - #[doc = "This endpoint is a control endpoint"] CONTROL, - #[doc = "This endpoint is an isochronous endpoint"] ISO, - #[doc = "This endpoint is an interrupt endpoint"] INTERRUPT, - } - impl EP_TYPEW { - #[allow(missing_docs)] - #[doc(hidden)] - #[inline] - pub fn _bits(&self) -> u8 { - match *self { - EP_TYPEW::BULK => 0, - EP_TYPEW::CONTROL => 1, - EP_TYPEW::ISO => 2, - EP_TYPEW::INTERRUPT => 3, - } - } - } - #[doc = r" Proxy"] - pub struct _EP_TYPEW<'a> { - w: &'a mut W, - } - impl<'a> _EP_TYPEW<'a> { - #[doc = r" Writes `variant` to the field"] - #[inline] - pub fn variant(self, variant: EP_TYPEW) -> &'a mut W { - { - self.bits(variant._bits()) - } - } - #[doc = "This endpoint is a bulk endpoint"] - #[inline] - pub fn bulk(self) -> &'a mut W { - self.variant(EP_TYPEW::BULK) - } - #[doc = "This endpoint is a control endpoint"] - #[inline] - pub fn control(self) -> &'a mut W { - self.variant(EP_TYPEW::CONTROL) - } - #[doc = "This endpoint is an isochronous endpoint"] - #[inline] - pub fn iso(self) -> &'a mut W { - self.variant(EP_TYPEW::ISO) - } - #[doc = "This endpoint is an interrupt endpoint"] - #[inline] - pub fn interrupt(self) -> &'a mut W { - self.variant(EP_TYPEW::INTERRUPT) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x03; - const OFFSET: u8 = 9; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _SETUPW<'a> { - w: &'a mut W, - } - impl<'a> _SETUPW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 11; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _STAT_RXW<'a> { - w: &'a mut W, - } - impl<'a> _STAT_RXW<'a> { - #[doc = r" Writes raw bits to the field"] - #[inline] - pub unsafe fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x03; - const OFFSET: u8 = 12; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _DTOG_RXW<'a> { - w: &'a mut W, - } - impl<'a> _DTOG_RXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 14; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _CTR_RXW<'a> { - w: &'a mut W, - } - impl<'a> _CTR_RXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 15; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - impl R { - #[doc = r" Value of the register as raw bits"] - #[inline] - pub fn bits(&self) -> u32 { - self.bits - } - #[doc = "Bits 0:3 - Endpoint address"] - #[inline] - pub fn ea(&self) -> EAR { - let bits = { - const MASK: u8 = 0x0f; - const OFFSET: u8 = 0; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }; - EAR { bits } - } - #[doc = "Bits 4:5 - Status bits, for transmission transfers"] - #[inline] - pub fn stat_tx(&self) -> STAT_TXR { - let bits = { - const MASK: u8 = 0x03; - const OFFSET: u8 = 4; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }; - STAT_TXR { bits } - } - #[doc = "Bit 6 - Data Toggle, for transmission transfers"] - #[inline] - pub fn dtog_tx(&self) -> DTOG_TXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 6; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - DTOG_TXR { bits } - } - #[doc = "Bit 7 - Correct Transfer for transmission"] - #[inline] - pub fn ctr_tx(&self) -> CTR_TXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 7; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - CTR_TXR { bits } - } - #[doc = "Bit 8 - Endpoint kind"] - #[inline] - pub fn ep_kind(&self) -> EP_KINDR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 8; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - EP_KINDR { bits } - } - #[doc = "Bits 9:10 - Endpoint type"] - #[inline] - pub fn ep_type(&self) -> EP_TYPER { - EP_TYPER::_from({ - const MASK: u8 = 0x03; - const OFFSET: u8 = 9; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }) - } - #[doc = "Bit 11 - Setup transaction completed"] - #[inline] - pub fn setup(&self) -> SETUPR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 11; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - SETUPR { bits } - } - #[doc = "Bits 12:13 - Status bits, for reception transfers"] - #[inline] - pub fn stat_rx(&self) -> STAT_RXR { - let bits = { - const MASK: u8 = 0x03; - const OFFSET: u8 = 12; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }; - STAT_RXR { bits } - } - #[doc = "Bit 14 - Data Toggle, for reception transfers"] - #[inline] - pub fn dtog_rx(&self) -> DTOG_RXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 14; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - DTOG_RXR { bits } - } - #[doc = "Bit 15 - Correct transfer for reception"] - #[inline] - pub fn ctr_rx(&self) -> CTR_RXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 15; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - CTR_RXR { bits } - } - } - impl W { - #[doc = r" Reset value of the register"] - #[inline] - pub fn reset_value() -> W { - W { bits: 0 } - } - #[doc = r" Writes raw bits to the register"] - #[inline] - pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { - self.bits = bits; - self - } - #[doc = "Bits 0:3 - Endpoint address"] - #[inline] - pub fn ea(&mut self) -> _EAW { - _EAW { w: self } - } - #[doc = "Bits 4:5 - Status bits, for transmission transfers"] - #[inline] - pub fn stat_tx(&mut self) -> _STAT_TXW { - _STAT_TXW { w: self } - } - #[doc = "Bit 6 - Data Toggle, for transmission transfers"] - #[inline] - pub fn dtog_tx(&mut self) -> _DTOG_TXW { - _DTOG_TXW { w: self } - } - #[doc = "Bit 7 - Correct Transfer for transmission"] - #[inline] - pub fn ctr_tx(&mut self) -> _CTR_TXW { - _CTR_TXW { w: self } - } - #[doc = "Bit 8 - Endpoint kind"] - #[inline] - pub fn ep_kind(&mut self) -> _EP_KINDW { - _EP_KINDW { w: self } - } - #[doc = "Bits 9:10 - Endpoint type"] - #[inline] - pub fn ep_type(&mut self) -> _EP_TYPEW { - _EP_TYPEW { w: self } - } - #[doc = "Bit 11 - Setup transaction completed"] - #[inline] - pub fn setup(&mut self) -> _SETUPW { - _SETUPW { w: self } - } - #[doc = "Bits 12:13 - Status bits, for reception transfers"] - #[inline] - pub fn stat_rx(&mut self) -> _STAT_RXW { - _STAT_RXW { w: self } - } - #[doc = "Bit 14 - Data Toggle, for reception transfers"] - #[inline] - pub fn dtog_rx(&mut self) -> _DTOG_RXW { - _DTOG_RXW { w: self } - } - #[doc = "Bit 15 - Correct transfer for reception"] - #[inline] - pub fn ctr_rx(&mut self) -> _CTR_RXW { - _CTR_RXW { w: self } - } - } - } - #[doc = "endpoint 4 register"] - pub struct EP4R { - register: VolatileCell, - } - #[doc = "endpoint 4 register"] - pub mod ep4r { - #[doc = r" Value read from the register"] - pub struct R { - bits: u32, - } - #[doc = r" Value to write to the register"] - pub struct W { - bits: u32, - } - impl super::EP4R { - #[doc = r" Modifies the contents of the register"] - #[inline] - pub fn modify(&self, f: F) - where - for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W, - { - let bits = self.register.get(); - let r = R { bits: bits }; - let mut w = W { bits: bits }; - f(&r, &mut w); - self.register.set(w.bits); - } - #[doc = r" Reads the contents of the register"] - #[inline] - pub fn read(&self) -> R { - R { - bits: self.register.get(), - } - } - #[doc = r" Writes to the register"] - #[inline] - pub fn write(&self, f: F) - where - F: FnOnce(&mut W) -> &mut W, - { - let mut w = W::reset_value(); - f(&mut w); - self.register.set(w.bits); - } - #[doc = r" Writes the reset value to the register"] - #[inline] - pub fn reset(&self) { - self.write(|w| w) - } - } - #[doc = r" Value of the field"] - pub struct EAR { - bits: u8, - } - impl EAR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - self.bits - } - } - #[doc = r" Value of the field"] - pub struct STAT_TXR { - bits: u8, - } - impl STAT_TXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - self.bits - } - } - #[doc = r" Value of the field"] - pub struct DTOG_TXR { - bits: bool, - } - impl DTOG_TXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct CTR_TXR { - bits: bool, - } - impl CTR_TXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct EP_KINDR { - bits: bool, - } - impl EP_KINDR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = "Possible values of the field `EP_TYPE`"] - #[derive(Clone, Copy, Debug, PartialEq)] - pub enum EP_TYPER { - #[doc = "This endpoint is a bulk endpoint"] BULK, - #[doc = "This endpoint is a control endpoint"] CONTROL, - #[doc = "This endpoint is an isochronous endpoint"] ISO, - #[doc = "This endpoint is an interrupt endpoint"] INTERRUPT, - } - impl EP_TYPER { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - match *self { - EP_TYPER::BULK => 0, - EP_TYPER::CONTROL => 0x01, - EP_TYPER::ISO => 0x02, - EP_TYPER::INTERRUPT => 0x03, - } - } - #[allow(missing_docs)] - #[doc(hidden)] - #[inline] - pub fn _from(value: u8) -> EP_TYPER { - match value { - 0 => EP_TYPER::BULK, - 1 => EP_TYPER::CONTROL, - 2 => EP_TYPER::ISO, - 3 => EP_TYPER::INTERRUPT, - _ => unreachable!(), - } - } - #[doc = "Checks if the value of the field is `BULK`"] - #[inline] - pub fn is_bulk(&self) -> bool { - *self == EP_TYPER::BULK - } - #[doc = "Checks if the value of the field is `CONTROL`"] - #[inline] - pub fn is_control(&self) -> bool { - *self == EP_TYPER::CONTROL - } - #[doc = "Checks if the value of the field is `ISO`"] - #[inline] - pub fn is_iso(&self) -> bool { - *self == EP_TYPER::ISO - } - #[doc = "Checks if the value of the field is `INTERRUPT`"] - #[inline] - pub fn is_interrupt(&self) -> bool { - *self == EP_TYPER::INTERRUPT - } - } - #[doc = r" Value of the field"] - pub struct SETUPR { - bits: bool, - } - impl SETUPR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct STAT_RXR { - bits: u8, - } - impl STAT_RXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - self.bits - } - } - #[doc = r" Value of the field"] - pub struct DTOG_RXR { - bits: bool, - } - impl DTOG_RXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct CTR_RXR { - bits: bool, - } - impl CTR_RXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Proxy"] - pub struct _EAW<'a> { - w: &'a mut W, - } - impl<'a> _EAW<'a> { - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x0f; - const OFFSET: u8 = 0; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _STAT_TXW<'a> { - w: &'a mut W, - } - impl<'a> _STAT_TXW<'a> { - #[doc = r" Writes raw bits to the field"] - #[inline] - pub unsafe fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x03; - const OFFSET: u8 = 4; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _DTOG_TXW<'a> { - w: &'a mut W, - } - impl<'a> _DTOG_TXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 6; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _CTR_TXW<'a> { - w: &'a mut W, - } - impl<'a> _CTR_TXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 7; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _EP_KINDW<'a> { - w: &'a mut W, - } - impl<'a> _EP_KINDW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 8; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = "Values that can be written to the field `EP_TYPE`"] - pub enum EP_TYPEW { - #[doc = "This endpoint is a bulk endpoint"] BULK, - #[doc = "This endpoint is a control endpoint"] CONTROL, - #[doc = "This endpoint is an isochronous endpoint"] ISO, - #[doc = "This endpoint is an interrupt endpoint"] INTERRUPT, - } - impl EP_TYPEW { - #[allow(missing_docs)] - #[doc(hidden)] - #[inline] - pub fn _bits(&self) -> u8 { - match *self { - EP_TYPEW::BULK => 0, - EP_TYPEW::CONTROL => 1, - EP_TYPEW::ISO => 2, - EP_TYPEW::INTERRUPT => 3, - } - } - } - #[doc = r" Proxy"] - pub struct _EP_TYPEW<'a> { - w: &'a mut W, - } - impl<'a> _EP_TYPEW<'a> { - #[doc = r" Writes `variant` to the field"] - #[inline] - pub fn variant(self, variant: EP_TYPEW) -> &'a mut W { - { - self.bits(variant._bits()) - } - } - #[doc = "This endpoint is a bulk endpoint"] - #[inline] - pub fn bulk(self) -> &'a mut W { - self.variant(EP_TYPEW::BULK) - } - #[doc = "This endpoint is a control endpoint"] - #[inline] - pub fn control(self) -> &'a mut W { - self.variant(EP_TYPEW::CONTROL) - } - #[doc = "This endpoint is an isochronous endpoint"] - #[inline] - pub fn iso(self) -> &'a mut W { - self.variant(EP_TYPEW::ISO) - } - #[doc = "This endpoint is an interrupt endpoint"] - #[inline] - pub fn interrupt(self) -> &'a mut W { - self.variant(EP_TYPEW::INTERRUPT) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x03; - const OFFSET: u8 = 9; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _SETUPW<'a> { - w: &'a mut W, - } - impl<'a> _SETUPW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 11; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _STAT_RXW<'a> { - w: &'a mut W, - } - impl<'a> _STAT_RXW<'a> { - #[doc = r" Writes raw bits to the field"] - #[inline] - pub unsafe fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x03; - const OFFSET: u8 = 12; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _DTOG_RXW<'a> { - w: &'a mut W, - } - impl<'a> _DTOG_RXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 14; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _CTR_RXW<'a> { - w: &'a mut W, - } - impl<'a> _CTR_RXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 15; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - impl R { - #[doc = r" Value of the register as raw bits"] - #[inline] - pub fn bits(&self) -> u32 { - self.bits - } - #[doc = "Bits 0:3 - Endpoint address"] - #[inline] - pub fn ea(&self) -> EAR { - let bits = { - const MASK: u8 = 0x0f; - const OFFSET: u8 = 0; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }; - EAR { bits } - } - #[doc = "Bits 4:5 - Status bits, for transmission transfers"] - #[inline] - pub fn stat_tx(&self) -> STAT_TXR { - let bits = { - const MASK: u8 = 0x03; - const OFFSET: u8 = 4; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }; - STAT_TXR { bits } - } - #[doc = "Bit 6 - Data Toggle, for transmission transfers"] - #[inline] - pub fn dtog_tx(&self) -> DTOG_TXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 6; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - DTOG_TXR { bits } - } - #[doc = "Bit 7 - Correct Transfer for transmission"] - #[inline] - pub fn ctr_tx(&self) -> CTR_TXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 7; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - CTR_TXR { bits } - } - #[doc = "Bit 8 - Endpoint kind"] - #[inline] - pub fn ep_kind(&self) -> EP_KINDR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 8; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - EP_KINDR { bits } - } - #[doc = "Bits 9:10 - Endpoint type"] - #[inline] - pub fn ep_type(&self) -> EP_TYPER { - EP_TYPER::_from({ - const MASK: u8 = 0x03; - const OFFSET: u8 = 9; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }) - } - #[doc = "Bit 11 - Setup transaction completed"] - #[inline] - pub fn setup(&self) -> SETUPR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 11; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - SETUPR { bits } - } - #[doc = "Bits 12:13 - Status bits, for reception transfers"] - #[inline] - pub fn stat_rx(&self) -> STAT_RXR { - let bits = { - const MASK: u8 = 0x03; - const OFFSET: u8 = 12; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }; - STAT_RXR { bits } - } - #[doc = "Bit 14 - Data Toggle, for reception transfers"] - #[inline] - pub fn dtog_rx(&self) -> DTOG_RXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 14; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - DTOG_RXR { bits } - } - #[doc = "Bit 15 - Correct transfer for reception"] - #[inline] - pub fn ctr_rx(&self) -> CTR_RXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 15; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - CTR_RXR { bits } - } - } - impl W { - #[doc = r" Reset value of the register"] - #[inline] - pub fn reset_value() -> W { - W { bits: 0 } - } - #[doc = r" Writes raw bits to the register"] - #[inline] - pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { - self.bits = bits; - self - } - #[doc = "Bits 0:3 - Endpoint address"] - #[inline] - pub fn ea(&mut self) -> _EAW { - _EAW { w: self } - } - #[doc = "Bits 4:5 - Status bits, for transmission transfers"] - #[inline] - pub fn stat_tx(&mut self) -> _STAT_TXW { - _STAT_TXW { w: self } - } - #[doc = "Bit 6 - Data Toggle, for transmission transfers"] - #[inline] - pub fn dtog_tx(&mut self) -> _DTOG_TXW { - _DTOG_TXW { w: self } - } - #[doc = "Bit 7 - Correct Transfer for transmission"] - #[inline] - pub fn ctr_tx(&mut self) -> _CTR_TXW { - _CTR_TXW { w: self } - } - #[doc = "Bit 8 - Endpoint kind"] - #[inline] - pub fn ep_kind(&mut self) -> _EP_KINDW { - _EP_KINDW { w: self } - } - #[doc = "Bits 9:10 - Endpoint type"] - #[inline] - pub fn ep_type(&mut self) -> _EP_TYPEW { - _EP_TYPEW { w: self } - } - #[doc = "Bit 11 - Setup transaction completed"] - #[inline] - pub fn setup(&mut self) -> _SETUPW { - _SETUPW { w: self } - } - #[doc = "Bits 12:13 - Status bits, for reception transfers"] - #[inline] - pub fn stat_rx(&mut self) -> _STAT_RXW { - _STAT_RXW { w: self } - } - #[doc = "Bit 14 - Data Toggle, for reception transfers"] - #[inline] - pub fn dtog_rx(&mut self) -> _DTOG_RXW { - _DTOG_RXW { w: self } - } - #[doc = "Bit 15 - Correct transfer for reception"] - #[inline] - pub fn ctr_rx(&mut self) -> _CTR_RXW { - _CTR_RXW { w: self } - } - } - } - #[doc = "endpoint 5 register"] - pub struct EP5R { - register: VolatileCell, - } - #[doc = "endpoint 5 register"] - pub mod ep5r { - #[doc = r" Value read from the register"] - pub struct R { - bits: u32, - } - #[doc = r" Value to write to the register"] - pub struct W { - bits: u32, - } - impl super::EP5R { - #[doc = r" Modifies the contents of the register"] - #[inline] - pub fn modify(&self, f: F) - where - for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W, - { - let bits = self.register.get(); - let r = R { bits: bits }; - let mut w = W { bits: bits }; - f(&r, &mut w); - self.register.set(w.bits); - } - #[doc = r" Reads the contents of the register"] - #[inline] - pub fn read(&self) -> R { - R { - bits: self.register.get(), - } - } - #[doc = r" Writes to the register"] - #[inline] - pub fn write(&self, f: F) - where - F: FnOnce(&mut W) -> &mut W, - { - let mut w = W::reset_value(); - f(&mut w); - self.register.set(w.bits); - } - #[doc = r" Writes the reset value to the register"] - #[inline] - pub fn reset(&self) { - self.write(|w| w) - } - } - #[doc = r" Value of the field"] - pub struct EAR { - bits: u8, - } - impl EAR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - self.bits - } - } - #[doc = r" Value of the field"] - pub struct STAT_TXR { - bits: u8, - } - impl STAT_TXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - self.bits - } - } - #[doc = r" Value of the field"] - pub struct DTOG_TXR { - bits: bool, - } - impl DTOG_TXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct CTR_TXR { - bits: bool, - } - impl CTR_TXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct EP_KINDR { - bits: bool, - } - impl EP_KINDR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = "Possible values of the field `EP_TYPE`"] - #[derive(Clone, Copy, Debug, PartialEq)] - pub enum EP_TYPER { - #[doc = "This endpoint is a bulk endpoint"] BULK, - #[doc = "This endpoint is a control endpoint"] CONTROL, - #[doc = "This endpoint is an isochronous endpoint"] ISO, - #[doc = "This endpoint is an interrupt endpoint"] INTERRUPT, - } - impl EP_TYPER { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - match *self { - EP_TYPER::BULK => 0, - EP_TYPER::CONTROL => 0x01, - EP_TYPER::ISO => 0x02, - EP_TYPER::INTERRUPT => 0x03, - } - } - #[allow(missing_docs)] - #[doc(hidden)] - #[inline] - pub fn _from(value: u8) -> EP_TYPER { - match value { - 0 => EP_TYPER::BULK, - 1 => EP_TYPER::CONTROL, - 2 => EP_TYPER::ISO, - 3 => EP_TYPER::INTERRUPT, - _ => unreachable!(), - } - } - #[doc = "Checks if the value of the field is `BULK`"] - #[inline] - pub fn is_bulk(&self) -> bool { - *self == EP_TYPER::BULK - } - #[doc = "Checks if the value of the field is `CONTROL`"] - #[inline] - pub fn is_control(&self) -> bool { - *self == EP_TYPER::CONTROL - } - #[doc = "Checks if the value of the field is `ISO`"] - #[inline] - pub fn is_iso(&self) -> bool { - *self == EP_TYPER::ISO - } - #[doc = "Checks if the value of the field is `INTERRUPT`"] - #[inline] - pub fn is_interrupt(&self) -> bool { - *self == EP_TYPER::INTERRUPT - } - } - #[doc = r" Value of the field"] - pub struct SETUPR { - bits: bool, - } - impl SETUPR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct STAT_RXR { - bits: u8, - } - impl STAT_RXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - self.bits - } - } - #[doc = r" Value of the field"] - pub struct DTOG_RXR { - bits: bool, - } - impl DTOG_RXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct CTR_RXR { - bits: bool, - } - impl CTR_RXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Proxy"] - pub struct _EAW<'a> { - w: &'a mut W, - } - impl<'a> _EAW<'a> { - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x0f; - const OFFSET: u8 = 0; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _STAT_TXW<'a> { - w: &'a mut W, - } - impl<'a> _STAT_TXW<'a> { - #[doc = r" Writes raw bits to the field"] - #[inline] - pub unsafe fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x03; - const OFFSET: u8 = 4; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _DTOG_TXW<'a> { - w: &'a mut W, - } - impl<'a> _DTOG_TXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 6; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _CTR_TXW<'a> { - w: &'a mut W, - } - impl<'a> _CTR_TXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 7; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _EP_KINDW<'a> { - w: &'a mut W, - } - impl<'a> _EP_KINDW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 8; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = "Values that can be written to the field `EP_TYPE`"] - pub enum EP_TYPEW { - #[doc = "This endpoint is a bulk endpoint"] BULK, - #[doc = "This endpoint is a control endpoint"] CONTROL, - #[doc = "This endpoint is an isochronous endpoint"] ISO, - #[doc = "This endpoint is an interrupt endpoint"] INTERRUPT, - } - impl EP_TYPEW { - #[allow(missing_docs)] - #[doc(hidden)] - #[inline] - pub fn _bits(&self) -> u8 { - match *self { - EP_TYPEW::BULK => 0, - EP_TYPEW::CONTROL => 1, - EP_TYPEW::ISO => 2, - EP_TYPEW::INTERRUPT => 3, - } - } - } - #[doc = r" Proxy"] - pub struct _EP_TYPEW<'a> { - w: &'a mut W, - } - impl<'a> _EP_TYPEW<'a> { - #[doc = r" Writes `variant` to the field"] - #[inline] - pub fn variant(self, variant: EP_TYPEW) -> &'a mut W { - { - self.bits(variant._bits()) - } - } - #[doc = "This endpoint is a bulk endpoint"] - #[inline] - pub fn bulk(self) -> &'a mut W { - self.variant(EP_TYPEW::BULK) - } - #[doc = "This endpoint is a control endpoint"] - #[inline] - pub fn control(self) -> &'a mut W { - self.variant(EP_TYPEW::CONTROL) - } - #[doc = "This endpoint is an isochronous endpoint"] - #[inline] - pub fn iso(self) -> &'a mut W { - self.variant(EP_TYPEW::ISO) - } - #[doc = "This endpoint is an interrupt endpoint"] - #[inline] - pub fn interrupt(self) -> &'a mut W { - self.variant(EP_TYPEW::INTERRUPT) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x03; - const OFFSET: u8 = 9; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _SETUPW<'a> { - w: &'a mut W, - } - impl<'a> _SETUPW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 11; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _STAT_RXW<'a> { - w: &'a mut W, - } - impl<'a> _STAT_RXW<'a> { - #[doc = r" Writes raw bits to the field"] - #[inline] - pub unsafe fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x03; - const OFFSET: u8 = 12; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _DTOG_RXW<'a> { - w: &'a mut W, - } - impl<'a> _DTOG_RXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 14; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _CTR_RXW<'a> { - w: &'a mut W, - } - impl<'a> _CTR_RXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 15; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - impl R { - #[doc = r" Value of the register as raw bits"] - #[inline] - pub fn bits(&self) -> u32 { - self.bits - } - #[doc = "Bits 0:3 - Endpoint address"] - #[inline] - pub fn ea(&self) -> EAR { - let bits = { - const MASK: u8 = 0x0f; - const OFFSET: u8 = 0; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }; - EAR { bits } - } - #[doc = "Bits 4:5 - Status bits, for transmission transfers"] - #[inline] - pub fn stat_tx(&self) -> STAT_TXR { - let bits = { - const MASK: u8 = 0x03; - const OFFSET: u8 = 4; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }; - STAT_TXR { bits } - } - #[doc = "Bit 6 - Data Toggle, for transmission transfers"] - #[inline] - pub fn dtog_tx(&self) -> DTOG_TXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 6; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - DTOG_TXR { bits } - } - #[doc = "Bit 7 - Correct Transfer for transmission"] - #[inline] - pub fn ctr_tx(&self) -> CTR_TXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 7; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - CTR_TXR { bits } - } - #[doc = "Bit 8 - Endpoint kind"] - #[inline] - pub fn ep_kind(&self) -> EP_KINDR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 8; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - EP_KINDR { bits } - } - #[doc = "Bits 9:10 - Endpoint type"] - #[inline] - pub fn ep_type(&self) -> EP_TYPER { - EP_TYPER::_from({ - const MASK: u8 = 0x03; - const OFFSET: u8 = 9; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }) - } - #[doc = "Bit 11 - Setup transaction completed"] - #[inline] - pub fn setup(&self) -> SETUPR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 11; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - SETUPR { bits } - } - #[doc = "Bits 12:13 - Status bits, for reception transfers"] - #[inline] - pub fn stat_rx(&self) -> STAT_RXR { - let bits = { - const MASK: u8 = 0x03; - const OFFSET: u8 = 12; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }; - STAT_RXR { bits } - } - #[doc = "Bit 14 - Data Toggle, for reception transfers"] - #[inline] - pub fn dtog_rx(&self) -> DTOG_RXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 14; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - DTOG_RXR { bits } - } - #[doc = "Bit 15 - Correct transfer for reception"] - #[inline] - pub fn ctr_rx(&self) -> CTR_RXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 15; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - CTR_RXR { bits } - } - } - impl W { - #[doc = r" Reset value of the register"] - #[inline] - pub fn reset_value() -> W { - W { bits: 0 } - } - #[doc = r" Writes raw bits to the register"] - #[inline] - pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { - self.bits = bits; - self - } - #[doc = "Bits 0:3 - Endpoint address"] - #[inline] - pub fn ea(&mut self) -> _EAW { - _EAW { w: self } - } - #[doc = "Bits 4:5 - Status bits, for transmission transfers"] - #[inline] - pub fn stat_tx(&mut self) -> _STAT_TXW { - _STAT_TXW { w: self } - } - #[doc = "Bit 6 - Data Toggle, for transmission transfers"] - #[inline] - pub fn dtog_tx(&mut self) -> _DTOG_TXW { - _DTOG_TXW { w: self } - } - #[doc = "Bit 7 - Correct Transfer for transmission"] - #[inline] - pub fn ctr_tx(&mut self) -> _CTR_TXW { - _CTR_TXW { w: self } - } - #[doc = "Bit 8 - Endpoint kind"] - #[inline] - pub fn ep_kind(&mut self) -> _EP_KINDW { - _EP_KINDW { w: self } - } - #[doc = "Bits 9:10 - Endpoint type"] - #[inline] - pub fn ep_type(&mut self) -> _EP_TYPEW { - _EP_TYPEW { w: self } - } - #[doc = "Bit 11 - Setup transaction completed"] - #[inline] - pub fn setup(&mut self) -> _SETUPW { - _SETUPW { w: self } - } - #[doc = "Bits 12:13 - Status bits, for reception transfers"] - #[inline] - pub fn stat_rx(&mut self) -> _STAT_RXW { - _STAT_RXW { w: self } - } - #[doc = "Bit 14 - Data Toggle, for reception transfers"] - #[inline] - pub fn dtog_rx(&mut self) -> _DTOG_RXW { - _DTOG_RXW { w: self } - } - #[doc = "Bit 15 - Correct transfer for reception"] - #[inline] - pub fn ctr_rx(&mut self) -> _CTR_RXW { - _CTR_RXW { w: self } - } - } - } - #[doc = "endpoint 6 register"] - pub struct EP6R { - register: VolatileCell, - } - #[doc = "endpoint 6 register"] - pub mod ep6r { - #[doc = r" Value read from the register"] - pub struct R { - bits: u32, - } - #[doc = r" Value to write to the register"] - pub struct W { - bits: u32, - } - impl super::EP6R { - #[doc = r" Modifies the contents of the register"] - #[inline] - pub fn modify(&self, f: F) - where - for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W, - { - let bits = self.register.get(); - let r = R { bits: bits }; - let mut w = W { bits: bits }; - f(&r, &mut w); - self.register.set(w.bits); - } - #[doc = r" Reads the contents of the register"] - #[inline] - pub fn read(&self) -> R { - R { - bits: self.register.get(), - } - } - #[doc = r" Writes to the register"] - #[inline] - pub fn write(&self, f: F) - where - F: FnOnce(&mut W) -> &mut W, - { - let mut w = W::reset_value(); - f(&mut w); - self.register.set(w.bits); - } - #[doc = r" Writes the reset value to the register"] - #[inline] - pub fn reset(&self) { - self.write(|w| w) - } - } - #[doc = r" Value of the field"] - pub struct EAR { - bits: u8, - } - impl EAR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - self.bits - } - } - #[doc = r" Value of the field"] - pub struct STAT_TXR { - bits: u8, - } - impl STAT_TXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - self.bits - } - } - #[doc = r" Value of the field"] - pub struct DTOG_TXR { - bits: bool, - } - impl DTOG_TXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct CTR_TXR { - bits: bool, - } - impl CTR_TXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct EP_KINDR { - bits: bool, - } - impl EP_KINDR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = "Possible values of the field `EP_TYPE`"] - #[derive(Clone, Copy, Debug, PartialEq)] - pub enum EP_TYPER { - #[doc = "This endpoint is a bulk endpoint"] BULK, - #[doc = "This endpoint is a control endpoint"] CONTROL, - #[doc = "This endpoint is an isochronous endpoint"] ISO, - #[doc = "This endpoint is an interrupt endpoint"] INTERRUPT, - } - impl EP_TYPER { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - match *self { - EP_TYPER::BULK => 0, - EP_TYPER::CONTROL => 0x01, - EP_TYPER::ISO => 0x02, - EP_TYPER::INTERRUPT => 0x03, - } - } - #[allow(missing_docs)] - #[doc(hidden)] - #[inline] - pub fn _from(value: u8) -> EP_TYPER { - match value { - 0 => EP_TYPER::BULK, - 1 => EP_TYPER::CONTROL, - 2 => EP_TYPER::ISO, - 3 => EP_TYPER::INTERRUPT, - _ => unreachable!(), - } - } - #[doc = "Checks if the value of the field is `BULK`"] - #[inline] - pub fn is_bulk(&self) -> bool { - *self == EP_TYPER::BULK - } - #[doc = "Checks if the value of the field is `CONTROL`"] - #[inline] - pub fn is_control(&self) -> bool { - *self == EP_TYPER::CONTROL - } - #[doc = "Checks if the value of the field is `ISO`"] - #[inline] - pub fn is_iso(&self) -> bool { - *self == EP_TYPER::ISO - } - #[doc = "Checks if the value of the field is `INTERRUPT`"] - #[inline] - pub fn is_interrupt(&self) -> bool { - *self == EP_TYPER::INTERRUPT - } - } - #[doc = r" Value of the field"] - pub struct SETUPR { - bits: bool, - } - impl SETUPR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct STAT_RXR { - bits: u8, - } - impl STAT_RXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bits(&self) -> u8 { - self.bits - } - } - #[doc = r" Value of the field"] - pub struct DTOG_RXR { - bits: bool, - } - impl DTOG_RXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Value of the field"] - pub struct CTR_RXR { - bits: bool, - } - impl CTR_RXR { - #[doc = r" Value of the field as raw bits"] - #[inline] - pub fn bit(&self) -> bool { - self.bits - } - #[doc = r" Returns `true` if the bit is clear (0)"] - #[inline] - pub fn bit_is_clear(&self) -> bool { - !self.bit() - } - #[doc = r" Returns `true` if the bit is set (1)"] - #[inline] - pub fn bit_is_set(&self) -> bool { - self.bit() - } - } - #[doc = r" Proxy"] - pub struct _EAW<'a> { - w: &'a mut W, - } - impl<'a> _EAW<'a> { - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x0f; - const OFFSET: u8 = 0; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _STAT_TXW<'a> { - w: &'a mut W, - } - impl<'a> _STAT_TXW<'a> { - #[doc = r" Writes raw bits to the field"] - #[inline] - pub unsafe fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x03; - const OFFSET: u8 = 4; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _DTOG_TXW<'a> { - w: &'a mut W, - } - impl<'a> _DTOG_TXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 6; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _CTR_TXW<'a> { - w: &'a mut W, - } - impl<'a> _CTR_TXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 7; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _EP_KINDW<'a> { - w: &'a mut W, - } - impl<'a> _EP_KINDW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 8; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = "Values that can be written to the field `EP_TYPE`"] - pub enum EP_TYPEW { - #[doc = "This endpoint is a bulk endpoint"] BULK, - #[doc = "This endpoint is a control endpoint"] CONTROL, - #[doc = "This endpoint is an isochronous endpoint"] ISO, - #[doc = "This endpoint is an interrupt endpoint"] INTERRUPT, - } - impl EP_TYPEW { - #[allow(missing_docs)] - #[doc(hidden)] - #[inline] - pub fn _bits(&self) -> u8 { - match *self { - EP_TYPEW::BULK => 0, - EP_TYPEW::CONTROL => 1, - EP_TYPEW::ISO => 2, - EP_TYPEW::INTERRUPT => 3, - } - } - } - #[doc = r" Proxy"] - pub struct _EP_TYPEW<'a> { - w: &'a mut W, - } - impl<'a> _EP_TYPEW<'a> { - #[doc = r" Writes `variant` to the field"] - #[inline] - pub fn variant(self, variant: EP_TYPEW) -> &'a mut W { - { - self.bits(variant._bits()) - } - } - #[doc = "This endpoint is a bulk endpoint"] - #[inline] - pub fn bulk(self) -> &'a mut W { - self.variant(EP_TYPEW::BULK) - } - #[doc = "This endpoint is a control endpoint"] - #[inline] - pub fn control(self) -> &'a mut W { - self.variant(EP_TYPEW::CONTROL) - } - #[doc = "This endpoint is an isochronous endpoint"] - #[inline] - pub fn iso(self) -> &'a mut W { - self.variant(EP_TYPEW::ISO) - } - #[doc = "This endpoint is an interrupt endpoint"] - #[inline] - pub fn interrupt(self) -> &'a mut W { - self.variant(EP_TYPEW::INTERRUPT) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x03; - const OFFSET: u8 = 9; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _SETUPW<'a> { - w: &'a mut W, - } - impl<'a> _SETUPW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 11; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _STAT_RXW<'a> { - w: &'a mut W, - } - impl<'a> _STAT_RXW<'a> { - #[doc = r" Writes raw bits to the field"] - #[inline] - pub unsafe fn bits(self, value: u8) -> &'a mut W { - const MASK: u8 = 0x03; - const OFFSET: u8 = 12; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _DTOG_RXW<'a> { - w: &'a mut W, - } - impl<'a> _DTOG_RXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 14; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - #[doc = r" Proxy"] - pub struct _CTR_RXW<'a> { - w: &'a mut W, - } - impl<'a> _CTR_RXW<'a> { - #[doc = r" Sets the field bit"] - pub fn set_bit(self) -> &'a mut W { - self.bit(true) - } - #[doc = r" Clears the field bit"] - pub fn clear_bit(self) -> &'a mut W { - self.bit(false) - } - #[doc = r" Writes raw bits to the field"] - #[inline] - pub fn bit(self, value: bool) -> &'a mut W { - const MASK: bool = true; - const OFFSET: u8 = 15; - self.w.bits &= !((MASK as u32) << OFFSET); - self.w.bits |= ((value & MASK) as u32) << OFFSET; - self.w - } - } - impl R { - #[doc = r" Value of the register as raw bits"] - #[inline] - pub fn bits(&self) -> u32 { - self.bits - } - #[doc = "Bits 0:3 - Endpoint address"] - #[inline] - pub fn ea(&self) -> EAR { - let bits = { - const MASK: u8 = 0x0f; - const OFFSET: u8 = 0; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }; - EAR { bits } - } - #[doc = "Bits 4:5 - Status bits, for transmission transfers"] - #[inline] - pub fn stat_tx(&self) -> STAT_TXR { - let bits = { - const MASK: u8 = 0x03; - const OFFSET: u8 = 4; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }; - STAT_TXR { bits } - } - #[doc = "Bit 6 - Data Toggle, for transmission transfers"] - #[inline] - pub fn dtog_tx(&self) -> DTOG_TXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 6; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - DTOG_TXR { bits } - } - #[doc = "Bit 7 - Correct Transfer for transmission"] - #[inline] - pub fn ctr_tx(&self) -> CTR_TXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 7; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - CTR_TXR { bits } - } - #[doc = "Bit 8 - Endpoint kind"] - #[inline] - pub fn ep_kind(&self) -> EP_KINDR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 8; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - EP_KINDR { bits } - } - #[doc = "Bits 9:10 - Endpoint type"] - #[inline] - pub fn ep_type(&self) -> EP_TYPER { - EP_TYPER::_from({ - const MASK: u8 = 0x03; - const OFFSET: u8 = 9; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }) - } - #[doc = "Bit 11 - Setup transaction completed"] - #[inline] - pub fn setup(&self) -> SETUPR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 11; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - SETUPR { bits } - } - #[doc = "Bits 12:13 - Status bits, for reception transfers"] - #[inline] - pub fn stat_rx(&self) -> STAT_RXR { - let bits = { - const MASK: u8 = 0x03; - const OFFSET: u8 = 12; - ((self.bits >> OFFSET) & MASK as u32) as u8 - }; - STAT_RXR { bits } - } - #[doc = "Bit 14 - Data Toggle, for reception transfers"] - #[inline] - pub fn dtog_rx(&self) -> DTOG_RXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 14; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - DTOG_RXR { bits } - } - #[doc = "Bit 15 - Correct transfer for reception"] - #[inline] - pub fn ctr_rx(&self) -> CTR_RXR { - let bits = { - const MASK: bool = true; - const OFFSET: u8 = 15; - ((self.bits >> OFFSET) & MASK as u32) != 0 - }; - CTR_RXR { bits } - } - } - impl W { - #[doc = r" Reset value of the register"] - #[inline] - pub fn reset_value() -> W { - W { bits: 0 } - } - #[doc = r" Writes raw bits to the register"] - #[inline] - pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { - self.bits = bits; - self - } - #[doc = "Bits 0:3 - Endpoint address"] - #[inline] - pub fn ea(&mut self) -> _EAW { - _EAW { w: self } - } - #[doc = "Bits 4:5 - Status bits, for transmission transfers"] - #[inline] - pub fn stat_tx(&mut self) -> _STAT_TXW { - _STAT_TXW { w: self } - } - #[doc = "Bit 6 - Data Toggle, for transmission transfers"] - #[inline] - pub fn dtog_tx(&mut self) -> _DTOG_TXW { - _DTOG_TXW { w: self } - } - #[doc = "Bit 7 - Correct Transfer for transmission"] - #[inline] - pub fn ctr_tx(&mut self) -> _CTR_TXW { - _CTR_TXW { w: self } - } - #[doc = "Bit 8 - Endpoint kind"] - #[inline] - pub fn ep_kind(&mut self) -> _EP_KINDW { - _EP_KINDW { w: self } - } - #[doc = "Bits 9:10 - Endpoint type"] - #[inline] - pub fn ep_type(&mut self) -> _EP_TYPEW { - _EP_TYPEW { w: self } - } - #[doc = "Bit 11 - Setup transaction completed"] - #[inline] - pub fn setup(&mut self) -> _SETUPW { - _SETUPW { w: self } - } - #[doc = "Bits 12:13 - Status bits, for reception transfers"] - #[inline] - pub fn stat_rx(&mut self) -> _STAT_RXW { - _STAT_RXW { w: self } - } - #[doc = "Bit 14 - Data Toggle, for reception transfers"] - #[inline] - pub fn dtog_rx(&mut self) -> _DTOG_RXW { - _DTOG_RXW { w: self } - } - #[doc = "Bit 15 - Correct transfer for reception"] - #[inline] - pub fn ctr_rx(&mut self) -> _CTR_RXW { - _CTR_RXW { w: self } - } - } - } - #[doc = "endpoint 7 register"] - pub struct EP7R { - register: VolatileCell, - } - #[doc = "endpoint 7 register"] - pub mod ep7r { - #[doc = r" Value read from the register"] - pub struct R { - bits: u32, - } - #[doc = r" Value to write to the register"] - pub struct W { - bits: u32, - } - impl super::EP7R { + impl super::EPR { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify(&self, f: F)