#[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::USBHS_HSTPIPCFG_CTRL_BULK_MODE {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
{
let bits = self.register.get();
self.register.set(f(&R { bits }, &mut W { bits }).bits);
}
#[doc = r"Reads the contents of the register"]
#[inline(always)]
pub fn read(&self) -> R {
R {
bits: self.register.get(),
}
}
#[doc = r"Writes to the register"]
#[inline(always)]
pub fn write<F>(&self, f: F)
where
F: FnOnce(&mut W) -> &mut W,
{
self.register.set(
f(&mut W {
bits: Self::reset_value(),
})
.bits,
);
}
#[doc = r"Reset value of the register"]
#[inline(always)]
pub const fn reset_value() -> u32 {
0
}
#[doc = r"Writes the reset value to the register"]
#[inline(always)]
pub fn reset(&self) {
self.register.set(Self::reset_value())
}
}
#[doc = r"Reader of the field"]
pub type ALLOC_R = crate::FR<bool, bool>;
#[doc = r"Proxy"]
pub struct _ALLOCW<'a> {
w: &'a mut W,
}
impl<'a> _ALLOCW<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
self.w
}
}
#[doc = "Possible values of the field `PBK`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PBKR {
#[doc = "Single-bank pipe"]
_1_BANK,
#[doc = "Double-bank pipe"]
_2_BANK,
#[doc = "Triple-bank pipe"]
_3_BANK,
}
impl crate::ToBits<u8> for PBKR {
#[inline(always)]
fn _bits(&self) -> u8 {
match *self {
PBKR::_1_BANK => 0,
PBKR::_2_BANK => 1,
PBKR::_3_BANK => 2,
}
}
}
#[doc = r"Reader of the field"]
pub type PBK_R = crate::FR<u8, PBKR>;
impl PBK_R {
#[doc = "Checks if the value of the field is `_1_BANK`"]
#[inline(always)]
pub fn is_1_bank(&self) -> bool {
*self == PBKR::_1_BANK
}
#[doc = "Checks if the value of the field is `_2_BANK`"]
#[inline(always)]
pub fn is_2_bank(&self) -> bool {
*self == PBKR::_2_BANK
}
#[doc = "Checks if the value of the field is `_3_BANK`"]
#[inline(always)]
pub fn is_3_bank(&self) -> bool {
*self == PBKR::_3_BANK
}
}
#[doc = "Values that can be written to the field `PBK`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PBKW {
#[doc = "Single-bank pipe"]
_1_BANK,
#[doc = "Double-bank pipe"]
_2_BANK,
#[doc = "Triple-bank pipe"]
_3_BANK,
}
impl PBKW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> u8 {
match *self {
PBKW::_1_BANK => 0,
PBKW::_2_BANK => 1,
PBKW::_3_BANK => 2,
}
}
}
#[doc = r"Proxy"]
pub struct _PBKW<'a> {
w: &'a mut W,
}
impl<'a> _PBKW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: PBKW) -> &'a mut W {
unsafe { self.bits(variant._bits()) }
}
#[doc = "Single-bank pipe"]
#[inline(always)]
pub fn _1_bank(self) -> &'a mut W {
self.variant(PBKW::_1_BANK)
}
#[doc = "Double-bank pipe"]
#[inline(always)]
pub fn _2_bank(self) -> &'a mut W {
self.variant(PBKW::_2_BANK)
}
#[doc = "Triple-bank pipe"]
#[inline(always)]
pub fn _3_bank(self) -> &'a mut W {
self.variant(PBKW::_3_BANK)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 2)) | (((value as u32) & 0x03) << 2);
self.w
}
}
#[doc = "Possible values of the field `PSIZE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PSIZER {
#[doc = "8 bytes"]
_8_BYTE,
#[doc = "16 bytes"]
_16_BYTE,
#[doc = "32 bytes"]
_32_BYTE,
#[doc = "64 bytes"]
_64_BYTE,
#[doc = "128 bytes"]
_128_BYTE,
#[doc = "256 bytes"]
_256_BYTE,
#[doc = "512 bytes"]
_512_BYTE,
#[doc = "1024 bytes"]
_1024_BYTE,
}
impl crate::ToBits<u8> for PSIZER {
#[inline(always)]
fn _bits(&self) -> u8 {
match *self {
PSIZER::_8_BYTE => 0,
PSIZER::_16_BYTE => 1,
PSIZER::_32_BYTE => 2,
PSIZER::_64_BYTE => 3,
PSIZER::_128_BYTE => 4,
PSIZER::_256_BYTE => 5,
PSIZER::_512_BYTE => 6,
PSIZER::_1024_BYTE => 7,
}
}
}
#[doc = r"Reader of the field"]
pub type PSIZE_R = crate::FR<u8, PSIZER>;
impl PSIZE_R {
#[doc = "Checks if the value of the field is `_8_BYTE`"]
#[inline(always)]
pub fn is_8_byte(&self) -> bool {
*self == PSIZER::_8_BYTE
}
#[doc = "Checks if the value of the field is `_16_BYTE`"]
#[inline(always)]
pub fn is_16_byte(&self) -> bool {
*self == PSIZER::_16_BYTE
}
#[doc = "Checks if the value of the field is `_32_BYTE`"]
#[inline(always)]
pub fn is_32_byte(&self) -> bool {
*self == PSIZER::_32_BYTE
}
#[doc = "Checks if the value of the field is `_64_BYTE`"]
#[inline(always)]
pub fn is_64_byte(&self) -> bool {
*self == PSIZER::_64_BYTE
}
#[doc = "Checks if the value of the field is `_128_BYTE`"]
#[inline(always)]
pub fn is_128_byte(&self) -> bool {
*self == PSIZER::_128_BYTE
}
#[doc = "Checks if the value of the field is `_256_BYTE`"]
#[inline(always)]
pub fn is_256_byte(&self) -> bool {
*self == PSIZER::_256_BYTE
}
#[doc = "Checks if the value of the field is `_512_BYTE`"]
#[inline(always)]
pub fn is_512_byte(&self) -> bool {
*self == PSIZER::_512_BYTE
}
#[doc = "Checks if the value of the field is `_1024_BYTE`"]
#[inline(always)]
pub fn is_1024_byte(&self) -> bool {
*self == PSIZER::_1024_BYTE
}
}
#[doc = "Values that can be written to the field `PSIZE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PSIZEW {
#[doc = "8 bytes"]
_8_BYTE,
#[doc = "16 bytes"]
_16_BYTE,
#[doc = "32 bytes"]
_32_BYTE,
#[doc = "64 bytes"]
_64_BYTE,
#[doc = "128 bytes"]
_128_BYTE,
#[doc = "256 bytes"]
_256_BYTE,
#[doc = "512 bytes"]
_512_BYTE,
#[doc = "1024 bytes"]
_1024_BYTE,
}
impl PSIZEW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> u8 {
match *self {
PSIZEW::_8_BYTE => 0,
PSIZEW::_16_BYTE => 1,
PSIZEW::_32_BYTE => 2,
PSIZEW::_64_BYTE => 3,
PSIZEW::_128_BYTE => 4,
PSIZEW::_256_BYTE => 5,
PSIZEW::_512_BYTE => 6,
PSIZEW::_1024_BYTE => 7,
}
}
}
#[doc = r"Proxy"]
pub struct _PSIZEW<'a> {
w: &'a mut W,
}
impl<'a> _PSIZEW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: PSIZEW) -> &'a mut W {
{
self.bits(variant._bits())
}
}
#[doc = "8 bytes"]
#[inline(always)]
pub fn _8_byte(self) -> &'a mut W {
self.variant(PSIZEW::_8_BYTE)
}
#[doc = "16 bytes"]
#[inline(always)]
pub fn _16_byte(self) -> &'a mut W {
self.variant(PSIZEW::_16_BYTE)
}
#[doc = "32 bytes"]
#[inline(always)]
pub fn _32_byte(self) -> &'a mut W {
self.variant(PSIZEW::_32_BYTE)
}
#[doc = "64 bytes"]
#[inline(always)]
pub fn _64_byte(self) -> &'a mut W {
self.variant(PSIZEW::_64_BYTE)
}
#[doc = "128 bytes"]
#[inline(always)]
pub fn _128_byte(self) -> &'a mut W {
self.variant(PSIZEW::_128_BYTE)
}
#[doc = "256 bytes"]
#[inline(always)]
pub fn _256_byte(self) -> &'a mut W {
self.variant(PSIZEW::_256_BYTE)
}
#[doc = "512 bytes"]
#[inline(always)]
pub fn _512_byte(self) -> &'a mut W {
self.variant(PSIZEW::_512_BYTE)
}
#[doc = "1024 bytes"]
#[inline(always)]
pub fn _1024_byte(self) -> &'a mut W {
self.variant(PSIZEW::_1024_BYTE)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x07 << 4)) | (((value as u32) & 0x07) << 4);
self.w
}
}
#[doc = "Possible values of the field `PTOKEN`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PTOKENR {
#[doc = "SETUP"]
SETUP,
#[doc = "IN"]
IN,
#[doc = "OUT"]
OUT,
}
impl crate::ToBits<u8> for PTOKENR {
#[inline(always)]
fn _bits(&self) -> u8 {
match *self {
PTOKENR::SETUP => 0,
PTOKENR::IN => 1,
PTOKENR::OUT => 2,
}
}
}
#[doc = r"Reader of the field"]
pub type PTOKEN_R = crate::FR<u8, PTOKENR>;
impl PTOKEN_R {
#[doc = "Checks if the value of the field is `SETUP`"]
#[inline(always)]
pub fn is_setup(&self) -> bool {
*self == PTOKENR::SETUP
}
#[doc = "Checks if the value of the field is `IN`"]
#[inline(always)]
pub fn is_in_(&self) -> bool {
*self == PTOKENR::IN
}
#[doc = "Checks if the value of the field is `OUT`"]
#[inline(always)]
pub fn is_out(&self) -> bool {
*self == PTOKENR::OUT
}
}
#[doc = "Values that can be written to the field `PTOKEN`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PTOKENW {
#[doc = "SETUP"]
SETUP,
#[doc = "IN"]
IN,
#[doc = "OUT"]
OUT,
}
impl PTOKENW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> u8 {
match *self {
PTOKENW::SETUP => 0,
PTOKENW::IN => 1,
PTOKENW::OUT => 2,
}
}
}
#[doc = r"Proxy"]
pub struct _PTOKENW<'a> {
w: &'a mut W,
}
impl<'a> _PTOKENW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: PTOKENW) -> &'a mut W {
unsafe { self.bits(variant._bits()) }
}
#[doc = "SETUP"]
#[inline(always)]
pub fn setup(self) -> &'a mut W {
self.variant(PTOKENW::SETUP)
}
#[doc = "IN"]
#[inline(always)]
pub fn in_(self) -> &'a mut W {
self.variant(PTOKENW::IN)
}
#[doc = "OUT"]
#[inline(always)]
pub fn out(self) -> &'a mut W {
self.variant(PTOKENW::OUT)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 8)) | (((value as u32) & 0x03) << 8);
self.w
}
}
#[doc = r"Reader of the field"]
pub type AUTOSW_R = crate::FR<bool, bool>;
#[doc = r"Proxy"]
pub struct _AUTOSWW<'a> {
w: &'a mut W,
}
impl<'a> _AUTOSWW<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 10)) | (((value as u32) & 0x01) << 10);
self.w
}
}
#[doc = "Possible values of the field `PTYPE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PTYPER {
#[doc = "Control"]
CTRL,
#[doc = "Isochronous"]
ISO,
#[doc = "Bulk"]
BLK,
#[doc = "Interrupt"]
INTRPT,
}
impl crate::ToBits<u8> for PTYPER {
#[inline(always)]
fn _bits(&self) -> u8 {
match *self {
PTYPER::CTRL => 0,
PTYPER::ISO => 1,
PTYPER::BLK => 2,
PTYPER::INTRPT => 3,
}
}
}
#[doc = r"Reader of the field"]
pub type PTYPE_R = crate::FR<u8, PTYPER>;
impl PTYPE_R {
#[doc = "Checks if the value of the field is `CTRL`"]
#[inline(always)]
pub fn is_ctrl(&self) -> bool {
*self == PTYPER::CTRL
}
#[doc = "Checks if the value of the field is `ISO`"]
#[inline(always)]
pub fn is_iso(&self) -> bool {
*self == PTYPER::ISO
}
#[doc = "Checks if the value of the field is `BLK`"]
#[inline(always)]
pub fn is_blk(&self) -> bool {
*self == PTYPER::BLK
}
#[doc = "Checks if the value of the field is `INTRPT`"]
#[inline(always)]
pub fn is_intrpt(&self) -> bool {
*self == PTYPER::INTRPT
}
}
#[doc = "Values that can be written to the field `PTYPE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PTYPEW {
#[doc = "Control"]
CTRL,
#[doc = "Isochronous"]
ISO,
#[doc = "Bulk"]
BLK,
#[doc = "Interrupt"]
INTRPT,
}
impl PTYPEW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> u8 {
match *self {
PTYPEW::CTRL => 0,
PTYPEW::ISO => 1,
PTYPEW::BLK => 2,
PTYPEW::INTRPT => 3,
}
}
}
#[doc = r"Proxy"]
pub struct _PTYPEW<'a> {
w: &'a mut W,
}
impl<'a> _PTYPEW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: PTYPEW) -> &'a mut W {
{
self.bits(variant._bits())
}
}
#[doc = "Control"]
#[inline(always)]
pub fn ctrl(self) -> &'a mut W {
self.variant(PTYPEW::CTRL)
}
#[doc = "Isochronous"]
#[inline(always)]
pub fn iso(self) -> &'a mut W {
self.variant(PTYPEW::ISO)
}
#[doc = "Bulk"]
#[inline(always)]
pub fn blk(self) -> &'a mut W {
self.variant(PTYPEW::BLK)
}
#[doc = "Interrupt"]
#[inline(always)]
pub fn intrpt(self) -> &'a mut W {
self.variant(PTYPEW::INTRPT)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 12)) | (((value as u32) & 0x03) << 12);
self.w
}
}
#[doc = r"Reader of the field"]
pub type PEPNUM_R = crate::FR<u8, u8>;
#[doc = r"Proxy"]
pub struct _PEPNUMW<'a> {
w: &'a mut W,
}
impl<'a> _PEPNUMW<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x0f << 16)) | (((value as u32) & 0x0f) << 16);
self.w
}
}
#[doc = r"Reader of the field"]
pub type PINGEN_R = crate::FR<bool, bool>;
#[doc = r"Proxy"]
pub struct _PINGENW<'a> {
w: &'a mut W,
}
impl<'a> _PINGENW<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 20)) | (((value as u32) & 0x01) << 20);
self.w
}
}
#[doc = r"Reader of the field"]
pub type BINTERVAL_R = crate::FR<u8, u8>;
#[doc = r"Proxy"]
pub struct _BINTERVALW<'a> {
w: &'a mut W,
}
impl<'a> _BINTERVALW<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0xff << 24)) | (((value as u32) & 0xff) << 24);
self.w
}
}
impl R {
#[doc = r"Value of the register as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bit 1 - Pipe Memory Allocate"]
#[inline(always)]
pub fn alloc(&self) -> ALLOC_R {
ALLOC_R::new(((self.bits() >> 1) & 0x01) != 0)
}
#[doc = "Bits 2:3 - Pipe Banks"]
#[inline(always)]
pub fn pbk(&self) -> PBK_R {
PBK_R::new(((self.bits() >> 2) & 0x03) as u8)
}
#[doc = "Bits 4:6 - Pipe Size"]
#[inline(always)]
pub fn psize(&self) -> PSIZE_R {
PSIZE_R::new(((self.bits() >> 4) & 0x07) as u8)
}
#[doc = "Bits 8:9 - Pipe Token"]
#[inline(always)]
pub fn ptoken(&self) -> PTOKEN_R {
PTOKEN_R::new(((self.bits() >> 8) & 0x03) as u8)
}
#[doc = "Bit 10 - Automatic Switch"]
#[inline(always)]
pub fn autosw(&self) -> AUTOSW_R {
AUTOSW_R::new(((self.bits() >> 10) & 0x01) != 0)
}
#[doc = "Bits 12:13 - Pipe Type"]
#[inline(always)]
pub fn ptype(&self) -> PTYPE_R {
PTYPE_R::new(((self.bits() >> 12) & 0x03) as u8)
}
#[doc = "Bits 16:19 - Pipe Endpoint Number"]
#[inline(always)]
pub fn pepnum(&self) -> PEPNUM_R {
PEPNUM_R::new(((self.bits() >> 16) & 0x0f) as u8)
}
#[doc = "Bit 20 - Ping Enable"]
#[inline(always)]
pub fn pingen(&self) -> PINGEN_R {
PINGEN_R::new(((self.bits() >> 20) & 0x01) != 0)
}
#[doc = "Bits 24:31 - bInterval Parameter for the Bulk-Out/Ping Transaction"]
#[inline(always)]
pub fn binterval(&self) -> BINTERVAL_R {
BINTERVAL_R::new(((self.bits() >> 24) & 0xff) as u8)
}
}
impl W {
#[doc = r"Writes raw bits to the register"]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bit 1 - Pipe Memory Allocate"]
#[inline(always)]
pub fn alloc(&mut self) -> _ALLOCW {
_ALLOCW { w: self }
}
#[doc = "Bits 2:3 - Pipe Banks"]
#[inline(always)]
pub fn pbk(&mut self) -> _PBKW {
_PBKW { w: self }
}
#[doc = "Bits 4:6 - Pipe Size"]
#[inline(always)]
pub fn psize(&mut self) -> _PSIZEW {
_PSIZEW { w: self }
}
#[doc = "Bits 8:9 - Pipe Token"]
#[inline(always)]
pub fn ptoken(&mut self) -> _PTOKENW {
_PTOKENW { w: self }
}
#[doc = "Bit 10 - Automatic Switch"]
#[inline(always)]
pub fn autosw(&mut self) -> _AUTOSWW {
_AUTOSWW { w: self }
}
#[doc = "Bits 12:13 - Pipe Type"]
#[inline(always)]
pub fn ptype(&mut self) -> _PTYPEW {
_PTYPEW { w: self }
}
#[doc = "Bits 16:19 - Pipe Endpoint Number"]
#[inline(always)]
pub fn pepnum(&mut self) -> _PEPNUMW {
_PEPNUMW { w: self }
}
#[doc = "Bit 20 - Ping Enable"]
#[inline(always)]
pub fn pingen(&mut self) -> _PINGENW {
_PINGENW { w: self }
}
#[doc = "Bits 24:31 - bInterval Parameter for the Bulk-Out/Ping Transaction"]
#[inline(always)]
pub fn binterval(&mut self) -> _BINTERVALW {
_BINTERVALW { w: self }
}
}