efm32gg_pac/efm32gg995/ebi/
pagectrl.rs

1#[doc = "Register `PAGECTRL` reader"]
2pub struct R(crate::R<PAGECTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PAGECTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PAGECTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PAGECTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `PAGECTRL` writer"]
17pub struct W(crate::W<PAGECTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<PAGECTRL_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<PAGECTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<PAGECTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `PAGELEN` reader - Page Length"]
38pub type PAGELEN_R = crate::FieldReader<u8, PAGELEN_A>;
39#[doc = "Page Length\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum PAGELEN_A {
43    #[doc = "0: 4 members in a page."]
44    MEMBER4 = 0,
45    #[doc = "1: 8 members in a page."]
46    MEMBER8 = 1,
47    #[doc = "2: 16 members in a page."]
48    MEMBER16 = 2,
49    #[doc = "3: 32 members in a page."]
50    MEMBER32 = 3,
51}
52impl From<PAGELEN_A> for u8 {
53    #[inline(always)]
54    fn from(variant: PAGELEN_A) -> Self {
55        variant as _
56    }
57}
58impl PAGELEN_R {
59    #[doc = "Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> PAGELEN_A {
62        match self.bits {
63            0 => PAGELEN_A::MEMBER4,
64            1 => PAGELEN_A::MEMBER8,
65            2 => PAGELEN_A::MEMBER16,
66            3 => PAGELEN_A::MEMBER32,
67            _ => unreachable!(),
68        }
69    }
70    #[doc = "Checks if the value of the field is `MEMBER4`"]
71    #[inline(always)]
72    pub fn is_member4(&self) -> bool {
73        *self == PAGELEN_A::MEMBER4
74    }
75    #[doc = "Checks if the value of the field is `MEMBER8`"]
76    #[inline(always)]
77    pub fn is_member8(&self) -> bool {
78        *self == PAGELEN_A::MEMBER8
79    }
80    #[doc = "Checks if the value of the field is `MEMBER16`"]
81    #[inline(always)]
82    pub fn is_member16(&self) -> bool {
83        *self == PAGELEN_A::MEMBER16
84    }
85    #[doc = "Checks if the value of the field is `MEMBER32`"]
86    #[inline(always)]
87    pub fn is_member32(&self) -> bool {
88        *self == PAGELEN_A::MEMBER32
89    }
90}
91#[doc = "Field `PAGELEN` writer - Page Length"]
92pub type PAGELEN_W<'a, const O: u8> =
93    crate::FieldWriterSafe<'a, u32, PAGECTRL_SPEC, u8, PAGELEN_A, 2, O>;
94impl<'a, const O: u8> PAGELEN_W<'a, O> {
95    #[doc = "4 members in a page."]
96    #[inline(always)]
97    pub fn member4(self) -> &'a mut W {
98        self.variant(PAGELEN_A::MEMBER4)
99    }
100    #[doc = "8 members in a page."]
101    #[inline(always)]
102    pub fn member8(self) -> &'a mut W {
103        self.variant(PAGELEN_A::MEMBER8)
104    }
105    #[doc = "16 members in a page."]
106    #[inline(always)]
107    pub fn member16(self) -> &'a mut W {
108        self.variant(PAGELEN_A::MEMBER16)
109    }
110    #[doc = "32 members in a page."]
111    #[inline(always)]
112    pub fn member32(self) -> &'a mut W {
113        self.variant(PAGELEN_A::MEMBER32)
114    }
115}
116#[doc = "Field `INCHIT` reader - Intrapage hit only on incremental addresses"]
117pub type INCHIT_R = crate::BitReader<bool>;
118#[doc = "Field `INCHIT` writer - Intrapage hit only on incremental addresses"]
119pub type INCHIT_W<'a, const O: u8> = crate::BitWriter<'a, u32, PAGECTRL_SPEC, bool, O>;
120#[doc = "Field `RDPA` reader - Page Read Access Time"]
121pub type RDPA_R = crate::FieldReader<u8, u8>;
122#[doc = "Field `RDPA` writer - Page Read Access Time"]
123pub type RDPA_W<'a, const O: u8> = crate::FieldWriter<'a, u32, PAGECTRL_SPEC, u8, u8, 3, O>;
124#[doc = "Field `KEEPOPEN` reader - Maximum Page Open Time."]
125pub type KEEPOPEN_R = crate::FieldReader<u8, u8>;
126#[doc = "Field `KEEPOPEN` writer - Maximum Page Open Time."]
127pub type KEEPOPEN_W<'a, const O: u8> = crate::FieldWriter<'a, u32, PAGECTRL_SPEC, u8, u8, 7, O>;
128impl R {
129    #[doc = "Bits 0:1 - Page Length"]
130    #[inline(always)]
131    pub fn pagelen(&self) -> PAGELEN_R {
132        PAGELEN_R::new((self.bits & 3) as u8)
133    }
134    #[doc = "Bit 4 - Intrapage hit only on incremental addresses"]
135    #[inline(always)]
136    pub fn inchit(&self) -> INCHIT_R {
137        INCHIT_R::new(((self.bits >> 4) & 1) != 0)
138    }
139    #[doc = "Bits 8:10 - Page Read Access Time"]
140    #[inline(always)]
141    pub fn rdpa(&self) -> RDPA_R {
142        RDPA_R::new(((self.bits >> 8) & 7) as u8)
143    }
144    #[doc = "Bits 20:26 - Maximum Page Open Time."]
145    #[inline(always)]
146    pub fn keepopen(&self) -> KEEPOPEN_R {
147        KEEPOPEN_R::new(((self.bits >> 20) & 0x7f) as u8)
148    }
149}
150impl W {
151    #[doc = "Bits 0:1 - Page Length"]
152    #[inline(always)]
153    #[must_use]
154    pub fn pagelen(&mut self) -> PAGELEN_W<0> {
155        PAGELEN_W::new(self)
156    }
157    #[doc = "Bit 4 - Intrapage hit only on incremental addresses"]
158    #[inline(always)]
159    #[must_use]
160    pub fn inchit(&mut self) -> INCHIT_W<4> {
161        INCHIT_W::new(self)
162    }
163    #[doc = "Bits 8:10 - Page Read Access Time"]
164    #[inline(always)]
165    #[must_use]
166    pub fn rdpa(&mut self) -> RDPA_W<8> {
167        RDPA_W::new(self)
168    }
169    #[doc = "Bits 20:26 - Maximum Page Open Time."]
170    #[inline(always)]
171    #[must_use]
172    pub fn keepopen(&mut self) -> KEEPOPEN_W<20> {
173        KEEPOPEN_W::new(self)
174    }
175    #[doc = "Writes raw bits to the register."]
176    #[inline(always)]
177    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
178        self.0.bits(bits);
179        self
180    }
181}
182#[doc = "Page Control Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [pagectrl](index.html) module"]
183pub struct PAGECTRL_SPEC;
184impl crate::RegisterSpec for PAGECTRL_SPEC {
185    type Ux = u32;
186}
187#[doc = "`read()` method returns [pagectrl::R](R) reader structure"]
188impl crate::Readable for PAGECTRL_SPEC {
189    type Reader = R;
190}
191#[doc = "`write(|w| ..)` method takes [pagectrl::W](W) writer structure"]
192impl crate::Writable for PAGECTRL_SPEC {
193    type Writer = W;
194    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
195    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
196}
197#[doc = "`reset()` method sets PAGECTRL to value 0x0700"]
198impl crate::Resettable for PAGECTRL_SPEC {
199    const RESET_VALUE: Self::Ux = 0x0700;
200}