efm32pg22-pac 0.1.1

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