atsamd51p/nvmctrl/
status.rs
1#[doc = "Register `STATUS` reader"]
2pub type R = crate::R<StatusSpec>;
3#[doc = "Field `READY` reader - Ready to accept a command"]
4pub type ReadyR = crate::BitReader;
5#[doc = "Field `PRM` reader - Power Reduction Mode"]
6pub type PrmR = crate::BitReader;
7#[doc = "Field `LOAD` reader - NVM Page Buffer Active Loading"]
8pub type LoadR = crate::BitReader;
9#[doc = "Field `SUSP` reader - NVM Write Or Erase Operation Is Suspended"]
10pub type SuspR = crate::BitReader;
11#[doc = "Field `AFIRST` reader - BANKA First"]
12pub type AfirstR = crate::BitReader;
13#[doc = "Field `BPDIS` reader - Boot Loader Protection Disable"]
14pub type BpdisR = crate::BitReader;
15#[doc = "Boot Loader Protection Size\n\nValue on reset: 0"]
16#[derive(Clone, Copy, Debug, PartialEq, Eq)]
17#[repr(u8)]
18pub enum Bootprotselect {
19 #[doc = "15: 0 kbytes"]
20 _0 = 15,
21 #[doc = "14: 8 kbytes"]
22 _8 = 14,
23 #[doc = "13: 16 kbytes"]
24 _16 = 13,
25 #[doc = "12: 24 kbytes"]
26 _24 = 12,
27 #[doc = "11: 32 kbytes"]
28 _32 = 11,
29 #[doc = "10: 40 kbytes"]
30 _40 = 10,
31 #[doc = "9: 48 kbytes"]
32 _48 = 9,
33 #[doc = "8: 56 kbytes"]
34 _56 = 8,
35 #[doc = "7: 64 kbytes"]
36 _64 = 7,
37 #[doc = "6: 72 kbytes"]
38 _72 = 6,
39 #[doc = "5: 80 kbytes"]
40 _80 = 5,
41 #[doc = "4: 88 kbytes"]
42 _88 = 4,
43 #[doc = "3: 96 kbytes"]
44 _96 = 3,
45 #[doc = "2: 104 kbytes"]
46 _104 = 2,
47 #[doc = "1: 112 kbytes"]
48 _112 = 1,
49 #[doc = "0: 120 kbytes"]
50 _120 = 0,
51}
52impl From<Bootprotselect> for u8 {
53 #[inline(always)]
54 fn from(variant: Bootprotselect) -> Self {
55 variant as _
56 }
57}
58impl crate::FieldSpec for Bootprotselect {
59 type Ux = u8;
60}
61impl crate::IsEnum for Bootprotselect {}
62#[doc = "Field `BOOTPROT` reader - Boot Loader Protection Size"]
63pub type BootprotR = crate::FieldReader<Bootprotselect>;
64impl BootprotR {
65 #[doc = "Get enumerated values variant"]
66 #[inline(always)]
67 pub const fn variant(&self) -> Bootprotselect {
68 match self.bits {
69 15 => Bootprotselect::_0,
70 14 => Bootprotselect::_8,
71 13 => Bootprotselect::_16,
72 12 => Bootprotselect::_24,
73 11 => Bootprotselect::_32,
74 10 => Bootprotselect::_40,
75 9 => Bootprotselect::_48,
76 8 => Bootprotselect::_56,
77 7 => Bootprotselect::_64,
78 6 => Bootprotselect::_72,
79 5 => Bootprotselect::_80,
80 4 => Bootprotselect::_88,
81 3 => Bootprotselect::_96,
82 2 => Bootprotselect::_104,
83 1 => Bootprotselect::_112,
84 0 => Bootprotselect::_120,
85 _ => unreachable!(),
86 }
87 }
88 #[doc = "0 kbytes"]
89 #[inline(always)]
90 pub fn is_0(&self) -> bool {
91 *self == Bootprotselect::_0
92 }
93 #[doc = "8 kbytes"]
94 #[inline(always)]
95 pub fn is_8(&self) -> bool {
96 *self == Bootprotselect::_8
97 }
98 #[doc = "16 kbytes"]
99 #[inline(always)]
100 pub fn is_16(&self) -> bool {
101 *self == Bootprotselect::_16
102 }
103 #[doc = "24 kbytes"]
104 #[inline(always)]
105 pub fn is_24(&self) -> bool {
106 *self == Bootprotselect::_24
107 }
108 #[doc = "32 kbytes"]
109 #[inline(always)]
110 pub fn is_32(&self) -> bool {
111 *self == Bootprotselect::_32
112 }
113 #[doc = "40 kbytes"]
114 #[inline(always)]
115 pub fn is_40(&self) -> bool {
116 *self == Bootprotselect::_40
117 }
118 #[doc = "48 kbytes"]
119 #[inline(always)]
120 pub fn is_48(&self) -> bool {
121 *self == Bootprotselect::_48
122 }
123 #[doc = "56 kbytes"]
124 #[inline(always)]
125 pub fn is_56(&self) -> bool {
126 *self == Bootprotselect::_56
127 }
128 #[doc = "64 kbytes"]
129 #[inline(always)]
130 pub fn is_64(&self) -> bool {
131 *self == Bootprotselect::_64
132 }
133 #[doc = "72 kbytes"]
134 #[inline(always)]
135 pub fn is_72(&self) -> bool {
136 *self == Bootprotselect::_72
137 }
138 #[doc = "80 kbytes"]
139 #[inline(always)]
140 pub fn is_80(&self) -> bool {
141 *self == Bootprotselect::_80
142 }
143 #[doc = "88 kbytes"]
144 #[inline(always)]
145 pub fn is_88(&self) -> bool {
146 *self == Bootprotselect::_88
147 }
148 #[doc = "96 kbytes"]
149 #[inline(always)]
150 pub fn is_96(&self) -> bool {
151 *self == Bootprotselect::_96
152 }
153 #[doc = "104 kbytes"]
154 #[inline(always)]
155 pub fn is_104(&self) -> bool {
156 *self == Bootprotselect::_104
157 }
158 #[doc = "112 kbytes"]
159 #[inline(always)]
160 pub fn is_112(&self) -> bool {
161 *self == Bootprotselect::_112
162 }
163 #[doc = "120 kbytes"]
164 #[inline(always)]
165 pub fn is_120(&self) -> bool {
166 *self == Bootprotselect::_120
167 }
168}
169impl R {
170 #[doc = "Bit 0 - Ready to accept a command"]
171 #[inline(always)]
172 pub fn ready(&self) -> ReadyR {
173 ReadyR::new((self.bits & 1) != 0)
174 }
175 #[doc = "Bit 1 - Power Reduction Mode"]
176 #[inline(always)]
177 pub fn prm(&self) -> PrmR {
178 PrmR::new(((self.bits >> 1) & 1) != 0)
179 }
180 #[doc = "Bit 2 - NVM Page Buffer Active Loading"]
181 #[inline(always)]
182 pub fn load(&self) -> LoadR {
183 LoadR::new(((self.bits >> 2) & 1) != 0)
184 }
185 #[doc = "Bit 3 - NVM Write Or Erase Operation Is Suspended"]
186 #[inline(always)]
187 pub fn susp(&self) -> SuspR {
188 SuspR::new(((self.bits >> 3) & 1) != 0)
189 }
190 #[doc = "Bit 4 - BANKA First"]
191 #[inline(always)]
192 pub fn afirst(&self) -> AfirstR {
193 AfirstR::new(((self.bits >> 4) & 1) != 0)
194 }
195 #[doc = "Bit 5 - Boot Loader Protection Disable"]
196 #[inline(always)]
197 pub fn bpdis(&self) -> BpdisR {
198 BpdisR::new(((self.bits >> 5) & 1) != 0)
199 }
200 #[doc = "Bits 8:11 - Boot Loader Protection Size"]
201 #[inline(always)]
202 pub fn bootprot(&self) -> BootprotR {
203 BootprotR::new(((self.bits >> 8) & 0x0f) as u8)
204 }
205}
206#[doc = "Status\n\nYou can [`read`](crate::Reg::read) this register and get [`status::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
207pub struct StatusSpec;
208impl crate::RegisterSpec for StatusSpec {
209 type Ux = u16;
210}
211#[doc = "`read()` method returns [`status::R`](R) reader structure"]
212impl crate::Readable for StatusSpec {}
213#[doc = "`reset()` method sets STATUS to value 0"]
214impl crate::Resettable for StatusSpec {
215 const RESET_VALUE: u16 = 0;
216}