mcxa-pac 0.1.1

Peripheral Access Crate for MCXA256 devices
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
543
544
545
546
547
548
549
#[doc = "Register `ERRSTAT` reader"]
pub type R = crate::R<ErrstatSpec>;
#[doc = "Register `ERRSTAT` writer"]
pub type W = crate::W<ErrstatSpec>;
#[doc = "PID Error Flag\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Piderr {
    #[doc = "0: Did not fail"]
    IntNo = 0,
    #[doc = "1: Failed"]
    IntYes = 1,
}
impl From<Piderr> for bool {
    #[inline(always)]
    fn from(variant: Piderr) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `PIDERR` reader - PID Error Flag"]
pub type PiderrR = crate::BitReader<Piderr>;
impl PiderrR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Piderr {
        match self.bits {
            false => Piderr::IntNo,
            true => Piderr::IntYes,
        }
    }
    #[doc = "Did not fail"]
    #[inline(always)]
    pub fn is_int_no(&self) -> bool {
        *self == Piderr::IntNo
    }
    #[doc = "Failed"]
    #[inline(always)]
    pub fn is_int_yes(&self) -> bool {
        *self == Piderr::IntYes
    }
}
#[doc = "Field `PIDERR` writer - PID Error Flag"]
pub type PiderrW<'a, REG> = crate::BitWriter1C<'a, REG, Piderr>;
impl<'a, REG> PiderrW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Did not fail"]
    #[inline(always)]
    pub fn int_no(self) -> &'a mut crate::W<REG> {
        self.variant(Piderr::IntNo)
    }
    #[doc = "Failed"]
    #[inline(always)]
    pub fn int_yes(self) -> &'a mut crate::W<REG> {
        self.variant(Piderr::IntYes)
    }
}
#[doc = "CRC5 Error or End of Frame Error Flag\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Crc5eof {
    #[doc = "0: Interrupt did not occur"]
    IntNo = 0,
    #[doc = "1: Interrupt occurred"]
    IntYes = 1,
}
impl From<Crc5eof> for bool {
    #[inline(always)]
    fn from(variant: Crc5eof) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `CRC5EOF` reader - CRC5 Error or End of Frame Error Flag"]
pub type Crc5eofR = crate::BitReader<Crc5eof>;
impl Crc5eofR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Crc5eof {
        match self.bits {
            false => Crc5eof::IntNo,
            true => Crc5eof::IntYes,
        }
    }
    #[doc = "Interrupt did not occur"]
    #[inline(always)]
    pub fn is_int_no(&self) -> bool {
        *self == Crc5eof::IntNo
    }
    #[doc = "Interrupt occurred"]
    #[inline(always)]
    pub fn is_int_yes(&self) -> bool {
        *self == Crc5eof::IntYes
    }
}
#[doc = "Field `CRC5EOF` writer - CRC5 Error or End of Frame Error Flag"]
pub type Crc5eofW<'a, REG> = crate::BitWriter1C<'a, REG, Crc5eof>;
impl<'a, REG> Crc5eofW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Interrupt did not occur"]
    #[inline(always)]
    pub fn int_no(self) -> &'a mut crate::W<REG> {
        self.variant(Crc5eof::IntNo)
    }
    #[doc = "Interrupt occurred"]
    #[inline(always)]
    pub fn int_yes(self) -> &'a mut crate::W<REG> {
        self.variant(Crc5eof::IntYes)
    }
}
#[doc = "CRC16 Error Flag\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Crc16 {
    #[doc = "0: Not rejected"]
    IntNo = 0,
    #[doc = "1: Rejected"]
    IntYes = 1,
}
impl From<Crc16> for bool {
    #[inline(always)]
    fn from(variant: Crc16) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `CRC16` reader - CRC16 Error Flag"]
pub type Crc16R = crate::BitReader<Crc16>;
impl Crc16R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Crc16 {
        match self.bits {
            false => Crc16::IntNo,
            true => Crc16::IntYes,
        }
    }
    #[doc = "Not rejected"]
    #[inline(always)]
    pub fn is_int_no(&self) -> bool {
        *self == Crc16::IntNo
    }
    #[doc = "Rejected"]
    #[inline(always)]
    pub fn is_int_yes(&self) -> bool {
        *self == Crc16::IntYes
    }
}
#[doc = "Field `CRC16` writer - CRC16 Error Flag"]
pub type Crc16W<'a, REG> = crate::BitWriter1C<'a, REG, Crc16>;
impl<'a, REG> Crc16W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Not rejected"]
    #[inline(always)]
    pub fn int_no(self) -> &'a mut crate::W<REG> {
        self.variant(Crc16::IntNo)
    }
    #[doc = "Rejected"]
    #[inline(always)]
    pub fn int_yes(self) -> &'a mut crate::W<REG> {
        self.variant(Crc16::IntYes)
    }
}
#[doc = "Data Field Not 8 Bits Flag\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Dfn8 {
    #[doc = "0: Integer number of bytes"]
    IntNo = 0,
    #[doc = "1: Not an integer number of bytes"]
    IntYes = 1,
}
impl From<Dfn8> for bool {
    #[inline(always)]
    fn from(variant: Dfn8) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `DFN8` reader - Data Field Not 8 Bits Flag"]
pub type Dfn8R = crate::BitReader<Dfn8>;
impl Dfn8R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Dfn8 {
        match self.bits {
            false => Dfn8::IntNo,
            true => Dfn8::IntYes,
        }
    }
    #[doc = "Integer number of bytes"]
    #[inline(always)]
    pub fn is_int_no(&self) -> bool {
        *self == Dfn8::IntNo
    }
    #[doc = "Not an integer number of bytes"]
    #[inline(always)]
    pub fn is_int_yes(&self) -> bool {
        *self == Dfn8::IntYes
    }
}
#[doc = "Field `DFN8` writer - Data Field Not 8 Bits Flag"]
pub type Dfn8W<'a, REG> = crate::BitWriter1C<'a, REG, Dfn8>;
impl<'a, REG> Dfn8W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Integer number of bytes"]
    #[inline(always)]
    pub fn int_no(self) -> &'a mut crate::W<REG> {
        self.variant(Dfn8::IntNo)
    }
    #[doc = "Not an integer number of bytes"]
    #[inline(always)]
    pub fn int_yes(self) -> &'a mut crate::W<REG> {
        self.variant(Dfn8::IntYes)
    }
}
#[doc = "Bus Turnaround Timeout Error Flag\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Btoerr {
    #[doc = "0: Not timed out"]
    IntNo = 0,
    #[doc = "1: Timed out"]
    IntYes = 1,
}
impl From<Btoerr> for bool {
    #[inline(always)]
    fn from(variant: Btoerr) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `BTOERR` reader - Bus Turnaround Timeout Error Flag"]
pub type BtoerrR = crate::BitReader<Btoerr>;
impl BtoerrR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Btoerr {
        match self.bits {
            false => Btoerr::IntNo,
            true => Btoerr::IntYes,
        }
    }
    #[doc = "Not timed out"]
    #[inline(always)]
    pub fn is_int_no(&self) -> bool {
        *self == Btoerr::IntNo
    }
    #[doc = "Timed out"]
    #[inline(always)]
    pub fn is_int_yes(&self) -> bool {
        *self == Btoerr::IntYes
    }
}
#[doc = "Field `BTOERR` writer - Bus Turnaround Timeout Error Flag"]
pub type BtoerrW<'a, REG> = crate::BitWriter1C<'a, REG, Btoerr>;
impl<'a, REG> BtoerrW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Not timed out"]
    #[inline(always)]
    pub fn int_no(self) -> &'a mut crate::W<REG> {
        self.variant(Btoerr::IntNo)
    }
    #[doc = "Timed out"]
    #[inline(always)]
    pub fn int_yes(self) -> &'a mut crate::W<REG> {
        self.variant(Btoerr::IntYes)
    }
}
#[doc = "DMA Access Error Flag\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Dmaerr {
    #[doc = "0: Interrupt did not occur"]
    IntNo = 0,
    #[doc = "1: Interrupt occurred"]
    IntYes = 1,
}
impl From<Dmaerr> for bool {
    #[inline(always)]
    fn from(variant: Dmaerr) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `DMAERR` reader - DMA Access Error Flag"]
pub type DmaerrR = crate::BitReader<Dmaerr>;
impl DmaerrR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Dmaerr {
        match self.bits {
            false => Dmaerr::IntNo,
            true => Dmaerr::IntYes,
        }
    }
    #[doc = "Interrupt did not occur"]
    #[inline(always)]
    pub fn is_int_no(&self) -> bool {
        *self == Dmaerr::IntNo
    }
    #[doc = "Interrupt occurred"]
    #[inline(always)]
    pub fn is_int_yes(&self) -> bool {
        *self == Dmaerr::IntYes
    }
}
#[doc = "Field `DMAERR` writer - DMA Access Error Flag"]
pub type DmaerrW<'a, REG> = crate::BitWriter1C<'a, REG, Dmaerr>;
impl<'a, REG> DmaerrW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Interrupt did not occur"]
    #[inline(always)]
    pub fn int_no(self) -> &'a mut crate::W<REG> {
        self.variant(Dmaerr::IntNo)
    }
    #[doc = "Interrupt occurred"]
    #[inline(always)]
    pub fn int_yes(self) -> &'a mut crate::W<REG> {
        self.variant(Dmaerr::IntYes)
    }
}
#[doc = "BD Unavailable Error Flag\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Ownerr {
    #[doc = "0: Interrupt did not occur"]
    IntNo = 0,
    #[doc = "1: Interrupt occurred"]
    IntYes = 1,
}
impl From<Ownerr> for bool {
    #[inline(always)]
    fn from(variant: Ownerr) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `OWNERR` reader - BD Unavailable Error Flag"]
pub type OwnerrR = crate::BitReader<Ownerr>;
impl OwnerrR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Ownerr {
        match self.bits {
            false => Ownerr::IntNo,
            true => Ownerr::IntYes,
        }
    }
    #[doc = "Interrupt did not occur"]
    #[inline(always)]
    pub fn is_int_no(&self) -> bool {
        *self == Ownerr::IntNo
    }
    #[doc = "Interrupt occurred"]
    #[inline(always)]
    pub fn is_int_yes(&self) -> bool {
        *self == Ownerr::IntYes
    }
}
#[doc = "Field `OWNERR` writer - BD Unavailable Error Flag"]
pub type OwnerrW<'a, REG> = crate::BitWriter1C<'a, REG, Ownerr>;
impl<'a, REG> OwnerrW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Interrupt did not occur"]
    #[inline(always)]
    pub fn int_no(self) -> &'a mut crate::W<REG> {
        self.variant(Ownerr::IntNo)
    }
    #[doc = "Interrupt occurred"]
    #[inline(always)]
    pub fn int_yes(self) -> &'a mut crate::W<REG> {
        self.variant(Ownerr::IntYes)
    }
}
#[doc = "Bit Stuff Error Flag\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Btserr {
    #[doc = "0: Packet not rejected due to the error"]
    IntNo = 0,
    #[doc = "1: Packet rejected due to the error"]
    IntYes = 1,
}
impl From<Btserr> for bool {
    #[inline(always)]
    fn from(variant: Btserr) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `BTSERR` reader - Bit Stuff Error Flag"]
pub type BtserrR = crate::BitReader<Btserr>;
impl BtserrR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Btserr {
        match self.bits {
            false => Btserr::IntNo,
            true => Btserr::IntYes,
        }
    }
    #[doc = "Packet not rejected due to the error"]
    #[inline(always)]
    pub fn is_int_no(&self) -> bool {
        *self == Btserr::IntNo
    }
    #[doc = "Packet rejected due to the error"]
    #[inline(always)]
    pub fn is_int_yes(&self) -> bool {
        *self == Btserr::IntYes
    }
}
#[doc = "Field `BTSERR` writer - Bit Stuff Error Flag"]
pub type BtserrW<'a, REG> = crate::BitWriter1C<'a, REG, Btserr>;
impl<'a, REG> BtserrW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Packet not rejected due to the error"]
    #[inline(always)]
    pub fn int_no(self) -> &'a mut crate::W<REG> {
        self.variant(Btserr::IntNo)
    }
    #[doc = "Packet rejected due to the error"]
    #[inline(always)]
    pub fn int_yes(self) -> &'a mut crate::W<REG> {
        self.variant(Btserr::IntYes)
    }
}
impl R {
    #[doc = "Bit 0 - PID Error Flag"]
    #[inline(always)]
    pub fn piderr(&self) -> PiderrR {
        PiderrR::new((self.bits & 1) != 0)
    }
    #[doc = "Bit 1 - CRC5 Error or End of Frame Error Flag"]
    #[inline(always)]
    pub fn crc5eof(&self) -> Crc5eofR {
        Crc5eofR::new(((self.bits >> 1) & 1) != 0)
    }
    #[doc = "Bit 2 - CRC16 Error Flag"]
    #[inline(always)]
    pub fn crc16(&self) -> Crc16R {
        Crc16R::new(((self.bits >> 2) & 1) != 0)
    }
    #[doc = "Bit 3 - Data Field Not 8 Bits Flag"]
    #[inline(always)]
    pub fn dfn8(&self) -> Dfn8R {
        Dfn8R::new(((self.bits >> 3) & 1) != 0)
    }
    #[doc = "Bit 4 - Bus Turnaround Timeout Error Flag"]
    #[inline(always)]
    pub fn btoerr(&self) -> BtoerrR {
        BtoerrR::new(((self.bits >> 4) & 1) != 0)
    }
    #[doc = "Bit 5 - DMA Access Error Flag"]
    #[inline(always)]
    pub fn dmaerr(&self) -> DmaerrR {
        DmaerrR::new(((self.bits >> 5) & 1) != 0)
    }
    #[doc = "Bit 6 - BD Unavailable Error Flag"]
    #[inline(always)]
    pub fn ownerr(&self) -> OwnerrR {
        OwnerrR::new(((self.bits >> 6) & 1) != 0)
    }
    #[doc = "Bit 7 - Bit Stuff Error Flag"]
    #[inline(always)]
    pub fn btserr(&self) -> BtserrR {
        BtserrR::new(((self.bits >> 7) & 1) != 0)
    }
}
#[cfg(feature = "debug")]
impl core::fmt::Debug for R {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("ERRSTAT")
            .field("piderr", &self.piderr())
            .field("crc5eof", &self.crc5eof())
            .field("crc16", &self.crc16())
            .field("dfn8", &self.dfn8())
            .field("btoerr", &self.btoerr())
            .field("dmaerr", &self.dmaerr())
            .field("ownerr", &self.ownerr())
            .field("btserr", &self.btserr())
            .finish()
    }
}
impl W {
    #[doc = "Bit 0 - PID Error Flag"]
    #[inline(always)]
    pub fn piderr(&mut self) -> PiderrW<'_, ErrstatSpec> {
        PiderrW::new(self, 0)
    }
    #[doc = "Bit 1 - CRC5 Error or End of Frame Error Flag"]
    #[inline(always)]
    pub fn crc5eof(&mut self) -> Crc5eofW<'_, ErrstatSpec> {
        Crc5eofW::new(self, 1)
    }
    #[doc = "Bit 2 - CRC16 Error Flag"]
    #[inline(always)]
    pub fn crc16(&mut self) -> Crc16W<'_, ErrstatSpec> {
        Crc16W::new(self, 2)
    }
    #[doc = "Bit 3 - Data Field Not 8 Bits Flag"]
    #[inline(always)]
    pub fn dfn8(&mut self) -> Dfn8W<'_, ErrstatSpec> {
        Dfn8W::new(self, 3)
    }
    #[doc = "Bit 4 - Bus Turnaround Timeout Error Flag"]
    #[inline(always)]
    pub fn btoerr(&mut self) -> BtoerrW<'_, ErrstatSpec> {
        BtoerrW::new(self, 4)
    }
    #[doc = "Bit 5 - DMA Access Error Flag"]
    #[inline(always)]
    pub fn dmaerr(&mut self) -> DmaerrW<'_, ErrstatSpec> {
        DmaerrW::new(self, 5)
    }
    #[doc = "Bit 6 - BD Unavailable Error Flag"]
    #[inline(always)]
    pub fn ownerr(&mut self) -> OwnerrW<'_, ErrstatSpec> {
        OwnerrW::new(self, 6)
    }
    #[doc = "Bit 7 - Bit Stuff Error Flag"]
    #[inline(always)]
    pub fn btserr(&mut self) -> BtserrW<'_, ErrstatSpec> {
        BtserrW::new(self, 7)
    }
}
#[doc = "Error Interrupt Status\n\nYou can [`read`](crate::Reg::read) this register and get [`errstat::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`errstat::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct ErrstatSpec;
impl crate::RegisterSpec for ErrstatSpec {
    type Ux = u8;
}
#[doc = "`read()` method returns [`errstat::R`](R) reader structure"]
impl crate::Readable for ErrstatSpec {}
#[doc = "`write(|w| ..)` method takes [`errstat::W`](W) writer structure"]
impl crate::Writable for ErrstatSpec {
    type Safety = crate::Unsafe;
    const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0xff;
}
#[doc = "`reset()` method sets ERRSTAT to value 0"]
impl crate::Resettable for ErrstatSpec {}