xmc4100/ppb/
mpu_rbar_a3.rs1#[doc = "Register `MPU_RBAR_A3` reader"]
2pub type R = crate::R<MPU_RBAR_A3_SPEC>;
3#[doc = "Register `MPU_RBAR_A3` writer"]
4pub type W = crate::W<MPU_RBAR_A3_SPEC>;
5#[doc = "Field `REGION` reader - MPU region field"]
6pub type REGION_R = crate::FieldReader;
7#[doc = "Field `REGION` writer - MPU region field"]
8pub type REGION_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
9#[doc = "MPU Region Number valid bit\n\nValue on reset: 0"]
10#[derive(Clone, Copy, Debug, PartialEq, Eq)]
11pub enum VALID_A {
12 #[doc = "0: MPU_RNR not changed, and the processor: - updates the base address for the region specified in the MPU_RNR - ignores the value of the REGION field"]
13 VALUE1 = 0,
14 #[doc = "1: the processor: - updates the value of the MPU_RNR to the value of the REGION field - updates the base address for the region specified in the REGION field."]
15 VALUE2 = 1,
16}
17impl From<VALID_A> for bool {
18 #[inline(always)]
19 fn from(variant: VALID_A) -> Self {
20 variant as u8 != 0
21 }
22}
23#[doc = "Field `VALID` reader - MPU Region Number valid bit"]
24pub type VALID_R = crate::BitReader<VALID_A>;
25impl VALID_R {
26 #[doc = "Get enumerated values variant"]
27 #[inline(always)]
28 pub const fn variant(&self) -> VALID_A {
29 match self.bits {
30 false => VALID_A::VALUE1,
31 true => VALID_A::VALUE2,
32 }
33 }
34 #[doc = "MPU_RNR not changed, and the processor: - updates the base address for the region specified in the MPU_RNR - ignores the value of the REGION field"]
35 #[inline(always)]
36 pub fn is_value1(&self) -> bool {
37 *self == VALID_A::VALUE1
38 }
39 #[doc = "the processor: - updates the value of the MPU_RNR to the value of the REGION field - updates the base address for the region specified in the REGION field."]
40 #[inline(always)]
41 pub fn is_value2(&self) -> bool {
42 *self == VALID_A::VALUE2
43 }
44}
45#[doc = "Field `VALID` writer - MPU Region Number valid bit"]
46pub type VALID_W<'a, REG> = crate::BitWriter<'a, REG, VALID_A>;
47impl<'a, REG> VALID_W<'a, REG>
48where
49 REG: crate::Writable + crate::RegisterSpec,
50{
51 #[doc = "MPU_RNR not changed, and the processor: - updates the base address for the region specified in the MPU_RNR - ignores the value of the REGION field"]
52 #[inline(always)]
53 pub fn value1(self) -> &'a mut crate::W<REG> {
54 self.variant(VALID_A::VALUE1)
55 }
56 #[doc = "the processor: - updates the value of the MPU_RNR to the value of the REGION field - updates the base address for the region specified in the REGION field."]
57 #[inline(always)]
58 pub fn value2(self) -> &'a mut crate::W<REG> {
59 self.variant(VALID_A::VALUE2)
60 }
61}
62#[doc = "Field `ADDR` reader - Region base address field"]
63pub type ADDR_R = crate::FieldReader<u32>;
64#[doc = "Field `ADDR` writer - Region base address field"]
65pub type ADDR_W<'a, REG> = crate::FieldWriter<'a, REG, 23, u32>;
66impl R {
67 #[doc = "Bits 0:3 - MPU region field"]
68 #[inline(always)]
69 pub fn region(&self) -> REGION_R {
70 REGION_R::new((self.bits & 0x0f) as u8)
71 }
72 #[doc = "Bit 4 - MPU Region Number valid bit"]
73 #[inline(always)]
74 pub fn valid(&self) -> VALID_R {
75 VALID_R::new(((self.bits >> 4) & 1) != 0)
76 }
77 #[doc = "Bits 9:31 - Region base address field"]
78 #[inline(always)]
79 pub fn addr(&self) -> ADDR_R {
80 ADDR_R::new((self.bits >> 9) & 0x007f_ffff)
81 }
82}
83impl W {
84 #[doc = "Bits 0:3 - MPU region field"]
85 #[inline(always)]
86 pub fn region(&mut self) -> REGION_W<MPU_RBAR_A3_SPEC> {
87 REGION_W::new(self, 0)
88 }
89 #[doc = "Bit 4 - MPU Region Number valid bit"]
90 #[inline(always)]
91 pub fn valid(&mut self) -> VALID_W<MPU_RBAR_A3_SPEC> {
92 VALID_W::new(self, 4)
93 }
94 #[doc = "Bits 9:31 - Region base address field"]
95 #[inline(always)]
96 pub fn addr(&mut self) -> ADDR_W<MPU_RBAR_A3_SPEC> {
97 ADDR_W::new(self, 9)
98 }
99}
100#[doc = "MPU Region Base Address Register A3\n\nYou can [`read`](crate::Reg::read) this register and get [`mpu_rbar_a3::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`mpu_rbar_a3::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
101pub struct MPU_RBAR_A3_SPEC;
102impl crate::RegisterSpec for MPU_RBAR_A3_SPEC {
103 type Ux = u32;
104}
105#[doc = "`read()` method returns [`mpu_rbar_a3::R`](R) reader structure"]
106impl crate::Readable for MPU_RBAR_A3_SPEC {}
107#[doc = "`write(|w| ..)` method takes [`mpu_rbar_a3::W`](W) writer structure"]
108impl crate::Writable for MPU_RBAR_A3_SPEC {
109 type Safety = crate::Unsafe;
110 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
111 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
112}
113#[doc = "`reset()` method sets MPU_RBAR_A3 to value 0"]
114impl crate::Resettable for MPU_RBAR_A3_SPEC {
115 const RESET_VALUE: u32 = 0;
116}