ra6m2/qspi/
sfmsdc.rs

1#[doc = "Register `SFMSDC` reader"]
2pub struct R(crate::R<SFMSDC_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SFMSDC_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SFMSDC_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SFMSDC_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SFMSDC` writer"]
17pub struct W(crate::W<SFMSDC_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SFMSDC_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<SFMSDC_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SFMSDC_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `SFMDN` reader - Selection of the number of dummy cycles of Fast Read instructions"]
38pub type SFMDN_R = crate::FieldReader<u8, SFMDN_A>;
39#[doc = "Selection of the number of dummy cycles of Fast Read instructions\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum SFMDN_A {
43    #[doc = "0: Default dummy cycles of each instruction."]
44    _0000 = 0,
45}
46impl From<SFMDN_A> for u8 {
47    #[inline(always)]
48    fn from(variant: SFMDN_A) -> Self {
49        variant as _
50    }
51}
52impl SFMDN_R {
53    #[doc = "Get enumerated values variant"]
54    #[inline(always)]
55    pub fn variant(&self) -> Option<SFMDN_A> {
56        match self.bits {
57            0 => Some(SFMDN_A::_0000),
58            _ => None,
59        }
60    }
61    #[doc = "Checks if the value of the field is `_0000`"]
62    #[inline(always)]
63    pub fn is_0000(&self) -> bool {
64        *self == SFMDN_A::_0000
65    }
66}
67#[doc = "Field `SFMDN` writer - Selection of the number of dummy cycles of Fast Read instructions"]
68pub type SFMDN_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SFMSDC_SPEC, u8, SFMDN_A, 4, O>;
69impl<'a, const O: u8> SFMDN_W<'a, O> {
70    #[doc = "Default dummy cycles of each instruction."]
71    #[inline(always)]
72    pub fn _0000(self) -> &'a mut W {
73        self.variant(SFMDN_A::_0000)
74    }
75}
76#[doc = "Field `SFMXST` reader - XIP mode status"]
77pub type SFMXST_R = crate::BitReader<SFMXST_A>;
78#[doc = "XIP mode status\n\nValue on reset: 0"]
79#[derive(Clone, Copy, Debug, PartialEq, Eq)]
80pub enum SFMXST_A {
81    #[doc = "0: Normal (non-XIP) mode is operating"]
82    _0 = 0,
83    #[doc = "1: XIP mode is operating"]
84    _1 = 1,
85}
86impl From<SFMXST_A> for bool {
87    #[inline(always)]
88    fn from(variant: SFMXST_A) -> Self {
89        variant as u8 != 0
90    }
91}
92impl SFMXST_R {
93    #[doc = "Get enumerated values variant"]
94    #[inline(always)]
95    pub fn variant(&self) -> SFMXST_A {
96        match self.bits {
97            false => SFMXST_A::_0,
98            true => SFMXST_A::_1,
99        }
100    }
101    #[doc = "Checks if the value of the field is `_0`"]
102    #[inline(always)]
103    pub fn is_0(&self) -> bool {
104        *self == SFMXST_A::_0
105    }
106    #[doc = "Checks if the value of the field is `_1`"]
107    #[inline(always)]
108    pub fn is_1(&self) -> bool {
109        *self == SFMXST_A::_1
110    }
111}
112#[doc = "Field `SFMXEN` reader - XIP mode permission"]
113pub type SFMXEN_R = crate::BitReader<SFMXEN_A>;
114#[doc = "XIP mode permission\n\nValue on reset: 0"]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum SFMXEN_A {
117    #[doc = "0: XIP mode is prohibited"]
118    _0 = 0,
119    #[doc = "1: XIP mode is permitted"]
120    _1 = 1,
121}
122impl From<SFMXEN_A> for bool {
123    #[inline(always)]
124    fn from(variant: SFMXEN_A) -> Self {
125        variant as u8 != 0
126    }
127}
128impl SFMXEN_R {
129    #[doc = "Get enumerated values variant"]
130    #[inline(always)]
131    pub fn variant(&self) -> SFMXEN_A {
132        match self.bits {
133            false => SFMXEN_A::_0,
134            true => SFMXEN_A::_1,
135        }
136    }
137    #[doc = "Checks if the value of the field is `_0`"]
138    #[inline(always)]
139    pub fn is_0(&self) -> bool {
140        *self == SFMXEN_A::_0
141    }
142    #[doc = "Checks if the value of the field is `_1`"]
143    #[inline(always)]
144    pub fn is_1(&self) -> bool {
145        *self == SFMXEN_A::_1
146    }
147}
148#[doc = "Field `SFMXEN` writer - XIP mode permission"]
149pub type SFMXEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, SFMSDC_SPEC, SFMXEN_A, O>;
150impl<'a, const O: u8> SFMXEN_W<'a, O> {
151    #[doc = "XIP mode is prohibited"]
152    #[inline(always)]
153    pub fn _0(self) -> &'a mut W {
154        self.variant(SFMXEN_A::_0)
155    }
156    #[doc = "XIP mode is permitted"]
157    #[inline(always)]
158    pub fn _1(self) -> &'a mut W {
159        self.variant(SFMXEN_A::_1)
160    }
161}
162#[doc = "Field `SFMXD` reader - Mode data for serial ROM. (Control XIP mode)"]
163pub type SFMXD_R = crate::FieldReader<u8, SFMXD_A>;
164#[doc = "Mode data for serial ROM. (Control XIP mode)\n\nValue on reset: 255"]
165#[derive(Clone, Copy, Debug, PartialEq, Eq)]
166#[repr(u8)]
167pub enum SFMXD_A {
168    #[doc = "0: XIP mode is prohibited"]
169    _0 = 0,
170    #[doc = "1: XIP mode is permitted"]
171    _1 = 1,
172}
173impl From<SFMXD_A> for u8 {
174    #[inline(always)]
175    fn from(variant: SFMXD_A) -> Self {
176        variant as _
177    }
178}
179impl SFMXD_R {
180    #[doc = "Get enumerated values variant"]
181    #[inline(always)]
182    pub fn variant(&self) -> Option<SFMXD_A> {
183        match self.bits {
184            0 => Some(SFMXD_A::_0),
185            1 => Some(SFMXD_A::_1),
186            _ => None,
187        }
188    }
189    #[doc = "Checks if the value of the field is `_0`"]
190    #[inline(always)]
191    pub fn is_0(&self) -> bool {
192        *self == SFMXD_A::_0
193    }
194    #[doc = "Checks if the value of the field is `_1`"]
195    #[inline(always)]
196    pub fn is_1(&self) -> bool {
197        *self == SFMXD_A::_1
198    }
199}
200#[doc = "Field `SFMXD` writer - Mode data for serial ROM. (Control XIP mode)"]
201pub type SFMXD_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SFMSDC_SPEC, u8, SFMXD_A, 8, O>;
202impl<'a, const O: u8> SFMXD_W<'a, O> {
203    #[doc = "XIP mode is prohibited"]
204    #[inline(always)]
205    pub fn _0(self) -> &'a mut W {
206        self.variant(SFMXD_A::_0)
207    }
208    #[doc = "XIP mode is permitted"]
209    #[inline(always)]
210    pub fn _1(self) -> &'a mut W {
211        self.variant(SFMXD_A::_1)
212    }
213}
214impl R {
215    #[doc = "Bits 0:3 - Selection of the number of dummy cycles of Fast Read instructions"]
216    #[inline(always)]
217    pub fn sfmdn(&self) -> SFMDN_R {
218        SFMDN_R::new((self.bits & 0x0f) as u8)
219    }
220    #[doc = "Bit 6 - XIP mode status"]
221    #[inline(always)]
222    pub fn sfmxst(&self) -> SFMXST_R {
223        SFMXST_R::new(((self.bits >> 6) & 1) != 0)
224    }
225    #[doc = "Bit 7 - XIP mode permission"]
226    #[inline(always)]
227    pub fn sfmxen(&self) -> SFMXEN_R {
228        SFMXEN_R::new(((self.bits >> 7) & 1) != 0)
229    }
230    #[doc = "Bits 8:15 - Mode data for serial ROM. (Control XIP mode)"]
231    #[inline(always)]
232    pub fn sfmxd(&self) -> SFMXD_R {
233        SFMXD_R::new(((self.bits >> 8) & 0xff) as u8)
234    }
235}
236impl W {
237    #[doc = "Bits 0:3 - Selection of the number of dummy cycles of Fast Read instructions"]
238    #[inline(always)]
239    #[must_use]
240    pub fn sfmdn(&mut self) -> SFMDN_W<0> {
241        SFMDN_W::new(self)
242    }
243    #[doc = "Bit 7 - XIP mode permission"]
244    #[inline(always)]
245    #[must_use]
246    pub fn sfmxen(&mut self) -> SFMXEN_W<7> {
247        SFMXEN_W::new(self)
248    }
249    #[doc = "Bits 8:15 - Mode data for serial ROM. (Control XIP mode)"]
250    #[inline(always)]
251    #[must_use]
252    pub fn sfmxd(&mut self) -> SFMXD_W<8> {
253        SFMXD_W::new(self)
254    }
255    #[doc = "Writes raw bits to the register."]
256    #[inline(always)]
257    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
258        self.0.bits(bits);
259        self
260    }
261}
262#[doc = "Dummy Cycle 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 [sfmsdc](index.html) module"]
263pub struct SFMSDC_SPEC;
264impl crate::RegisterSpec for SFMSDC_SPEC {
265    type Ux = u32;
266}
267#[doc = "`read()` method returns [sfmsdc::R](R) reader structure"]
268impl crate::Readable for SFMSDC_SPEC {
269    type Reader = R;
270}
271#[doc = "`write(|w| ..)` method takes [sfmsdc::W](W) writer structure"]
272impl crate::Writable for SFMSDC_SPEC {
273    type Writer = W;
274    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
275    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
276}
277#[doc = "`reset()` method sets SFMSDC to value 0xff00"]
278impl crate::Resettable for SFMSDC_SPEC {
279    const RESET_VALUE: Self::Ux = 0xff00;
280}