efm32tg11b_pac/efm32tg11b120/emu/
ram0ctrl.rs1#[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 = "Field `RAMPOWERDOWN` reader - RAM0 Blockset Power-down"]
38pub type RAMPOWERDOWN_R = crate::FieldReader<u8, RAMPOWERDOWN_A>;
39#[doc = "RAM0 Blockset Power-down\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum RAMPOWERDOWN_A {
43 #[doc = "0: None of the RAM blocks powered down"]
44 NONE = 0,
45 #[doc = "4: Power down RAM block 3"]
46 BLK3 = 4,
47 #[doc = "6: Power down RAM blocks 2 and above"]
48 BLK2TO3 = 6,
49 #[doc = "7: Power down RAM blocks 1 and above"]
50 BLK1TO3 = 7,
51}
52impl From<RAMPOWERDOWN_A> for u8 {
53 #[inline(always)]
54 fn from(variant: RAMPOWERDOWN_A) -> Self {
55 variant as _
56 }
57}
58impl RAMPOWERDOWN_R {
59 #[doc = "Get enumerated values variant"]
60 #[inline(always)]
61 pub fn variant(&self) -> Option<RAMPOWERDOWN_A> {
62 match self.bits {
63 0 => Some(RAMPOWERDOWN_A::NONE),
64 4 => Some(RAMPOWERDOWN_A::BLK3),
65 6 => Some(RAMPOWERDOWN_A::BLK2TO3),
66 7 => Some(RAMPOWERDOWN_A::BLK1TO3),
67 _ => None,
68 }
69 }
70 #[doc = "Checks if the value of the field is `NONE`"]
71 #[inline(always)]
72 pub fn is_none(&self) -> bool {
73 *self == RAMPOWERDOWN_A::NONE
74 }
75 #[doc = "Checks if the value of the field is `BLK3`"]
76 #[inline(always)]
77 pub fn is_blk3(&self) -> bool {
78 *self == RAMPOWERDOWN_A::BLK3
79 }
80 #[doc = "Checks if the value of the field is `BLK2TO3`"]
81 #[inline(always)]
82 pub fn is_blk2to3(&self) -> bool {
83 *self == RAMPOWERDOWN_A::BLK2TO3
84 }
85 #[doc = "Checks if the value of the field is `BLK1TO3`"]
86 #[inline(always)]
87 pub fn is_blk1to3(&self) -> bool {
88 *self == RAMPOWERDOWN_A::BLK1TO3
89 }
90}
91#[doc = "Field `RAMPOWERDOWN` writer - RAM0 Blockset Power-down"]
92pub type RAMPOWERDOWN_W<'a, const O: u8> =
93 crate::FieldWriter<'a, u32, RAM0CTRL_SPEC, u8, RAMPOWERDOWN_A, 3, O>;
94impl<'a, const O: u8> RAMPOWERDOWN_W<'a, O> {
95 #[doc = "None of the RAM blocks powered down"]
96 #[inline(always)]
97 pub fn none(self) -> &'a mut W {
98 self.variant(RAMPOWERDOWN_A::NONE)
99 }
100 #[doc = "Power down RAM block 3"]
101 #[inline(always)]
102 pub fn blk3(self) -> &'a mut W {
103 self.variant(RAMPOWERDOWN_A::BLK3)
104 }
105 #[doc = "Power down RAM blocks 2 and above"]
106 #[inline(always)]
107 pub fn blk2to3(self) -> &'a mut W {
108 self.variant(RAMPOWERDOWN_A::BLK2TO3)
109 }
110 #[doc = "Power down RAM blocks 1 and above"]
111 #[inline(always)]
112 pub fn blk1to3(self) -> &'a mut W {
113 self.variant(RAMPOWERDOWN_A::BLK1TO3)
114 }
115}
116impl R {
117 #[doc = "Bits 0:2 - RAM0 Blockset Power-down"]
118 #[inline(always)]
119 pub fn rampowerdown(&self) -> RAMPOWERDOWN_R {
120 RAMPOWERDOWN_R::new((self.bits & 7) as u8)
121 }
122}
123impl W {
124 #[doc = "Bits 0:2 - RAM0 Blockset Power-down"]
125 #[inline(always)]
126 #[must_use]
127 pub fn rampowerdown(&mut self) -> RAMPOWERDOWN_W<0> {
128 RAMPOWERDOWN_W::new(self)
129 }
130 #[doc = "Writes raw bits to the register."]
131 #[inline(always)]
132 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
133 self.0.bits(bits);
134 self
135 }
136}
137#[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"]
138pub struct RAM0CTRL_SPEC;
139impl crate::RegisterSpec for RAM0CTRL_SPEC {
140 type Ux = u32;
141}
142#[doc = "`read()` method returns [ram0ctrl::R](R) reader structure"]
143impl crate::Readable for RAM0CTRL_SPEC {
144 type Reader = R;
145}
146#[doc = "`write(|w| ..)` method takes [ram0ctrl::W](W) writer structure"]
147impl crate::Writable for RAM0CTRL_SPEC {
148 type Writer = W;
149 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
150 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
151}
152#[doc = "`reset()` method sets RAM0CTRL to value 0"]
153impl crate::Resettable for RAM0CTRL_SPEC {
154 const RESET_VALUE: Self::Ux = 0;
155}