esp32s3/usb0/
grstctl.rs

1#[doc = "Register `GRSTCTL` reader"]
2pub type R = crate::R<GRSTCTL_SPEC>;
3#[doc = "Register `GRSTCTL` writer"]
4pub type W = crate::W<GRSTCTL_SPEC>;
5#[doc = "Field `CSFTRST` reader - "]
6pub type CSFTRST_R = crate::BitReader;
7#[doc = "Field `CSFTRST` writer - "]
8pub type CSFTRST_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `PIUFSSFTRST` reader - "]
10pub type PIUFSSFTRST_R = crate::BitReader;
11#[doc = "Field `PIUFSSFTRST` writer - "]
12pub type PIUFSSFTRST_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `FRMCNTRRST` reader - "]
14pub type FRMCNTRRST_R = crate::BitReader;
15#[doc = "Field `FRMCNTRRST` writer - "]
16pub type FRMCNTRRST_W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `RXFFLSH` reader - "]
18pub type RXFFLSH_R = crate::BitReader;
19#[doc = "Field `RXFFLSH` writer - "]
20pub type RXFFLSH_W<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `TXFFLSH` reader - "]
22pub type TXFFLSH_R = crate::BitReader;
23#[doc = "Field `TXFFLSH` writer - "]
24pub type TXFFLSH_W<'a, REG> = crate::BitWriter<'a, REG>;
25#[doc = "Field `TXFNUM` reader - "]
26pub type TXFNUM_R = crate::FieldReader;
27#[doc = "Field `TXFNUM` writer - "]
28pub type TXFNUM_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
29#[doc = "Field `DMAREQ` reader - "]
30pub type DMAREQ_R = crate::BitReader;
31#[doc = "Field `AHBIDLE` reader - "]
32pub type AHBIDLE_R = crate::BitReader;
33impl R {
34    #[doc = "Bit 0"]
35    #[inline(always)]
36    pub fn csftrst(&self) -> CSFTRST_R {
37        CSFTRST_R::new((self.bits & 1) != 0)
38    }
39    #[doc = "Bit 1"]
40    #[inline(always)]
41    pub fn piufssftrst(&self) -> PIUFSSFTRST_R {
42        PIUFSSFTRST_R::new(((self.bits >> 1) & 1) != 0)
43    }
44    #[doc = "Bit 2"]
45    #[inline(always)]
46    pub fn frmcntrrst(&self) -> FRMCNTRRST_R {
47        FRMCNTRRST_R::new(((self.bits >> 2) & 1) != 0)
48    }
49    #[doc = "Bit 4"]
50    #[inline(always)]
51    pub fn rxfflsh(&self) -> RXFFLSH_R {
52        RXFFLSH_R::new(((self.bits >> 4) & 1) != 0)
53    }
54    #[doc = "Bit 5"]
55    #[inline(always)]
56    pub fn txfflsh(&self) -> TXFFLSH_R {
57        TXFFLSH_R::new(((self.bits >> 5) & 1) != 0)
58    }
59    #[doc = "Bits 6:10"]
60    #[inline(always)]
61    pub fn txfnum(&self) -> TXFNUM_R {
62        TXFNUM_R::new(((self.bits >> 6) & 0x1f) as u8)
63    }
64    #[doc = "Bit 30"]
65    #[inline(always)]
66    pub fn dmareq(&self) -> DMAREQ_R {
67        DMAREQ_R::new(((self.bits >> 30) & 1) != 0)
68    }
69    #[doc = "Bit 31"]
70    #[inline(always)]
71    pub fn ahbidle(&self) -> AHBIDLE_R {
72        AHBIDLE_R::new(((self.bits >> 31) & 1) != 0)
73    }
74}
75#[cfg(feature = "impl-register-debug")]
76impl core::fmt::Debug for R {
77    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
78        f.debug_struct("GRSTCTL")
79            .field("csftrst", &self.csftrst())
80            .field("piufssftrst", &self.piufssftrst())
81            .field("frmcntrrst", &self.frmcntrrst())
82            .field("rxfflsh", &self.rxfflsh())
83            .field("txfflsh", &self.txfflsh())
84            .field("txfnum", &self.txfnum())
85            .field("dmareq", &self.dmareq())
86            .field("ahbidle", &self.ahbidle())
87            .finish()
88    }
89}
90impl W {
91    #[doc = "Bit 0"]
92    #[inline(always)]
93    pub fn csftrst(&mut self) -> CSFTRST_W<GRSTCTL_SPEC> {
94        CSFTRST_W::new(self, 0)
95    }
96    #[doc = "Bit 1"]
97    #[inline(always)]
98    pub fn piufssftrst(&mut self) -> PIUFSSFTRST_W<GRSTCTL_SPEC> {
99        PIUFSSFTRST_W::new(self, 1)
100    }
101    #[doc = "Bit 2"]
102    #[inline(always)]
103    pub fn frmcntrrst(&mut self) -> FRMCNTRRST_W<GRSTCTL_SPEC> {
104        FRMCNTRRST_W::new(self, 2)
105    }
106    #[doc = "Bit 4"]
107    #[inline(always)]
108    pub fn rxfflsh(&mut self) -> RXFFLSH_W<GRSTCTL_SPEC> {
109        RXFFLSH_W::new(self, 4)
110    }
111    #[doc = "Bit 5"]
112    #[inline(always)]
113    pub fn txfflsh(&mut self) -> TXFFLSH_W<GRSTCTL_SPEC> {
114        TXFFLSH_W::new(self, 5)
115    }
116    #[doc = "Bits 6:10"]
117    #[inline(always)]
118    pub fn txfnum(&mut self) -> TXFNUM_W<GRSTCTL_SPEC> {
119        TXFNUM_W::new(self, 6)
120    }
121}
122#[doc = "\n\nYou can [`read`](crate::Reg::read) this register and get [`grstctl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`grstctl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
123pub struct GRSTCTL_SPEC;
124impl crate::RegisterSpec for GRSTCTL_SPEC {
125    type Ux = u32;
126}
127#[doc = "`read()` method returns [`grstctl::R`](R) reader structure"]
128impl crate::Readable for GRSTCTL_SPEC {}
129#[doc = "`write(|w| ..)` method takes [`grstctl::W`](W) writer structure"]
130impl crate::Writable for GRSTCTL_SPEC {
131    type Safety = crate::Unsafe;
132}
133#[doc = "`reset()` method sets GRSTCTL to value 0"]
134impl crate::Resettable for GRSTCTL_SPEC {}