Skip to main content

atsamd51g19a/nvmctrl/
status.rs

1#[doc = "Reader of register STATUS"]
2pub type R = crate::R<u16, super::STATUS>;
3#[doc = "Reader of field `READY`"]
4pub type READY_R = crate::R<bool, bool>;
5#[doc = "Reader of field `PRM`"]
6pub type PRM_R = crate::R<bool, bool>;
7#[doc = "Reader of field `LOAD`"]
8pub type LOAD_R = crate::R<bool, bool>;
9#[doc = "Reader of field `SUSP`"]
10pub type SUSP_R = crate::R<bool, bool>;
11#[doc = "Reader of field `AFIRST`"]
12pub type AFIRST_R = crate::R<bool, bool>;
13#[doc = "Reader of field `BPDIS`"]
14pub type BPDIS_R = crate::R<bool, bool>;
15#[doc = "Boot Loader Protection Size\n\nValue on reset: 0"]
16#[derive(Clone, Copy, Debug, PartialEq)]
17#[repr(u8)]
18pub enum BOOTPROT_A {
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<BOOTPROT_A> for u8 {
53    #[inline(always)]
54    fn from(variant: BOOTPROT_A) -> Self {
55        variant as _
56    }
57}
58#[doc = "Reader of field `BOOTPROT`"]
59pub type BOOTPROT_R = crate::R<u8, BOOTPROT_A>;
60impl BOOTPROT_R {
61    #[doc = r"Get enumerated values variant"]
62    #[inline(always)]
63    pub fn variant(&self) -> BOOTPROT_A {
64        match self.bits {
65            15 => BOOTPROT_A::_0,
66            14 => BOOTPROT_A::_8,
67            13 => BOOTPROT_A::_16,
68            12 => BOOTPROT_A::_24,
69            11 => BOOTPROT_A::_32,
70            10 => BOOTPROT_A::_40,
71            9 => BOOTPROT_A::_48,
72            8 => BOOTPROT_A::_56,
73            7 => BOOTPROT_A::_64,
74            6 => BOOTPROT_A::_72,
75            5 => BOOTPROT_A::_80,
76            4 => BOOTPROT_A::_88,
77            3 => BOOTPROT_A::_96,
78            2 => BOOTPROT_A::_104,
79            1 => BOOTPROT_A::_112,
80            0 => BOOTPROT_A::_120,
81            _ => unreachable!(),
82        }
83    }
84    #[doc = "Checks if the value of the field is `_0`"]
85    #[inline(always)]
86    pub fn is_0(&self) -> bool {
87        *self == BOOTPROT_A::_0
88    }
89    #[doc = "Checks if the value of the field is `_8`"]
90    #[inline(always)]
91    pub fn is_8(&self) -> bool {
92        *self == BOOTPROT_A::_8
93    }
94    #[doc = "Checks if the value of the field is `_16`"]
95    #[inline(always)]
96    pub fn is_16(&self) -> bool {
97        *self == BOOTPROT_A::_16
98    }
99    #[doc = "Checks if the value of the field is `_24`"]
100    #[inline(always)]
101    pub fn is_24(&self) -> bool {
102        *self == BOOTPROT_A::_24
103    }
104    #[doc = "Checks if the value of the field is `_32`"]
105    #[inline(always)]
106    pub fn is_32(&self) -> bool {
107        *self == BOOTPROT_A::_32
108    }
109    #[doc = "Checks if the value of the field is `_40`"]
110    #[inline(always)]
111    pub fn is_40(&self) -> bool {
112        *self == BOOTPROT_A::_40
113    }
114    #[doc = "Checks if the value of the field is `_48`"]
115    #[inline(always)]
116    pub fn is_48(&self) -> bool {
117        *self == BOOTPROT_A::_48
118    }
119    #[doc = "Checks if the value of the field is `_56`"]
120    #[inline(always)]
121    pub fn is_56(&self) -> bool {
122        *self == BOOTPROT_A::_56
123    }
124    #[doc = "Checks if the value of the field is `_64`"]
125    #[inline(always)]
126    pub fn is_64(&self) -> bool {
127        *self == BOOTPROT_A::_64
128    }
129    #[doc = "Checks if the value of the field is `_72`"]
130    #[inline(always)]
131    pub fn is_72(&self) -> bool {
132        *self == BOOTPROT_A::_72
133    }
134    #[doc = "Checks if the value of the field is `_80`"]
135    #[inline(always)]
136    pub fn is_80(&self) -> bool {
137        *self == BOOTPROT_A::_80
138    }
139    #[doc = "Checks if the value of the field is `_88`"]
140    #[inline(always)]
141    pub fn is_88(&self) -> bool {
142        *self == BOOTPROT_A::_88
143    }
144    #[doc = "Checks if the value of the field is `_96`"]
145    #[inline(always)]
146    pub fn is_96(&self) -> bool {
147        *self == BOOTPROT_A::_96
148    }
149    #[doc = "Checks if the value of the field is `_104`"]
150    #[inline(always)]
151    pub fn is_104(&self) -> bool {
152        *self == BOOTPROT_A::_104
153    }
154    #[doc = "Checks if the value of the field is `_112`"]
155    #[inline(always)]
156    pub fn is_112(&self) -> bool {
157        *self == BOOTPROT_A::_112
158    }
159    #[doc = "Checks if the value of the field is `_120`"]
160    #[inline(always)]
161    pub fn is_120(&self) -> bool {
162        *self == BOOTPROT_A::_120
163    }
164}
165impl R {
166    #[doc = "Bit 0 - Ready to accept a command"]
167    #[inline(always)]
168    pub fn ready(&self) -> READY_R {
169        READY_R::new((self.bits & 0x01) != 0)
170    }
171    #[doc = "Bit 1 - Power Reduction Mode"]
172    #[inline(always)]
173    pub fn prm(&self) -> PRM_R {
174        PRM_R::new(((self.bits >> 1) & 0x01) != 0)
175    }
176    #[doc = "Bit 2 - NVM Page Buffer Active Loading"]
177    #[inline(always)]
178    pub fn load(&self) -> LOAD_R {
179        LOAD_R::new(((self.bits >> 2) & 0x01) != 0)
180    }
181    #[doc = "Bit 3 - NVM Write Or Erase Operation Is Suspended"]
182    #[inline(always)]
183    pub fn susp(&self) -> SUSP_R {
184        SUSP_R::new(((self.bits >> 3) & 0x01) != 0)
185    }
186    #[doc = "Bit 4 - BANKA First"]
187    #[inline(always)]
188    pub fn afirst(&self) -> AFIRST_R {
189        AFIRST_R::new(((self.bits >> 4) & 0x01) != 0)
190    }
191    #[doc = "Bit 5 - Boot Loader Protection Disable"]
192    #[inline(always)]
193    pub fn bpdis(&self) -> BPDIS_R {
194        BPDIS_R::new(((self.bits >> 5) & 0x01) != 0)
195    }
196    #[doc = "Bits 8:11 - Boot Loader Protection Size"]
197    #[inline(always)]
198    pub fn bootprot(&self) -> BOOTPROT_R {
199        BOOTPROT_R::new(((self.bits >> 8) & 0x0f) as u8)
200    }
201}