1#[doc = "Register `SFMSPC` reader"]
2pub struct R(crate::R<SFMSPC_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<SFMSPC_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<SFMSPC_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<SFMSPC_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `SFMSPC` writer"]
17pub struct W(crate::W<SFMSPC_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<SFMSPC_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<SFMSPC_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<SFMSPC_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `SFMSPI` reader - Selection of SPI protocolNOTE: Serial ROM's SPI protocol is required to be set by software separately."]
38pub type SFMSPI_R = crate::FieldReader<u8, SFMSPI_A>;
39#[doc = "Selection of SPI protocolNOTE: Serial ROM's SPI protocol is required to be set by software separately.\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum SFMSPI_A {
43 #[doc = "0: Extended SPI protocol"]
44 _00 = 0,
45 #[doc = "1: Dual SPI protocol"]
46 _01 = 1,
47 #[doc = "2: Quad SPI protocol"]
48 _10 = 2,
49 #[doc = "3: Setting prohibited."]
50 _11 = 3,
51}
52impl From<SFMSPI_A> for u8 {
53 #[inline(always)]
54 fn from(variant: SFMSPI_A) -> Self {
55 variant as _
56 }
57}
58impl SFMSPI_R {
59 #[doc = "Get enumerated values variant"]
60 #[inline(always)]
61 pub fn variant(&self) -> SFMSPI_A {
62 match self.bits {
63 0 => SFMSPI_A::_00,
64 1 => SFMSPI_A::_01,
65 2 => SFMSPI_A::_10,
66 3 => SFMSPI_A::_11,
67 _ => unreachable!(),
68 }
69 }
70 #[doc = "Checks if the value of the field is `_00`"]
71 #[inline(always)]
72 pub fn is_00(&self) -> bool {
73 *self == SFMSPI_A::_00
74 }
75 #[doc = "Checks if the value of the field is `_01`"]
76 #[inline(always)]
77 pub fn is_01(&self) -> bool {
78 *self == SFMSPI_A::_01
79 }
80 #[doc = "Checks if the value of the field is `_10`"]
81 #[inline(always)]
82 pub fn is_10(&self) -> bool {
83 *self == SFMSPI_A::_10
84 }
85 #[doc = "Checks if the value of the field is `_11`"]
86 #[inline(always)]
87 pub fn is_11(&self) -> bool {
88 *self == SFMSPI_A::_11
89 }
90}
91#[doc = "Field `SFMSPI` writer - Selection of SPI protocolNOTE: Serial ROM's SPI protocol is required to be set by software separately."]
92pub type SFMSPI_W<'a, const O: u8> =
93 crate::FieldWriterSafe<'a, u32, SFMSPC_SPEC, u8, SFMSPI_A, 2, O>;
94impl<'a, const O: u8> SFMSPI_W<'a, O> {
95 #[doc = "Extended SPI protocol"]
96 #[inline(always)]
97 pub fn _00(self) -> &'a mut W {
98 self.variant(SFMSPI_A::_00)
99 }
100 #[doc = "Dual SPI protocol"]
101 #[inline(always)]
102 pub fn _01(self) -> &'a mut W {
103 self.variant(SFMSPI_A::_01)
104 }
105 #[doc = "Quad SPI protocol"]
106 #[inline(always)]
107 pub fn _10(self) -> &'a mut W {
108 self.variant(SFMSPI_A::_10)
109 }
110 #[doc = "Setting prohibited."]
111 #[inline(always)]
112 pub fn _11(self) -> &'a mut W {
113 self.variant(SFMSPI_A::_11)
114 }
115}
116#[doc = "Field `SFMSDE` reader - Selection of the minimum time of input output switch, when Dual SPI protocol or Quad SPI protocol is selected."]
117pub type SFMSDE_R = crate::BitReader<SFMSDE_A>;
118#[doc = "Selection of the minimum time of input output switch, when Dual SPI protocol or Quad SPI protocol is selected.\n\nValue on reset: 1"]
119#[derive(Clone, Copy, Debug, PartialEq, Eq)]
120pub enum SFMSDE_A {
121 #[doc = "0: Does not allocate minimum switch time"]
122 _0 = 0,
123 #[doc = "1: Allocate the minimum switch time equivalent to 1*QSPXLK"]
124 _1 = 1,
125}
126impl From<SFMSDE_A> for bool {
127 #[inline(always)]
128 fn from(variant: SFMSDE_A) -> Self {
129 variant as u8 != 0
130 }
131}
132impl SFMSDE_R {
133 #[doc = "Get enumerated values variant"]
134 #[inline(always)]
135 pub fn variant(&self) -> SFMSDE_A {
136 match self.bits {
137 false => SFMSDE_A::_0,
138 true => SFMSDE_A::_1,
139 }
140 }
141 #[doc = "Checks if the value of the field is `_0`"]
142 #[inline(always)]
143 pub fn is_0(&self) -> bool {
144 *self == SFMSDE_A::_0
145 }
146 #[doc = "Checks if the value of the field is `_1`"]
147 #[inline(always)]
148 pub fn is_1(&self) -> bool {
149 *self == SFMSDE_A::_1
150 }
151}
152#[doc = "Field `SFMSDE` writer - Selection of the minimum time of input output switch, when Dual SPI protocol or Quad SPI protocol is selected."]
153pub type SFMSDE_W<'a, const O: u8> = crate::BitWriter<'a, u32, SFMSPC_SPEC, SFMSDE_A, O>;
154impl<'a, const O: u8> SFMSDE_W<'a, O> {
155 #[doc = "Does not allocate minimum switch time"]
156 #[inline(always)]
157 pub fn _0(self) -> &'a mut W {
158 self.variant(SFMSDE_A::_0)
159 }
160 #[doc = "Allocate the minimum switch time equivalent to 1*QSPXLK"]
161 #[inline(always)]
162 pub fn _1(self) -> &'a mut W {
163 self.variant(SFMSDE_A::_1)
164 }
165}
166impl R {
167 #[doc = "Bits 0:1 - Selection of SPI protocolNOTE: Serial ROM's SPI protocol is required to be set by software separately."]
168 #[inline(always)]
169 pub fn sfmspi(&self) -> SFMSPI_R {
170 SFMSPI_R::new((self.bits & 3) as u8)
171 }
172 #[doc = "Bit 4 - Selection of the minimum time of input output switch, when Dual SPI protocol or Quad SPI protocol is selected."]
173 #[inline(always)]
174 pub fn sfmsde(&self) -> SFMSDE_R {
175 SFMSDE_R::new(((self.bits >> 4) & 1) != 0)
176 }
177}
178impl W {
179 #[doc = "Bits 0:1 - Selection of SPI protocolNOTE: Serial ROM's SPI protocol is required to be set by software separately."]
180 #[inline(always)]
181 #[must_use]
182 pub fn sfmspi(&mut self) -> SFMSPI_W<0> {
183 SFMSPI_W::new(self)
184 }
185 #[doc = "Bit 4 - Selection of the minimum time of input output switch, when Dual SPI protocol or Quad SPI protocol is selected."]
186 #[inline(always)]
187 #[must_use]
188 pub fn sfmsde(&mut self) -> SFMSDE_W<4> {
189 SFMSDE_W::new(self)
190 }
191 #[doc = "Writes raw bits to the register."]
192 #[inline(always)]
193 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
194 self.0.bits(bits);
195 self
196 }
197}
198#[doc = "SPI Protocol 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 [sfmspc](index.html) module"]
199pub struct SFMSPC_SPEC;
200impl crate::RegisterSpec for SFMSPC_SPEC {
201 type Ux = u32;
202}
203#[doc = "`read()` method returns [sfmspc::R](R) reader structure"]
204impl crate::Readable for SFMSPC_SPEC {
205 type Reader = R;
206}
207#[doc = "`write(|w| ..)` method takes [sfmspc::W](W) writer structure"]
208impl crate::Writable for SFMSPC_SPEC {
209 type Writer = W;
210 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
211 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
212}
213#[doc = "`reset()` method sets SFMSPC to value 0x10"]
214impl crate::Resettable for SFMSPC_SPEC {
215 const RESET_VALUE: Self::Ux = 0x10;
216}