efm32gg11b510_pac/emu/
ram0ctrl.rs

1#[doc = "Register `RAM0CTRL` reader"]
2pub struct R(crate::R<RAM0CTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<RAM0CTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<RAM0CTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<RAM0CTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `RAM0CTRL` writer"]
17pub struct W(crate::W<RAM0CTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<RAM0CTRL_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<RAM0CTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<RAM0CTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "RAM0 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 = "64: Power down RAM block 7 and above"]
44    BLK7 = 64,
45    #[doc = "96: Power down RAM block 6 and above"]
46    BLK6TO7 = 96,
47    #[doc = "112: Power down RAM block 5 and above"]
48    BLK5TO7 = 112,
49    #[doc = "120: Power down RAM blocks 4 and above"]
50    BLK4TO7 = 120,
51    #[doc = "124: Power down RAM blocks 3 and above"]
52    BLK3TO7 = 124,
53    #[doc = "126: Power down RAM blocks 2 and above"]
54    BLK2TO7 = 126,
55    #[doc = "127: Power down RAM blocks 1 and above"]
56    BLK1TO7 = 127,
57}
58impl From<RAMPOWERDOWN_A> for u8 {
59    #[inline(always)]
60    fn from(variant: RAMPOWERDOWN_A) -> Self {
61        variant as _
62    }
63}
64#[doc = "Field `RAMPOWERDOWN` reader - RAM0 Blockset Power-down"]
65pub type RAMPOWERDOWN_R = crate::FieldReader<u8, RAMPOWERDOWN_A>;
66impl RAMPOWERDOWN_R {
67    #[doc = "Get enumerated values variant"]
68    #[inline(always)]
69    pub fn variant(&self) -> Option<RAMPOWERDOWN_A> {
70        match self.bits {
71            0 => Some(RAMPOWERDOWN_A::NONE),
72            64 => Some(RAMPOWERDOWN_A::BLK7),
73            96 => Some(RAMPOWERDOWN_A::BLK6TO7),
74            112 => Some(RAMPOWERDOWN_A::BLK5TO7),
75            120 => Some(RAMPOWERDOWN_A::BLK4TO7),
76            124 => Some(RAMPOWERDOWN_A::BLK3TO7),
77            126 => Some(RAMPOWERDOWN_A::BLK2TO7),
78            127 => Some(RAMPOWERDOWN_A::BLK1TO7),
79            _ => None,
80        }
81    }
82    #[doc = "Checks if the value of the field is `NONE`"]
83    #[inline(always)]
84    pub fn is_none(&self) -> bool {
85        *self == RAMPOWERDOWN_A::NONE
86    }
87    #[doc = "Checks if the value of the field is `BLK7`"]
88    #[inline(always)]
89    pub fn is_blk7(&self) -> bool {
90        *self == RAMPOWERDOWN_A::BLK7
91    }
92    #[doc = "Checks if the value of the field is `BLK6TO7`"]
93    #[inline(always)]
94    pub fn is_blk6to7(&self) -> bool {
95        *self == RAMPOWERDOWN_A::BLK6TO7
96    }
97    #[doc = "Checks if the value of the field is `BLK5TO7`"]
98    #[inline(always)]
99    pub fn is_blk5to7(&self) -> bool {
100        *self == RAMPOWERDOWN_A::BLK5TO7
101    }
102    #[doc = "Checks if the value of the field is `BLK4TO7`"]
103    #[inline(always)]
104    pub fn is_blk4to7(&self) -> bool {
105        *self == RAMPOWERDOWN_A::BLK4TO7
106    }
107    #[doc = "Checks if the value of the field is `BLK3TO7`"]
108    #[inline(always)]
109    pub fn is_blk3to7(&self) -> bool {
110        *self == RAMPOWERDOWN_A::BLK3TO7
111    }
112    #[doc = "Checks if the value of the field is `BLK2TO7`"]
113    #[inline(always)]
114    pub fn is_blk2to7(&self) -> bool {
115        *self == RAMPOWERDOWN_A::BLK2TO7
116    }
117    #[doc = "Checks if the value of the field is `BLK1TO7`"]
118    #[inline(always)]
119    pub fn is_blk1to7(&self) -> bool {
120        *self == RAMPOWERDOWN_A::BLK1TO7
121    }
122}
123#[doc = "Field `RAMPOWERDOWN` writer - RAM0 Blockset Power-down"]
124pub type RAMPOWERDOWN_W<'a> = crate::FieldWriter<'a, u32, RAM0CTRL_SPEC, u8, RAMPOWERDOWN_A, 7, 0>;
125impl<'a> RAMPOWERDOWN_W<'a> {
126    #[doc = "None of the RAM blocks powered down"]
127    #[inline(always)]
128    pub fn none(self) -> &'a mut W {
129        self.variant(RAMPOWERDOWN_A::NONE)
130    }
131    #[doc = "Power down RAM block 7 and above"]
132    #[inline(always)]
133    pub fn blk7(self) -> &'a mut W {
134        self.variant(RAMPOWERDOWN_A::BLK7)
135    }
136    #[doc = "Power down RAM block 6 and above"]
137    #[inline(always)]
138    pub fn blk6to7(self) -> &'a mut W {
139        self.variant(RAMPOWERDOWN_A::BLK6TO7)
140    }
141    #[doc = "Power down RAM block 5 and above"]
142    #[inline(always)]
143    pub fn blk5to7(self) -> &'a mut W {
144        self.variant(RAMPOWERDOWN_A::BLK5TO7)
145    }
146    #[doc = "Power down RAM blocks 4 and above"]
147    #[inline(always)]
148    pub fn blk4to7(self) -> &'a mut W {
149        self.variant(RAMPOWERDOWN_A::BLK4TO7)
150    }
151    #[doc = "Power down RAM blocks 3 and above"]
152    #[inline(always)]
153    pub fn blk3to7(self) -> &'a mut W {
154        self.variant(RAMPOWERDOWN_A::BLK3TO7)
155    }
156    #[doc = "Power down RAM blocks 2 and above"]
157    #[inline(always)]
158    pub fn blk2to7(self) -> &'a mut W {
159        self.variant(RAMPOWERDOWN_A::BLK2TO7)
160    }
161    #[doc = "Power down RAM blocks 1 and above"]
162    #[inline(always)]
163    pub fn blk1to7(self) -> &'a mut W {
164        self.variant(RAMPOWERDOWN_A::BLK1TO7)
165    }
166}
167impl R {
168    #[doc = "Bits 0:6 - RAM0 Blockset Power-down"]
169    #[inline(always)]
170    pub fn rampowerdown(&self) -> RAMPOWERDOWN_R {
171        RAMPOWERDOWN_R::new((self.bits & 0x7f) as u8)
172    }
173}
174impl W {
175    #[doc = "Bits 0:6 - RAM0 Blockset Power-down"]
176    #[inline(always)]
177    pub fn rampowerdown(&mut self) -> RAMPOWERDOWN_W {
178        RAMPOWERDOWN_W::new(self)
179    }
180    #[doc = "Writes raw bits to the register."]
181    #[inline(always)]
182    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
183        self.0.bits(bits);
184        self
185    }
186}
187#[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 [ram0ctrl](index.html) module"]
188pub struct RAM0CTRL_SPEC;
189impl crate::RegisterSpec for RAM0CTRL_SPEC {
190    type Ux = u32;
191}
192#[doc = "`read()` method returns [ram0ctrl::R](R) reader structure"]
193impl crate::Readable for RAM0CTRL_SPEC {
194    type Reader = R;
195}
196#[doc = "`write(|w| ..)` method takes [ram0ctrl::W](W) writer structure"]
197impl crate::Writable for RAM0CTRL_SPEC {
198    type Writer = W;
199}
200#[doc = "`reset()` method sets RAM0CTRL to value 0"]
201impl crate::Resettable for RAM0CTRL_SPEC {
202    #[inline(always)]
203    fn reset_value() -> Self::Ux {
204        0
205    }
206}