lpc550x/ahb_secure_ctrl/
sec_ctrl_ram2_mem_rule0.rs

1#[doc = "Register `SEC_CTRL_RAM2_MEM_RULE0` reader"]
2pub struct R(crate::R<SEC_CTRL_RAM2_MEM_RULE0_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SEC_CTRL_RAM2_MEM_RULE0_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SEC_CTRL_RAM2_MEM_RULE0_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SEC_CTRL_RAM2_MEM_RULE0_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SEC_CTRL_RAM2_MEM_RULE0` writer"]
17pub struct W(crate::W<SEC_CTRL_RAM2_MEM_RULE0_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SEC_CTRL_RAM2_MEM_RULE0_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<SEC_CTRL_RAM2_MEM_RULE0_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SEC_CTRL_RAM2_MEM_RULE0_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `RULE0` reader - secure control rule0. it can be set when check_reg's write_lock is '0'"]
38pub type RULE0_R = crate::FieldReader<u8, RULE0_A>;
39#[doc = "secure control rule0. it can be set when check_reg's write_lock is '0'\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum RULE0_A {
43    #[doc = "0: Non-secure and Non-priviledge user access allowed."]
44    ENUM_NS_NP = 0,
45    #[doc = "1: Non-secure and Privilege access allowed."]
46    ENUM_NS_P = 1,
47    #[doc = "2: Secure and Non-priviledge user access allowed."]
48    ENUM_S_NP = 2,
49    #[doc = "3: Secure and Priviledge user access allowed."]
50    ENUM_S_P = 3,
51}
52impl From<RULE0_A> for u8 {
53    #[inline(always)]
54    fn from(variant: RULE0_A) -> Self {
55        variant as _
56    }
57}
58impl RULE0_R {
59    #[doc = "Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> RULE0_A {
62        match self.bits {
63            0 => RULE0_A::ENUM_NS_NP,
64            1 => RULE0_A::ENUM_NS_P,
65            2 => RULE0_A::ENUM_S_NP,
66            3 => RULE0_A::ENUM_S_P,
67            _ => unreachable!(),
68        }
69    }
70    #[doc = "Checks if the value of the field is `ENUM_NS_NP`"]
71    #[inline(always)]
72    pub fn is_enum_ns_np(&self) -> bool {
73        *self == RULE0_A::ENUM_NS_NP
74    }
75    #[doc = "Checks if the value of the field is `ENUM_NS_P`"]
76    #[inline(always)]
77    pub fn is_enum_ns_p(&self) -> bool {
78        *self == RULE0_A::ENUM_NS_P
79    }
80    #[doc = "Checks if the value of the field is `ENUM_S_NP`"]
81    #[inline(always)]
82    pub fn is_enum_s_np(&self) -> bool {
83        *self == RULE0_A::ENUM_S_NP
84    }
85    #[doc = "Checks if the value of the field is `ENUM_S_P`"]
86    #[inline(always)]
87    pub fn is_enum_s_p(&self) -> bool {
88        *self == RULE0_A::ENUM_S_P
89    }
90}
91#[doc = "Field `RULE0` writer - secure control rule0. it can be set when check_reg's write_lock is '0'"]
92pub type RULE0_W<'a, const O: u8> =
93    crate::FieldWriterSafe<'a, u32, SEC_CTRL_RAM2_MEM_RULE0_SPEC, u8, RULE0_A, 2, O>;
94impl<'a, const O: u8> RULE0_W<'a, O> {
95    #[doc = "Non-secure and Non-priviledge user access allowed."]
96    #[inline(always)]
97    pub fn enum_ns_np(self) -> &'a mut W {
98        self.variant(RULE0_A::ENUM_NS_NP)
99    }
100    #[doc = "Non-secure and Privilege access allowed."]
101    #[inline(always)]
102    pub fn enum_ns_p(self) -> &'a mut W {
103        self.variant(RULE0_A::ENUM_NS_P)
104    }
105    #[doc = "Secure and Non-priviledge user access allowed."]
106    #[inline(always)]
107    pub fn enum_s_np(self) -> &'a mut W {
108        self.variant(RULE0_A::ENUM_S_NP)
109    }
110    #[doc = "Secure and Priviledge user access allowed."]
111    #[inline(always)]
112    pub fn enum_s_p(self) -> &'a mut W {
113        self.variant(RULE0_A::ENUM_S_P)
114    }
115}
116#[doc = "Field `RULE1` reader - secure control rule1. it can be set when check_reg's write_lock is '0'"]
117pub type RULE1_R = crate::FieldReader<u8, RULE1_A>;
118#[doc = "secure control rule1. it can be set when check_reg's write_lock is '0'\n\nValue on reset: 0"]
119#[derive(Clone, Copy, Debug, PartialEq, Eq)]
120#[repr(u8)]
121pub enum RULE1_A {
122    #[doc = "0: Non-secure and Non-priviledge user access allowed."]
123    ENUM_NS_NP = 0,
124    #[doc = "1: Non-secure and Privilege access allowed."]
125    ENUM_NS_P = 1,
126    #[doc = "2: Secure and Non-priviledge user access allowed."]
127    ENUM_S_NP = 2,
128    #[doc = "3: Secure and Priviledge user access allowed."]
129    ENUM_S_P = 3,
130}
131impl From<RULE1_A> for u8 {
132    #[inline(always)]
133    fn from(variant: RULE1_A) -> Self {
134        variant as _
135    }
136}
137impl RULE1_R {
138    #[doc = "Get enumerated values variant"]
139    #[inline(always)]
140    pub fn variant(&self) -> RULE1_A {
141        match self.bits {
142            0 => RULE1_A::ENUM_NS_NP,
143            1 => RULE1_A::ENUM_NS_P,
144            2 => RULE1_A::ENUM_S_NP,
145            3 => RULE1_A::ENUM_S_P,
146            _ => unreachable!(),
147        }
148    }
149    #[doc = "Checks if the value of the field is `ENUM_NS_NP`"]
150    #[inline(always)]
151    pub fn is_enum_ns_np(&self) -> bool {
152        *self == RULE1_A::ENUM_NS_NP
153    }
154    #[doc = "Checks if the value of the field is `ENUM_NS_P`"]
155    #[inline(always)]
156    pub fn is_enum_ns_p(&self) -> bool {
157        *self == RULE1_A::ENUM_NS_P
158    }
159    #[doc = "Checks if the value of the field is `ENUM_S_NP`"]
160    #[inline(always)]
161    pub fn is_enum_s_np(&self) -> bool {
162        *self == RULE1_A::ENUM_S_NP
163    }
164    #[doc = "Checks if the value of the field is `ENUM_S_P`"]
165    #[inline(always)]
166    pub fn is_enum_s_p(&self) -> bool {
167        *self == RULE1_A::ENUM_S_P
168    }
169}
170#[doc = "Field `RULE1` writer - secure control rule1. it can be set when check_reg's write_lock is '0'"]
171pub type RULE1_W<'a, const O: u8> =
172    crate::FieldWriterSafe<'a, u32, SEC_CTRL_RAM2_MEM_RULE0_SPEC, u8, RULE1_A, 2, O>;
173impl<'a, const O: u8> RULE1_W<'a, O> {
174    #[doc = "Non-secure and Non-priviledge user access allowed."]
175    #[inline(always)]
176    pub fn enum_ns_np(self) -> &'a mut W {
177        self.variant(RULE1_A::ENUM_NS_NP)
178    }
179    #[doc = "Non-secure and Privilege access allowed."]
180    #[inline(always)]
181    pub fn enum_ns_p(self) -> &'a mut W {
182        self.variant(RULE1_A::ENUM_NS_P)
183    }
184    #[doc = "Secure and Non-priviledge user access allowed."]
185    #[inline(always)]
186    pub fn enum_s_np(self) -> &'a mut W {
187        self.variant(RULE1_A::ENUM_S_NP)
188    }
189    #[doc = "Secure and Priviledge user access allowed."]
190    #[inline(always)]
191    pub fn enum_s_p(self) -> &'a mut W {
192        self.variant(RULE1_A::ENUM_S_P)
193    }
194}
195#[doc = "Field `RULE2` reader - secure control rule2. it can be set when check_reg's write_lock is '0'"]
196pub type RULE2_R = crate::FieldReader<u8, RULE2_A>;
197#[doc = "secure control rule2. it can be set when check_reg's write_lock is '0'\n\nValue on reset: 0"]
198#[derive(Clone, Copy, Debug, PartialEq, Eq)]
199#[repr(u8)]
200pub enum RULE2_A {
201    #[doc = "0: Non-secure and Non-priviledge user access allowed."]
202    ENUM_NS_NP = 0,
203    #[doc = "1: Non-secure and Privilege access allowed."]
204    ENUM_NS_P = 1,
205    #[doc = "2: Secure and Non-priviledge user access allowed."]
206    ENUM_S_NP = 2,
207    #[doc = "3: Secure and Priviledge user access allowed."]
208    ENUM_S_P = 3,
209}
210impl From<RULE2_A> for u8 {
211    #[inline(always)]
212    fn from(variant: RULE2_A) -> Self {
213        variant as _
214    }
215}
216impl RULE2_R {
217    #[doc = "Get enumerated values variant"]
218    #[inline(always)]
219    pub fn variant(&self) -> RULE2_A {
220        match self.bits {
221            0 => RULE2_A::ENUM_NS_NP,
222            1 => RULE2_A::ENUM_NS_P,
223            2 => RULE2_A::ENUM_S_NP,
224            3 => RULE2_A::ENUM_S_P,
225            _ => unreachable!(),
226        }
227    }
228    #[doc = "Checks if the value of the field is `ENUM_NS_NP`"]
229    #[inline(always)]
230    pub fn is_enum_ns_np(&self) -> bool {
231        *self == RULE2_A::ENUM_NS_NP
232    }
233    #[doc = "Checks if the value of the field is `ENUM_NS_P`"]
234    #[inline(always)]
235    pub fn is_enum_ns_p(&self) -> bool {
236        *self == RULE2_A::ENUM_NS_P
237    }
238    #[doc = "Checks if the value of the field is `ENUM_S_NP`"]
239    #[inline(always)]
240    pub fn is_enum_s_np(&self) -> bool {
241        *self == RULE2_A::ENUM_S_NP
242    }
243    #[doc = "Checks if the value of the field is `ENUM_S_P`"]
244    #[inline(always)]
245    pub fn is_enum_s_p(&self) -> bool {
246        *self == RULE2_A::ENUM_S_P
247    }
248}
249#[doc = "Field `RULE2` writer - secure control rule2. it can be set when check_reg's write_lock is '0'"]
250pub type RULE2_W<'a, const O: u8> =
251    crate::FieldWriterSafe<'a, u32, SEC_CTRL_RAM2_MEM_RULE0_SPEC, u8, RULE2_A, 2, O>;
252impl<'a, const O: u8> RULE2_W<'a, O> {
253    #[doc = "Non-secure and Non-priviledge user access allowed."]
254    #[inline(always)]
255    pub fn enum_ns_np(self) -> &'a mut W {
256        self.variant(RULE2_A::ENUM_NS_NP)
257    }
258    #[doc = "Non-secure and Privilege access allowed."]
259    #[inline(always)]
260    pub fn enum_ns_p(self) -> &'a mut W {
261        self.variant(RULE2_A::ENUM_NS_P)
262    }
263    #[doc = "Secure and Non-priviledge user access allowed."]
264    #[inline(always)]
265    pub fn enum_s_np(self) -> &'a mut W {
266        self.variant(RULE2_A::ENUM_S_NP)
267    }
268    #[doc = "Secure and Priviledge user access allowed."]
269    #[inline(always)]
270    pub fn enum_s_p(self) -> &'a mut W {
271        self.variant(RULE2_A::ENUM_S_P)
272    }
273}
274#[doc = "Field `RULE3` reader - secure control rule3. it can be set when check_reg's write_lock is '0'"]
275pub type RULE3_R = crate::FieldReader<u8, RULE3_A>;
276#[doc = "secure control rule3. it can be set when check_reg's write_lock is '0'\n\nValue on reset: 0"]
277#[derive(Clone, Copy, Debug, PartialEq, Eq)]
278#[repr(u8)]
279pub enum RULE3_A {
280    #[doc = "0: Non-secure and Non-priviledge user access allowed."]
281    ENUM_NS_NP = 0,
282    #[doc = "1: Non-secure and Privilege access allowed."]
283    ENUM_NS_P = 1,
284    #[doc = "2: Secure and Non-priviledge user access allowed."]
285    ENUM_S_NP = 2,
286    #[doc = "3: Secure and Priviledge user access allowed."]
287    ENUM_S_P = 3,
288}
289impl From<RULE3_A> for u8 {
290    #[inline(always)]
291    fn from(variant: RULE3_A) -> Self {
292        variant as _
293    }
294}
295impl RULE3_R {
296    #[doc = "Get enumerated values variant"]
297    #[inline(always)]
298    pub fn variant(&self) -> RULE3_A {
299        match self.bits {
300            0 => RULE3_A::ENUM_NS_NP,
301            1 => RULE3_A::ENUM_NS_P,
302            2 => RULE3_A::ENUM_S_NP,
303            3 => RULE3_A::ENUM_S_P,
304            _ => unreachable!(),
305        }
306    }
307    #[doc = "Checks if the value of the field is `ENUM_NS_NP`"]
308    #[inline(always)]
309    pub fn is_enum_ns_np(&self) -> bool {
310        *self == RULE3_A::ENUM_NS_NP
311    }
312    #[doc = "Checks if the value of the field is `ENUM_NS_P`"]
313    #[inline(always)]
314    pub fn is_enum_ns_p(&self) -> bool {
315        *self == RULE3_A::ENUM_NS_P
316    }
317    #[doc = "Checks if the value of the field is `ENUM_S_NP`"]
318    #[inline(always)]
319    pub fn is_enum_s_np(&self) -> bool {
320        *self == RULE3_A::ENUM_S_NP
321    }
322    #[doc = "Checks if the value of the field is `ENUM_S_P`"]
323    #[inline(always)]
324    pub fn is_enum_s_p(&self) -> bool {
325        *self == RULE3_A::ENUM_S_P
326    }
327}
328#[doc = "Field `RULE3` writer - secure control rule3. it can be set when check_reg's write_lock is '0'"]
329pub type RULE3_W<'a, const O: u8> =
330    crate::FieldWriterSafe<'a, u32, SEC_CTRL_RAM2_MEM_RULE0_SPEC, u8, RULE3_A, 2, O>;
331impl<'a, const O: u8> RULE3_W<'a, O> {
332    #[doc = "Non-secure and Non-priviledge user access allowed."]
333    #[inline(always)]
334    pub fn enum_ns_np(self) -> &'a mut W {
335        self.variant(RULE3_A::ENUM_NS_NP)
336    }
337    #[doc = "Non-secure and Privilege access allowed."]
338    #[inline(always)]
339    pub fn enum_ns_p(self) -> &'a mut W {
340        self.variant(RULE3_A::ENUM_NS_P)
341    }
342    #[doc = "Secure and Non-priviledge user access allowed."]
343    #[inline(always)]
344    pub fn enum_s_np(self) -> &'a mut W {
345        self.variant(RULE3_A::ENUM_S_NP)
346    }
347    #[doc = "Secure and Priviledge user access allowed."]
348    #[inline(always)]
349    pub fn enum_s_p(self) -> &'a mut W {
350        self.variant(RULE3_A::ENUM_S_P)
351    }
352}
353impl R {
354    #[doc = "Bits 0:1 - secure control rule0. it can be set when check_reg's write_lock is '0'"]
355    #[inline(always)]
356    pub fn rule0(&self) -> RULE0_R {
357        RULE0_R::new((self.bits & 3) as u8)
358    }
359    #[doc = "Bits 4:5 - secure control rule1. it can be set when check_reg's write_lock is '0'"]
360    #[inline(always)]
361    pub fn rule1(&self) -> RULE1_R {
362        RULE1_R::new(((self.bits >> 4) & 3) as u8)
363    }
364    #[doc = "Bits 8:9 - secure control rule2. it can be set when check_reg's write_lock is '0'"]
365    #[inline(always)]
366    pub fn rule2(&self) -> RULE2_R {
367        RULE2_R::new(((self.bits >> 8) & 3) as u8)
368    }
369    #[doc = "Bits 12:13 - secure control rule3. it can be set when check_reg's write_lock is '0'"]
370    #[inline(always)]
371    pub fn rule3(&self) -> RULE3_R {
372        RULE3_R::new(((self.bits >> 12) & 3) as u8)
373    }
374}
375impl W {
376    #[doc = "Bits 0:1 - secure control rule0. it can be set when check_reg's write_lock is '0'"]
377    #[inline(always)]
378    pub fn rule0(&mut self) -> RULE0_W<0> {
379        RULE0_W::new(self)
380    }
381    #[doc = "Bits 4:5 - secure control rule1. it can be set when check_reg's write_lock is '0'"]
382    #[inline(always)]
383    pub fn rule1(&mut self) -> RULE1_W<4> {
384        RULE1_W::new(self)
385    }
386    #[doc = "Bits 8:9 - secure control rule2. it can be set when check_reg's write_lock is '0'"]
387    #[inline(always)]
388    pub fn rule2(&mut self) -> RULE2_W<8> {
389        RULE2_W::new(self)
390    }
391    #[doc = "Bits 12:13 - secure control rule3. it can be set when check_reg's write_lock is '0'"]
392    #[inline(always)]
393    pub fn rule3(&mut self) -> RULE3_W<12> {
394        RULE3_W::new(self)
395    }
396    #[doc = "Writes raw bits to the register."]
397    #[inline(always)]
398    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
399        self.0.bits(bits);
400        self
401    }
402}
403#[doc = "Security access rules for RAM2 slaves.\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 [sec_ctrl_ram2_mem_rule0](index.html) module"]
404pub struct SEC_CTRL_RAM2_MEM_RULE0_SPEC;
405impl crate::RegisterSpec for SEC_CTRL_RAM2_MEM_RULE0_SPEC {
406    type Ux = u32;
407}
408#[doc = "`read()` method returns [sec_ctrl_ram2_mem_rule0::R](R) reader structure"]
409impl crate::Readable for SEC_CTRL_RAM2_MEM_RULE0_SPEC {
410    type Reader = R;
411}
412#[doc = "`write(|w| ..)` method takes [sec_ctrl_ram2_mem_rule0::W](W) writer structure"]
413impl crate::Writable for SEC_CTRL_RAM2_MEM_RULE0_SPEC {
414    type Writer = W;
415}
416#[doc = "`reset()` method sets SEC_CTRL_RAM2_MEM_RULE0 to value 0"]
417impl crate::Resettable for SEC_CTRL_RAM2_MEM_RULE0_SPEC {
418    #[inline(always)]
419    fn reset_value() -> Self::Ux {
420        0
421    }
422}