lpc550x/ahb_secure_ctrl/
sec_mask_lock.rs

1#[doc = "Register `SEC_MASK_LOCK` reader"]
2pub struct R(crate::R<SEC_MASK_LOCK_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SEC_MASK_LOCK_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SEC_MASK_LOCK_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SEC_MASK_LOCK_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SEC_MASK_LOCK` writer"]
17pub struct W(crate::W<SEC_MASK_LOCK_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SEC_MASK_LOCK_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_MASK_LOCK_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SEC_MASK_LOCK_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `SEC_GPIO_MASK0_LOCK` reader - SEC_GPIO_MASK0 register write-lock."]
38pub type SEC_GPIO_MASK0_LOCK_R = crate::FieldReader<u8, SEC_GPIO_MASK0_LOCK_A>;
39#[doc = "SEC_GPIO_MASK0 register write-lock.\n\nValue on reset: 2"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum SEC_GPIO_MASK0_LOCK_A {
43    #[doc = "1: Restricted mode."]
44    BLOCKED = 1,
45    #[doc = "2: Writable."]
46    WRITABLE = 2,
47}
48impl From<SEC_GPIO_MASK0_LOCK_A> for u8 {
49    #[inline(always)]
50    fn from(variant: SEC_GPIO_MASK0_LOCK_A) -> Self {
51        variant as _
52    }
53}
54impl SEC_GPIO_MASK0_LOCK_R {
55    #[doc = "Get enumerated values variant"]
56    #[inline(always)]
57    pub fn variant(&self) -> Option<SEC_GPIO_MASK0_LOCK_A> {
58        match self.bits {
59            1 => Some(SEC_GPIO_MASK0_LOCK_A::BLOCKED),
60            2 => Some(SEC_GPIO_MASK0_LOCK_A::WRITABLE),
61            _ => None,
62        }
63    }
64    #[doc = "Checks if the value of the field is `BLOCKED`"]
65    #[inline(always)]
66    pub fn is_blocked(&self) -> bool {
67        *self == SEC_GPIO_MASK0_LOCK_A::BLOCKED
68    }
69    #[doc = "Checks if the value of the field is `WRITABLE`"]
70    #[inline(always)]
71    pub fn is_writable(&self) -> bool {
72        *self == SEC_GPIO_MASK0_LOCK_A::WRITABLE
73    }
74}
75#[doc = "Field `SEC_GPIO_MASK0_LOCK` writer - SEC_GPIO_MASK0 register write-lock."]
76pub type SEC_GPIO_MASK0_LOCK_W<'a, const O: u8> =
77    crate::FieldWriter<'a, u32, SEC_MASK_LOCK_SPEC, u8, SEC_GPIO_MASK0_LOCK_A, 2, O>;
78impl<'a, const O: u8> SEC_GPIO_MASK0_LOCK_W<'a, O> {
79    #[doc = "Restricted mode."]
80    #[inline(always)]
81    pub fn blocked(self) -> &'a mut W {
82        self.variant(SEC_GPIO_MASK0_LOCK_A::BLOCKED)
83    }
84    #[doc = "Writable."]
85    #[inline(always)]
86    pub fn writable(self) -> &'a mut W {
87        self.variant(SEC_GPIO_MASK0_LOCK_A::WRITABLE)
88    }
89}
90#[doc = "Field `SEC_GPIO_MASK1_LOCK` reader - SEC_GPIO_MASK1 register write-lock."]
91pub type SEC_GPIO_MASK1_LOCK_R = crate::FieldReader<u8, SEC_GPIO_MASK1_LOCK_A>;
92#[doc = "SEC_GPIO_MASK1 register write-lock.\n\nValue on reset: 2"]
93#[derive(Clone, Copy, Debug, PartialEq, Eq)]
94#[repr(u8)]
95pub enum SEC_GPIO_MASK1_LOCK_A {
96    #[doc = "1: Restricted mode."]
97    BLOCKED = 1,
98    #[doc = "2: Writable."]
99    WRITABLE = 2,
100}
101impl From<SEC_GPIO_MASK1_LOCK_A> for u8 {
102    #[inline(always)]
103    fn from(variant: SEC_GPIO_MASK1_LOCK_A) -> Self {
104        variant as _
105    }
106}
107impl SEC_GPIO_MASK1_LOCK_R {
108    #[doc = "Get enumerated values variant"]
109    #[inline(always)]
110    pub fn variant(&self) -> Option<SEC_GPIO_MASK1_LOCK_A> {
111        match self.bits {
112            1 => Some(SEC_GPIO_MASK1_LOCK_A::BLOCKED),
113            2 => Some(SEC_GPIO_MASK1_LOCK_A::WRITABLE),
114            _ => None,
115        }
116    }
117    #[doc = "Checks if the value of the field is `BLOCKED`"]
118    #[inline(always)]
119    pub fn is_blocked(&self) -> bool {
120        *self == SEC_GPIO_MASK1_LOCK_A::BLOCKED
121    }
122    #[doc = "Checks if the value of the field is `WRITABLE`"]
123    #[inline(always)]
124    pub fn is_writable(&self) -> bool {
125        *self == SEC_GPIO_MASK1_LOCK_A::WRITABLE
126    }
127}
128#[doc = "Field `SEC_GPIO_MASK1_LOCK` writer - SEC_GPIO_MASK1 register write-lock."]
129pub type SEC_GPIO_MASK1_LOCK_W<'a, const O: u8> =
130    crate::FieldWriter<'a, u32, SEC_MASK_LOCK_SPEC, u8, SEC_GPIO_MASK1_LOCK_A, 2, O>;
131impl<'a, const O: u8> SEC_GPIO_MASK1_LOCK_W<'a, O> {
132    #[doc = "Restricted mode."]
133    #[inline(always)]
134    pub fn blocked(self) -> &'a mut W {
135        self.variant(SEC_GPIO_MASK1_LOCK_A::BLOCKED)
136    }
137    #[doc = "Writable."]
138    #[inline(always)]
139    pub fn writable(self) -> &'a mut W {
140        self.variant(SEC_GPIO_MASK1_LOCK_A::WRITABLE)
141    }
142}
143impl R {
144    #[doc = "Bits 0:1 - SEC_GPIO_MASK0 register write-lock."]
145    #[inline(always)]
146    pub fn sec_gpio_mask0_lock(&self) -> SEC_GPIO_MASK0_LOCK_R {
147        SEC_GPIO_MASK0_LOCK_R::new((self.bits & 3) as u8)
148    }
149    #[doc = "Bits 2:3 - SEC_GPIO_MASK1 register write-lock."]
150    #[inline(always)]
151    pub fn sec_gpio_mask1_lock(&self) -> SEC_GPIO_MASK1_LOCK_R {
152        SEC_GPIO_MASK1_LOCK_R::new(((self.bits >> 2) & 3) as u8)
153    }
154}
155impl W {
156    #[doc = "Bits 0:1 - SEC_GPIO_MASK0 register write-lock."]
157    #[inline(always)]
158    pub fn sec_gpio_mask0_lock(&mut self) -> SEC_GPIO_MASK0_LOCK_W<0> {
159        SEC_GPIO_MASK0_LOCK_W::new(self)
160    }
161    #[doc = "Bits 2:3 - SEC_GPIO_MASK1 register write-lock."]
162    #[inline(always)]
163    pub fn sec_gpio_mask1_lock(&mut self) -> SEC_GPIO_MASK1_LOCK_W<2> {
164        SEC_GPIO_MASK1_LOCK_W::new(self)
165    }
166    #[doc = "Writes raw bits to the register."]
167    #[inline(always)]
168    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
169        self.0.bits(bits);
170        self
171    }
172}
173#[doc = "Security General Purpose register access control.\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_mask_lock](index.html) module"]
174pub struct SEC_MASK_LOCK_SPEC;
175impl crate::RegisterSpec for SEC_MASK_LOCK_SPEC {
176    type Ux = u32;
177}
178#[doc = "`read()` method returns [sec_mask_lock::R](R) reader structure"]
179impl crate::Readable for SEC_MASK_LOCK_SPEC {
180    type Reader = R;
181}
182#[doc = "`write(|w| ..)` method takes [sec_mask_lock::W](W) writer structure"]
183impl crate::Writable for SEC_MASK_LOCK_SPEC {
184    type Writer = W;
185}
186#[doc = "`reset()` method sets SEC_MASK_LOCK to value 0x0aaa"]
187impl crate::Resettable for SEC_MASK_LOCK_SPEC {
188    #[inline(always)]
189    fn reset_value() -> Self::Ux {
190        0x0aaa
191    }
192}