atsamd51p/cmcc/
cfg.rs

1#[doc = "Register `CFG` reader"]
2pub type R = crate::R<CfgSpec>;
3#[doc = "Register `CFG` writer"]
4pub type W = crate::W<CfgSpec>;
5#[doc = "Field `ICDIS` reader - Instruction Cache Disable"]
6pub type IcdisR = crate::BitReader;
7#[doc = "Field `ICDIS` writer - Instruction Cache Disable"]
8pub type IcdisW<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `DCDIS` reader - Data Cache Disable"]
10pub type DcdisR = crate::BitReader;
11#[doc = "Field `DCDIS` writer - Data Cache Disable"]
12pub type DcdisW<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Cache size configured by software\n\nValue on reset: 2"]
14#[derive(Clone, Copy, Debug, PartialEq, Eq)]
15#[repr(u8)]
16pub enum Csizeswselect {
17    #[doc = "0: The Cache Size is configured to 1KB"]
18    ConfCsize1kb = 0,
19    #[doc = "1: The Cache Size is configured to 2KB"]
20    ConfCsize2kb = 1,
21    #[doc = "2: The Cache Size is configured to 4KB"]
22    ConfCsize4kb = 2,
23}
24impl From<Csizeswselect> for u8 {
25    #[inline(always)]
26    fn from(variant: Csizeswselect) -> Self {
27        variant as _
28    }
29}
30impl crate::FieldSpec for Csizeswselect {
31    type Ux = u8;
32}
33impl crate::IsEnum for Csizeswselect {}
34#[doc = "Field `CSIZESW` reader - Cache size configured by software"]
35pub type CsizeswR = crate::FieldReader<Csizeswselect>;
36impl CsizeswR {
37    #[doc = "Get enumerated values variant"]
38    #[inline(always)]
39    pub const fn variant(&self) -> Option<Csizeswselect> {
40        match self.bits {
41            0 => Some(Csizeswselect::ConfCsize1kb),
42            1 => Some(Csizeswselect::ConfCsize2kb),
43            2 => Some(Csizeswselect::ConfCsize4kb),
44            _ => None,
45        }
46    }
47    #[doc = "The Cache Size is configured to 1KB"]
48    #[inline(always)]
49    pub fn is_conf_csize_1kb(&self) -> bool {
50        *self == Csizeswselect::ConfCsize1kb
51    }
52    #[doc = "The Cache Size is configured to 2KB"]
53    #[inline(always)]
54    pub fn is_conf_csize_2kb(&self) -> bool {
55        *self == Csizeswselect::ConfCsize2kb
56    }
57    #[doc = "The Cache Size is configured to 4KB"]
58    #[inline(always)]
59    pub fn is_conf_csize_4kb(&self) -> bool {
60        *self == Csizeswselect::ConfCsize4kb
61    }
62}
63#[doc = "Field `CSIZESW` writer - Cache size configured by software"]
64pub type CsizeswW<'a, REG> = crate::FieldWriter<'a, REG, 3, Csizeswselect>;
65impl<'a, REG> CsizeswW<'a, REG>
66where
67    REG: crate::Writable + crate::RegisterSpec,
68    REG::Ux: From<u8>,
69{
70    #[doc = "The Cache Size is configured to 1KB"]
71    #[inline(always)]
72    pub fn conf_csize_1kb(self) -> &'a mut crate::W<REG> {
73        self.variant(Csizeswselect::ConfCsize1kb)
74    }
75    #[doc = "The Cache Size is configured to 2KB"]
76    #[inline(always)]
77    pub fn conf_csize_2kb(self) -> &'a mut crate::W<REG> {
78        self.variant(Csizeswselect::ConfCsize2kb)
79    }
80    #[doc = "The Cache Size is configured to 4KB"]
81    #[inline(always)]
82    pub fn conf_csize_4kb(self) -> &'a mut crate::W<REG> {
83        self.variant(Csizeswselect::ConfCsize4kb)
84    }
85}
86impl R {
87    #[doc = "Bit 1 - Instruction Cache Disable"]
88    #[inline(always)]
89    pub fn icdis(&self) -> IcdisR {
90        IcdisR::new(((self.bits >> 1) & 1) != 0)
91    }
92    #[doc = "Bit 2 - Data Cache Disable"]
93    #[inline(always)]
94    pub fn dcdis(&self) -> DcdisR {
95        DcdisR::new(((self.bits >> 2) & 1) != 0)
96    }
97    #[doc = "Bits 4:6 - Cache size configured by software"]
98    #[inline(always)]
99    pub fn csizesw(&self) -> CsizeswR {
100        CsizeswR::new(((self.bits >> 4) & 7) as u8)
101    }
102}
103impl W {
104    #[doc = "Bit 1 - Instruction Cache Disable"]
105    #[inline(always)]
106    #[must_use]
107    pub fn icdis(&mut self) -> IcdisW<CfgSpec> {
108        IcdisW::new(self, 1)
109    }
110    #[doc = "Bit 2 - Data Cache Disable"]
111    #[inline(always)]
112    #[must_use]
113    pub fn dcdis(&mut self) -> DcdisW<CfgSpec> {
114        DcdisW::new(self, 2)
115    }
116    #[doc = "Bits 4:6 - Cache size configured by software"]
117    #[inline(always)]
118    #[must_use]
119    pub fn csizesw(&mut self) -> CsizeswW<CfgSpec> {
120        CsizeswW::new(self, 4)
121    }
122}
123#[doc = "Cache Configuration Register\n\nYou can [`read`](crate::Reg::read) this register and get [`cfg::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`cfg::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
124pub struct CfgSpec;
125impl crate::RegisterSpec for CfgSpec {
126    type Ux = u32;
127}
128#[doc = "`read()` method returns [`cfg::R`](R) reader structure"]
129impl crate::Readable for CfgSpec {}
130#[doc = "`write(|w| ..)` method takes [`cfg::W`](W) writer structure"]
131impl crate::Writable for CfgSpec {
132    type Safety = crate::Unsafe;
133    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
134    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
135}
136#[doc = "`reset()` method sets CFG to value 0x20"]
137impl crate::Resettable for CfgSpec {
138    const RESET_VALUE: u32 = 0x20;
139}