efm32pg22_pac/efm32pg22c200/cryptoacc_ns_pkctrl/
command.rs1#[doc = "Register `COMMAND` reader"]
2pub struct R(crate::R<COMMAND_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<COMMAND_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<COMMAND_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<COMMAND_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `COMMAND` writer"]
17pub struct W(crate::W<COMMAND_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<COMMAND_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<COMMAND_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<COMMAND_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `OPERATION` reader - Type of Operation"]
38pub type OPERATION_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `OPERATION` writer - Type of Operation"]
40pub type OPERATION_W<'a, const O: u8> = crate::FieldWriter<'a, u32, COMMAND_SPEC, u8, u8, 7, O>;
41#[doc = "Field `FIELD` reader - Field"]
42pub type FIELD_R = crate::BitReader<FIELD_A>;
43#[doc = "Field\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45pub enum FIELD_A {
46 #[doc = "0: Field is GF(p)"]
47 GFP = 0,
48 #[doc = "1: Field is GF(2^m)"]
49 GF2M = 1,
50}
51impl From<FIELD_A> for bool {
52 #[inline(always)]
53 fn from(variant: FIELD_A) -> Self {
54 variant as u8 != 0
55 }
56}
57impl FIELD_R {
58 #[doc = "Get enumerated values variant"]
59 #[inline(always)]
60 pub fn variant(&self) -> FIELD_A {
61 match self.bits {
62 false => FIELD_A::GFP,
63 true => FIELD_A::GF2M,
64 }
65 }
66 #[doc = "Checks if the value of the field is `GFP`"]
67 #[inline(always)]
68 pub fn is_gfp(&self) -> bool {
69 *self == FIELD_A::GFP
70 }
71 #[doc = "Checks if the value of the field is `GF2M`"]
72 #[inline(always)]
73 pub fn is_gf2m(&self) -> bool {
74 *self == FIELD_A::GF2M
75 }
76}
77#[doc = "Field `FIELD` writer - Field"]
78pub type FIELD_W<'a, const O: u8> = crate::BitWriter<'a, u32, COMMAND_SPEC, FIELD_A, O>;
79impl<'a, const O: u8> FIELD_W<'a, O> {
80 #[doc = "Field is GF(p)"]
81 #[inline(always)]
82 pub fn gfp(self) -> &'a mut W {
83 self.variant(FIELD_A::GFP)
84 }
85 #[doc = "Field is GF(2^m)"]
86 #[inline(always)]
87 pub fn gf2m(self) -> &'a mut W {
88 self.variant(FIELD_A::GF2M)
89 }
90}
91#[doc = "Field `SIZE` reader - Size of Operands in data memory"]
92pub type SIZE_R = crate::FieldReader<u16, u16>;
93#[doc = "Field `SIZE` writer - Size of Operands in data memory"]
94pub type SIZE_W<'a, const O: u8> = crate::FieldWriter<'a, u32, COMMAND_SPEC, u16, u16, 11, O>;
95#[doc = "Field `SELCURVE` reader - Select Curve"]
96pub type SELCURVE_R = crate::FieldReader<u8, SELCURVE_A>;
97#[doc = "Select Curve\n\nValue on reset: 0"]
98#[derive(Clone, Copy, Debug, PartialEq, Eq)]
99#[repr(u8)]
100pub enum SELCURVE_A {
101 #[doc = "0: No acceleration"]
102 NONE = 0,
103 #[doc = "1: P256"]
104 P256 = 1,
105 #[doc = "4: P192"]
106 P192 = 4,
107}
108impl From<SELCURVE_A> for u8 {
109 #[inline(always)]
110 fn from(variant: SELCURVE_A) -> Self {
111 variant as _
112 }
113}
114impl SELCURVE_R {
115 #[doc = "Get enumerated values variant"]
116 #[inline(always)]
117 pub fn variant(&self) -> Option<SELCURVE_A> {
118 match self.bits {
119 0 => Some(SELCURVE_A::NONE),
120 1 => Some(SELCURVE_A::P256),
121 4 => Some(SELCURVE_A::P192),
122 _ => None,
123 }
124 }
125 #[doc = "Checks if the value of the field is `NONE`"]
126 #[inline(always)]
127 pub fn is_none(&self) -> bool {
128 *self == SELCURVE_A::NONE
129 }
130 #[doc = "Checks if the value of the field is `P256`"]
131 #[inline(always)]
132 pub fn is_p256(&self) -> bool {
133 *self == SELCURVE_A::P256
134 }
135 #[doc = "Checks if the value of the field is `P192`"]
136 #[inline(always)]
137 pub fn is_p192(&self) -> bool {
138 *self == SELCURVE_A::P192
139 }
140}
141#[doc = "Field `SELCURVE` writer - Select Curve"]
142pub type SELCURVE_W<'a, const O: u8> =
143 crate::FieldWriter<'a, u32, COMMAND_SPEC, u8, SELCURVE_A, 3, O>;
144impl<'a, const O: u8> SELCURVE_W<'a, O> {
145 #[doc = "No acceleration"]
146 #[inline(always)]
147 pub fn none(self) -> &'a mut W {
148 self.variant(SELCURVE_A::NONE)
149 }
150 #[doc = "P256"]
151 #[inline(always)]
152 pub fn p256(self) -> &'a mut W {
153 self.variant(SELCURVE_A::P256)
154 }
155 #[doc = "P192"]
156 #[inline(always)]
157 pub fn p192(self) -> &'a mut W {
158 self.variant(SELCURVE_A::P192)
159 }
160}
161#[doc = "Field `EDWARDS` reader - Edwards Curve Enable"]
162pub type EDWARDS_R = crate::BitReader<bool>;
163#[doc = "Field `EDWARDS` writer - Edwards Curve Enable"]
164pub type EDWARDS_W<'a, const O: u8> = crate::BitWriter<'a, u32, COMMAND_SPEC, bool, O>;
165#[doc = "Field `BUFSEL` reader - Buffer Select"]
166pub type BUFSEL_R = crate::BitReader<BUFSEL_A>;
167#[doc = "Buffer Select\n\nValue on reset: 0"]
168#[derive(Clone, Copy, Debug, PartialEq, Eq)]
169pub enum BUFSEL_A {
170 #[doc = "0: use data in data memory 0"]
171 MEM0 = 0,
172}
173impl From<BUFSEL_A> for bool {
174 #[inline(always)]
175 fn from(variant: BUFSEL_A) -> Self {
176 variant as u8 != 0
177 }
178}
179impl BUFSEL_R {
180 #[doc = "Get enumerated values variant"]
181 #[inline(always)]
182 pub fn variant(&self) -> Option<BUFSEL_A> {
183 match self.bits {
184 false => Some(BUFSEL_A::MEM0),
185 _ => None,
186 }
187 }
188 #[doc = "Checks if the value of the field is `MEM0`"]
189 #[inline(always)]
190 pub fn is_mem0(&self) -> bool {
191 *self == BUFSEL_A::MEM0
192 }
193}
194#[doc = "Field `BUFSEL` writer - Buffer Select"]
195pub type BUFSEL_W<'a, const O: u8> = crate::BitWriter<'a, u32, COMMAND_SPEC, BUFSEL_A, O>;
196impl<'a, const O: u8> BUFSEL_W<'a, O> {
197 #[doc = "use data in data memory 0"]
198 #[inline(always)]
199 pub fn mem0(self) -> &'a mut W {
200 self.variant(BUFSEL_A::MEM0)
201 }
202}
203#[doc = "Field `SWAPBYTES` reader - Swap bytes"]
204pub type SWAPBYTES_R = crate::BitReader<SWAPBYTES_A>;
205#[doc = "Swap bytes\n\nValue on reset: 0"]
206#[derive(Clone, Copy, Debug, PartialEq, Eq)]
207pub enum SWAPBYTES_A {
208 #[doc = "0: Native format (little endian)"]
209 NATIVE = 0,
210 #[doc = "1: Byte swapped (big endian)"]
211 SWAPPED = 1,
212}
213impl From<SWAPBYTES_A> for bool {
214 #[inline(always)]
215 fn from(variant: SWAPBYTES_A) -> Self {
216 variant as u8 != 0
217 }
218}
219impl SWAPBYTES_R {
220 #[doc = "Get enumerated values variant"]
221 #[inline(always)]
222 pub fn variant(&self) -> SWAPBYTES_A {
223 match self.bits {
224 false => SWAPBYTES_A::NATIVE,
225 true => SWAPBYTES_A::SWAPPED,
226 }
227 }
228 #[doc = "Checks if the value of the field is `NATIVE`"]
229 #[inline(always)]
230 pub fn is_native(&self) -> bool {
231 *self == SWAPBYTES_A::NATIVE
232 }
233 #[doc = "Checks if the value of the field is `SWAPPED`"]
234 #[inline(always)]
235 pub fn is_swapped(&self) -> bool {
236 *self == SWAPBYTES_A::SWAPPED
237 }
238}
239#[doc = "Field `SWAPBYTES` writer - Swap bytes"]
240pub type SWAPBYTES_W<'a, const O: u8> = crate::BitWriter<'a, u32, COMMAND_SPEC, SWAPBYTES_A, O>;
241impl<'a, const O: u8> SWAPBYTES_W<'a, O> {
242 #[doc = "Native format (little endian)"]
243 #[inline(always)]
244 pub fn native(self) -> &'a mut W {
245 self.variant(SWAPBYTES_A::NATIVE)
246 }
247 #[doc = "Byte swapped (big endian)"]
248 #[inline(always)]
249 pub fn swapped(self) -> &'a mut W {
250 self.variant(SWAPBYTES_A::SWAPPED)
251 }
252}
253#[doc = "Field `FLAGA` reader - Flag A"]
254pub type FLAGA_R = crate::BitReader<bool>;
255#[doc = "Field `FLAGA` writer - Flag A"]
256pub type FLAGA_W<'a, const O: u8> = crate::BitWriter<'a, u32, COMMAND_SPEC, bool, O>;
257#[doc = "Field `FLAGB` reader - Flag B"]
258pub type FLAGB_R = crate::BitReader<bool>;
259#[doc = "Field `FLAGB` writer - Flag B"]
260pub type FLAGB_W<'a, const O: u8> = crate::BitWriter<'a, u32, COMMAND_SPEC, bool, O>;
261#[doc = "Field `CALCR2` reader - Calculate R2"]
262pub type CALCR2_R = crate::BitReader<CALCR2_A>;
263#[doc = "Calculate R2\n\nValue on reset: 0"]
264#[derive(Clone, Copy, Debug, PartialEq, Eq)]
265pub enum CALCR2_A {
266 #[doc = "0: don't recalculate R² mod N"]
267 FALSE = 0,
268 #[doc = "1: re-calculate R² mod N"]
269 TRUE = 1,
270}
271impl From<CALCR2_A> for bool {
272 #[inline(always)]
273 fn from(variant: CALCR2_A) -> Self {
274 variant as u8 != 0
275 }
276}
277impl CALCR2_R {
278 #[doc = "Get enumerated values variant"]
279 #[inline(always)]
280 pub fn variant(&self) -> CALCR2_A {
281 match self.bits {
282 false => CALCR2_A::FALSE,
283 true => CALCR2_A::TRUE,
284 }
285 }
286 #[doc = "Checks if the value of the field is `FALSE`"]
287 #[inline(always)]
288 pub fn is_false(&self) -> bool {
289 *self == CALCR2_A::FALSE
290 }
291 #[doc = "Checks if the value of the field is `TRUE`"]
292 #[inline(always)]
293 pub fn is_true(&self) -> bool {
294 *self == CALCR2_A::TRUE
295 }
296}
297#[doc = "Field `CALCR2` writer - Calculate R2"]
298pub type CALCR2_W<'a, const O: u8> = crate::BitWriter<'a, u32, COMMAND_SPEC, CALCR2_A, O>;
299impl<'a, const O: u8> CALCR2_W<'a, O> {
300 #[doc = "don't recalculate R² mod N"]
301 #[inline(always)]
302 pub fn false_(self) -> &'a mut W {
303 self.variant(CALCR2_A::FALSE)
304 }
305 #[doc = "re-calculate R² mod N"]
306 #[inline(always)]
307 pub fn true_(self) -> &'a mut W {
308 self.variant(CALCR2_A::TRUE)
309 }
310}
311impl R {
312 #[doc = "Bits 0:6 - Type of Operation"]
313 #[inline(always)]
314 pub fn operation(&self) -> OPERATION_R {
315 OPERATION_R::new((self.bits & 0x7f) as u8)
316 }
317 #[doc = "Bit 7 - Field"]
318 #[inline(always)]
319 pub fn field(&self) -> FIELD_R {
320 FIELD_R::new(((self.bits >> 7) & 1) != 0)
321 }
322 #[doc = "Bits 8:18 - Size of Operands in data memory"]
323 #[inline(always)]
324 pub fn size(&self) -> SIZE_R {
325 SIZE_R::new(((self.bits >> 8) & 0x07ff) as u16)
326 }
327 #[doc = "Bits 20:22 - Select Curve"]
328 #[inline(always)]
329 pub fn selcurve(&self) -> SELCURVE_R {
330 SELCURVE_R::new(((self.bits >> 20) & 7) as u8)
331 }
332 #[doc = "Bit 26 - Edwards Curve Enable"]
333 #[inline(always)]
334 pub fn edwards(&self) -> EDWARDS_R {
335 EDWARDS_R::new(((self.bits >> 26) & 1) != 0)
336 }
337 #[doc = "Bit 27 - Buffer Select"]
338 #[inline(always)]
339 pub fn bufsel(&self) -> BUFSEL_R {
340 BUFSEL_R::new(((self.bits >> 27) & 1) != 0)
341 }
342 #[doc = "Bit 28 - Swap bytes"]
343 #[inline(always)]
344 pub fn swapbytes(&self) -> SWAPBYTES_R {
345 SWAPBYTES_R::new(((self.bits >> 28) & 1) != 0)
346 }
347 #[doc = "Bit 29 - Flag A"]
348 #[inline(always)]
349 pub fn flaga(&self) -> FLAGA_R {
350 FLAGA_R::new(((self.bits >> 29) & 1) != 0)
351 }
352 #[doc = "Bit 30 - Flag B"]
353 #[inline(always)]
354 pub fn flagb(&self) -> FLAGB_R {
355 FLAGB_R::new(((self.bits >> 30) & 1) != 0)
356 }
357 #[doc = "Bit 31 - Calculate R2"]
358 #[inline(always)]
359 pub fn calcr2(&self) -> CALCR2_R {
360 CALCR2_R::new(((self.bits >> 31) & 1) != 0)
361 }
362}
363impl W {
364 #[doc = "Bits 0:6 - Type of Operation"]
365 #[inline(always)]
366 #[must_use]
367 pub fn operation(&mut self) -> OPERATION_W<0> {
368 OPERATION_W::new(self)
369 }
370 #[doc = "Bit 7 - Field"]
371 #[inline(always)]
372 #[must_use]
373 pub fn field(&mut self) -> FIELD_W<7> {
374 FIELD_W::new(self)
375 }
376 #[doc = "Bits 8:18 - Size of Operands in data memory"]
377 #[inline(always)]
378 #[must_use]
379 pub fn size(&mut self) -> SIZE_W<8> {
380 SIZE_W::new(self)
381 }
382 #[doc = "Bits 20:22 - Select Curve"]
383 #[inline(always)]
384 #[must_use]
385 pub fn selcurve(&mut self) -> SELCURVE_W<20> {
386 SELCURVE_W::new(self)
387 }
388 #[doc = "Bit 26 - Edwards Curve Enable"]
389 #[inline(always)]
390 #[must_use]
391 pub fn edwards(&mut self) -> EDWARDS_W<26> {
392 EDWARDS_W::new(self)
393 }
394 #[doc = "Bit 27 - Buffer Select"]
395 #[inline(always)]
396 #[must_use]
397 pub fn bufsel(&mut self) -> BUFSEL_W<27> {
398 BUFSEL_W::new(self)
399 }
400 #[doc = "Bit 28 - Swap bytes"]
401 #[inline(always)]
402 #[must_use]
403 pub fn swapbytes(&mut self) -> SWAPBYTES_W<28> {
404 SWAPBYTES_W::new(self)
405 }
406 #[doc = "Bit 29 - Flag A"]
407 #[inline(always)]
408 #[must_use]
409 pub fn flaga(&mut self) -> FLAGA_W<29> {
410 FLAGA_W::new(self)
411 }
412 #[doc = "Bit 30 - Flag B"]
413 #[inline(always)]
414 #[must_use]
415 pub fn flagb(&mut self) -> FLAGB_W<30> {
416 FLAGB_W::new(self)
417 }
418 #[doc = "Bit 31 - Calculate R2"]
419 #[inline(always)]
420 #[must_use]
421 pub fn calcr2(&mut self) -> CALCR2_W<31> {
422 CALCR2_W::new(self)
423 }
424 #[doc = "Writes raw bits to the register."]
425 #[inline(always)]
426 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
427 self.0.bits(bits);
428 self
429 }
430}
431#[doc = "No Description\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 [command](index.html) module"]
432pub struct COMMAND_SPEC;
433impl crate::RegisterSpec for COMMAND_SPEC {
434 type Ux = u32;
435}
436#[doc = "`read()` method returns [command::R](R) reader structure"]
437impl crate::Readable for COMMAND_SPEC {
438 type Reader = R;
439}
440#[doc = "`write(|w| ..)` method takes [command::W](W) writer structure"]
441impl crate::Writable for COMMAND_SPEC {
442 type Writer = W;
443 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
444 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
445}
446#[doc = "`reset()` method sets COMMAND to value 0"]
447impl crate::Resettable for COMMAND_SPEC {
448 const RESET_VALUE: Self::Ux = 0;
449}