rp2040_pac/ppb/
mpu_rbar.rs

1#[doc = "Register `MPU_RBAR` reader"]
2pub type R = crate::R<MPU_RBAR_SPEC>;
3#[doc = "Register `MPU_RBAR` writer"]
4pub type W = crate::W<MPU_RBAR_SPEC>;
5#[doc = "Field `REGION` reader - On writes, specifies the number of the region whose base address to update provided VALID is set written as 1. On reads, returns bits \\[3:0\\]
6of MPU_RNR."]
7pub type REGION_R = crate::FieldReader;
8#[doc = "Field `REGION` writer - On writes, specifies the number of the region whose base address to update provided VALID is set written as 1. On reads, returns bits \\[3:0\\]
9of MPU_RNR."]
10pub type REGION_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
11#[doc = "Field `VALID` reader - On writes, indicates whether the write must update the base address of the region identified by the REGION field, updating the MPU_RNR to indicate this new region.  
12 Write:  
13 0 = MPU_RNR not changed, and the processor:  
14 Updates the base address for the region specified in the MPU_RNR.  
15 Ignores the value of the REGION field.  
16 1 = The processor:  
17 Updates the value of the MPU_RNR to the value of the REGION field.  
18 Updates the base address for the region specified in the REGION field.  
19 Always reads as zero."]
20pub type VALID_R = crate::BitReader;
21#[doc = "Field `VALID` writer - On writes, indicates whether the write must update the base address of the region identified by the REGION field, updating the MPU_RNR to indicate this new region.  
22 Write:  
23 0 = MPU_RNR not changed, and the processor:  
24 Updates the base address for the region specified in the MPU_RNR.  
25 Ignores the value of the REGION field.  
26 1 = The processor:  
27 Updates the value of the MPU_RNR to the value of the REGION field.  
28 Updates the base address for the region specified in the REGION field.  
29 Always reads as zero."]
30pub type VALID_W<'a, REG> = crate::BitWriter<'a, REG>;
31#[doc = "Field `ADDR` reader - Base address of the region."]
32pub type ADDR_R = crate::FieldReader<u32>;
33#[doc = "Field `ADDR` writer - Base address of the region."]
34pub type ADDR_W<'a, REG> = crate::FieldWriter<'a, REG, 24, u32>;
35impl R {
36    #[doc = "Bits 0:3 - On writes, specifies the number of the region whose base address to update provided VALID is set written as 1. On reads, returns bits \\[3:0\\]
37of MPU_RNR."]
38    #[inline(always)]
39    pub fn region(&self) -> REGION_R {
40        REGION_R::new((self.bits & 0x0f) as u8)
41    }
42    #[doc = "Bit 4 - On writes, indicates whether the write must update the base address of the region identified by the REGION field, updating the MPU_RNR to indicate this new region.  
43 Write:  
44 0 = MPU_RNR not changed, and the processor:  
45 Updates the base address for the region specified in the MPU_RNR.  
46 Ignores the value of the REGION field.  
47 1 = The processor:  
48 Updates the value of the MPU_RNR to the value of the REGION field.  
49 Updates the base address for the region specified in the REGION field.  
50 Always reads as zero."]
51    #[inline(always)]
52    pub fn valid(&self) -> VALID_R {
53        VALID_R::new(((self.bits >> 4) & 1) != 0)
54    }
55    #[doc = "Bits 8:31 - Base address of the region."]
56    #[inline(always)]
57    pub fn addr(&self) -> ADDR_R {
58        ADDR_R::new((self.bits >> 8) & 0x00ff_ffff)
59    }
60}
61impl W {
62    #[doc = "Bits 0:3 - On writes, specifies the number of the region whose base address to update provided VALID is set written as 1. On reads, returns bits \\[3:0\\]
63of MPU_RNR."]
64    #[inline(always)]
65    #[must_use]
66    pub fn region(&mut self) -> REGION_W<MPU_RBAR_SPEC> {
67        REGION_W::new(self, 0)
68    }
69    #[doc = "Bit 4 - On writes, indicates whether the write must update the base address of the region identified by the REGION field, updating the MPU_RNR to indicate this new region.  
70 Write:  
71 0 = MPU_RNR not changed, and the processor:  
72 Updates the base address for the region specified in the MPU_RNR.  
73 Ignores the value of the REGION field.  
74 1 = The processor:  
75 Updates the value of the MPU_RNR to the value of the REGION field.  
76 Updates the base address for the region specified in the REGION field.  
77 Always reads as zero."]
78    #[inline(always)]
79    #[must_use]
80    pub fn valid(&mut self) -> VALID_W<MPU_RBAR_SPEC> {
81        VALID_W::new(self, 4)
82    }
83    #[doc = "Bits 8:31 - Base address of the region."]
84    #[inline(always)]
85    #[must_use]
86    pub fn addr(&mut self) -> ADDR_W<MPU_RBAR_SPEC> {
87        ADDR_W::new(self, 8)
88    }
89    #[doc = r" Writes raw bits to the register."]
90    #[doc = r""]
91    #[doc = r" # Safety"]
92    #[doc = r""]
93    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
94    #[inline(always)]
95    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
96        self.bits = bits;
97        self
98    }
99}
100#[doc = "Read the MPU Region Base Address Register to determine the base address of the region identified by MPU_RNR. Write to update the base address of said region or that of a specified region, with whose number MPU_RNR will also be updated.  
101
102You can [`read`](crate::generic::Reg::read) this register and get [`mpu_rbar::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`mpu_rbar::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
103pub struct MPU_RBAR_SPEC;
104impl crate::RegisterSpec for MPU_RBAR_SPEC {
105    type Ux = u32;
106}
107#[doc = "`read()` method returns [`mpu_rbar::R`](R) reader structure"]
108impl crate::Readable for MPU_RBAR_SPEC {}
109#[doc = "`write(|w| ..)` method takes [`mpu_rbar::W`](W) writer structure"]
110impl crate::Writable for MPU_RBAR_SPEC {
111    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
112    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
113}
114#[doc = "`reset()` method sets MPU_RBAR to value 0"]
115impl crate::Resettable for MPU_RBAR_SPEC {
116    const RESET_VALUE: u32 = 0;
117}