d1_pac/iommu/
iommu_4kb_bdy_prt_ctrl.rs

1#[doc = "Register `iommu_4kb_bdy_prt_ctrl` reader"]
2pub type R = crate::R<IOMMU_4KB_BDY_PRT_CTRL_SPEC>;
3#[doc = "Register `iommu_4kb_bdy_prt_ctrl` writer"]
4pub type W = crate::W<IOMMU_4KB_BDY_PRT_CTRL_SPEC>;
5#[doc = "Field `m_4kb_bdy_prt_ctrl[0-6]` reader - Master\\[i\\] 4 KB boundary protect control bit"]
6pub type M_4KB_BDY_PRT_CTRL_R = crate::BitReader<M_4KB_BDY_PRT_CTRL_A>;
7#[doc = "Master\\[i\\] 4 KB boundary protect control bit\n\nValue on reset: 1"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum M_4KB_BDY_PRT_CTRL_A {
10    #[doc = "0: Disable 4 KB boundary protect"]
11    DISABLE = 0,
12    #[doc = "1: Enable 4 KB boundary protect"]
13    ENABLE = 1,
14}
15impl From<M_4KB_BDY_PRT_CTRL_A> for bool {
16    #[inline(always)]
17    fn from(variant: M_4KB_BDY_PRT_CTRL_A) -> Self {
18        variant as u8 != 0
19    }
20}
21impl M_4KB_BDY_PRT_CTRL_R {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> M_4KB_BDY_PRT_CTRL_A {
25        match self.bits {
26            false => M_4KB_BDY_PRT_CTRL_A::DISABLE,
27            true => M_4KB_BDY_PRT_CTRL_A::ENABLE,
28        }
29    }
30    #[doc = "Disable 4 KB boundary protect"]
31    #[inline(always)]
32    pub fn is_disable(&self) -> bool {
33        *self == M_4KB_BDY_PRT_CTRL_A::DISABLE
34    }
35    #[doc = "Enable 4 KB boundary protect"]
36    #[inline(always)]
37    pub fn is_enable(&self) -> bool {
38        *self == M_4KB_BDY_PRT_CTRL_A::ENABLE
39    }
40}
41#[doc = "Field `m_4kb_bdy_prt_ctrl[0-6]` writer - Master\\[i\\] 4 KB boundary protect control bit"]
42pub type M_4KB_BDY_PRT_CTRL_W<'a, REG> = crate::BitWriter<'a, REG, M_4KB_BDY_PRT_CTRL_A>;
43impl<'a, REG> M_4KB_BDY_PRT_CTRL_W<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "Disable 4 KB boundary protect"]
48    #[inline(always)]
49    pub fn disable(self) -> &'a mut crate::W<REG> {
50        self.variant(M_4KB_BDY_PRT_CTRL_A::DISABLE)
51    }
52    #[doc = "Enable 4 KB boundary protect"]
53    #[inline(always)]
54    pub fn enable(self) -> &'a mut crate::W<REG> {
55        self.variant(M_4KB_BDY_PRT_CTRL_A::ENABLE)
56    }
57}
58impl R {
59    #[doc = "Master\\[i\\] 4 KB boundary protect control bit\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `m0_4kb_bdy_prt_ctrl` field"]
60    #[inline(always)]
61    pub fn m_4kb_bdy_prt_ctrl(&self, n: u8) -> M_4KB_BDY_PRT_CTRL_R {
62        #[allow(clippy::no_effect)]
63        [(); 7][n as usize];
64        M_4KB_BDY_PRT_CTRL_R::new(((self.bits >> n) & 1) != 0)
65    }
66    #[doc = "Bit 0 - Master\\[i\\] 4 KB boundary protect control bit"]
67    #[inline(always)]
68    pub fn m0_4kb_bdy_prt_ctrl(&self) -> M_4KB_BDY_PRT_CTRL_R {
69        M_4KB_BDY_PRT_CTRL_R::new((self.bits & 1) != 0)
70    }
71    #[doc = "Bit 1 - Master\\[i\\] 4 KB boundary protect control bit"]
72    #[inline(always)]
73    pub fn m1_4kb_bdy_prt_ctrl(&self) -> M_4KB_BDY_PRT_CTRL_R {
74        M_4KB_BDY_PRT_CTRL_R::new(((self.bits >> 1) & 1) != 0)
75    }
76    #[doc = "Bit 2 - Master\\[i\\] 4 KB boundary protect control bit"]
77    #[inline(always)]
78    pub fn m2_4kb_bdy_prt_ctrl(&self) -> M_4KB_BDY_PRT_CTRL_R {
79        M_4KB_BDY_PRT_CTRL_R::new(((self.bits >> 2) & 1) != 0)
80    }
81    #[doc = "Bit 3 - Master\\[i\\] 4 KB boundary protect control bit"]
82    #[inline(always)]
83    pub fn m3_4kb_bdy_prt_ctrl(&self) -> M_4KB_BDY_PRT_CTRL_R {
84        M_4KB_BDY_PRT_CTRL_R::new(((self.bits >> 3) & 1) != 0)
85    }
86    #[doc = "Bit 4 - Master\\[i\\] 4 KB boundary protect control bit"]
87    #[inline(always)]
88    pub fn m4_4kb_bdy_prt_ctrl(&self) -> M_4KB_BDY_PRT_CTRL_R {
89        M_4KB_BDY_PRT_CTRL_R::new(((self.bits >> 4) & 1) != 0)
90    }
91    #[doc = "Bit 5 - Master\\[i\\] 4 KB boundary protect control bit"]
92    #[inline(always)]
93    pub fn m5_4kb_bdy_prt_ctrl(&self) -> M_4KB_BDY_PRT_CTRL_R {
94        M_4KB_BDY_PRT_CTRL_R::new(((self.bits >> 5) & 1) != 0)
95    }
96    #[doc = "Bit 6 - Master\\[i\\] 4 KB boundary protect control bit"]
97    #[inline(always)]
98    pub fn m6_4kb_bdy_prt_ctrl(&self) -> M_4KB_BDY_PRT_CTRL_R {
99        M_4KB_BDY_PRT_CTRL_R::new(((self.bits >> 6) & 1) != 0)
100    }
101}
102impl W {
103    #[doc = "Master\\[i\\] 4 KB boundary protect control bit\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `m0_4kb_bdy_prt_ctrl` field"]
104    #[inline(always)]
105    #[must_use]
106    pub fn m_4kb_bdy_prt_ctrl(
107        &mut self,
108        n: u8,
109    ) -> M_4KB_BDY_PRT_CTRL_W<IOMMU_4KB_BDY_PRT_CTRL_SPEC> {
110        #[allow(clippy::no_effect)]
111        [(); 7][n as usize];
112        M_4KB_BDY_PRT_CTRL_W::new(self, n)
113    }
114    #[doc = "Bit 0 - Master\\[i\\] 4 KB boundary protect control bit"]
115    #[inline(always)]
116    #[must_use]
117    pub fn m0_4kb_bdy_prt_ctrl(&mut self) -> M_4KB_BDY_PRT_CTRL_W<IOMMU_4KB_BDY_PRT_CTRL_SPEC> {
118        M_4KB_BDY_PRT_CTRL_W::new(self, 0)
119    }
120    #[doc = "Bit 1 - Master\\[i\\] 4 KB boundary protect control bit"]
121    #[inline(always)]
122    #[must_use]
123    pub fn m1_4kb_bdy_prt_ctrl(&mut self) -> M_4KB_BDY_PRT_CTRL_W<IOMMU_4KB_BDY_PRT_CTRL_SPEC> {
124        M_4KB_BDY_PRT_CTRL_W::new(self, 1)
125    }
126    #[doc = "Bit 2 - Master\\[i\\] 4 KB boundary protect control bit"]
127    #[inline(always)]
128    #[must_use]
129    pub fn m2_4kb_bdy_prt_ctrl(&mut self) -> M_4KB_BDY_PRT_CTRL_W<IOMMU_4KB_BDY_PRT_CTRL_SPEC> {
130        M_4KB_BDY_PRT_CTRL_W::new(self, 2)
131    }
132    #[doc = "Bit 3 - Master\\[i\\] 4 KB boundary protect control bit"]
133    #[inline(always)]
134    #[must_use]
135    pub fn m3_4kb_bdy_prt_ctrl(&mut self) -> M_4KB_BDY_PRT_CTRL_W<IOMMU_4KB_BDY_PRT_CTRL_SPEC> {
136        M_4KB_BDY_PRT_CTRL_W::new(self, 3)
137    }
138    #[doc = "Bit 4 - Master\\[i\\] 4 KB boundary protect control bit"]
139    #[inline(always)]
140    #[must_use]
141    pub fn m4_4kb_bdy_prt_ctrl(&mut self) -> M_4KB_BDY_PRT_CTRL_W<IOMMU_4KB_BDY_PRT_CTRL_SPEC> {
142        M_4KB_BDY_PRT_CTRL_W::new(self, 4)
143    }
144    #[doc = "Bit 5 - Master\\[i\\] 4 KB boundary protect control bit"]
145    #[inline(always)]
146    #[must_use]
147    pub fn m5_4kb_bdy_prt_ctrl(&mut self) -> M_4KB_BDY_PRT_CTRL_W<IOMMU_4KB_BDY_PRT_CTRL_SPEC> {
148        M_4KB_BDY_PRT_CTRL_W::new(self, 5)
149    }
150    #[doc = "Bit 6 - Master\\[i\\] 4 KB boundary protect control bit"]
151    #[inline(always)]
152    #[must_use]
153    pub fn m6_4kb_bdy_prt_ctrl(&mut self) -> M_4KB_BDY_PRT_CTRL_W<IOMMU_4KB_BDY_PRT_CTRL_SPEC> {
154        M_4KB_BDY_PRT_CTRL_W::new(self, 6)
155    }
156    #[doc = r" Writes raw bits to the register."]
157    #[doc = r""]
158    #[doc = r" # Safety"]
159    #[doc = r""]
160    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
161    #[inline(always)]
162    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
163        self.bits = bits;
164        self
165    }
166}
167#[doc = "IOMMU 4KB Boundary Protect Control Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`iommu_4kb_bdy_prt_ctrl::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 [`iommu_4kb_bdy_prt_ctrl::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
168pub struct IOMMU_4KB_BDY_PRT_CTRL_SPEC;
169impl crate::RegisterSpec for IOMMU_4KB_BDY_PRT_CTRL_SPEC {
170    type Ux = u32;
171}
172#[doc = "`read()` method returns [`iommu_4kb_bdy_prt_ctrl::R`](R) reader structure"]
173impl crate::Readable for IOMMU_4KB_BDY_PRT_CTRL_SPEC {}
174#[doc = "`write(|w| ..)` method takes [`iommu_4kb_bdy_prt_ctrl::W`](W) writer structure"]
175impl crate::Writable for IOMMU_4KB_BDY_PRT_CTRL_SPEC {
176    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
177    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
178}
179#[doc = "`reset()` method sets iommu_4kb_bdy_prt_ctrl to value 0x7f"]
180impl crate::Resettable for IOMMU_4KB_BDY_PRT_CTRL_SPEC {
181    const RESET_VALUE: Self::Ux = 0x7f;
182}