eos_s3/pmu/
pf_mem_ctrl_1.rs

1#[doc = "Register `PF_MEM_CTRL_1` reader"]
2pub struct R(crate::R<PF_MEM_CTRL_1_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PF_MEM_CTRL_1_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PF_MEM_CTRL_1_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PF_MEM_CTRL_1_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `PF_MEM_CTRL_1` writer"]
17pub struct W(crate::W<PF_MEM_CTRL_1_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<PF_MEM_CTRL_1_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<PF_MEM_CTRL_1_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<PF_MEM_CTRL_1_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Control SD Pin of FIFO_2 instances on PF subsystem\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum CTRL_PF_SRAM_SD_0_A {
40    #[doc = "0: Disable the shut down function of SRAM Macro."]
41    DISABLE_SHUT_DOWN = 0,
42    #[doc = "1: Enable the shut down function of SRAM Macro, Memory content will be lost."]
43    ENABLE_SHUT_DOWN = 1,
44}
45impl From<CTRL_PF_SRAM_SD_0_A> for bool {
46    #[inline(always)]
47    fn from(variant: CTRL_PF_SRAM_SD_0_A) -> Self {
48        variant as u8 != 0
49    }
50}
51#[doc = "Field `CTRL_PF_SRAM_SD_0` reader - Control SD Pin of FIFO_2 instances on PF subsystem"]
52pub struct CTRL_PF_SRAM_SD_0_R(crate::FieldReader<bool, CTRL_PF_SRAM_SD_0_A>);
53impl CTRL_PF_SRAM_SD_0_R {
54    #[inline(always)]
55    pub(crate) fn new(bits: bool) -> Self {
56        CTRL_PF_SRAM_SD_0_R(crate::FieldReader::new(bits))
57    }
58    #[doc = r"Get enumerated values variant"]
59    #[inline(always)]
60    pub fn variant(&self) -> CTRL_PF_SRAM_SD_0_A {
61        match self.bits {
62            false => CTRL_PF_SRAM_SD_0_A::DISABLE_SHUT_DOWN,
63            true => CTRL_PF_SRAM_SD_0_A::ENABLE_SHUT_DOWN,
64        }
65    }
66    #[doc = "Checks if the value of the field is `DISABLE_SHUT_DOWN`"]
67    #[inline(always)]
68    pub fn is_disable_shut_down(&self) -> bool {
69        **self == CTRL_PF_SRAM_SD_0_A::DISABLE_SHUT_DOWN
70    }
71    #[doc = "Checks if the value of the field is `ENABLE_SHUT_DOWN`"]
72    #[inline(always)]
73    pub fn is_enable_shut_down(&self) -> bool {
74        **self == CTRL_PF_SRAM_SD_0_A::ENABLE_SHUT_DOWN
75    }
76}
77impl core::ops::Deref for CTRL_PF_SRAM_SD_0_R {
78    type Target = crate::FieldReader<bool, CTRL_PF_SRAM_SD_0_A>;
79    #[inline(always)]
80    fn deref(&self) -> &Self::Target {
81        &self.0
82    }
83}
84#[doc = "Field `CTRL_PF_SRAM_SD_0` writer - Control SD Pin of FIFO_2 instances on PF subsystem"]
85pub struct CTRL_PF_SRAM_SD_0_W<'a> {
86    w: &'a mut W,
87}
88impl<'a> CTRL_PF_SRAM_SD_0_W<'a> {
89    #[doc = r"Writes `variant` to the field"]
90    #[inline(always)]
91    pub fn variant(self, variant: CTRL_PF_SRAM_SD_0_A) -> &'a mut W {
92        self.bit(variant.into())
93    }
94    #[doc = "Disable the shut down function of SRAM Macro."]
95    #[inline(always)]
96    pub fn disable_shut_down(self) -> &'a mut W {
97        self.variant(CTRL_PF_SRAM_SD_0_A::DISABLE_SHUT_DOWN)
98    }
99    #[doc = "Enable the shut down function of SRAM Macro, Memory content will be lost."]
100    #[inline(always)]
101    pub fn enable_shut_down(self) -> &'a mut W {
102        self.variant(CTRL_PF_SRAM_SD_0_A::ENABLE_SHUT_DOWN)
103    }
104    #[doc = r"Sets the field bit"]
105    #[inline(always)]
106    pub fn set_bit(self) -> &'a mut W {
107        self.bit(true)
108    }
109    #[doc = r"Clears the field bit"]
110    #[inline(always)]
111    pub fn clear_bit(self) -> &'a mut W {
112        self.bit(false)
113    }
114    #[doc = r"Writes raw bits to the field"]
115    #[inline(always)]
116    pub fn bit(self, value: bool) -> &'a mut W {
117        self.w.bits =
118            (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2);
119        self.w
120    }
121}
122#[doc = "Control SD Pin of FIFO_8k instances on PF subsystem"]
123pub type CTRL_PF_SRAM_SD_8K_A = CTRL_PF_SRAM_SD_0_A;
124#[doc = "Field `CTRL_PF_SRAM_SD_8k` reader - Control SD Pin of FIFO_8k instances on PF subsystem"]
125pub type CTRL_PF_SRAM_SD_8K_R = CTRL_PF_SRAM_SD_0_R;
126#[doc = "Field `CTRL_PF_SRAM_SD_8k` writer - Control SD Pin of FIFO_8k instances on PF subsystem"]
127pub struct CTRL_PF_SRAM_SD_8K_W<'a> {
128    w: &'a mut W,
129}
130impl<'a> CTRL_PF_SRAM_SD_8K_W<'a> {
131    #[doc = r"Writes `variant` to the field"]
132    #[inline(always)]
133    pub fn variant(self, variant: CTRL_PF_SRAM_SD_8K_A) -> &'a mut W {
134        self.bit(variant.into())
135    }
136    #[doc = "Disable the shut down function of SRAM Macro."]
137    #[inline(always)]
138    pub fn disable_shut_down(self) -> &'a mut W {
139        self.variant(CTRL_PF_SRAM_SD_8K_A::DISABLE_SHUT_DOWN)
140    }
141    #[doc = "Enable the shut down function of SRAM Macro, Memory content will be lost."]
142    #[inline(always)]
143    pub fn enable_shut_down(self) -> &'a mut W {
144        self.variant(CTRL_PF_SRAM_SD_8K_A::ENABLE_SHUT_DOWN)
145    }
146    #[doc = r"Sets the field bit"]
147    #[inline(always)]
148    pub fn set_bit(self) -> &'a mut W {
149        self.bit(true)
150    }
151    #[doc = r"Clears the field bit"]
152    #[inline(always)]
153    pub fn clear_bit(self) -> &'a mut W {
154        self.bit(false)
155    }
156    #[doc = r"Writes raw bits to the field"]
157    #[inline(always)]
158    pub fn bit(self, value: bool) -> &'a mut W {
159        self.w.bits =
160            (self.w.bits & !(0x01 << 3)) | ((value as u32 & 0x01) << 3);
161        self.w
162    }
163}
164impl R {
165    #[doc = "Bit 2 - Control SD Pin of FIFO_2 instances on PF subsystem"]
166    #[inline(always)]
167    pub fn ctrl_pf_sram_sd_0(&self) -> CTRL_PF_SRAM_SD_0_R {
168        CTRL_PF_SRAM_SD_0_R::new(((self.bits >> 2) & 0x01) != 0)
169    }
170    #[doc = "Bit 3 - Control SD Pin of FIFO_8k instances on PF subsystem"]
171    #[inline(always)]
172    pub fn ctrl_pf_sram_sd_8k(&self) -> CTRL_PF_SRAM_SD_8K_R {
173        CTRL_PF_SRAM_SD_8K_R::new(((self.bits >> 3) & 0x01) != 0)
174    }
175}
176impl W {
177    #[doc = "Bit 2 - Control SD Pin of FIFO_2 instances on PF subsystem"]
178    #[inline(always)]
179    pub fn ctrl_pf_sram_sd_0(&mut self) -> CTRL_PF_SRAM_SD_0_W {
180        CTRL_PF_SRAM_SD_0_W { w: self }
181    }
182    #[doc = "Bit 3 - Control SD Pin of FIFO_8k instances on PF subsystem"]
183    #[inline(always)]
184    pub fn ctrl_pf_sram_sd_8k(&mut self) -> CTRL_PF_SRAM_SD_8K_W {
185        CTRL_PF_SRAM_SD_8K_W { w: self }
186    }
187    #[doc = "Writes raw bits to the register."]
188    #[inline(always)]
189    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
190        self.0.bits(bits);
191        self
192    }
193}
194#[doc = "Control Shut Down pin of various FIFOs intances in the PF subsystem. For each one: 1'b1 : Enable the Shut Down function of SRAM Macro, Memory content will be lost\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 [pf_mem_ctrl_1](index.html) module"]
195pub struct PF_MEM_CTRL_1_SPEC;
196impl crate::RegisterSpec for PF_MEM_CTRL_1_SPEC {
197    type Ux = u32;
198}
199#[doc = "`read()` method returns [pf_mem_ctrl_1::R](R) reader structure"]
200impl crate::Readable for PF_MEM_CTRL_1_SPEC {
201    type Reader = R;
202}
203#[doc = "`write(|w| ..)` method takes [pf_mem_ctrl_1::W](W) writer structure"]
204impl crate::Writable for PF_MEM_CTRL_1_SPEC {
205    type Writer = W;
206}
207#[doc = "`reset()` method sets PF_MEM_CTRL_1 to value 0"]
208impl crate::Resettable for PF_MEM_CTRL_1_SPEC {
209    #[inline(always)]
210    fn reset_value() -> Self::Ux {
211        0
212    }
213}