xmc4800/ebu/
addrsel3.rs

1#[doc = "Register `ADDRSEL3` reader"]
2pub type R = crate::R<ADDRSEL3_SPEC>;
3#[doc = "Register `ADDRSEL3` writer"]
4pub type W = crate::W<ADDRSEL3_SPEC>;
5#[doc = "Memory Region Enable\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum REGENAB_A {
8    #[doc = "0: Memory region is disabled (default after reset)."]
9    VALUE1 = 0,
10    #[doc = "1: Memory region is enabled."]
11    VALUE2 = 1,
12}
13impl From<REGENAB_A> for bool {
14    #[inline(always)]
15    fn from(variant: REGENAB_A) -> Self {
16        variant as u8 != 0
17    }
18}
19#[doc = "Field `REGENAB` reader - Memory Region Enable"]
20pub type REGENAB_R = crate::BitReader<REGENAB_A>;
21impl REGENAB_R {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> REGENAB_A {
25        match self.bits {
26            false => REGENAB_A::VALUE1,
27            true => REGENAB_A::VALUE2,
28        }
29    }
30    #[doc = "Memory region is disabled (default after reset)."]
31    #[inline(always)]
32    pub fn is_value1(&self) -> bool {
33        *self == REGENAB_A::VALUE1
34    }
35    #[doc = "Memory region is enabled."]
36    #[inline(always)]
37    pub fn is_value2(&self) -> bool {
38        *self == REGENAB_A::VALUE2
39    }
40}
41#[doc = "Field `REGENAB` writer - Memory Region Enable"]
42pub type REGENAB_W<'a, REG> = crate::BitWriter<'a, REG, REGENAB_A>;
43impl<'a, REG> REGENAB_W<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "Memory region is disabled (default after reset)."]
48    #[inline(always)]
49    pub fn value1(self) -> &'a mut crate::W<REG> {
50        self.variant(REGENAB_A::VALUE1)
51    }
52    #[doc = "Memory region is enabled."]
53    #[inline(always)]
54    pub fn value2(self) -> &'a mut crate::W<REG> {
55        self.variant(REGENAB_A::VALUE2)
56    }
57}
58#[doc = "Alternate Region Enable\n\nValue on reset: 0"]
59#[derive(Clone, Copy, Debug, PartialEq, Eq)]
60pub enum ALTENAB_A {
61    #[doc = "0: Memory region is disabled (default after reset)."]
62    VALUE1 = 0,
63    #[doc = "1: Memory region is enabled."]
64    VALUE2 = 1,
65}
66impl From<ALTENAB_A> for bool {
67    #[inline(always)]
68    fn from(variant: ALTENAB_A) -> Self {
69        variant as u8 != 0
70    }
71}
72#[doc = "Field `ALTENAB` reader - Alternate Region Enable"]
73pub type ALTENAB_R = crate::BitReader<ALTENAB_A>;
74impl ALTENAB_R {
75    #[doc = "Get enumerated values variant"]
76    #[inline(always)]
77    pub const fn variant(&self) -> ALTENAB_A {
78        match self.bits {
79            false => ALTENAB_A::VALUE1,
80            true => ALTENAB_A::VALUE2,
81        }
82    }
83    #[doc = "Memory region is disabled (default after reset)."]
84    #[inline(always)]
85    pub fn is_value1(&self) -> bool {
86        *self == ALTENAB_A::VALUE1
87    }
88    #[doc = "Memory region is enabled."]
89    #[inline(always)]
90    pub fn is_value2(&self) -> bool {
91        *self == ALTENAB_A::VALUE2
92    }
93}
94#[doc = "Field `ALTENAB` writer - Alternate Region Enable"]
95pub type ALTENAB_W<'a, REG> = crate::BitWriter<'a, REG, ALTENAB_A>;
96impl<'a, REG> ALTENAB_W<'a, REG>
97where
98    REG: crate::Writable + crate::RegisterSpec,
99{
100    #[doc = "Memory region is disabled (default after reset)."]
101    #[inline(always)]
102    pub fn value1(self) -> &'a mut crate::W<REG> {
103        self.variant(ALTENAB_A::VALUE1)
104    }
105    #[doc = "Memory region is enabled."]
106    #[inline(always)]
107    pub fn value2(self) -> &'a mut crate::W<REG> {
108        self.variant(ALTENAB_A::VALUE2)
109    }
110}
111#[doc = "Memory Region Write Protect\n\nValue on reset: 0"]
112#[derive(Clone, Copy, Debug, PartialEq, Eq)]
113pub enum WPROT_A {
114    #[doc = "0: Region is enabled for write accesses"]
115    VALUE1 = 0,
116    #[doc = "1: Region is write protected."]
117    VALUE2 = 1,
118}
119impl From<WPROT_A> for bool {
120    #[inline(always)]
121    fn from(variant: WPROT_A) -> Self {
122        variant as u8 != 0
123    }
124}
125#[doc = "Field `WPROT` reader - Memory Region Write Protect"]
126pub type WPROT_R = crate::BitReader<WPROT_A>;
127impl WPROT_R {
128    #[doc = "Get enumerated values variant"]
129    #[inline(always)]
130    pub const fn variant(&self) -> WPROT_A {
131        match self.bits {
132            false => WPROT_A::VALUE1,
133            true => WPROT_A::VALUE2,
134        }
135    }
136    #[doc = "Region is enabled for write accesses"]
137    #[inline(always)]
138    pub fn is_value1(&self) -> bool {
139        *self == WPROT_A::VALUE1
140    }
141    #[doc = "Region is write protected."]
142    #[inline(always)]
143    pub fn is_value2(&self) -> bool {
144        *self == WPROT_A::VALUE2
145    }
146}
147#[doc = "Field `WPROT` writer - Memory Region Write Protect"]
148pub type WPROT_W<'a, REG> = crate::BitWriter<'a, REG, WPROT_A>;
149impl<'a, REG> WPROT_W<'a, REG>
150where
151    REG: crate::Writable + crate::RegisterSpec,
152{
153    #[doc = "Region is enabled for write accesses"]
154    #[inline(always)]
155    pub fn value1(self) -> &'a mut crate::W<REG> {
156        self.variant(WPROT_A::VALUE1)
157    }
158    #[doc = "Region is write protected."]
159    #[inline(always)]
160    pub fn value2(self) -> &'a mut crate::W<REG> {
161        self.variant(WPROT_A::VALUE2)
162    }
163}
164impl R {
165    #[doc = "Bit 0 - Memory Region Enable"]
166    #[inline(always)]
167    pub fn regenab(&self) -> REGENAB_R {
168        REGENAB_R::new((self.bits & 1) != 0)
169    }
170    #[doc = "Bit 1 - Alternate Region Enable"]
171    #[inline(always)]
172    pub fn altenab(&self) -> ALTENAB_R {
173        ALTENAB_R::new(((self.bits >> 1) & 1) != 0)
174    }
175    #[doc = "Bit 2 - Memory Region Write Protect"]
176    #[inline(always)]
177    pub fn wprot(&self) -> WPROT_R {
178        WPROT_R::new(((self.bits >> 2) & 1) != 0)
179    }
180}
181impl W {
182    #[doc = "Bit 0 - Memory Region Enable"]
183    #[inline(always)]
184    pub fn regenab(&mut self) -> REGENAB_W<ADDRSEL3_SPEC> {
185        REGENAB_W::new(self, 0)
186    }
187    #[doc = "Bit 1 - Alternate Region Enable"]
188    #[inline(always)]
189    pub fn altenab(&mut self) -> ALTENAB_W<ADDRSEL3_SPEC> {
190        ALTENAB_W::new(self, 1)
191    }
192    #[doc = "Bit 2 - Memory Region Write Protect"]
193    #[inline(always)]
194    pub fn wprot(&mut self) -> WPROT_W<ADDRSEL3_SPEC> {
195        WPROT_W::new(self, 2)
196    }
197}
198#[doc = "EBU Address Select Register 3\n\nYou can [`read`](crate::Reg::read) this register and get [`addrsel3::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`addrsel3::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
199pub struct ADDRSEL3_SPEC;
200impl crate::RegisterSpec for ADDRSEL3_SPEC {
201    type Ux = u32;
202}
203#[doc = "`read()` method returns [`addrsel3::R`](R) reader structure"]
204impl crate::Readable for ADDRSEL3_SPEC {}
205#[doc = "`write(|w| ..)` method takes [`addrsel3::W`](W) writer structure"]
206impl crate::Writable for ADDRSEL3_SPEC {
207    type Safety = crate::Unsafe;
208    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
209    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
210}
211#[doc = "`reset()` method sets ADDRSEL3 to value 0"]
212impl crate::Resettable for ADDRSEL3_SPEC {
213    const RESET_VALUE: u32 = 0;
214}