ra6t2/cpscu/
stbramsar.rs

1#[doc = "Register `STBRAMSAR` reader"]
2pub struct R(crate::R<STBRAMSAR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<STBRAMSAR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<STBRAMSAR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<STBRAMSAR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `STBRAMSAR` writer"]
17pub struct W(crate::W<STBRAMSAR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<STBRAMSAR_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<STBRAMSAR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<STBRAMSAR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `NSBSTBR` reader - Security attributes of each region for Standby RAM"]
38pub type NSBSTBR_R = crate::FieldReader<u8, NSBSTBR_A>;
39#[doc = "Security attributes of each region for Standby RAM\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum NSBSTBR_A {
43    #[doc = "0: Region7-0 are all Secure."]
44    _0X0 = 0,
45    #[doc = "1: Region7 is Non-secure. Region6-0 are Secure"]
46    _0X1 = 1,
47    #[doc = "2: Region7-6 are Non-secure. Region5-0 are Secure."]
48    _0X2 = 2,
49    #[doc = "3: Region7-5 are Non-secure. Region4-0 are Secure."]
50    _0X3 = 3,
51    #[doc = "4: Region7-4 are Non-secure. Region 3-0 are Secure."]
52    _0X4 = 4,
53    #[doc = "5: Region7-3 are Non-secure. Region 2-0 are Secure."]
54    _0X5 = 5,
55    #[doc = "6: Region7-2 are Non-secure. Region 1-0 are Secure."]
56    _0X6 = 6,
57    #[doc = "7: Region7-1 are Non-Secure. Region0 is Secure."]
58    _0X7 = 7,
59}
60impl From<NSBSTBR_A> for u8 {
61    #[inline(always)]
62    fn from(variant: NSBSTBR_A) -> Self {
63        variant as _
64    }
65}
66impl NSBSTBR_R {
67    #[doc = "Get enumerated values variant"]
68    #[inline(always)]
69    pub fn variant(&self) -> Option<NSBSTBR_A> {
70        match self.bits {
71            0 => Some(NSBSTBR_A::_0X0),
72            1 => Some(NSBSTBR_A::_0X1),
73            2 => Some(NSBSTBR_A::_0X2),
74            3 => Some(NSBSTBR_A::_0X3),
75            4 => Some(NSBSTBR_A::_0X4),
76            5 => Some(NSBSTBR_A::_0X5),
77            6 => Some(NSBSTBR_A::_0X6),
78            7 => Some(NSBSTBR_A::_0X7),
79            _ => None,
80        }
81    }
82    #[doc = "Checks if the value of the field is `_0X0`"]
83    #[inline(always)]
84    pub fn is_0x0(&self) -> bool {
85        *self == NSBSTBR_A::_0X0
86    }
87    #[doc = "Checks if the value of the field is `_0X1`"]
88    #[inline(always)]
89    pub fn is_0x1(&self) -> bool {
90        *self == NSBSTBR_A::_0X1
91    }
92    #[doc = "Checks if the value of the field is `_0X2`"]
93    #[inline(always)]
94    pub fn is_0x2(&self) -> bool {
95        *self == NSBSTBR_A::_0X2
96    }
97    #[doc = "Checks if the value of the field is `_0X3`"]
98    #[inline(always)]
99    pub fn is_0x3(&self) -> bool {
100        *self == NSBSTBR_A::_0X3
101    }
102    #[doc = "Checks if the value of the field is `_0X4`"]
103    #[inline(always)]
104    pub fn is_0x4(&self) -> bool {
105        *self == NSBSTBR_A::_0X4
106    }
107    #[doc = "Checks if the value of the field is `_0X5`"]
108    #[inline(always)]
109    pub fn is_0x5(&self) -> bool {
110        *self == NSBSTBR_A::_0X5
111    }
112    #[doc = "Checks if the value of the field is `_0X6`"]
113    #[inline(always)]
114    pub fn is_0x6(&self) -> bool {
115        *self == NSBSTBR_A::_0X6
116    }
117    #[doc = "Checks if the value of the field is `_0X7`"]
118    #[inline(always)]
119    pub fn is_0x7(&self) -> bool {
120        *self == NSBSTBR_A::_0X7
121    }
122}
123#[doc = "Field `NSBSTBR` writer - Security attributes of each region for Standby RAM"]
124pub type NSBSTBR_W<'a, const O: u8> =
125    crate::FieldWriter<'a, u32, STBRAMSAR_SPEC, u8, NSBSTBR_A, 4, O>;
126impl<'a, const O: u8> NSBSTBR_W<'a, O> {
127    #[doc = "Region7-0 are all Secure."]
128    #[inline(always)]
129    pub fn _0x0(self) -> &'a mut W {
130        self.variant(NSBSTBR_A::_0X0)
131    }
132    #[doc = "Region7 is Non-secure. Region6-0 are Secure"]
133    #[inline(always)]
134    pub fn _0x1(self) -> &'a mut W {
135        self.variant(NSBSTBR_A::_0X1)
136    }
137    #[doc = "Region7-6 are Non-secure. Region5-0 are Secure."]
138    #[inline(always)]
139    pub fn _0x2(self) -> &'a mut W {
140        self.variant(NSBSTBR_A::_0X2)
141    }
142    #[doc = "Region7-5 are Non-secure. Region4-0 are Secure."]
143    #[inline(always)]
144    pub fn _0x3(self) -> &'a mut W {
145        self.variant(NSBSTBR_A::_0X3)
146    }
147    #[doc = "Region7-4 are Non-secure. Region 3-0 are Secure."]
148    #[inline(always)]
149    pub fn _0x4(self) -> &'a mut W {
150        self.variant(NSBSTBR_A::_0X4)
151    }
152    #[doc = "Region7-3 are Non-secure. Region 2-0 are Secure."]
153    #[inline(always)]
154    pub fn _0x5(self) -> &'a mut W {
155        self.variant(NSBSTBR_A::_0X5)
156    }
157    #[doc = "Region7-2 are Non-secure. Region 1-0 are Secure."]
158    #[inline(always)]
159    pub fn _0x6(self) -> &'a mut W {
160        self.variant(NSBSTBR_A::_0X6)
161    }
162    #[doc = "Region7-1 are Non-Secure. Region0 is Secure."]
163    #[inline(always)]
164    pub fn _0x7(self) -> &'a mut W {
165        self.variant(NSBSTBR_A::_0X7)
166    }
167}
168impl R {
169    #[doc = "Bits 0:3 - Security attributes of each region for Standby RAM"]
170    #[inline(always)]
171    pub fn nsbstbr(&self) -> NSBSTBR_R {
172        NSBSTBR_R::new((self.bits & 0x0f) as u8)
173    }
174}
175impl W {
176    #[doc = "Bits 0:3 - Security attributes of each region for Standby RAM"]
177    #[inline(always)]
178    #[must_use]
179    pub fn nsbstbr(&mut self) -> NSBSTBR_W<0> {
180        NSBSTBR_W::new(self)
181    }
182    #[doc = "Writes raw bits to the register."]
183    #[inline(always)]
184    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
185        self.0.bits(bits);
186        self
187    }
188}
189#[doc = "Standby RAM memory Security Attribution Register\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 [stbramsar](index.html) module"]
190pub struct STBRAMSAR_SPEC;
191impl crate::RegisterSpec for STBRAMSAR_SPEC {
192    type Ux = u32;
193}
194#[doc = "`read()` method returns [stbramsar::R](R) reader structure"]
195impl crate::Readable for STBRAMSAR_SPEC {
196    type Reader = R;
197}
198#[doc = "`write(|w| ..)` method takes [stbramsar::W](W) writer structure"]
199impl crate::Writable for STBRAMSAR_SPEC {
200    type Writer = W;
201    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
202    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
203}
204#[doc = "`reset()` method sets STBRAMSAR to value 0xffff_fff0"]
205impl crate::Resettable for STBRAMSAR_SPEC {
206    const RESET_VALUE: Self::Ux = 0xffff_fff0;
207}