mimxrt685s_pac/ahb_secure_ctrl/
flexspi0_region3_rule0.rs

1#[doc = "Register `FLEXSPI0_REGION3_RULE0` reader"]
2pub type R = crate::R<Flexspi0Region3Rule0Spec>;
3#[doc = "Register `FLEXSPI0_REGION3_RULE0` writer"]
4pub type W = crate::W<Flexspi0Region3Rule0Spec>;
5#[doc = "Rule 0\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8#[repr(u8)]
9pub enum Rule0 {
10    #[doc = "0: Non-secure and non-privilege user access allowed"]
11    NonsecureNonprivUserAllowed = 0,
12    #[doc = "1: Non-secure and privilege access allowed"]
13    NonsecurePrivUserAllowed = 1,
14    #[doc = "2: Secure and non-privilege user access allowed"]
15    SecureNonprivUserAllowed = 2,
16    #[doc = "3: Secure and privilege user access allowed"]
17    SecurePrivUserAllowed = 3,
18}
19impl From<Rule0> for u8 {
20    #[inline(always)]
21    fn from(variant: Rule0) -> Self {
22        variant as _
23    }
24}
25impl crate::FieldSpec for Rule0 {
26    type Ux = u8;
27}
28impl crate::IsEnum for Rule0 {}
29#[doc = "Field `RULE0` reader - Rule 0"]
30pub type Rule0R = crate::FieldReader<Rule0>;
31impl Rule0R {
32    #[doc = "Get enumerated values variant"]
33    #[inline(always)]
34    pub const fn variant(&self) -> Rule0 {
35        match self.bits {
36            0 => Rule0::NonsecureNonprivUserAllowed,
37            1 => Rule0::NonsecurePrivUserAllowed,
38            2 => Rule0::SecureNonprivUserAllowed,
39            3 => Rule0::SecurePrivUserAllowed,
40            _ => unreachable!(),
41        }
42    }
43    #[doc = "Non-secure and non-privilege user access allowed"]
44    #[inline(always)]
45    pub fn is_nonsecure_nonpriv_user_allowed(&self) -> bool {
46        *self == Rule0::NonsecureNonprivUserAllowed
47    }
48    #[doc = "Non-secure and privilege access allowed"]
49    #[inline(always)]
50    pub fn is_nonsecure_priv_user_allowed(&self) -> bool {
51        *self == Rule0::NonsecurePrivUserAllowed
52    }
53    #[doc = "Secure and non-privilege user access allowed"]
54    #[inline(always)]
55    pub fn is_secure_nonpriv_user_allowed(&self) -> bool {
56        *self == Rule0::SecureNonprivUserAllowed
57    }
58    #[doc = "Secure and privilege user access allowed"]
59    #[inline(always)]
60    pub fn is_secure_priv_user_allowed(&self) -> bool {
61        *self == Rule0::SecurePrivUserAllowed
62    }
63}
64#[doc = "Field `RULE0` writer - Rule 0"]
65pub type Rule0W<'a, REG> = crate::FieldWriter<'a, REG, 2, Rule0, crate::Safe>;
66impl<'a, REG> Rule0W<'a, REG>
67where
68    REG: crate::Writable + crate::RegisterSpec,
69    REG::Ux: From<u8>,
70{
71    #[doc = "Non-secure and non-privilege user access allowed"]
72    #[inline(always)]
73    pub fn nonsecure_nonpriv_user_allowed(self) -> &'a mut crate::W<REG> {
74        self.variant(Rule0::NonsecureNonprivUserAllowed)
75    }
76    #[doc = "Non-secure and privilege access allowed"]
77    #[inline(always)]
78    pub fn nonsecure_priv_user_allowed(self) -> &'a mut crate::W<REG> {
79        self.variant(Rule0::NonsecurePrivUserAllowed)
80    }
81    #[doc = "Secure and non-privilege user access allowed"]
82    #[inline(always)]
83    pub fn secure_nonpriv_user_allowed(self) -> &'a mut crate::W<REG> {
84        self.variant(Rule0::SecureNonprivUserAllowed)
85    }
86    #[doc = "Secure and privilege user access allowed"]
87    #[inline(always)]
88    pub fn secure_priv_user_allowed(self) -> &'a mut crate::W<REG> {
89        self.variant(Rule0::SecurePrivUserAllowed)
90    }
91}
92#[doc = "Rule 1\n\nValue on reset: 0"]
93#[cfg_attr(feature = "defmt", derive(defmt::Format))]
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95#[repr(u8)]
96pub enum Rule1 {
97    #[doc = "0: Non-secure and non-privilege user access allowed"]
98    NonsecureNonprivUserAllowed = 0,
99    #[doc = "1: Non-secure and privilege access allowed"]
100    NonsecurePrivUserAllowed = 1,
101    #[doc = "2: Secure and non-privilege user access allowed"]
102    SecureNonprivUserAllowed = 2,
103    #[doc = "3: Secure and privilege user access allowed"]
104    SecurePrivUserAllowed = 3,
105}
106impl From<Rule1> for u8 {
107    #[inline(always)]
108    fn from(variant: Rule1) -> Self {
109        variant as _
110    }
111}
112impl crate::FieldSpec for Rule1 {
113    type Ux = u8;
114}
115impl crate::IsEnum for Rule1 {}
116#[doc = "Field `RULE1` reader - Rule 1"]
117pub type Rule1R = crate::FieldReader<Rule1>;
118impl Rule1R {
119    #[doc = "Get enumerated values variant"]
120    #[inline(always)]
121    pub const fn variant(&self) -> Rule1 {
122        match self.bits {
123            0 => Rule1::NonsecureNonprivUserAllowed,
124            1 => Rule1::NonsecurePrivUserAllowed,
125            2 => Rule1::SecureNonprivUserAllowed,
126            3 => Rule1::SecurePrivUserAllowed,
127            _ => unreachable!(),
128        }
129    }
130    #[doc = "Non-secure and non-privilege user access allowed"]
131    #[inline(always)]
132    pub fn is_nonsecure_nonpriv_user_allowed(&self) -> bool {
133        *self == Rule1::NonsecureNonprivUserAllowed
134    }
135    #[doc = "Non-secure and privilege access allowed"]
136    #[inline(always)]
137    pub fn is_nonsecure_priv_user_allowed(&self) -> bool {
138        *self == Rule1::NonsecurePrivUserAllowed
139    }
140    #[doc = "Secure and non-privilege user access allowed"]
141    #[inline(always)]
142    pub fn is_secure_nonpriv_user_allowed(&self) -> bool {
143        *self == Rule1::SecureNonprivUserAllowed
144    }
145    #[doc = "Secure and privilege user access allowed"]
146    #[inline(always)]
147    pub fn is_secure_priv_user_allowed(&self) -> bool {
148        *self == Rule1::SecurePrivUserAllowed
149    }
150}
151#[doc = "Field `RULE1` writer - Rule 1"]
152pub type Rule1W<'a, REG> = crate::FieldWriter<'a, REG, 2, Rule1, crate::Safe>;
153impl<'a, REG> Rule1W<'a, REG>
154where
155    REG: crate::Writable + crate::RegisterSpec,
156    REG::Ux: From<u8>,
157{
158    #[doc = "Non-secure and non-privilege user access allowed"]
159    #[inline(always)]
160    pub fn nonsecure_nonpriv_user_allowed(self) -> &'a mut crate::W<REG> {
161        self.variant(Rule1::NonsecureNonprivUserAllowed)
162    }
163    #[doc = "Non-secure and privilege access allowed"]
164    #[inline(always)]
165    pub fn nonsecure_priv_user_allowed(self) -> &'a mut crate::W<REG> {
166        self.variant(Rule1::NonsecurePrivUserAllowed)
167    }
168    #[doc = "Secure and non-privilege user access allowed"]
169    #[inline(always)]
170    pub fn secure_nonpriv_user_allowed(self) -> &'a mut crate::W<REG> {
171        self.variant(Rule1::SecureNonprivUserAllowed)
172    }
173    #[doc = "Secure and privilege user access allowed"]
174    #[inline(always)]
175    pub fn secure_priv_user_allowed(self) -> &'a mut crate::W<REG> {
176        self.variant(Rule1::SecurePrivUserAllowed)
177    }
178}
179#[doc = "Rule 2\n\nValue on reset: 0"]
180#[cfg_attr(feature = "defmt", derive(defmt::Format))]
181#[derive(Clone, Copy, Debug, PartialEq, Eq)]
182#[repr(u8)]
183pub enum Rule2 {
184    #[doc = "0: Non-secure and non-privilege user access allowed"]
185    NonsecureNonprivUserAllowed = 0,
186    #[doc = "1: Non-secure and privilege access allowed"]
187    NonsecurePrivUserAllowed = 1,
188    #[doc = "2: Secure and non-privilege user access allowed"]
189    SecureNonprivUserAllowed = 2,
190    #[doc = "3: Secure and privilege user access allowed"]
191    SecurePrivUserAllowed = 3,
192}
193impl From<Rule2> for u8 {
194    #[inline(always)]
195    fn from(variant: Rule2) -> Self {
196        variant as _
197    }
198}
199impl crate::FieldSpec for Rule2 {
200    type Ux = u8;
201}
202impl crate::IsEnum for Rule2 {}
203#[doc = "Field `RULE2` reader - Rule 2"]
204pub type Rule2R = crate::FieldReader<Rule2>;
205impl Rule2R {
206    #[doc = "Get enumerated values variant"]
207    #[inline(always)]
208    pub const fn variant(&self) -> Rule2 {
209        match self.bits {
210            0 => Rule2::NonsecureNonprivUserAllowed,
211            1 => Rule2::NonsecurePrivUserAllowed,
212            2 => Rule2::SecureNonprivUserAllowed,
213            3 => Rule2::SecurePrivUserAllowed,
214            _ => unreachable!(),
215        }
216    }
217    #[doc = "Non-secure and non-privilege user access allowed"]
218    #[inline(always)]
219    pub fn is_nonsecure_nonpriv_user_allowed(&self) -> bool {
220        *self == Rule2::NonsecureNonprivUserAllowed
221    }
222    #[doc = "Non-secure and privilege access allowed"]
223    #[inline(always)]
224    pub fn is_nonsecure_priv_user_allowed(&self) -> bool {
225        *self == Rule2::NonsecurePrivUserAllowed
226    }
227    #[doc = "Secure and non-privilege user access allowed"]
228    #[inline(always)]
229    pub fn is_secure_nonpriv_user_allowed(&self) -> bool {
230        *self == Rule2::SecureNonprivUserAllowed
231    }
232    #[doc = "Secure and privilege user access allowed"]
233    #[inline(always)]
234    pub fn is_secure_priv_user_allowed(&self) -> bool {
235        *self == Rule2::SecurePrivUserAllowed
236    }
237}
238#[doc = "Field `RULE2` writer - Rule 2"]
239pub type Rule2W<'a, REG> = crate::FieldWriter<'a, REG, 2, Rule2, crate::Safe>;
240impl<'a, REG> Rule2W<'a, REG>
241where
242    REG: crate::Writable + crate::RegisterSpec,
243    REG::Ux: From<u8>,
244{
245    #[doc = "Non-secure and non-privilege user access allowed"]
246    #[inline(always)]
247    pub fn nonsecure_nonpriv_user_allowed(self) -> &'a mut crate::W<REG> {
248        self.variant(Rule2::NonsecureNonprivUserAllowed)
249    }
250    #[doc = "Non-secure and privilege access allowed"]
251    #[inline(always)]
252    pub fn nonsecure_priv_user_allowed(self) -> &'a mut crate::W<REG> {
253        self.variant(Rule2::NonsecurePrivUserAllowed)
254    }
255    #[doc = "Secure and non-privilege user access allowed"]
256    #[inline(always)]
257    pub fn secure_nonpriv_user_allowed(self) -> &'a mut crate::W<REG> {
258        self.variant(Rule2::SecureNonprivUserAllowed)
259    }
260    #[doc = "Secure and privilege user access allowed"]
261    #[inline(always)]
262    pub fn secure_priv_user_allowed(self) -> &'a mut crate::W<REG> {
263        self.variant(Rule2::SecurePrivUserAllowed)
264    }
265}
266#[doc = "Rule 3\n\nValue on reset: 0"]
267#[cfg_attr(feature = "defmt", derive(defmt::Format))]
268#[derive(Clone, Copy, Debug, PartialEq, Eq)]
269#[repr(u8)]
270pub enum Rule3 {
271    #[doc = "0: Non-secure and non-privilege user access allowed"]
272    NonsecureNonprivUserAllowed = 0,
273    #[doc = "1: Non-secure and privilege access allowed"]
274    NonsecurePrivUserAllowed = 1,
275    #[doc = "2: Secure and non-privilege user access allowed"]
276    SecureNonprivUserAllowed = 2,
277    #[doc = "3: Secure and privilege user access allowed"]
278    SecurePrivUserAllowed = 3,
279}
280impl From<Rule3> for u8 {
281    #[inline(always)]
282    fn from(variant: Rule3) -> Self {
283        variant as _
284    }
285}
286impl crate::FieldSpec for Rule3 {
287    type Ux = u8;
288}
289impl crate::IsEnum for Rule3 {}
290#[doc = "Field `RULE3` reader - Rule 3"]
291pub type Rule3R = crate::FieldReader<Rule3>;
292impl Rule3R {
293    #[doc = "Get enumerated values variant"]
294    #[inline(always)]
295    pub const fn variant(&self) -> Rule3 {
296        match self.bits {
297            0 => Rule3::NonsecureNonprivUserAllowed,
298            1 => Rule3::NonsecurePrivUserAllowed,
299            2 => Rule3::SecureNonprivUserAllowed,
300            3 => Rule3::SecurePrivUserAllowed,
301            _ => unreachable!(),
302        }
303    }
304    #[doc = "Non-secure and non-privilege user access allowed"]
305    #[inline(always)]
306    pub fn is_nonsecure_nonpriv_user_allowed(&self) -> bool {
307        *self == Rule3::NonsecureNonprivUserAllowed
308    }
309    #[doc = "Non-secure and privilege access allowed"]
310    #[inline(always)]
311    pub fn is_nonsecure_priv_user_allowed(&self) -> bool {
312        *self == Rule3::NonsecurePrivUserAllowed
313    }
314    #[doc = "Secure and non-privilege user access allowed"]
315    #[inline(always)]
316    pub fn is_secure_nonpriv_user_allowed(&self) -> bool {
317        *self == Rule3::SecureNonprivUserAllowed
318    }
319    #[doc = "Secure and privilege user access allowed"]
320    #[inline(always)]
321    pub fn is_secure_priv_user_allowed(&self) -> bool {
322        *self == Rule3::SecurePrivUserAllowed
323    }
324}
325#[doc = "Field `RULE3` writer - Rule 3"]
326pub type Rule3W<'a, REG> = crate::FieldWriter<'a, REG, 2, Rule3, crate::Safe>;
327impl<'a, REG> Rule3W<'a, REG>
328where
329    REG: crate::Writable + crate::RegisterSpec,
330    REG::Ux: From<u8>,
331{
332    #[doc = "Non-secure and non-privilege user access allowed"]
333    #[inline(always)]
334    pub fn nonsecure_nonpriv_user_allowed(self) -> &'a mut crate::W<REG> {
335        self.variant(Rule3::NonsecureNonprivUserAllowed)
336    }
337    #[doc = "Non-secure and privilege access allowed"]
338    #[inline(always)]
339    pub fn nonsecure_priv_user_allowed(self) -> &'a mut crate::W<REG> {
340        self.variant(Rule3::NonsecurePrivUserAllowed)
341    }
342    #[doc = "Secure and non-privilege user access allowed"]
343    #[inline(always)]
344    pub fn secure_nonpriv_user_allowed(self) -> &'a mut crate::W<REG> {
345        self.variant(Rule3::SecureNonprivUserAllowed)
346    }
347    #[doc = "Secure and privilege user access allowed"]
348    #[inline(always)]
349    pub fn secure_priv_user_allowed(self) -> &'a mut crate::W<REG> {
350        self.variant(Rule3::SecurePrivUserAllowed)
351    }
352}
353impl R {
354    #[doc = "Bits 0:1 - Rule 0"]
355    #[inline(always)]
356    pub fn rule0(&self) -> Rule0R {
357        Rule0R::new((self.bits & 3) as u8)
358    }
359    #[doc = "Bits 4:5 - Rule 1"]
360    #[inline(always)]
361    pub fn rule1(&self) -> Rule1R {
362        Rule1R::new(((self.bits >> 4) & 3) as u8)
363    }
364    #[doc = "Bits 8:9 - Rule 2"]
365    #[inline(always)]
366    pub fn rule2(&self) -> Rule2R {
367        Rule2R::new(((self.bits >> 8) & 3) as u8)
368    }
369    #[doc = "Bits 12:13 - Rule 3"]
370    #[inline(always)]
371    pub fn rule3(&self) -> Rule3R {
372        Rule3R::new(((self.bits >> 12) & 3) as u8)
373    }
374}
375#[cfg(feature = "debug")]
376impl core::fmt::Debug for R {
377    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
378        f.debug_struct("FLEXSPI0_REGION3_RULE0")
379            .field("rule0", &self.rule0())
380            .field("rule1", &self.rule1())
381            .field("rule2", &self.rule2())
382            .field("rule3", &self.rule3())
383            .finish()
384    }
385}
386impl W {
387    #[doc = "Bits 0:1 - Rule 0"]
388    #[inline(always)]
389    pub fn rule0(&mut self) -> Rule0W<Flexspi0Region3Rule0Spec> {
390        Rule0W::new(self, 0)
391    }
392    #[doc = "Bits 4:5 - Rule 1"]
393    #[inline(always)]
394    pub fn rule1(&mut self) -> Rule1W<Flexspi0Region3Rule0Spec> {
395        Rule1W::new(self, 4)
396    }
397    #[doc = "Bits 8:9 - Rule 2"]
398    #[inline(always)]
399    pub fn rule2(&mut self) -> Rule2W<Flexspi0Region3Rule0Spec> {
400        Rule2W::new(self, 8)
401    }
402    #[doc = "Bits 12:13 - Rule 3"]
403    #[inline(always)]
404    pub fn rule3(&mut self) -> Rule3W<Flexspi0Region3Rule0Spec> {
405        Rule3W::new(self, 12)
406    }
407}
408#[doc = "FLEXSPI0 Region 3 Rule 0 Register\n\nYou can [`read`](crate::Reg::read) this register and get [`flexspi0_region3_rule0::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`flexspi0_region3_rule0::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
409pub struct Flexspi0Region3Rule0Spec;
410impl crate::RegisterSpec for Flexspi0Region3Rule0Spec {
411    type Ux = u32;
412}
413#[doc = "`read()` method returns [`flexspi0_region3_rule0::R`](R) reader structure"]
414impl crate::Readable for Flexspi0Region3Rule0Spec {}
415#[doc = "`write(|w| ..)` method takes [`flexspi0_region3_rule0::W`](W) writer structure"]
416impl crate::Writable for Flexspi0Region3Rule0Spec {
417    type Safety = crate::Unsafe;
418    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
419    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
420}
421#[doc = "`reset()` method sets FLEXSPI0_REGION3_RULE0 to value 0"]
422impl crate::Resettable for Flexspi0Region3Rule0Spec {
423    const RESET_VALUE: u32 = 0;
424}