efm32gg11b510_pac/emu/
ram1ctrl.rs

1#[doc = "Register `RAM1CTRL` reader"]
2pub struct R(crate::R<RAM1CTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<RAM1CTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<RAM1CTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<RAM1CTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `RAM1CTRL` writer"]
17pub struct W(crate::W<RAM1CTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<RAM1CTRL_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<RAM1CTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<RAM1CTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "RAM1 Blockset Power-down\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum RAMPOWERDOWN_A {
41    #[doc = "0: None of the RAM blocks powered down"]
42    NONE = 0,
43    #[doc = "128: Power down RAM block 7 (address range 0x2003C000-0x2003FFFF)"]
44    BLK7 = 128,
45    #[doc = "192: Power down RAM blocks 6-7 (address range 0x20038000-0x2003FFFF)"]
46    BLK6TO7 = 192,
47    #[doc = "224: Power down RAM blocks 5-7 (address range 0x20034000-0x2003FFFF)"]
48    BLK5TO7 = 224,
49    #[doc = "240: Power down RAM blocks 4-7 (address range 0x20030000-0x2003FFFF)"]
50    BLK4TO7 = 240,
51    #[doc = "248: Power down RAM blocks 3-7 (address range 0x2002C000-0x2003FFFF)"]
52    BLK3TO7 = 248,
53    #[doc = "252: Power down RAM blocks 2-7 (address range 0x20028000-0x2003FFFF)"]
54    BLK2TO7 = 252,
55    #[doc = "254: Power down RAM blocks 1-7 (address range 0x20024000-0x2003FFFF)"]
56    BLK1TO7 = 254,
57    #[doc = "255: Power down RAM blocks 0-7 (address range 0x20020000-0x2003FFFF)"]
58    BLK0TO7 = 255,
59}
60impl From<RAMPOWERDOWN_A> for u8 {
61    #[inline(always)]
62    fn from(variant: RAMPOWERDOWN_A) -> Self {
63        variant as _
64    }
65}
66#[doc = "Field `RAMPOWERDOWN` reader - RAM1 Blockset Power-down"]
67pub type RAMPOWERDOWN_R = crate::FieldReader<u8, RAMPOWERDOWN_A>;
68impl RAMPOWERDOWN_R {
69    #[doc = "Get enumerated values variant"]
70    #[inline(always)]
71    pub fn variant(&self) -> Option<RAMPOWERDOWN_A> {
72        match self.bits {
73            0 => Some(RAMPOWERDOWN_A::NONE),
74            128 => Some(RAMPOWERDOWN_A::BLK7),
75            192 => Some(RAMPOWERDOWN_A::BLK6TO7),
76            224 => Some(RAMPOWERDOWN_A::BLK5TO7),
77            240 => Some(RAMPOWERDOWN_A::BLK4TO7),
78            248 => Some(RAMPOWERDOWN_A::BLK3TO7),
79            252 => Some(RAMPOWERDOWN_A::BLK2TO7),
80            254 => Some(RAMPOWERDOWN_A::BLK1TO7),
81            255 => Some(RAMPOWERDOWN_A::BLK0TO7),
82            _ => None,
83        }
84    }
85    #[doc = "Checks if the value of the field is `NONE`"]
86    #[inline(always)]
87    pub fn is_none(&self) -> bool {
88        *self == RAMPOWERDOWN_A::NONE
89    }
90    #[doc = "Checks if the value of the field is `BLK7`"]
91    #[inline(always)]
92    pub fn is_blk7(&self) -> bool {
93        *self == RAMPOWERDOWN_A::BLK7
94    }
95    #[doc = "Checks if the value of the field is `BLK6TO7`"]
96    #[inline(always)]
97    pub fn is_blk6to7(&self) -> bool {
98        *self == RAMPOWERDOWN_A::BLK6TO7
99    }
100    #[doc = "Checks if the value of the field is `BLK5TO7`"]
101    #[inline(always)]
102    pub fn is_blk5to7(&self) -> bool {
103        *self == RAMPOWERDOWN_A::BLK5TO7
104    }
105    #[doc = "Checks if the value of the field is `BLK4TO7`"]
106    #[inline(always)]
107    pub fn is_blk4to7(&self) -> bool {
108        *self == RAMPOWERDOWN_A::BLK4TO7
109    }
110    #[doc = "Checks if the value of the field is `BLK3TO7`"]
111    #[inline(always)]
112    pub fn is_blk3to7(&self) -> bool {
113        *self == RAMPOWERDOWN_A::BLK3TO7
114    }
115    #[doc = "Checks if the value of the field is `BLK2TO7`"]
116    #[inline(always)]
117    pub fn is_blk2to7(&self) -> bool {
118        *self == RAMPOWERDOWN_A::BLK2TO7
119    }
120    #[doc = "Checks if the value of the field is `BLK1TO7`"]
121    #[inline(always)]
122    pub fn is_blk1to7(&self) -> bool {
123        *self == RAMPOWERDOWN_A::BLK1TO7
124    }
125    #[doc = "Checks if the value of the field is `BLK0TO7`"]
126    #[inline(always)]
127    pub fn is_blk0to7(&self) -> bool {
128        *self == RAMPOWERDOWN_A::BLK0TO7
129    }
130}
131#[doc = "Field `RAMPOWERDOWN` writer - RAM1 Blockset Power-down"]
132pub type RAMPOWERDOWN_W<'a> = crate::FieldWriter<'a, u32, RAM1CTRL_SPEC, u8, RAMPOWERDOWN_A, 8, 0>;
133impl<'a> RAMPOWERDOWN_W<'a> {
134    #[doc = "None of the RAM blocks powered down"]
135    #[inline(always)]
136    pub fn none(self) -> &'a mut W {
137        self.variant(RAMPOWERDOWN_A::NONE)
138    }
139    #[doc = "Power down RAM block 7 (address range 0x2003C000-0x2003FFFF)"]
140    #[inline(always)]
141    pub fn blk7(self) -> &'a mut W {
142        self.variant(RAMPOWERDOWN_A::BLK7)
143    }
144    #[doc = "Power down RAM blocks 6-7 (address range 0x20038000-0x2003FFFF)"]
145    #[inline(always)]
146    pub fn blk6to7(self) -> &'a mut W {
147        self.variant(RAMPOWERDOWN_A::BLK6TO7)
148    }
149    #[doc = "Power down RAM blocks 5-7 (address range 0x20034000-0x2003FFFF)"]
150    #[inline(always)]
151    pub fn blk5to7(self) -> &'a mut W {
152        self.variant(RAMPOWERDOWN_A::BLK5TO7)
153    }
154    #[doc = "Power down RAM blocks 4-7 (address range 0x20030000-0x2003FFFF)"]
155    #[inline(always)]
156    pub fn blk4to7(self) -> &'a mut W {
157        self.variant(RAMPOWERDOWN_A::BLK4TO7)
158    }
159    #[doc = "Power down RAM blocks 3-7 (address range 0x2002C000-0x2003FFFF)"]
160    #[inline(always)]
161    pub fn blk3to7(self) -> &'a mut W {
162        self.variant(RAMPOWERDOWN_A::BLK3TO7)
163    }
164    #[doc = "Power down RAM blocks 2-7 (address range 0x20028000-0x2003FFFF)"]
165    #[inline(always)]
166    pub fn blk2to7(self) -> &'a mut W {
167        self.variant(RAMPOWERDOWN_A::BLK2TO7)
168    }
169    #[doc = "Power down RAM blocks 1-7 (address range 0x20024000-0x2003FFFF)"]
170    #[inline(always)]
171    pub fn blk1to7(self) -> &'a mut W {
172        self.variant(RAMPOWERDOWN_A::BLK1TO7)
173    }
174    #[doc = "Power down RAM blocks 0-7 (address range 0x20020000-0x2003FFFF)"]
175    #[inline(always)]
176    pub fn blk0to7(self) -> &'a mut W {
177        self.variant(RAMPOWERDOWN_A::BLK0TO7)
178    }
179}
180impl R {
181    #[doc = "Bits 0:7 - RAM1 Blockset Power-down"]
182    #[inline(always)]
183    pub fn rampowerdown(&self) -> RAMPOWERDOWN_R {
184        RAMPOWERDOWN_R::new((self.bits & 0xff) as u8)
185    }
186}
187impl W {
188    #[doc = "Bits 0:7 - RAM1 Blockset Power-down"]
189    #[inline(always)]
190    pub fn rampowerdown(&mut self) -> RAMPOWERDOWN_W {
191        RAMPOWERDOWN_W::new(self)
192    }
193    #[doc = "Writes raw bits to the register."]
194    #[inline(always)]
195    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
196        self.0.bits(bits);
197        self
198    }
199}
200#[doc = "Memory Control Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [ram1ctrl](index.html) module"]
201pub struct RAM1CTRL_SPEC;
202impl crate::RegisterSpec for RAM1CTRL_SPEC {
203    type Ux = u32;
204}
205#[doc = "`read()` method returns [ram1ctrl::R](R) reader structure"]
206impl crate::Readable for RAM1CTRL_SPEC {
207    type Reader = R;
208}
209#[doc = "`write(|w| ..)` method takes [ram1ctrl::W](W) writer structure"]
210impl crate::Writable for RAM1CTRL_SPEC {
211    type Writer = W;
212}
213#[doc = "`reset()` method sets RAM1CTRL to value 0"]
214impl crate::Resettable for RAM1CTRL_SPEC {
215    #[inline(always)]
216    fn reset_value() -> Self::Ux {
217        0
218    }
219}