efm32gg12b810_pac/ebi/
pagectrl.rs1#[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 = "Page Length\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum PAGELEN_A {
41 #[doc = "0: 4 members in a page."]
42 MEMBER4 = 0,
43 #[doc = "1: 8 members in a page."]
44 MEMBER8 = 1,
45 #[doc = "2: 16 members in a page."]
46 MEMBER16 = 2,
47 #[doc = "3: 32 members in a page."]
48 MEMBER32 = 3,
49}
50impl From<PAGELEN_A> for u8 {
51 #[inline(always)]
52 fn from(variant: PAGELEN_A) -> Self {
53 variant as _
54 }
55}
56#[doc = "Field `PAGELEN` reader - Page Length"]
57pub type PAGELEN_R = crate::FieldReader<u8, PAGELEN_A>;
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> = crate::FieldWriterSafe<'a, u32, PAGECTRL_SPEC, u8, PAGELEN_A, 2, 0>;
93impl<'a> PAGELEN_W<'a> {
94 #[doc = "4 members in a page."]
95 #[inline(always)]
96 pub fn member4(self) -> &'a mut W {
97 self.variant(PAGELEN_A::MEMBER4)
98 }
99 #[doc = "8 members in a page."]
100 #[inline(always)]
101 pub fn member8(self) -> &'a mut W {
102 self.variant(PAGELEN_A::MEMBER8)
103 }
104 #[doc = "16 members in a page."]
105 #[inline(always)]
106 pub fn member16(self) -> &'a mut W {
107 self.variant(PAGELEN_A::MEMBER16)
108 }
109 #[doc = "32 members in a page."]
110 #[inline(always)]
111 pub fn member32(self) -> &'a mut W {
112 self.variant(PAGELEN_A::MEMBER32)
113 }
114}
115#[doc = "Field `INCHIT` reader - Intrapage Hit Only on Incremental Addresses"]
116pub type INCHIT_R = crate::BitReader<bool>;
117#[doc = "Field `INCHIT` writer - Intrapage Hit Only on Incremental Addresses"]
118pub type INCHIT_W<'a> = crate::BitWriter<'a, u32, PAGECTRL_SPEC, bool, 4>;
119#[doc = "Field `RDPA` reader - Page Read Access Time"]
120pub type RDPA_R = crate::FieldReader<u8, u8>;
121#[doc = "Field `RDPA` writer - Page Read Access Time"]
122pub type RDPA_W<'a> = crate::FieldWriter<'a, u32, PAGECTRL_SPEC, u8, u8, 4, 8>;
123#[doc = "Field `KEEPOPEN` reader - Maximum Page Open Time"]
124pub type KEEPOPEN_R = crate::FieldReader<u8, u8>;
125#[doc = "Field `KEEPOPEN` writer - Maximum Page Open Time"]
126pub type KEEPOPEN_W<'a> = crate::FieldWriter<'a, u32, PAGECTRL_SPEC, u8, u8, 7, 20>;
127impl R {
128 #[doc = "Bits 0:1 - Page Length"]
129 #[inline(always)]
130 pub fn pagelen(&self) -> PAGELEN_R {
131 PAGELEN_R::new((self.bits & 3) as u8)
132 }
133 #[doc = "Bit 4 - Intrapage Hit Only on Incremental Addresses"]
134 #[inline(always)]
135 pub fn inchit(&self) -> INCHIT_R {
136 INCHIT_R::new(((self.bits >> 4) & 1) != 0)
137 }
138 #[doc = "Bits 8:11 - Page Read Access Time"]
139 #[inline(always)]
140 pub fn rdpa(&self) -> RDPA_R {
141 RDPA_R::new(((self.bits >> 8) & 0x0f) as u8)
142 }
143 #[doc = "Bits 20:26 - Maximum Page Open Time"]
144 #[inline(always)]
145 pub fn keepopen(&self) -> KEEPOPEN_R {
146 KEEPOPEN_R::new(((self.bits >> 20) & 0x7f) as u8)
147 }
148}
149impl W {
150 #[doc = "Bits 0:1 - Page Length"]
151 #[inline(always)]
152 pub fn pagelen(&mut self) -> PAGELEN_W {
153 PAGELEN_W::new(self)
154 }
155 #[doc = "Bit 4 - Intrapage Hit Only on Incremental Addresses"]
156 #[inline(always)]
157 pub fn inchit(&mut self) -> INCHIT_W {
158 INCHIT_W::new(self)
159 }
160 #[doc = "Bits 8:11 - Page Read Access Time"]
161 #[inline(always)]
162 pub fn rdpa(&mut self) -> RDPA_W {
163 RDPA_W::new(self)
164 }
165 #[doc = "Bits 20:26 - Maximum Page Open Time"]
166 #[inline(always)]
167 pub fn keepopen(&mut self) -> KEEPOPEN_W {
168 KEEPOPEN_W::new(self)
169 }
170 #[doc = "Writes raw bits to the register."]
171 #[inline(always)]
172 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
173 self.0.bits(bits);
174 self
175 }
176}
177#[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"]
178pub struct PAGECTRL_SPEC;
179impl crate::RegisterSpec for PAGECTRL_SPEC {
180 type Ux = u32;
181}
182#[doc = "`read()` method returns [pagectrl::R](R) reader structure"]
183impl crate::Readable for PAGECTRL_SPEC {
184 type Reader = R;
185}
186#[doc = "`write(|w| ..)` method takes [pagectrl::W](W) writer structure"]
187impl crate::Writable for PAGECTRL_SPEC {
188 type Writer = W;
189}
190#[doc = "`reset()` method sets PAGECTRL to value 0x0f00"]
191impl crate::Resettable for PAGECTRL_SPEC {
192 #[inline(always)]
193 fn reset_value() -> Self::Ux {
194 0x0f00
195 }
196}