1#[doc = "Register `RLAR` reader"]
2pub type R = crate::R<RlarSpec>;
3#[doc = "Register `RLAR` writer"]
4pub type W = crate::W<RlarSpec>;
5#[doc = "Enable. SAU region enable.\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Enable {
9 #[doc = "0: SAU region is enabled."]
10 Enabled = 0,
11 #[doc = "1: SAU region is disabled."]
12 Disabled = 1,
13}
14impl From<Enable> for bool {
15 #[inline(always)]
16 fn from(variant: Enable) -> Self {
17 variant as u8 != 0
18 }
19}
20#[doc = "Field `ENABLE` reader - Enable. SAU region enable."]
21pub type EnableR = crate::BitReader<Enable>;
22impl EnableR {
23 #[doc = "Get enumerated values variant"]
24 #[inline(always)]
25 pub const fn variant(&self) -> Enable {
26 match self.bits {
27 false => Enable::Enabled,
28 true => Enable::Disabled,
29 }
30 }
31 #[doc = "SAU region is enabled."]
32 #[inline(always)]
33 pub fn is_enabled(&self) -> bool {
34 *self == Enable::Enabled
35 }
36 #[doc = "SAU region is disabled."]
37 #[inline(always)]
38 pub fn is_disabled(&self) -> bool {
39 *self == Enable::Disabled
40 }
41}
42#[doc = "Field `ENABLE` writer - Enable. SAU region enable."]
43pub type EnableW<'a, REG> = crate::BitWriter<'a, REG, Enable>;
44impl<'a, REG> EnableW<'a, REG>
45where
46 REG: crate::Writable + crate::RegisterSpec,
47{
48 #[doc = "SAU region is enabled."]
49 #[inline(always)]
50 pub fn enabled(self) -> &'a mut crate::W<REG> {
51 self.variant(Enable::Enabled)
52 }
53 #[doc = "SAU region is disabled."]
54 #[inline(always)]
55 pub fn disabled(self) -> &'a mut crate::W<REG> {
56 self.variant(Enable::Disabled)
57 }
58}
59#[doc = "Non-secure callable. Controls whether Non-secure state is permitted to execute an SG instruction from this region.\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum Nsc {
63 #[doc = "0: Region is not Non-secure callable."]
64 NotNonSecureCallable = 0,
65 #[doc = "1: Region is Non-secure callable."]
66 NonSecureCallable = 1,
67}
68impl From<Nsc> for bool {
69 #[inline(always)]
70 fn from(variant: Nsc) -> Self {
71 variant as u8 != 0
72 }
73}
74#[doc = "Field `NSC` reader - Non-secure callable. Controls whether Non-secure state is permitted to execute an SG instruction from this region."]
75pub type NscR = crate::BitReader<Nsc>;
76impl NscR {
77 #[doc = "Get enumerated values variant"]
78 #[inline(always)]
79 pub const fn variant(&self) -> Nsc {
80 match self.bits {
81 false => Nsc::NotNonSecureCallable,
82 true => Nsc::NonSecureCallable,
83 }
84 }
85 #[doc = "Region is not Non-secure callable."]
86 #[inline(always)]
87 pub fn is_not_non_secure_callable(&self) -> bool {
88 *self == Nsc::NotNonSecureCallable
89 }
90 #[doc = "Region is Non-secure callable."]
91 #[inline(always)]
92 pub fn is_non_secure_callable(&self) -> bool {
93 *self == Nsc::NonSecureCallable
94 }
95}
96#[doc = "Field `NSC` writer - Non-secure callable. Controls whether Non-secure state is permitted to execute an SG instruction from this region."]
97pub type NscW<'a, REG> = crate::BitWriter<'a, REG, Nsc>;
98impl<'a, REG> NscW<'a, REG>
99where
100 REG: crate::Writable + crate::RegisterSpec,
101{
102 #[doc = "Region is not Non-secure callable."]
103 #[inline(always)]
104 pub fn not_non_secure_callable(self) -> &'a mut crate::W<REG> {
105 self.variant(Nsc::NotNonSecureCallable)
106 }
107 #[doc = "Region is Non-secure callable."]
108 #[inline(always)]
109 pub fn non_secure_callable(self) -> &'a mut crate::W<REG> {
110 self.variant(Nsc::NonSecureCallable)
111 }
112}
113#[doc = "Field `LADDR` reader - Limit address. Holds bits\\[31:5\\] of the limit address for the selected SAU region. Bits\\[4:0\\] of the limit address are defined as 0x1F."]
114pub type LaddrR = crate::FieldReader<u32>;
115#[doc = "Field `LADDR` writer - Limit address. Holds bits\\[31:5\\] of the limit address for the selected SAU region. Bits\\[4:0\\] of the limit address are defined as 0x1F."]
116pub type LaddrW<'a, REG> = crate::FieldWriter<'a, REG, 27, u32>;
117impl R {
118 #[doc = "Bit 0 - Enable. SAU region enable."]
119 #[inline(always)]
120 pub fn enable(&self) -> EnableR {
121 EnableR::new((self.bits & 1) != 0)
122 }
123 #[doc = "Bit 1 - Non-secure callable. Controls whether Non-secure state is permitted to execute an SG instruction from this region."]
124 #[inline(always)]
125 pub fn nsc(&self) -> NscR {
126 NscR::new(((self.bits >> 1) & 1) != 0)
127 }
128 #[doc = "Bits 5:31 - Limit address. Holds bits\\[31:5\\] of the limit address for the selected SAU region. Bits\\[4:0\\] of the limit address are defined as 0x1F."]
129 #[inline(always)]
130 pub fn laddr(&self) -> LaddrR {
131 LaddrR::new((self.bits >> 5) & 0x07ff_ffff)
132 }
133}
134#[cfg(feature = "debug")]
135impl core::fmt::Debug for R {
136 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
137 f.debug_struct("RLAR")
138 .field("enable", &self.enable())
139 .field("nsc", &self.nsc())
140 .field("laddr", &self.laddr())
141 .finish()
142 }
143}
144impl W {
145 #[doc = "Bit 0 - Enable. SAU region enable."]
146 #[inline(always)]
147 pub fn enable(&mut self) -> EnableW<'_, RlarSpec> {
148 EnableW::new(self, 0)
149 }
150 #[doc = "Bit 1 - Non-secure callable. Controls whether Non-secure state is permitted to execute an SG instruction from this region."]
151 #[inline(always)]
152 pub fn nsc(&mut self) -> NscW<'_, RlarSpec> {
153 NscW::new(self, 1)
154 }
155 #[doc = "Bits 5:31 - Limit address. Holds bits\\[31:5\\] of the limit address for the selected SAU region. Bits\\[4:0\\] of the limit address are defined as 0x1F."]
156 #[inline(always)]
157 pub fn laddr(&mut self) -> LaddrW<'_, RlarSpec> {
158 LaddrW::new(self, 5)
159 }
160}
161#[doc = "Security Attribution Unit Region Limit Address Register\n\nYou can [`read`](crate::Reg::read) this register and get [`rlar::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`rlar::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
162pub struct RlarSpec;
163impl crate::RegisterSpec for RlarSpec {
164 type Ux = u32;
165}
166#[doc = "`read()` method returns [`rlar::R`](R) reader structure"]
167impl crate::Readable for RlarSpec {}
168#[doc = "`write(|w| ..)` method takes [`rlar::W`](W) writer structure"]
169impl crate::Writable for RlarSpec {
170 type Safety = crate::Unsafe;
171}
172#[doc = "`reset()` method sets RLAR to value 0"]
173impl crate::Resettable for RlarSpec {}