efm32gg12b810/emu/
ram1ctrl.rs

1#[doc = "Reader of register RAM1CTRL"]
2pub type R = crate::R<u32, super::RAM1CTRL>;
3#[doc = "Writer for register RAM1CTRL"]
4pub type W = crate::W<u32, super::RAM1CTRL>;
5#[doc = "Register RAM1CTRL `reset()`'s with value 0"]
6impl crate::ResetValue for super::RAM1CTRL {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "RAM1 Blockset Power-down\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u8)]
16pub enum RAMPOWERDOWN_A {
17    #[doc = "0: None of the RAM blocks powered down"]
18    NONE = 0,
19    #[doc = "8: Power down RAM block 3 (address range 0x2001C000-0x2001FFFF)"]
20    BLK3 = 8,
21    #[doc = "12: Power down RAM blocks 2-3 (address range 0x20018000-0x2001FFFF)"]
22    BLK2TO3 = 12,
23    #[doc = "14: Power down RAM blocks 1-3 (address range 0x20014000-0x2001FFFF)"]
24    BLK1TO3 = 14,
25    #[doc = "15: Power down RAM blocks 0-3 (address range 0x20010000-0x2001FFFF)"]
26    BLK0TO3 = 15,
27}
28impl From<RAMPOWERDOWN_A> for u8 {
29    #[inline(always)]
30    fn from(variant: RAMPOWERDOWN_A) -> Self {
31        variant as _
32    }
33}
34#[doc = "Reader of field `RAMPOWERDOWN`"]
35pub type RAMPOWERDOWN_R = crate::R<u8, RAMPOWERDOWN_A>;
36impl RAMPOWERDOWN_R {
37    #[doc = r"Get enumerated values variant"]
38    #[inline(always)]
39    pub fn variant(&self) -> crate::Variant<u8, RAMPOWERDOWN_A> {
40        use crate::Variant::*;
41        match self.bits {
42            0 => Val(RAMPOWERDOWN_A::NONE),
43            8 => Val(RAMPOWERDOWN_A::BLK3),
44            12 => Val(RAMPOWERDOWN_A::BLK2TO3),
45            14 => Val(RAMPOWERDOWN_A::BLK1TO3),
46            15 => Val(RAMPOWERDOWN_A::BLK0TO3),
47            i => Res(i),
48        }
49    }
50    #[doc = "Checks if the value of the field is `NONE`"]
51    #[inline(always)]
52    pub fn is_none(&self) -> bool {
53        *self == RAMPOWERDOWN_A::NONE
54    }
55    #[doc = "Checks if the value of the field is `BLK3`"]
56    #[inline(always)]
57    pub fn is_blk3(&self) -> bool {
58        *self == RAMPOWERDOWN_A::BLK3
59    }
60    #[doc = "Checks if the value of the field is `BLK2TO3`"]
61    #[inline(always)]
62    pub fn is_blk2to3(&self) -> bool {
63        *self == RAMPOWERDOWN_A::BLK2TO3
64    }
65    #[doc = "Checks if the value of the field is `BLK1TO3`"]
66    #[inline(always)]
67    pub fn is_blk1to3(&self) -> bool {
68        *self == RAMPOWERDOWN_A::BLK1TO3
69    }
70    #[doc = "Checks if the value of the field is `BLK0TO3`"]
71    #[inline(always)]
72    pub fn is_blk0to3(&self) -> bool {
73        *self == RAMPOWERDOWN_A::BLK0TO3
74    }
75}
76#[doc = "Write proxy for field `RAMPOWERDOWN`"]
77pub struct RAMPOWERDOWN_W<'a> {
78    w: &'a mut W,
79}
80impl<'a> RAMPOWERDOWN_W<'a> {
81    #[doc = r"Writes `variant` to the field"]
82    #[inline(always)]
83    pub fn variant(self, variant: RAMPOWERDOWN_A) -> &'a mut W {
84        unsafe { self.bits(variant.into()) }
85    }
86    #[doc = "None of the RAM blocks powered down"]
87    #[inline(always)]
88    pub fn none(self) -> &'a mut W {
89        self.variant(RAMPOWERDOWN_A::NONE)
90    }
91    #[doc = "Power down RAM block 3 (address range 0x2001C000-0x2001FFFF)"]
92    #[inline(always)]
93    pub fn blk3(self) -> &'a mut W {
94        self.variant(RAMPOWERDOWN_A::BLK3)
95    }
96    #[doc = "Power down RAM blocks 2-3 (address range 0x20018000-0x2001FFFF)"]
97    #[inline(always)]
98    pub fn blk2to3(self) -> &'a mut W {
99        self.variant(RAMPOWERDOWN_A::BLK2TO3)
100    }
101    #[doc = "Power down RAM blocks 1-3 (address range 0x20014000-0x2001FFFF)"]
102    #[inline(always)]
103    pub fn blk1to3(self) -> &'a mut W {
104        self.variant(RAMPOWERDOWN_A::BLK1TO3)
105    }
106    #[doc = "Power down RAM blocks 0-3 (address range 0x20010000-0x2001FFFF)"]
107    #[inline(always)]
108    pub fn blk0to3(self) -> &'a mut W {
109        self.variant(RAMPOWERDOWN_A::BLK0TO3)
110    }
111    #[doc = r"Writes raw bits to the field"]
112    #[inline(always)]
113    pub unsafe fn bits(self, value: u8) -> &'a mut W {
114        self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
115        self.w
116    }
117}
118impl R {
119    #[doc = "Bits 0:3 - RAM1 Blockset Power-down"]
120    #[inline(always)]
121    pub fn rampowerdown(&self) -> RAMPOWERDOWN_R {
122        RAMPOWERDOWN_R::new((self.bits & 0x0f) as u8)
123    }
124}
125impl W {
126    #[doc = "Bits 0:3 - RAM1 Blockset Power-down"]
127    #[inline(always)]
128    pub fn rampowerdown(&mut self) -> RAMPOWERDOWN_W {
129        RAMPOWERDOWN_W { w: self }
130    }
131}