atsam4e16e_pac/hsmci/
cstor.rs1#[doc = "Register `CSTOR` reader"]
2pub struct R(crate::R<CSTOR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CSTOR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CSTOR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CSTOR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CSTOR` writer"]
17pub struct W(crate::W<CSTOR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CSTOR_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<CSTOR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CSTOR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `CSTOCYC` reader - Completion Signal Timeout Cycle Number"]
38pub type CSTOCYC_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `CSTOCYC` writer - Completion Signal Timeout Cycle Number"]
40pub type CSTOCYC_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CSTOR_SPEC, u8, u8, 4, O>;
41#[doc = "Field `CSTOMUL` reader - Completion Signal Timeout Multiplier"]
42pub type CSTOMUL_R = crate::FieldReader<u8, CSTOMUL_A>;
43#[doc = "Completion Signal Timeout Multiplier\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45#[repr(u8)]
46pub enum CSTOMUL_A {
47 #[doc = "0: CSTOCYC x 1"]
48 _1 = 0,
49 #[doc = "1: CSTOCYC x 16"]
50 _16 = 1,
51 #[doc = "2: CSTOCYC x 128"]
52 _128 = 2,
53 #[doc = "3: CSTOCYC x 256"]
54 _256 = 3,
55 #[doc = "4: CSTOCYC x 1024"]
56 _1024 = 4,
57 #[doc = "5: CSTOCYC x 4096"]
58 _4096 = 5,
59 #[doc = "6: CSTOCYC x 65536"]
60 _65536 = 6,
61 #[doc = "7: CSTOCYC x 1048576"]
62 _1048576 = 7,
63}
64impl From<CSTOMUL_A> for u8 {
65 #[inline(always)]
66 fn from(variant: CSTOMUL_A) -> Self {
67 variant as _
68 }
69}
70impl CSTOMUL_R {
71 #[doc = "Get enumerated values variant"]
72 #[inline(always)]
73 pub fn variant(&self) -> CSTOMUL_A {
74 match self.bits {
75 0 => CSTOMUL_A::_1,
76 1 => CSTOMUL_A::_16,
77 2 => CSTOMUL_A::_128,
78 3 => CSTOMUL_A::_256,
79 4 => CSTOMUL_A::_1024,
80 5 => CSTOMUL_A::_4096,
81 6 => CSTOMUL_A::_65536,
82 7 => CSTOMUL_A::_1048576,
83 _ => unreachable!(),
84 }
85 }
86 #[doc = "Checks if the value of the field is `_1`"]
87 #[inline(always)]
88 pub fn is_1(&self) -> bool {
89 *self == CSTOMUL_A::_1
90 }
91 #[doc = "Checks if the value of the field is `_16`"]
92 #[inline(always)]
93 pub fn is_16(&self) -> bool {
94 *self == CSTOMUL_A::_16
95 }
96 #[doc = "Checks if the value of the field is `_128`"]
97 #[inline(always)]
98 pub fn is_128(&self) -> bool {
99 *self == CSTOMUL_A::_128
100 }
101 #[doc = "Checks if the value of the field is `_256`"]
102 #[inline(always)]
103 pub fn is_256(&self) -> bool {
104 *self == CSTOMUL_A::_256
105 }
106 #[doc = "Checks if the value of the field is `_1024`"]
107 #[inline(always)]
108 pub fn is_1024(&self) -> bool {
109 *self == CSTOMUL_A::_1024
110 }
111 #[doc = "Checks if the value of the field is `_4096`"]
112 #[inline(always)]
113 pub fn is_4096(&self) -> bool {
114 *self == CSTOMUL_A::_4096
115 }
116 #[doc = "Checks if the value of the field is `_65536`"]
117 #[inline(always)]
118 pub fn is_65536(&self) -> bool {
119 *self == CSTOMUL_A::_65536
120 }
121 #[doc = "Checks if the value of the field is `_1048576`"]
122 #[inline(always)]
123 pub fn is_1048576(&self) -> bool {
124 *self == CSTOMUL_A::_1048576
125 }
126}
127#[doc = "Field `CSTOMUL` writer - Completion Signal Timeout Multiplier"]
128pub type CSTOMUL_W<'a, const O: u8> =
129 crate::FieldWriterSafe<'a, u32, CSTOR_SPEC, u8, CSTOMUL_A, 3, O>;
130impl<'a, const O: u8> CSTOMUL_W<'a, O> {
131 #[doc = "CSTOCYC x 1"]
132 #[inline(always)]
133 pub fn _1(self) -> &'a mut W {
134 self.variant(CSTOMUL_A::_1)
135 }
136 #[doc = "CSTOCYC x 16"]
137 #[inline(always)]
138 pub fn _16(self) -> &'a mut W {
139 self.variant(CSTOMUL_A::_16)
140 }
141 #[doc = "CSTOCYC x 128"]
142 #[inline(always)]
143 pub fn _128(self) -> &'a mut W {
144 self.variant(CSTOMUL_A::_128)
145 }
146 #[doc = "CSTOCYC x 256"]
147 #[inline(always)]
148 pub fn _256(self) -> &'a mut W {
149 self.variant(CSTOMUL_A::_256)
150 }
151 #[doc = "CSTOCYC x 1024"]
152 #[inline(always)]
153 pub fn _1024(self) -> &'a mut W {
154 self.variant(CSTOMUL_A::_1024)
155 }
156 #[doc = "CSTOCYC x 4096"]
157 #[inline(always)]
158 pub fn _4096(self) -> &'a mut W {
159 self.variant(CSTOMUL_A::_4096)
160 }
161 #[doc = "CSTOCYC x 65536"]
162 #[inline(always)]
163 pub fn _65536(self) -> &'a mut W {
164 self.variant(CSTOMUL_A::_65536)
165 }
166 #[doc = "CSTOCYC x 1048576"]
167 #[inline(always)]
168 pub fn _1048576(self) -> &'a mut W {
169 self.variant(CSTOMUL_A::_1048576)
170 }
171}
172impl R {
173 #[doc = "Bits 0:3 - Completion Signal Timeout Cycle Number"]
174 #[inline(always)]
175 pub fn cstocyc(&self) -> CSTOCYC_R {
176 CSTOCYC_R::new((self.bits & 0x0f) as u8)
177 }
178 #[doc = "Bits 4:6 - Completion Signal Timeout Multiplier"]
179 #[inline(always)]
180 pub fn cstomul(&self) -> CSTOMUL_R {
181 CSTOMUL_R::new(((self.bits >> 4) & 7) as u8)
182 }
183}
184impl W {
185 #[doc = "Bits 0:3 - Completion Signal Timeout Cycle Number"]
186 #[inline(always)]
187 #[must_use]
188 pub fn cstocyc(&mut self) -> CSTOCYC_W<0> {
189 CSTOCYC_W::new(self)
190 }
191 #[doc = "Bits 4:6 - Completion Signal Timeout Multiplier"]
192 #[inline(always)]
193 #[must_use]
194 pub fn cstomul(&mut self) -> CSTOMUL_W<4> {
195 CSTOMUL_W::new(self)
196 }
197 #[doc = "Writes raw bits to the register."]
198 #[inline(always)]
199 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
200 self.0.bits(bits);
201 self
202 }
203}
204#[doc = "Completion Signal Timeout 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 [cstor](index.html) module"]
205pub struct CSTOR_SPEC;
206impl crate::RegisterSpec for CSTOR_SPEC {
207 type Ux = u32;
208}
209#[doc = "`read()` method returns [cstor::R](R) reader structure"]
210impl crate::Readable for CSTOR_SPEC {
211 type Reader = R;
212}
213#[doc = "`write(|w| ..)` method takes [cstor::W](W) writer structure"]
214impl crate::Writable for CSTOR_SPEC {
215 type Writer = W;
216 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
217 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
218}
219#[doc = "`reset()` method sets CSTOR to value 0"]
220impl crate::Resettable for CSTOR_SPEC {
221 const RESET_VALUE: Self::Ux = 0;
222}