xmc4300/pref/
pcon.rs

1#[doc = "Register `PCON` reader"]
2pub type R = crate::R<PCON_SPEC>;
3#[doc = "Register `PCON` writer"]
4pub type W = crate::W<PCON_SPEC>;
5#[doc = "Instruction Prefetch Buffer Bypass\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum IBYP_A {
8    #[doc = "0: Instruction prefetch buffer not bypassed."]
9    CONST_0 = 0,
10    #[doc = "1: Instruction prefetch buffer bypassed."]
11    CONST_1 = 1,
12}
13impl From<IBYP_A> for bool {
14    #[inline(always)]
15    fn from(variant: IBYP_A) -> Self {
16        variant as u8 != 0
17    }
18}
19#[doc = "Field `IBYP` reader - Instruction Prefetch Buffer Bypass"]
20pub type IBYP_R = crate::BitReader<IBYP_A>;
21impl IBYP_R {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> IBYP_A {
25        match self.bits {
26            false => IBYP_A::CONST_0,
27            true => IBYP_A::CONST_1,
28        }
29    }
30    #[doc = "Instruction prefetch buffer not bypassed."]
31    #[inline(always)]
32    pub fn is_const_0(&self) -> bool {
33        *self == IBYP_A::CONST_0
34    }
35    #[doc = "Instruction prefetch buffer bypassed."]
36    #[inline(always)]
37    pub fn is_const_1(&self) -> bool {
38        *self == IBYP_A::CONST_1
39    }
40}
41#[doc = "Field `IBYP` writer - Instruction Prefetch Buffer Bypass"]
42pub type IBYP_W<'a, REG> = crate::BitWriter<'a, REG, IBYP_A>;
43impl<'a, REG> IBYP_W<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "Instruction prefetch buffer not bypassed."]
48    #[inline(always)]
49    pub fn const_0(self) -> &'a mut crate::W<REG> {
50        self.variant(IBYP_A::CONST_0)
51    }
52    #[doc = "Instruction prefetch buffer bypassed."]
53    #[inline(always)]
54    pub fn const_1(self) -> &'a mut crate::W<REG> {
55        self.variant(IBYP_A::CONST_1)
56    }
57}
58#[doc = "Instruction Prefetch Buffer Invalidate\n\nValue on reset: 0"]
59#[derive(Clone, Copy, Debug, PartialEq, Eq)]
60pub enum IINV_A {
61    #[doc = "0: No effect."]
62    CONST_0 = 0,
63    #[doc = "1: Initiate invalidation of entire instruction cache."]
64    CONST_1 = 1,
65}
66impl From<IINV_A> for bool {
67    #[inline(always)]
68    fn from(variant: IINV_A) -> Self {
69        variant as u8 != 0
70    }
71}
72#[doc = "Field `IINV` writer - Instruction Prefetch Buffer Invalidate"]
73pub type IINV_W<'a, REG> = crate::BitWriter<'a, REG, IINV_A>;
74impl<'a, REG> IINV_W<'a, REG>
75where
76    REG: crate::Writable + crate::RegisterSpec,
77{
78    #[doc = "No effect."]
79    #[inline(always)]
80    pub fn const_0(self) -> &'a mut crate::W<REG> {
81        self.variant(IINV_A::CONST_0)
82    }
83    #[doc = "Initiate invalidation of entire instruction cache."]
84    #[inline(always)]
85    pub fn const_1(self) -> &'a mut crate::W<REG> {
86        self.variant(IINV_A::CONST_1)
87    }
88}
89#[doc = "Data Buffer Bypass\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum DBYP_A {
92    #[doc = "0: Prefetch Data buffer not bypassed."]
93    VALUE1 = 0,
94    #[doc = "1: Prefetch Data buffer bypassed."]
95    VALUE2 = 1,
96}
97impl From<DBYP_A> for bool {
98    #[inline(always)]
99    fn from(variant: DBYP_A) -> Self {
100        variant as u8 != 0
101    }
102}
103#[doc = "Field `DBYP` reader - Data Buffer Bypass"]
104pub type DBYP_R = crate::BitReader<DBYP_A>;
105impl DBYP_R {
106    #[doc = "Get enumerated values variant"]
107    #[inline(always)]
108    pub const fn variant(&self) -> DBYP_A {
109        match self.bits {
110            false => DBYP_A::VALUE1,
111            true => DBYP_A::VALUE2,
112        }
113    }
114    #[doc = "Prefetch Data buffer not bypassed."]
115    #[inline(always)]
116    pub fn is_value1(&self) -> bool {
117        *self == DBYP_A::VALUE1
118    }
119    #[doc = "Prefetch Data buffer bypassed."]
120    #[inline(always)]
121    pub fn is_value2(&self) -> bool {
122        *self == DBYP_A::VALUE2
123    }
124}
125#[doc = "Field `DBYP` writer - Data Buffer Bypass"]
126pub type DBYP_W<'a, REG> = crate::BitWriter<'a, REG, DBYP_A>;
127impl<'a, REG> DBYP_W<'a, REG>
128where
129    REG: crate::Writable + crate::RegisterSpec,
130{
131    #[doc = "Prefetch Data buffer not bypassed."]
132    #[inline(always)]
133    pub fn value1(self) -> &'a mut crate::W<REG> {
134        self.variant(DBYP_A::VALUE1)
135    }
136    #[doc = "Prefetch Data buffer bypassed."]
137    #[inline(always)]
138    pub fn value2(self) -> &'a mut crate::W<REG> {
139        self.variant(DBYP_A::VALUE2)
140    }
141}
142impl R {
143    #[doc = "Bit 0 - Instruction Prefetch Buffer Bypass"]
144    #[inline(always)]
145    pub fn ibyp(&self) -> IBYP_R {
146        IBYP_R::new((self.bits & 1) != 0)
147    }
148    #[doc = "Bit 4 - Data Buffer Bypass"]
149    #[inline(always)]
150    pub fn dbyp(&self) -> DBYP_R {
151        DBYP_R::new(((self.bits >> 4) & 1) != 0)
152    }
153}
154impl W {
155    #[doc = "Bit 0 - Instruction Prefetch Buffer Bypass"]
156    #[inline(always)]
157    pub fn ibyp(&mut self) -> IBYP_W<PCON_SPEC> {
158        IBYP_W::new(self, 0)
159    }
160    #[doc = "Bit 1 - Instruction Prefetch Buffer Invalidate"]
161    #[inline(always)]
162    pub fn iinv(&mut self) -> IINV_W<PCON_SPEC> {
163        IINV_W::new(self, 1)
164    }
165    #[doc = "Bit 4 - Data Buffer Bypass"]
166    #[inline(always)]
167    pub fn dbyp(&mut self) -> DBYP_W<PCON_SPEC> {
168        DBYP_W::new(self, 4)
169    }
170}
171#[doc = "Prefetch Configuration Register\n\nYou can [`read`](crate::Reg::read) this register and get [`pcon::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`pcon::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
172pub struct PCON_SPEC;
173impl crate::RegisterSpec for PCON_SPEC {
174    type Ux = u32;
175}
176#[doc = "`read()` method returns [`pcon::R`](R) reader structure"]
177impl crate::Readable for PCON_SPEC {}
178#[doc = "`write(|w| ..)` method takes [`pcon::W`](W) writer structure"]
179impl crate::Writable for PCON_SPEC {
180    type Safety = crate::Unsafe;
181    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
182    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
183}
184#[doc = "`reset()` method sets PCON to value 0"]
185impl crate::Resettable for PCON_SPEC {
186    const RESET_VALUE: u32 = 0;
187}