nrf9160_pac/spu_s/flashregion/
perm.rs1#[doc = "Register `PERM` reader"]
2pub struct R(crate::R<PERM_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<PERM_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<PERM_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<PERM_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `PERM` writer"]
17pub struct W(crate::W<PERM_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<PERM_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<PERM_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<PERM_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `EXECUTE` reader - Configure instruction fetch permissions from flash region n"]
38pub type EXECUTE_R = crate::BitReader<EXECUTE_A>;
39#[doc = "Configure instruction fetch permissions from flash region n\n\nValue on reset: 1"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum EXECUTE_A {
42 #[doc = "1: Allow instruction fetches from flash region n"]
43 ENABLE = 1,
44 #[doc = "0: Block instruction fetches from flash region n"]
45 DISABLE = 0,
46}
47impl From<EXECUTE_A> for bool {
48 #[inline(always)]
49 fn from(variant: EXECUTE_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl EXECUTE_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> EXECUTE_A {
57 match self.bits {
58 true => EXECUTE_A::ENABLE,
59 false => EXECUTE_A::DISABLE,
60 }
61 }
62 #[doc = "Checks if the value of the field is `ENABLE`"]
63 #[inline(always)]
64 pub fn is_enable(&self) -> bool {
65 *self == EXECUTE_A::ENABLE
66 }
67 #[doc = "Checks if the value of the field is `DISABLE`"]
68 #[inline(always)]
69 pub fn is_disable(&self) -> bool {
70 *self == EXECUTE_A::DISABLE
71 }
72}
73#[doc = "Field `EXECUTE` writer - Configure instruction fetch permissions from flash region n"]
74pub type EXECUTE_W<'a, const O: u8> = crate::BitWriter<'a, u32, PERM_SPEC, EXECUTE_A, O>;
75impl<'a, const O: u8> EXECUTE_W<'a, O> {
76 #[doc = "Allow instruction fetches from flash region n"]
77 #[inline(always)]
78 pub fn enable(self) -> &'a mut W {
79 self.variant(EXECUTE_A::ENABLE)
80 }
81 #[doc = "Block instruction fetches from flash region n"]
82 #[inline(always)]
83 pub fn disable(self) -> &'a mut W {
84 self.variant(EXECUTE_A::DISABLE)
85 }
86}
87#[doc = "Field `WRITE` reader - Configure write permission for flash region n"]
88pub type WRITE_R = crate::BitReader<WRITE_A>;
89#[doc = "Configure write permission for flash region n\n\nValue on reset: 1"]
90#[derive(Clone, Copy, Debug, PartialEq)]
91pub enum WRITE_A {
92 #[doc = "1: Allow write operation to region n"]
93 ENABLE = 1,
94 #[doc = "0: Block write operation to region n"]
95 DISABLE = 0,
96}
97impl From<WRITE_A> for bool {
98 #[inline(always)]
99 fn from(variant: WRITE_A) -> Self {
100 variant as u8 != 0
101 }
102}
103impl WRITE_R {
104 #[doc = "Get enumerated values variant"]
105 #[inline(always)]
106 pub fn variant(&self) -> WRITE_A {
107 match self.bits {
108 true => WRITE_A::ENABLE,
109 false => WRITE_A::DISABLE,
110 }
111 }
112 #[doc = "Checks if the value of the field is `ENABLE`"]
113 #[inline(always)]
114 pub fn is_enable(&self) -> bool {
115 *self == WRITE_A::ENABLE
116 }
117 #[doc = "Checks if the value of the field is `DISABLE`"]
118 #[inline(always)]
119 pub fn is_disable(&self) -> bool {
120 *self == WRITE_A::DISABLE
121 }
122}
123#[doc = "Field `WRITE` writer - Configure write permission for flash region n"]
124pub type WRITE_W<'a, const O: u8> = crate::BitWriter<'a, u32, PERM_SPEC, WRITE_A, O>;
125impl<'a, const O: u8> WRITE_W<'a, O> {
126 #[doc = "Allow write operation to region n"]
127 #[inline(always)]
128 pub fn enable(self) -> &'a mut W {
129 self.variant(WRITE_A::ENABLE)
130 }
131 #[doc = "Block write operation to region n"]
132 #[inline(always)]
133 pub fn disable(self) -> &'a mut W {
134 self.variant(WRITE_A::DISABLE)
135 }
136}
137#[doc = "Field `READ` reader - Configure read permissions for flash region n"]
138pub type READ_R = crate::BitReader<READ_A>;
139#[doc = "Configure read permissions for flash region n\n\nValue on reset: 1"]
140#[derive(Clone, Copy, Debug, PartialEq)]
141pub enum READ_A {
142 #[doc = "1: Allow read operation from flash region n"]
143 ENABLE = 1,
144 #[doc = "0: Block read operation from flash region n"]
145 DISABLE = 0,
146}
147impl From<READ_A> for bool {
148 #[inline(always)]
149 fn from(variant: READ_A) -> Self {
150 variant as u8 != 0
151 }
152}
153impl READ_R {
154 #[doc = "Get enumerated values variant"]
155 #[inline(always)]
156 pub fn variant(&self) -> READ_A {
157 match self.bits {
158 true => READ_A::ENABLE,
159 false => READ_A::DISABLE,
160 }
161 }
162 #[doc = "Checks if the value of the field is `ENABLE`"]
163 #[inline(always)]
164 pub fn is_enable(&self) -> bool {
165 *self == READ_A::ENABLE
166 }
167 #[doc = "Checks if the value of the field is `DISABLE`"]
168 #[inline(always)]
169 pub fn is_disable(&self) -> bool {
170 *self == READ_A::DISABLE
171 }
172}
173#[doc = "Field `READ` writer - Configure read permissions for flash region n"]
174pub type READ_W<'a, const O: u8> = crate::BitWriter<'a, u32, PERM_SPEC, READ_A, O>;
175impl<'a, const O: u8> READ_W<'a, O> {
176 #[doc = "Allow read operation from flash region n"]
177 #[inline(always)]
178 pub fn enable(self) -> &'a mut W {
179 self.variant(READ_A::ENABLE)
180 }
181 #[doc = "Block read operation from flash region n"]
182 #[inline(always)]
183 pub fn disable(self) -> &'a mut W {
184 self.variant(READ_A::DISABLE)
185 }
186}
187#[doc = "Field `SECATTR` reader - Security attribute for flash region n"]
188pub type SECATTR_R = crate::BitReader<SECATTR_A>;
189#[doc = "Security attribute for flash region n\n\nValue on reset: 1"]
190#[derive(Clone, Copy, Debug, PartialEq)]
191pub enum SECATTR_A {
192 #[doc = "0: Flash region n security attribute is non-secure"]
193 NON_SECURE = 0,
194 #[doc = "1: Flash region n security attribute is secure"]
195 SECURE = 1,
196}
197impl From<SECATTR_A> for bool {
198 #[inline(always)]
199 fn from(variant: SECATTR_A) -> Self {
200 variant as u8 != 0
201 }
202}
203impl SECATTR_R {
204 #[doc = "Get enumerated values variant"]
205 #[inline(always)]
206 pub fn variant(&self) -> SECATTR_A {
207 match self.bits {
208 false => SECATTR_A::NON_SECURE,
209 true => SECATTR_A::SECURE,
210 }
211 }
212 #[doc = "Checks if the value of the field is `NON_SECURE`"]
213 #[inline(always)]
214 pub fn is_non_secure(&self) -> bool {
215 *self == SECATTR_A::NON_SECURE
216 }
217 #[doc = "Checks if the value of the field is `SECURE`"]
218 #[inline(always)]
219 pub fn is_secure(&self) -> bool {
220 *self == SECATTR_A::SECURE
221 }
222}
223#[doc = "Field `SECATTR` writer - Security attribute for flash region n"]
224pub type SECATTR_W<'a, const O: u8> = crate::BitWriter<'a, u32, PERM_SPEC, SECATTR_A, O>;
225impl<'a, const O: u8> SECATTR_W<'a, O> {
226 #[doc = "Flash region n security attribute is non-secure"]
227 #[inline(always)]
228 pub fn non_secure(self) -> &'a mut W {
229 self.variant(SECATTR_A::NON_SECURE)
230 }
231 #[doc = "Flash region n security attribute is secure"]
232 #[inline(always)]
233 pub fn secure(self) -> &'a mut W {
234 self.variant(SECATTR_A::SECURE)
235 }
236}
237#[doc = "Field `LOCK` reader - "]
238pub type LOCK_R = crate::BitReader<LOCK_A>;
239#[doc = "\n\nValue on reset: 0"]
240#[derive(Clone, Copy, Debug, PartialEq)]
241pub enum LOCK_A {
242 #[doc = "0: This register can be updated"]
243 UNLOCKED = 0,
244 #[doc = "1: The content of this register can't be changed until the next reset"]
245 LOCKED = 1,
246}
247impl From<LOCK_A> for bool {
248 #[inline(always)]
249 fn from(variant: LOCK_A) -> Self {
250 variant as u8 != 0
251 }
252}
253impl LOCK_R {
254 #[doc = "Get enumerated values variant"]
255 #[inline(always)]
256 pub fn variant(&self) -> LOCK_A {
257 match self.bits {
258 false => LOCK_A::UNLOCKED,
259 true => LOCK_A::LOCKED,
260 }
261 }
262 #[doc = "Checks if the value of the field is `UNLOCKED`"]
263 #[inline(always)]
264 pub fn is_unlocked(&self) -> bool {
265 *self == LOCK_A::UNLOCKED
266 }
267 #[doc = "Checks if the value of the field is `LOCKED`"]
268 #[inline(always)]
269 pub fn is_locked(&self) -> bool {
270 *self == LOCK_A::LOCKED
271 }
272}
273#[doc = "Field `LOCK` writer - "]
274pub type LOCK_W<'a, const O: u8> = crate::BitWriter<'a, u32, PERM_SPEC, LOCK_A, O>;
275impl<'a, const O: u8> LOCK_W<'a, O> {
276 #[doc = "This register can be updated"]
277 #[inline(always)]
278 pub fn unlocked(self) -> &'a mut W {
279 self.variant(LOCK_A::UNLOCKED)
280 }
281 #[doc = "The content of this register can't be changed until the next reset"]
282 #[inline(always)]
283 pub fn locked(self) -> &'a mut W {
284 self.variant(LOCK_A::LOCKED)
285 }
286}
287impl R {
288 #[doc = "Bit 0 - Configure instruction fetch permissions from flash region n"]
289 #[inline(always)]
290 pub fn execute(&self) -> EXECUTE_R {
291 EXECUTE_R::new((self.bits & 1) != 0)
292 }
293 #[doc = "Bit 1 - Configure write permission for flash region n"]
294 #[inline(always)]
295 pub fn write(&self) -> WRITE_R {
296 WRITE_R::new(((self.bits >> 1) & 1) != 0)
297 }
298 #[doc = "Bit 2 - Configure read permissions for flash region n"]
299 #[inline(always)]
300 pub fn read(&self) -> READ_R {
301 READ_R::new(((self.bits >> 2) & 1) != 0)
302 }
303 #[doc = "Bit 4 - Security attribute for flash region n"]
304 #[inline(always)]
305 pub fn secattr(&self) -> SECATTR_R {
306 SECATTR_R::new(((self.bits >> 4) & 1) != 0)
307 }
308 #[doc = "Bit 8"]
309 #[inline(always)]
310 pub fn lock(&self) -> LOCK_R {
311 LOCK_R::new(((self.bits >> 8) & 1) != 0)
312 }
313}
314impl W {
315 #[doc = "Bit 0 - Configure instruction fetch permissions from flash region n"]
316 #[inline(always)]
317 pub fn execute(&mut self) -> EXECUTE_W<0> {
318 EXECUTE_W::new(self)
319 }
320 #[doc = "Bit 1 - Configure write permission for flash region n"]
321 #[inline(always)]
322 pub fn write(&mut self) -> WRITE_W<1> {
323 WRITE_W::new(self)
324 }
325 #[doc = "Bit 2 - Configure read permissions for flash region n"]
326 #[inline(always)]
327 pub fn read(&mut self) -> READ_W<2> {
328 READ_W::new(self)
329 }
330 #[doc = "Bit 4 - Security attribute for flash region n"]
331 #[inline(always)]
332 pub fn secattr(&mut self) -> SECATTR_W<4> {
333 SECATTR_W::new(self)
334 }
335 #[doc = "Bit 8"]
336 #[inline(always)]
337 pub fn lock(&mut self) -> LOCK_W<8> {
338 LOCK_W::new(self)
339 }
340 #[doc = "Writes raw bits to the register."]
341 #[inline(always)]
342 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
343 self.0.bits(bits);
344 self
345 }
346}
347#[doc = "Description cluster: Access permissions for flash region n\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 [perm](index.html) module"]
348pub struct PERM_SPEC;
349impl crate::RegisterSpec for PERM_SPEC {
350 type Ux = u32;
351}
352#[doc = "`read()` method returns [perm::R](R) reader structure"]
353impl crate::Readable for PERM_SPEC {
354 type Reader = R;
355}
356#[doc = "`write(|w| ..)` method takes [perm::W](W) writer structure"]
357impl crate::Writable for PERM_SPEC {
358 type Writer = W;
359}
360#[doc = "`reset()` method sets PERM to value 0x17"]
361impl crate::Resettable for PERM_SPEC {
362 #[inline(always)]
363 fn reset_value() -> Self::Ux {
364 0x17
365 }
366}