d1_pac/iommu/
iommu_va_config.rs

1#[doc = "Register `iommu_va_config` reader"]
2pub type R = crate::R<IOMMU_VA_CONFIG_SPEC>;
3#[doc = "Register `iommu_va_config` writer"]
4pub type W = crate::W<IOMMU_VA_CONFIG_SPEC>;
5#[doc = "Field `va_config_start` reader - "]
6pub type VA_CONFIG_START_R = crate::BitReader<VA_CONFIG_START_A>;
7#[doc = "\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum VA_CONFIG_START_A {
10    #[doc = "0: No operation or operation is completed"]
11    NO_OPERATION_OR_COMPLETED = 0,
12    #[doc = "1: Start"]
13    S_TART = 1,
14}
15impl From<VA_CONFIG_START_A> for bool {
16    #[inline(always)]
17    fn from(variant: VA_CONFIG_START_A) -> Self {
18        variant as u8 != 0
19    }
20}
21impl VA_CONFIG_START_R {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> VA_CONFIG_START_A {
25        match self.bits {
26            false => VA_CONFIG_START_A::NO_OPERATION_OR_COMPLETED,
27            true => VA_CONFIG_START_A::S_TART,
28        }
29    }
30    #[doc = "No operation or operation is completed"]
31    #[inline(always)]
32    pub fn is_no_operation_or_completed(&self) -> bool {
33        *self == VA_CONFIG_START_A::NO_OPERATION_OR_COMPLETED
34    }
35    #[doc = "Start"]
36    #[inline(always)]
37    pub fn is_s_tart(&self) -> bool {
38        *self == VA_CONFIG_START_A::S_TART
39    }
40}
41#[doc = "Field `va_config_start` writer - "]
42pub type VA_CONFIG_START_W<'a, REG> = crate::BitWriter<'a, REG, VA_CONFIG_START_A>;
43impl<'a, REG> VA_CONFIG_START_W<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "No operation or operation is completed"]
48    #[inline(always)]
49    pub fn no_operation_or_completed(self) -> &'a mut crate::W<REG> {
50        self.variant(VA_CONFIG_START_A::NO_OPERATION_OR_COMPLETED)
51    }
52    #[doc = "Start"]
53    #[inline(always)]
54    pub fn s_tart(self) -> &'a mut crate::W<REG> {
55        self.variant(VA_CONFIG_START_A::S_TART)
56    }
57}
58#[doc = "Field `va_config` reader - Virtual Address Configuration"]
59pub type VA_CONFIG_R = crate::BitReader<VA_CONFIG_A>;
60#[doc = "Virtual Address Configuration\n\nValue on reset: 0"]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum VA_CONFIG_A {
63    #[doc = "0: Read operation"]
64    R_EAD = 0,
65    #[doc = "1: Write operation"]
66    W_RITE = 1,
67}
68impl From<VA_CONFIG_A> for bool {
69    #[inline(always)]
70    fn from(variant: VA_CONFIG_A) -> Self {
71        variant as u8 != 0
72    }
73}
74impl VA_CONFIG_R {
75    #[doc = "Get enumerated values variant"]
76    #[inline(always)]
77    pub const fn variant(&self) -> VA_CONFIG_A {
78        match self.bits {
79            false => VA_CONFIG_A::R_EAD,
80            true => VA_CONFIG_A::W_RITE,
81        }
82    }
83    #[doc = "Read operation"]
84    #[inline(always)]
85    pub fn is_r_ead(&self) -> bool {
86        *self == VA_CONFIG_A::R_EAD
87    }
88    #[doc = "Write operation"]
89    #[inline(always)]
90    pub fn is_w_rite(&self) -> bool {
91        *self == VA_CONFIG_A::W_RITE
92    }
93}
94#[doc = "Field `va_config` writer - Virtual Address Configuration"]
95pub type VA_CONFIG_W<'a, REG> = crate::BitWriter<'a, REG, VA_CONFIG_A>;
96impl<'a, REG> VA_CONFIG_W<'a, REG>
97where
98    REG: crate::Writable + crate::RegisterSpec,
99{
100    #[doc = "Read operation"]
101    #[inline(always)]
102    pub fn r_ead(self) -> &'a mut crate::W<REG> {
103        self.variant(VA_CONFIG_A::R_EAD)
104    }
105    #[doc = "Write operation"]
106    #[inline(always)]
107    pub fn w_rite(self) -> &'a mut crate::W<REG> {
108        self.variant(VA_CONFIG_A::W_RITE)
109    }
110}
111#[doc = "Field `mode_sel` reader - "]
112pub type MODE_SEL_R = crate::BitReader<MODE_SEL_A>;
113#[doc = "\n\nValue on reset: 0"]
114#[derive(Clone, Copy, Debug, PartialEq, Eq)]
115pub enum MODE_SEL_A {
116    #[doc = "0: Prefetch"]
117    P_REFETCH = 0,
118    #[doc = "1: Debug Mode"]
119    D_EBUG = 1,
120}
121impl From<MODE_SEL_A> for bool {
122    #[inline(always)]
123    fn from(variant: MODE_SEL_A) -> Self {
124        variant as u8 != 0
125    }
126}
127impl MODE_SEL_R {
128    #[doc = "Get enumerated values variant"]
129    #[inline(always)]
130    pub const fn variant(&self) -> MODE_SEL_A {
131        match self.bits {
132            false => MODE_SEL_A::P_REFETCH,
133            true => MODE_SEL_A::D_EBUG,
134        }
135    }
136    #[doc = "Prefetch"]
137    #[inline(always)]
138    pub fn is_p_refetch(&self) -> bool {
139        *self == MODE_SEL_A::P_REFETCH
140    }
141    #[doc = "Debug Mode"]
142    #[inline(always)]
143    pub fn is_d_ebug(&self) -> bool {
144        *self == MODE_SEL_A::D_EBUG
145    }
146}
147#[doc = "Field `mode_sel` writer - "]
148pub type MODE_SEL_W<'a, REG> = crate::BitWriter<'a, REG, MODE_SEL_A>;
149impl<'a, REG> MODE_SEL_W<'a, REG>
150where
151    REG: crate::Writable + crate::RegisterSpec,
152{
153    #[doc = "Prefetch"]
154    #[inline(always)]
155    pub fn p_refetch(self) -> &'a mut crate::W<REG> {
156        self.variant(MODE_SEL_A::P_REFETCH)
157    }
158    #[doc = "Debug Mode"]
159    #[inline(always)]
160    pub fn d_ebug(self) -> &'a mut crate::W<REG> {
161        self.variant(MODE_SEL_A::D_EBUG)
162    }
163}
164impl R {
165    #[doc = "Bit 0"]
166    #[inline(always)]
167    pub fn va_config_start(&self) -> VA_CONFIG_START_R {
168        VA_CONFIG_START_R::new((self.bits & 1) != 0)
169    }
170    #[doc = "Bit 8 - Virtual Address Configuration"]
171    #[inline(always)]
172    pub fn va_config(&self) -> VA_CONFIG_R {
173        VA_CONFIG_R::new(((self.bits >> 8) & 1) != 0)
174    }
175    #[doc = "Bit 31"]
176    #[inline(always)]
177    pub fn mode_sel(&self) -> MODE_SEL_R {
178        MODE_SEL_R::new(((self.bits >> 31) & 1) != 0)
179    }
180}
181impl W {
182    #[doc = "Bit 0"]
183    #[inline(always)]
184    #[must_use]
185    pub fn va_config_start(&mut self) -> VA_CONFIG_START_W<IOMMU_VA_CONFIG_SPEC> {
186        VA_CONFIG_START_W::new(self, 0)
187    }
188    #[doc = "Bit 8 - Virtual Address Configuration"]
189    #[inline(always)]
190    #[must_use]
191    pub fn va_config(&mut self) -> VA_CONFIG_W<IOMMU_VA_CONFIG_SPEC> {
192        VA_CONFIG_W::new(self, 8)
193    }
194    #[doc = "Bit 31"]
195    #[inline(always)]
196    #[must_use]
197    pub fn mode_sel(&mut self) -> MODE_SEL_W<IOMMU_VA_CONFIG_SPEC> {
198        MODE_SEL_W::new(self, 31)
199    }
200    #[doc = r" Writes raw bits to the register."]
201    #[doc = r""]
202    #[doc = r" # Safety"]
203    #[doc = r""]
204    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
205    #[inline(always)]
206    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
207        self.bits = bits;
208        self
209    }
210}
211#[doc = "IOMMU Virtual Address Configuration Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`iommu_va_config::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_va_config::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
212pub struct IOMMU_VA_CONFIG_SPEC;
213impl crate::RegisterSpec for IOMMU_VA_CONFIG_SPEC {
214    type Ux = u32;
215}
216#[doc = "`read()` method returns [`iommu_va_config::R`](R) reader structure"]
217impl crate::Readable for IOMMU_VA_CONFIG_SPEC {}
218#[doc = "`write(|w| ..)` method takes [`iommu_va_config::W`](W) writer structure"]
219impl crate::Writable for IOMMU_VA_CONFIG_SPEC {
220    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
221    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
222}
223#[doc = "`reset()` method sets iommu_va_config to value 0"]
224impl crate::Resettable for IOMMU_VA_CONFIG_SPEC {
225    const RESET_VALUE: Self::Ux = 0;
226}