atsam3a4c 0.1.0

Peripheral access API for ATSAM3A4C microcontrollers (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
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
#[doc = "Register `DEVEPTCFG4` reader"]
pub type R = crate::R<Deveptcfg4Spec>;
#[doc = "Register `DEVEPTCFG4` writer"]
pub type W = crate::W<Deveptcfg4Spec>;
#[doc = "Field `ALLOC` reader - Endpoint Memory Allocate"]
pub type AllocR = crate::BitReader;
#[doc = "Field `ALLOC` writer - Endpoint Memory Allocate"]
pub type AllocW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Endpoint Banks"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Epbk {
    #[doc = "0: Single-bank endpoint"]
    _1Bank = 0,
    #[doc = "1: Double-bank endpoint"]
    _2Bank = 1,
    #[doc = "2: Triple-bank endpoint"]
    _3Bank = 2,
}
impl From<Epbk> for u8 {
    #[inline(always)]
    fn from(variant: Epbk) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Epbk {
    type Ux = u8;
}
impl crate::IsEnum for Epbk {}
#[doc = "Field `EPBK` reader - Endpoint Banks"]
pub type EpbkR = crate::FieldReader<Epbk>;
impl EpbkR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<Epbk> {
        match self.bits {
            0 => Some(Epbk::_1Bank),
            1 => Some(Epbk::_2Bank),
            2 => Some(Epbk::_3Bank),
            _ => None,
        }
    }
    #[doc = "Single-bank endpoint"]
    #[inline(always)]
    pub fn is_1_bank(&self) -> bool {
        *self == Epbk::_1Bank
    }
    #[doc = "Double-bank endpoint"]
    #[inline(always)]
    pub fn is_2_bank(&self) -> bool {
        *self == Epbk::_2Bank
    }
    #[doc = "Triple-bank endpoint"]
    #[inline(always)]
    pub fn is_3_bank(&self) -> bool {
        *self == Epbk::_3Bank
    }
}
#[doc = "Field `EPBK` writer - Endpoint Banks"]
pub type EpbkW<'a, REG> = crate::FieldWriter<'a, REG, 2, Epbk>;
impl<'a, REG> EpbkW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Single-bank endpoint"]
    #[inline(always)]
    pub fn _1_bank(self) -> &'a mut crate::W<REG> {
        self.variant(Epbk::_1Bank)
    }
    #[doc = "Double-bank endpoint"]
    #[inline(always)]
    pub fn _2_bank(self) -> &'a mut crate::W<REG> {
        self.variant(Epbk::_2Bank)
    }
    #[doc = "Triple-bank endpoint"]
    #[inline(always)]
    pub fn _3_bank(self) -> &'a mut crate::W<REG> {
        self.variant(Epbk::_3Bank)
    }
}
#[doc = "Endpoint Size"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Epsize {
    #[doc = "0: 8 bytes"]
    _8Byte = 0,
    #[doc = "1: 16 bytes"]
    _16Byte = 1,
    #[doc = "2: 32 bytes"]
    _32Byte = 2,
    #[doc = "3: 64 bytes"]
    _64Byte = 3,
    #[doc = "4: 128 bytes"]
    _128Byte = 4,
    #[doc = "5: 256 bytes"]
    _256Byte = 5,
    #[doc = "6: 512 bytes"]
    _512Byte = 6,
    #[doc = "7: 1024 bytes"]
    _1024Byte = 7,
}
impl From<Epsize> for u8 {
    #[inline(always)]
    fn from(variant: Epsize) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Epsize {
    type Ux = u8;
}
impl crate::IsEnum for Epsize {}
#[doc = "Field `EPSIZE` reader - Endpoint Size"]
pub type EpsizeR = crate::FieldReader<Epsize>;
impl EpsizeR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Epsize {
        match self.bits {
            0 => Epsize::_8Byte,
            1 => Epsize::_16Byte,
            2 => Epsize::_32Byte,
            3 => Epsize::_64Byte,
            4 => Epsize::_128Byte,
            5 => Epsize::_256Byte,
            6 => Epsize::_512Byte,
            7 => Epsize::_1024Byte,
            _ => unreachable!(),
        }
    }
    #[doc = "8 bytes"]
    #[inline(always)]
    pub fn is_8_byte(&self) -> bool {
        *self == Epsize::_8Byte
    }
    #[doc = "16 bytes"]
    #[inline(always)]
    pub fn is_16_byte(&self) -> bool {
        *self == Epsize::_16Byte
    }
    #[doc = "32 bytes"]
    #[inline(always)]
    pub fn is_32_byte(&self) -> bool {
        *self == Epsize::_32Byte
    }
    #[doc = "64 bytes"]
    #[inline(always)]
    pub fn is_64_byte(&self) -> bool {
        *self == Epsize::_64Byte
    }
    #[doc = "128 bytes"]
    #[inline(always)]
    pub fn is_128_byte(&self) -> bool {
        *self == Epsize::_128Byte
    }
    #[doc = "256 bytes"]
    #[inline(always)]
    pub fn is_256_byte(&self) -> bool {
        *self == Epsize::_256Byte
    }
    #[doc = "512 bytes"]
    #[inline(always)]
    pub fn is_512_byte(&self) -> bool {
        *self == Epsize::_512Byte
    }
    #[doc = "1024 bytes"]
    #[inline(always)]
    pub fn is_1024_byte(&self) -> bool {
        *self == Epsize::_1024Byte
    }
}
#[doc = "Field `EPSIZE` writer - Endpoint Size"]
pub type EpsizeW<'a, REG> = crate::FieldWriter<'a, REG, 3, Epsize, crate::Safe>;
impl<'a, REG> EpsizeW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "8 bytes"]
    #[inline(always)]
    pub fn _8_byte(self) -> &'a mut crate::W<REG> {
        self.variant(Epsize::_8Byte)
    }
    #[doc = "16 bytes"]
    #[inline(always)]
    pub fn _16_byte(self) -> &'a mut crate::W<REG> {
        self.variant(Epsize::_16Byte)
    }
    #[doc = "32 bytes"]
    #[inline(always)]
    pub fn _32_byte(self) -> &'a mut crate::W<REG> {
        self.variant(Epsize::_32Byte)
    }
    #[doc = "64 bytes"]
    #[inline(always)]
    pub fn _64_byte(self) -> &'a mut crate::W<REG> {
        self.variant(Epsize::_64Byte)
    }
    #[doc = "128 bytes"]
    #[inline(always)]
    pub fn _128_byte(self) -> &'a mut crate::W<REG> {
        self.variant(Epsize::_128Byte)
    }
    #[doc = "256 bytes"]
    #[inline(always)]
    pub fn _256_byte(self) -> &'a mut crate::W<REG> {
        self.variant(Epsize::_256Byte)
    }
    #[doc = "512 bytes"]
    #[inline(always)]
    pub fn _512_byte(self) -> &'a mut crate::W<REG> {
        self.variant(Epsize::_512Byte)
    }
    #[doc = "1024 bytes"]
    #[inline(always)]
    pub fn _1024_byte(self) -> &'a mut crate::W<REG> {
        self.variant(Epsize::_1024Byte)
    }
}
#[doc = "Endpoint Direction"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Epdir {
    #[doc = "0: The endpoint direction is OUT."]
    Out = 0,
    #[doc = "1: The endpoint direction is IN (nor for control endpoints)."]
    In = 1,
}
impl From<Epdir> for bool {
    #[inline(always)]
    fn from(variant: Epdir) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `EPDIR` reader - Endpoint Direction"]
pub type EpdirR = crate::BitReader<Epdir>;
impl EpdirR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Epdir {
        match self.bits {
            false => Epdir::Out,
            true => Epdir::In,
        }
    }
    #[doc = "The endpoint direction is OUT."]
    #[inline(always)]
    pub fn is_out(&self) -> bool {
        *self == Epdir::Out
    }
    #[doc = "The endpoint direction is IN (nor for control endpoints)."]
    #[inline(always)]
    pub fn is_in(&self) -> bool {
        *self == Epdir::In
    }
}
#[doc = "Field `EPDIR` writer - Endpoint Direction"]
pub type EpdirW<'a, REG> = crate::BitWriter<'a, REG, Epdir>;
impl<'a, REG> EpdirW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "The endpoint direction is OUT."]
    #[inline(always)]
    pub fn out(self) -> &'a mut crate::W<REG> {
        self.variant(Epdir::Out)
    }
    #[doc = "The endpoint direction is IN (nor for control endpoints)."]
    #[inline(always)]
    pub fn in_(self) -> &'a mut crate::W<REG> {
        self.variant(Epdir::In)
    }
}
#[doc = "Field `AUTOSW` reader - Automatic Switch"]
pub type AutoswR = crate::BitReader;
#[doc = "Field `AUTOSW` writer - Automatic Switch"]
pub type AutoswW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Endpoint Type"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Eptype {
    #[doc = "0: Control"]
    Ctrl = 0,
    #[doc = "1: Isochronous"]
    Iso = 1,
    #[doc = "2: Bulk"]
    Blk = 2,
    #[doc = "3: Interrupt"]
    Intrpt = 3,
}
impl From<Eptype> for u8 {
    #[inline(always)]
    fn from(variant: Eptype) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Eptype {
    type Ux = u8;
}
impl crate::IsEnum for Eptype {}
#[doc = "Field `EPTYPE` reader - Endpoint Type"]
pub type EptypeR = crate::FieldReader<Eptype>;
impl EptypeR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Eptype {
        match self.bits {
            0 => Eptype::Ctrl,
            1 => Eptype::Iso,
            2 => Eptype::Blk,
            3 => Eptype::Intrpt,
            _ => unreachable!(),
        }
    }
    #[doc = "Control"]
    #[inline(always)]
    pub fn is_ctrl(&self) -> bool {
        *self == Eptype::Ctrl
    }
    #[doc = "Isochronous"]
    #[inline(always)]
    pub fn is_iso(&self) -> bool {
        *self == Eptype::Iso
    }
    #[doc = "Bulk"]
    #[inline(always)]
    pub fn is_blk(&self) -> bool {
        *self == Eptype::Blk
    }
    #[doc = "Interrupt"]
    #[inline(always)]
    pub fn is_intrpt(&self) -> bool {
        *self == Eptype::Intrpt
    }
}
#[doc = "Field `EPTYPE` writer - Endpoint Type"]
pub type EptypeW<'a, REG> = crate::FieldWriter<'a, REG, 2, Eptype, crate::Safe>;
impl<'a, REG> EptypeW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Control"]
    #[inline(always)]
    pub fn ctrl(self) -> &'a mut crate::W<REG> {
        self.variant(Eptype::Ctrl)
    }
    #[doc = "Isochronous"]
    #[inline(always)]
    pub fn iso(self) -> &'a mut crate::W<REG> {
        self.variant(Eptype::Iso)
    }
    #[doc = "Bulk"]
    #[inline(always)]
    pub fn blk(self) -> &'a mut crate::W<REG> {
        self.variant(Eptype::Blk)
    }
    #[doc = "Interrupt"]
    #[inline(always)]
    pub fn intrpt(self) -> &'a mut crate::W<REG> {
        self.variant(Eptype::Intrpt)
    }
}
#[doc = "Number of transaction per microframe for isochronous endpoint"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Nbtrans {
    #[doc = "0: reserved to endpoint that does not have the high-bandwidth isochronous capability."]
    _0Trans = 0,
    #[doc = "1: default value: one transaction per micro-frame."]
    _1Trans = 1,
    #[doc = "2: 2 transactions per micro-frame. This endpoint should be configured as double-bank."]
    _2Trans = 2,
    #[doc = "3: 3 transactions per micro-frame. This endpoint should be configured as triple-bank."]
    _3Trans = 3,
}
impl From<Nbtrans> for u8 {
    #[inline(always)]
    fn from(variant: Nbtrans) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Nbtrans {
    type Ux = u8;
}
impl crate::IsEnum for Nbtrans {}
#[doc = "Field `NBTRANS` reader - Number of transaction per microframe for isochronous endpoint"]
pub type NbtransR = crate::FieldReader<Nbtrans>;
impl NbtransR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Nbtrans {
        match self.bits {
            0 => Nbtrans::_0Trans,
            1 => Nbtrans::_1Trans,
            2 => Nbtrans::_2Trans,
            3 => Nbtrans::_3Trans,
            _ => unreachable!(),
        }
    }
    #[doc = "reserved to endpoint that does not have the high-bandwidth isochronous capability."]
    #[inline(always)]
    pub fn is_0_trans(&self) -> bool {
        *self == Nbtrans::_0Trans
    }
    #[doc = "default value: one transaction per micro-frame."]
    #[inline(always)]
    pub fn is_1_trans(&self) -> bool {
        *self == Nbtrans::_1Trans
    }
    #[doc = "2 transactions per micro-frame. This endpoint should be configured as double-bank."]
    #[inline(always)]
    pub fn is_2_trans(&self) -> bool {
        *self == Nbtrans::_2Trans
    }
    #[doc = "3 transactions per micro-frame. This endpoint should be configured as triple-bank."]
    #[inline(always)]
    pub fn is_3_trans(&self) -> bool {
        *self == Nbtrans::_3Trans
    }
}
#[doc = "Field `NBTRANS` writer - Number of transaction per microframe for isochronous endpoint"]
pub type NbtransW<'a, REG> = crate::FieldWriter<'a, REG, 2, Nbtrans, crate::Safe>;
impl<'a, REG> NbtransW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "reserved to endpoint that does not have the high-bandwidth isochronous capability."]
    #[inline(always)]
    pub fn _0_trans(self) -> &'a mut crate::W<REG> {
        self.variant(Nbtrans::_0Trans)
    }
    #[doc = "default value: one transaction per micro-frame."]
    #[inline(always)]
    pub fn _1_trans(self) -> &'a mut crate::W<REG> {
        self.variant(Nbtrans::_1Trans)
    }
    #[doc = "2 transactions per micro-frame. This endpoint should be configured as double-bank."]
    #[inline(always)]
    pub fn _2_trans(self) -> &'a mut crate::W<REG> {
        self.variant(Nbtrans::_2Trans)
    }
    #[doc = "3 transactions per micro-frame. This endpoint should be configured as triple-bank."]
    #[inline(always)]
    pub fn _3_trans(self) -> &'a mut crate::W<REG> {
        self.variant(Nbtrans::_3Trans)
    }
}
impl R {
    #[doc = "Bit 1 - Endpoint Memory Allocate"]
    #[inline(always)]
    pub fn alloc(&self) -> AllocR {
        AllocR::new(((self.bits >> 1) & 1) != 0)
    }
    #[doc = "Bits 2:3 - Endpoint Banks"]
    #[inline(always)]
    pub fn epbk(&self) -> EpbkR {
        EpbkR::new(((self.bits >> 2) & 3) as u8)
    }
    #[doc = "Bits 4:6 - Endpoint Size"]
    #[inline(always)]
    pub fn epsize(&self) -> EpsizeR {
        EpsizeR::new(((self.bits >> 4) & 7) as u8)
    }
    #[doc = "Bit 8 - Endpoint Direction"]
    #[inline(always)]
    pub fn epdir(&self) -> EpdirR {
        EpdirR::new(((self.bits >> 8) & 1) != 0)
    }
    #[doc = "Bit 9 - Automatic Switch"]
    #[inline(always)]
    pub fn autosw(&self) -> AutoswR {
        AutoswR::new(((self.bits >> 9) & 1) != 0)
    }
    #[doc = "Bits 11:12 - Endpoint Type"]
    #[inline(always)]
    pub fn eptype(&self) -> EptypeR {
        EptypeR::new(((self.bits >> 11) & 3) as u8)
    }
    #[doc = "Bits 13:14 - Number of transaction per microframe for isochronous endpoint"]
    #[inline(always)]
    pub fn nbtrans(&self) -> NbtransR {
        NbtransR::new(((self.bits >> 13) & 3) as u8)
    }
}
impl W {
    #[doc = "Bit 1 - Endpoint Memory Allocate"]
    #[inline(always)]
    #[must_use]
    pub fn alloc(&mut self) -> AllocW<Deveptcfg4Spec> {
        AllocW::new(self, 1)
    }
    #[doc = "Bits 2:3 - Endpoint Banks"]
    #[inline(always)]
    #[must_use]
    pub fn epbk(&mut self) -> EpbkW<Deveptcfg4Spec> {
        EpbkW::new(self, 2)
    }
    #[doc = "Bits 4:6 - Endpoint Size"]
    #[inline(always)]
    #[must_use]
    pub fn epsize(&mut self) -> EpsizeW<Deveptcfg4Spec> {
        EpsizeW::new(self, 4)
    }
    #[doc = "Bit 8 - Endpoint Direction"]
    #[inline(always)]
    #[must_use]
    pub fn epdir(&mut self) -> EpdirW<Deveptcfg4Spec> {
        EpdirW::new(self, 8)
    }
    #[doc = "Bit 9 - Automatic Switch"]
    #[inline(always)]
    #[must_use]
    pub fn autosw(&mut self) -> AutoswW<Deveptcfg4Spec> {
        AutoswW::new(self, 9)
    }
    #[doc = "Bits 11:12 - Endpoint Type"]
    #[inline(always)]
    #[must_use]
    pub fn eptype(&mut self) -> EptypeW<Deveptcfg4Spec> {
        EptypeW::new(self, 11)
    }
    #[doc = "Bits 13:14 - Number of transaction per microframe for isochronous endpoint"]
    #[inline(always)]
    #[must_use]
    pub fn nbtrans(&mut self) -> NbtransW<Deveptcfg4Spec> {
        NbtransW::new(self, 13)
    }
}
#[doc = "Device Endpoint Configuration Register (n = 0) 4\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`deveptcfg4::R`](R).  You can [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`deveptcfg4::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct Deveptcfg4Spec;
impl crate::RegisterSpec for Deveptcfg4Spec {
    type Ux = u32;
}
#[doc = "`read()` method returns [`deveptcfg4::R`](R) reader structure"]
impl crate::Readable for Deveptcfg4Spec {}
#[doc = "`write(|w| ..)` method takes [`deveptcfg4::W`](W) writer structure"]
impl crate::Writable for Deveptcfg4Spec {
    type Safety = crate::Unsafe;
    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}