corstone300_pac/sau/
ctrl.rs1#[doc = "Register `CTRL` reader"]
6pub struct R(crate::R<CTRL_SPEC>);
7impl core::ops::Deref for R {
8 type Target = crate::R<CTRL_SPEC>;
9 #[inline(always)]
10 fn deref(&self) -> &Self::Target {
11 &self.0
12 }
13}
14impl From<crate::R<CTRL_SPEC>> for R {
15 #[inline(always)]
16 fn from(reader: crate::R<CTRL_SPEC>) -> Self {
17 R(reader)
18 }
19}
20#[doc = "Register `CTRL` writer"]
21pub struct W(crate::W<CTRL_SPEC>);
22impl core::ops::Deref for W {
23 type Target = crate::W<CTRL_SPEC>;
24 #[inline(always)]
25 fn deref(&self) -> &Self::Target {
26 &self.0
27 }
28}
29impl core::ops::DerefMut for W {
30 #[inline(always)]
31 fn deref_mut(&mut self) -> &mut Self::Target {
32 &mut self.0
33 }
34}
35impl From<crate::W<CTRL_SPEC>> for W {
36 #[inline(always)]
37 fn from(writer: crate::W<CTRL_SPEC>) -> Self {
38 W(writer)
39 }
40}
41#[doc = "Field `ENABLE` reader - Enable"]
42pub type ENABLE_R = crate::BitReader<ENABLE_A>;
43#[doc = "Enable\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45pub enum ENABLE_A {
46 #[doc = "0: SAU is disabled"]
47 DISABLE = 0,
48 #[doc = "1: SAU is enabled"]
49 ENABLE = 1,
50}
51impl From<ENABLE_A> for bool {
52 #[inline(always)]
53 fn from(variant: ENABLE_A) -> Self {
54 variant as u8 != 0
55 }
56}
57impl ENABLE_R {
58 #[doc = "Get enumerated values variant"]
59 #[inline(always)]
60 pub fn variant(&self) -> ENABLE_A {
61 match self.bits {
62 false => ENABLE_A::DISABLE,
63 true => ENABLE_A::ENABLE,
64 }
65 }
66 #[doc = "Checks if the value of the field is `DISABLE`"]
67 #[inline(always)]
68 pub fn is_disable(&self) -> bool {
69 *self == ENABLE_A::DISABLE
70 }
71 #[doc = "Checks if the value of the field is `ENABLE`"]
72 #[inline(always)]
73 pub fn is_enable(&self) -> bool {
74 *self == ENABLE_A::ENABLE
75 }
76}
77#[doc = "Field `ENABLE` writer - Enable"]
78pub type ENABLE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, ENABLE_A, O>;
79impl<'a, const O: u8> ENABLE_W<'a, O> {
80 #[doc = "SAU is disabled"]
81 #[inline(always)]
82 pub fn disable(self) -> &'a mut W {
83 self.variant(ENABLE_A::DISABLE)
84 }
85 #[doc = "SAU is enabled"]
86 #[inline(always)]
87 pub fn enable(self) -> &'a mut W {
88 self.variant(ENABLE_A::ENABLE)
89 }
90}
91#[doc = "Field `ALLNS` reader - Security attribution if SAU disabled"]
92pub type ALLNS_R = crate::BitReader<ALLNS_A>;
93#[doc = "Security attribution if SAU disabled\n\nValue on reset: 0"]
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95pub enum ALLNS_A {
96 #[doc = "0: Memory is marked as secure"]
97 SECURE = 0,
98 #[doc = "1: Memory is marked as non-secure"]
99 NON_SECURE = 1,
100}
101impl From<ALLNS_A> for bool {
102 #[inline(always)]
103 fn from(variant: ALLNS_A) -> Self {
104 variant as u8 != 0
105 }
106}
107impl ALLNS_R {
108 #[doc = "Get enumerated values variant"]
109 #[inline(always)]
110 pub fn variant(&self) -> ALLNS_A {
111 match self.bits {
112 false => ALLNS_A::SECURE,
113 true => ALLNS_A::NON_SECURE,
114 }
115 }
116 #[doc = "Checks if the value of the field is `SECURE`"]
117 #[inline(always)]
118 pub fn is_secure(&self) -> bool {
119 *self == ALLNS_A::SECURE
120 }
121 #[doc = "Checks if the value of the field is `NON_SECURE`"]
122 #[inline(always)]
123 pub fn is_non_secure(&self) -> bool {
124 *self == ALLNS_A::NON_SECURE
125 }
126}
127#[doc = "Field `ALLNS` writer - Security attribution if SAU disabled"]
128pub type ALLNS_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, ALLNS_A, O>;
129impl<'a, const O: u8> ALLNS_W<'a, O> {
130 #[doc = "Memory is marked as secure"]
131 #[inline(always)]
132 pub fn secure(self) -> &'a mut W {
133 self.variant(ALLNS_A::SECURE)
134 }
135 #[doc = "Memory is marked as non-secure"]
136 #[inline(always)]
137 pub fn non_secure(self) -> &'a mut W {
138 self.variant(ALLNS_A::NON_SECURE)
139 }
140}
141impl R {
142 #[doc = "Bit 0 - Enable"]
143 #[inline(always)]
144 pub fn enable(&self) -> ENABLE_R {
145 ENABLE_R::new((self.bits & 1) != 0)
146 }
147 #[doc = "Bit 1 - Security attribution if SAU disabled"]
148 #[inline(always)]
149 pub fn allns(&self) -> ALLNS_R {
150 ALLNS_R::new(((self.bits >> 1) & 1) != 0)
151 }
152}
153impl W {
154 #[doc = "Bit 0 - Enable"]
155 #[inline(always)]
156 pub fn enable(&mut self) -> ENABLE_W<0> {
157 ENABLE_W::new(self)
158 }
159 #[doc = "Bit 1 - Security attribution if SAU disabled"]
160 #[inline(always)]
161 pub fn allns(&mut self) -> ALLNS_W<1> {
162 ALLNS_W::new(self)
163 }
164 #[doc = "Writes raw bits to the register."]
165 #[inline(always)]
166 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
167 self.0.bits(bits);
168 self
169 }
170}
171#[doc = "Control 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 [ctrl](index.html) module"]
172pub struct CTRL_SPEC;
173impl crate::RegisterSpec for CTRL_SPEC {
174 type Ux = u32;
175}
176#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
177impl crate::Readable for CTRL_SPEC {
178 type Reader = R;
179}
180#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
181impl crate::Writable for CTRL_SPEC {
182 type Writer = W;
183}
184#[doc = "`reset()` method sets CTRL to value 0"]
185impl crate::Resettable for CTRL_SPEC {
186 #[inline(always)]
187 fn reset_value() -> Self::Ux {
188 0
189 }
190}