nrf52840_pac/acl/acl/
perm.rs
1#[doc = "Register `PERM` reader"]
2pub struct R(crate::R<PERM_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<PERM_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<PERM_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<PERM_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `PERM` writer"]
17pub struct W(crate::W<PERM_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<PERM_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<PERM_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<PERM_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `WRITE` reader - Configure write and erase permissions for region n. Write '0' has no effect."]
38pub type WRITE_R = crate::BitReader<WRITE_A>;
39#[doc = "Configure write and erase permissions for region n. Write '0' has no effect.\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum WRITE_A {
42 #[doc = "0: Allow write and erase instructions to region n"]
43 ENABLE = 0,
44 #[doc = "1: Block write and erase instructions to region n"]
45 DISABLE = 1,
46}
47impl From<WRITE_A> for bool {
48 #[inline(always)]
49 fn from(variant: WRITE_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl WRITE_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> WRITE_A {
57 match self.bits {
58 false => WRITE_A::ENABLE,
59 true => WRITE_A::DISABLE,
60 }
61 }
62 #[doc = "Checks if the value of the field is `ENABLE`"]
63 #[inline(always)]
64 pub fn is_enable(&self) -> bool {
65 *self == WRITE_A::ENABLE
66 }
67 #[doc = "Checks if the value of the field is `DISABLE`"]
68 #[inline(always)]
69 pub fn is_disable(&self) -> bool {
70 *self == WRITE_A::DISABLE
71 }
72}
73#[doc = "Field `WRITE` writer - Configure write and erase permissions for region n. Write '0' has no effect."]
74pub type WRITE_W<'a, const O: u8> = crate::BitWriter<'a, u32, PERM_SPEC, WRITE_A, O>;
75impl<'a, const O: u8> WRITE_W<'a, O> {
76 #[doc = "Allow write and erase instructions to region n"]
77 #[inline(always)]
78 pub fn enable(self) -> &'a mut W {
79 self.variant(WRITE_A::ENABLE)
80 }
81 #[doc = "Block write and erase instructions to region n"]
82 #[inline(always)]
83 pub fn disable(self) -> &'a mut W {
84 self.variant(WRITE_A::DISABLE)
85 }
86}
87#[doc = "Field `READ` reader - Configure read permissions for region n. Write '0' has no effect."]
88pub type READ_R = crate::BitReader<READ_A>;
89#[doc = "Configure read permissions for region n. Write '0' has no effect.\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq)]
91pub enum READ_A {
92 #[doc = "0: Allow read instructions to region n"]
93 ENABLE = 0,
94 #[doc = "1: Block read instructions to region n"]
95 DISABLE = 1,
96}
97impl From<READ_A> for bool {
98 #[inline(always)]
99 fn from(variant: READ_A) -> Self {
100 variant as u8 != 0
101 }
102}
103impl READ_R {
104 #[doc = "Get enumerated values variant"]
105 #[inline(always)]
106 pub fn variant(&self) -> READ_A {
107 match self.bits {
108 false => READ_A::ENABLE,
109 true => READ_A::DISABLE,
110 }
111 }
112 #[doc = "Checks if the value of the field is `ENABLE`"]
113 #[inline(always)]
114 pub fn is_enable(&self) -> bool {
115 *self == READ_A::ENABLE
116 }
117 #[doc = "Checks if the value of the field is `DISABLE`"]
118 #[inline(always)]
119 pub fn is_disable(&self) -> bool {
120 *self == READ_A::DISABLE
121 }
122}
123#[doc = "Field `READ` writer - Configure read permissions for region n. Write '0' has no effect."]
124pub type READ_W<'a, const O: u8> = crate::BitWriter<'a, u32, PERM_SPEC, READ_A, O>;
125impl<'a, const O: u8> READ_W<'a, O> {
126 #[doc = "Allow read instructions to region n"]
127 #[inline(always)]
128 pub fn enable(self) -> &'a mut W {
129 self.variant(READ_A::ENABLE)
130 }
131 #[doc = "Block read instructions to region n"]
132 #[inline(always)]
133 pub fn disable(self) -> &'a mut W {
134 self.variant(READ_A::DISABLE)
135 }
136}
137impl R {
138 #[doc = "Bit 1 - Configure write and erase permissions for region n. Write '0' has no effect."]
139 #[inline(always)]
140 pub fn write(&self) -> WRITE_R {
141 WRITE_R::new(((self.bits >> 1) & 1) != 0)
142 }
143 #[doc = "Bit 2 - Configure read permissions for region n. Write '0' has no effect."]
144 #[inline(always)]
145 pub fn read(&self) -> READ_R {
146 READ_R::new(((self.bits >> 2) & 1) != 0)
147 }
148}
149impl W {
150 #[doc = "Bit 1 - Configure write and erase permissions for region n. Write '0' has no effect."]
151 #[inline(always)]
152 pub fn write(&mut self) -> WRITE_W<1> {
153 WRITE_W::new(self)
154 }
155 #[doc = "Bit 2 - Configure read permissions for region n. Write '0' has no effect."]
156 #[inline(always)]
157 pub fn read(&mut self) -> READ_W<2> {
158 READ_W::new(self)
159 }
160 #[doc = "Writes raw bits to the register."]
161 #[inline(always)]
162 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
163 self.0.bits(bits);
164 self
165 }
166}
167#[doc = "Description cluster\\[n\\]: Access permissions for region n as defined by start address ACL\\[n\\].ADDR and size ACL\\[n\\].SIZE\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 [perm](index.html) module"]
168pub struct PERM_SPEC;
169impl crate::RegisterSpec for PERM_SPEC {
170 type Ux = u32;
171}
172#[doc = "`read()` method returns [perm::R](R) reader structure"]
173impl crate::Readable for PERM_SPEC {
174 type Reader = R;
175}
176#[doc = "`write(|w| ..)` method takes [perm::W](W) writer structure"]
177impl crate::Writable for PERM_SPEC {
178 type Writer = W;
179}
180#[doc = "`reset()` method sets PERM to value 0"]
181impl crate::Resettable for PERM_SPEC {
182 #[inline(always)]
183 fn reset_value() -> Self::Ux {
184 0
185 }
186}