atsamd51g/sdhc0/
aesr.rs
1#[doc = "Register `AESR` reader"]
2pub type R = crate::R<AesrSpec>;
3#[doc = "ADMA Error State\n\nValue on reset: 0"]
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5#[repr(u8)]
6pub enum Errstselect {
7 #[doc = "0: ST_STOP (Stop DMA)"]
8 Stop = 0,
9 #[doc = "1: ST_FDS (Fetch Descriptor)"]
10 Fds = 1,
11 #[doc = "3: ST_TFR (Transfer Data)"]
12 Tfr = 3,
13}
14impl From<Errstselect> for u8 {
15 #[inline(always)]
16 fn from(variant: Errstselect) -> Self {
17 variant as _
18 }
19}
20impl crate::FieldSpec for Errstselect {
21 type Ux = u8;
22}
23impl crate::IsEnum for Errstselect {}
24#[doc = "Field `ERRST` reader - ADMA Error State"]
25pub type ErrstR = crate::FieldReader<Errstselect>;
26impl ErrstR {
27 #[doc = "Get enumerated values variant"]
28 #[inline(always)]
29 pub const fn variant(&self) -> Option<Errstselect> {
30 match self.bits {
31 0 => Some(Errstselect::Stop),
32 1 => Some(Errstselect::Fds),
33 3 => Some(Errstselect::Tfr),
34 _ => None,
35 }
36 }
37 #[doc = "ST_STOP (Stop DMA)"]
38 #[inline(always)]
39 pub fn is_stop(&self) -> bool {
40 *self == Errstselect::Stop
41 }
42 #[doc = "ST_FDS (Fetch Descriptor)"]
43 #[inline(always)]
44 pub fn is_fds(&self) -> bool {
45 *self == Errstselect::Fds
46 }
47 #[doc = "ST_TFR (Transfer Data)"]
48 #[inline(always)]
49 pub fn is_tfr(&self) -> bool {
50 *self == Errstselect::Tfr
51 }
52}
53#[doc = "ADMA Length Mismatch Error\n\nValue on reset: 0"]
54#[derive(Clone, Copy, Debug, PartialEq, Eq)]
55pub enum Lmisselect {
56 #[doc = "0: No Error"]
57 No = 0,
58 #[doc = "1: Error"]
59 Yes = 1,
60}
61impl From<Lmisselect> for bool {
62 #[inline(always)]
63 fn from(variant: Lmisselect) -> Self {
64 variant as u8 != 0
65 }
66}
67#[doc = "Field `LMIS` reader - ADMA Length Mismatch Error"]
68pub type LmisR = crate::BitReader<Lmisselect>;
69impl LmisR {
70 #[doc = "Get enumerated values variant"]
71 #[inline(always)]
72 pub const fn variant(&self) -> Lmisselect {
73 match self.bits {
74 false => Lmisselect::No,
75 true => Lmisselect::Yes,
76 }
77 }
78 #[doc = "No Error"]
79 #[inline(always)]
80 pub fn is_no(&self) -> bool {
81 *self == Lmisselect::No
82 }
83 #[doc = "Error"]
84 #[inline(always)]
85 pub fn is_yes(&self) -> bool {
86 *self == Lmisselect::Yes
87 }
88}
89impl R {
90 #[doc = "Bits 0:1 - ADMA Error State"]
91 #[inline(always)]
92 pub fn errst(&self) -> ErrstR {
93 ErrstR::new(self.bits & 3)
94 }
95 #[doc = "Bit 2 - ADMA Length Mismatch Error"]
96 #[inline(always)]
97 pub fn lmis(&self) -> LmisR {
98 LmisR::new(((self.bits >> 2) & 1) != 0)
99 }
100}
101#[doc = "ADMA Error Status\n\nYou can [`read`](crate::Reg::read) this register and get [`aesr::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
102pub struct AesrSpec;
103impl crate::RegisterSpec for AesrSpec {
104 type Ux = u8;
105}
106#[doc = "`read()` method returns [`aesr::R`](R) reader structure"]
107impl crate::Readable for AesrSpec {}
108#[doc = "`reset()` method sets AESR to value 0"]
109impl crate::Resettable for AesrSpec {
110 const RESET_VALUE: u8 = 0;
111}