atsamd51g/nvmctrl/
ctrla.rs
1#[doc = "Register `CTRLA` reader"]
2pub type R = crate::R<CtrlaSpec>;
3#[doc = "Register `CTRLA` writer"]
4pub type W = crate::W<CtrlaSpec>;
5#[doc = "Field `AUTOWS` reader - Auto Wait State Enable"]
6pub type AutowsR = crate::BitReader;
7#[doc = "Field `AUTOWS` writer - Auto Wait State Enable"]
8pub type AutowsW<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `SUSPEN` reader - Suspend Enable"]
10pub type SuspenR = crate::BitReader;
11#[doc = "Field `SUSPEN` writer - Suspend Enable"]
12pub type SuspenW<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Write Mode\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq, Eq)]
15#[repr(u8)]
16pub enum Wmodeselect {
17 #[doc = "0: Manual Write"]
18 Man = 0,
19 #[doc = "1: Automatic Double Word Write"]
20 Adw = 1,
21 #[doc = "2: Automatic Quad Word"]
22 Aqw = 2,
23 #[doc = "3: Automatic Page Write"]
24 Ap = 3,
25}
26impl From<Wmodeselect> for u8 {
27 #[inline(always)]
28 fn from(variant: Wmodeselect) -> Self {
29 variant as _
30 }
31}
32impl crate::FieldSpec for Wmodeselect {
33 type Ux = u8;
34}
35impl crate::IsEnum for Wmodeselect {}
36#[doc = "Field `WMODE` reader - Write Mode"]
37pub type WmodeR = crate::FieldReader<Wmodeselect>;
38impl WmodeR {
39 #[doc = "Get enumerated values variant"]
40 #[inline(always)]
41 pub const fn variant(&self) -> Wmodeselect {
42 match self.bits {
43 0 => Wmodeselect::Man,
44 1 => Wmodeselect::Adw,
45 2 => Wmodeselect::Aqw,
46 3 => Wmodeselect::Ap,
47 _ => unreachable!(),
48 }
49 }
50 #[doc = "Manual Write"]
51 #[inline(always)]
52 pub fn is_man(&self) -> bool {
53 *self == Wmodeselect::Man
54 }
55 #[doc = "Automatic Double Word Write"]
56 #[inline(always)]
57 pub fn is_adw(&self) -> bool {
58 *self == Wmodeselect::Adw
59 }
60 #[doc = "Automatic Quad Word"]
61 #[inline(always)]
62 pub fn is_aqw(&self) -> bool {
63 *self == Wmodeselect::Aqw
64 }
65 #[doc = "Automatic Page Write"]
66 #[inline(always)]
67 pub fn is_ap(&self) -> bool {
68 *self == Wmodeselect::Ap
69 }
70}
71#[doc = "Field `WMODE` writer - Write Mode"]
72pub type WmodeW<'a, REG> = crate::FieldWriter<'a, REG, 2, Wmodeselect, crate::Safe>;
73impl<'a, REG> WmodeW<'a, REG>
74where
75 REG: crate::Writable + crate::RegisterSpec,
76 REG::Ux: From<u8>,
77{
78 #[doc = "Manual Write"]
79 #[inline(always)]
80 pub fn man(self) -> &'a mut crate::W<REG> {
81 self.variant(Wmodeselect::Man)
82 }
83 #[doc = "Automatic Double Word Write"]
84 #[inline(always)]
85 pub fn adw(self) -> &'a mut crate::W<REG> {
86 self.variant(Wmodeselect::Adw)
87 }
88 #[doc = "Automatic Quad Word"]
89 #[inline(always)]
90 pub fn aqw(self) -> &'a mut crate::W<REG> {
91 self.variant(Wmodeselect::Aqw)
92 }
93 #[doc = "Automatic Page Write"]
94 #[inline(always)]
95 pub fn ap(self) -> &'a mut crate::W<REG> {
96 self.variant(Wmodeselect::Ap)
97 }
98}
99#[doc = "Power Reduction Mode during Sleep\n\nValue on reset: 0"]
100#[derive(Clone, Copy, Debug, PartialEq, Eq)]
101#[repr(u8)]
102pub enum Prmselect {
103 #[doc = "0: NVM block enters low-power mode when entering standby mode. NVM block enters low-power mode when SPRM command is issued. NVM block exits low-power mode upon first access."]
104 Semiauto = 0,
105 #[doc = "1: NVM block enters low-power mode when entering standby mode. NVM block enters low-power mode when SPRM command is issued. NVM block exits low-power mode when system is not in standby mode."]
106 Fullauto = 1,
107 #[doc = "3: NVM block does not enter low-power mode when entering standby mode. NVM block enters low-power mode when SPRM command is issued. NVM block exits low-power mode upon first access."]
108 Manual = 3,
109}
110impl From<Prmselect> for u8 {
111 #[inline(always)]
112 fn from(variant: Prmselect) -> Self {
113 variant as _
114 }
115}
116impl crate::FieldSpec for Prmselect {
117 type Ux = u8;
118}
119impl crate::IsEnum for Prmselect {}
120#[doc = "Field `PRM` reader - Power Reduction Mode during Sleep"]
121pub type PrmR = crate::FieldReader<Prmselect>;
122impl PrmR {
123 #[doc = "Get enumerated values variant"]
124 #[inline(always)]
125 pub const fn variant(&self) -> Option<Prmselect> {
126 match self.bits {
127 0 => Some(Prmselect::Semiauto),
128 1 => Some(Prmselect::Fullauto),
129 3 => Some(Prmselect::Manual),
130 _ => None,
131 }
132 }
133 #[doc = "NVM block enters low-power mode when entering standby mode. NVM block enters low-power mode when SPRM command is issued. NVM block exits low-power mode upon first access."]
134 #[inline(always)]
135 pub fn is_semiauto(&self) -> bool {
136 *self == Prmselect::Semiauto
137 }
138 #[doc = "NVM block enters low-power mode when entering standby mode. NVM block enters low-power mode when SPRM command is issued. NVM block exits low-power mode when system is not in standby mode."]
139 #[inline(always)]
140 pub fn is_fullauto(&self) -> bool {
141 *self == Prmselect::Fullauto
142 }
143 #[doc = "NVM block does not enter low-power mode when entering standby mode. NVM block enters low-power mode when SPRM command is issued. NVM block exits low-power mode upon first access."]
144 #[inline(always)]
145 pub fn is_manual(&self) -> bool {
146 *self == Prmselect::Manual
147 }
148}
149#[doc = "Field `PRM` writer - Power Reduction Mode during Sleep"]
150pub type PrmW<'a, REG> = crate::FieldWriter<'a, REG, 2, Prmselect>;
151impl<'a, REG> PrmW<'a, REG>
152where
153 REG: crate::Writable + crate::RegisterSpec,
154 REG::Ux: From<u8>,
155{
156 #[doc = "NVM block enters low-power mode when entering standby mode. NVM block enters low-power mode when SPRM command is issued. NVM block exits low-power mode upon first access."]
157 #[inline(always)]
158 pub fn semiauto(self) -> &'a mut crate::W<REG> {
159 self.variant(Prmselect::Semiauto)
160 }
161 #[doc = "NVM block enters low-power mode when entering standby mode. NVM block enters low-power mode when SPRM command is issued. NVM block exits low-power mode when system is not in standby mode."]
162 #[inline(always)]
163 pub fn fullauto(self) -> &'a mut crate::W<REG> {
164 self.variant(Prmselect::Fullauto)
165 }
166 #[doc = "NVM block does not enter low-power mode when entering standby mode. NVM block enters low-power mode when SPRM command is issued. NVM block exits low-power mode upon first access."]
167 #[inline(always)]
168 pub fn manual(self) -> &'a mut crate::W<REG> {
169 self.variant(Prmselect::Manual)
170 }
171}
172#[doc = "Field `RWS` reader - NVM Read Wait States"]
173pub type RwsR = crate::FieldReader;
174#[doc = "Field `RWS` writer - NVM Read Wait States"]
175pub type RwsW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
176#[doc = "Field `AHBNS0` reader - Force AHB0 access to NONSEQ, burst transfers are continuously rearbitrated"]
177pub type Ahbns0R = crate::BitReader;
178#[doc = "Field `AHBNS0` writer - Force AHB0 access to NONSEQ, burst transfers are continuously rearbitrated"]
179pub type Ahbns0W<'a, REG> = crate::BitWriter<'a, REG>;
180#[doc = "Field `AHBNS1` reader - Force AHB1 access to NONSEQ, burst transfers are continuously rearbitrated"]
181pub type Ahbns1R = crate::BitReader;
182#[doc = "Field `AHBNS1` writer - Force AHB1 access to NONSEQ, burst transfers are continuously rearbitrated"]
183pub type Ahbns1W<'a, REG> = crate::BitWriter<'a, REG>;
184#[doc = "Field `CACHEDIS0` reader - AHB0 Cache Disable"]
185pub type Cachedis0R = crate::BitReader;
186#[doc = "Field `CACHEDIS0` writer - AHB0 Cache Disable"]
187pub type Cachedis0W<'a, REG> = crate::BitWriter<'a, REG>;
188#[doc = "Field `CACHEDIS1` reader - AHB1 Cache Disable"]
189pub type Cachedis1R = crate::BitReader;
190#[doc = "Field `CACHEDIS1` writer - AHB1 Cache Disable"]
191pub type Cachedis1W<'a, REG> = crate::BitWriter<'a, REG>;
192impl R {
193 #[doc = "Bit 2 - Auto Wait State Enable"]
194 #[inline(always)]
195 pub fn autows(&self) -> AutowsR {
196 AutowsR::new(((self.bits >> 2) & 1) != 0)
197 }
198 #[doc = "Bit 3 - Suspend Enable"]
199 #[inline(always)]
200 pub fn suspen(&self) -> SuspenR {
201 SuspenR::new(((self.bits >> 3) & 1) != 0)
202 }
203 #[doc = "Bits 4:5 - Write Mode"]
204 #[inline(always)]
205 pub fn wmode(&self) -> WmodeR {
206 WmodeR::new(((self.bits >> 4) & 3) as u8)
207 }
208 #[doc = "Bits 6:7 - Power Reduction Mode during Sleep"]
209 #[inline(always)]
210 pub fn prm(&self) -> PrmR {
211 PrmR::new(((self.bits >> 6) & 3) as u8)
212 }
213 #[doc = "Bits 8:11 - NVM Read Wait States"]
214 #[inline(always)]
215 pub fn rws(&self) -> RwsR {
216 RwsR::new(((self.bits >> 8) & 0x0f) as u8)
217 }
218 #[doc = "Bit 12 - Force AHB0 access to NONSEQ, burst transfers are continuously rearbitrated"]
219 #[inline(always)]
220 pub fn ahbns0(&self) -> Ahbns0R {
221 Ahbns0R::new(((self.bits >> 12) & 1) != 0)
222 }
223 #[doc = "Bit 13 - Force AHB1 access to NONSEQ, burst transfers are continuously rearbitrated"]
224 #[inline(always)]
225 pub fn ahbns1(&self) -> Ahbns1R {
226 Ahbns1R::new(((self.bits >> 13) & 1) != 0)
227 }
228 #[doc = "Bit 14 - AHB0 Cache Disable"]
229 #[inline(always)]
230 pub fn cachedis0(&self) -> Cachedis0R {
231 Cachedis0R::new(((self.bits >> 14) & 1) != 0)
232 }
233 #[doc = "Bit 15 - AHB1 Cache Disable"]
234 #[inline(always)]
235 pub fn cachedis1(&self) -> Cachedis1R {
236 Cachedis1R::new(((self.bits >> 15) & 1) != 0)
237 }
238}
239impl W {
240 #[doc = "Bit 2 - Auto Wait State Enable"]
241 #[inline(always)]
242 #[must_use]
243 pub fn autows(&mut self) -> AutowsW<CtrlaSpec> {
244 AutowsW::new(self, 2)
245 }
246 #[doc = "Bit 3 - Suspend Enable"]
247 #[inline(always)]
248 #[must_use]
249 pub fn suspen(&mut self) -> SuspenW<CtrlaSpec> {
250 SuspenW::new(self, 3)
251 }
252 #[doc = "Bits 4:5 - Write Mode"]
253 #[inline(always)]
254 #[must_use]
255 pub fn wmode(&mut self) -> WmodeW<CtrlaSpec> {
256 WmodeW::new(self, 4)
257 }
258 #[doc = "Bits 6:7 - Power Reduction Mode during Sleep"]
259 #[inline(always)]
260 #[must_use]
261 pub fn prm(&mut self) -> PrmW<CtrlaSpec> {
262 PrmW::new(self, 6)
263 }
264 #[doc = "Bits 8:11 - NVM Read Wait States"]
265 #[inline(always)]
266 #[must_use]
267 pub fn rws(&mut self) -> RwsW<CtrlaSpec> {
268 RwsW::new(self, 8)
269 }
270 #[doc = "Bit 12 - Force AHB0 access to NONSEQ, burst transfers are continuously rearbitrated"]
271 #[inline(always)]
272 #[must_use]
273 pub fn ahbns0(&mut self) -> Ahbns0W<CtrlaSpec> {
274 Ahbns0W::new(self, 12)
275 }
276 #[doc = "Bit 13 - Force AHB1 access to NONSEQ, burst transfers are continuously rearbitrated"]
277 #[inline(always)]
278 #[must_use]
279 pub fn ahbns1(&mut self) -> Ahbns1W<CtrlaSpec> {
280 Ahbns1W::new(self, 13)
281 }
282 #[doc = "Bit 14 - AHB0 Cache Disable"]
283 #[inline(always)]
284 #[must_use]
285 pub fn cachedis0(&mut self) -> Cachedis0W<CtrlaSpec> {
286 Cachedis0W::new(self, 14)
287 }
288 #[doc = "Bit 15 - AHB1 Cache Disable"]
289 #[inline(always)]
290 #[must_use]
291 pub fn cachedis1(&mut self) -> Cachedis1W<CtrlaSpec> {
292 Cachedis1W::new(self, 15)
293 }
294}
295#[doc = "Control A\n\nYou can [`read`](crate::Reg::read) this register and get [`ctrla::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ctrla::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
296pub struct CtrlaSpec;
297impl crate::RegisterSpec for CtrlaSpec {
298 type Ux = u16;
299}
300#[doc = "`read()` method returns [`ctrla::R`](R) reader structure"]
301impl crate::Readable for CtrlaSpec {}
302#[doc = "`write(|w| ..)` method takes [`ctrla::W`](W) writer structure"]
303impl crate::Writable for CtrlaSpec {
304 type Safety = crate::Unsafe;
305 const ZERO_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
306 const ONE_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
307}
308#[doc = "`reset()` method sets CTRLA to value 0x04"]
309impl crate::Resettable for CtrlaSpec {
310 const RESET_VALUE: u16 = 0x04;
311}