atsamd51p/sdhc0/
acr.rs
1#[doc = "Register `ACR` reader"]
2pub type R = crate::R<AcrSpec>;
3#[doc = "Register `ACR` writer"]
4pub type W = crate::W<AcrSpec>;
5#[doc = "AHB Maximum Burst\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum Bmaxselect {
9 #[doc = "0: `0`"]
10 Incr16 = 0,
11 #[doc = "1: `1`"]
12 Incr8 = 1,
13 #[doc = "2: `10`"]
14 Incr4 = 2,
15 #[doc = "3: `11`"]
16 Single = 3,
17}
18impl From<Bmaxselect> for u8 {
19 #[inline(always)]
20 fn from(variant: Bmaxselect) -> Self {
21 variant as _
22 }
23}
24impl crate::FieldSpec for Bmaxselect {
25 type Ux = u8;
26}
27impl crate::IsEnum for Bmaxselect {}
28#[doc = "Field `BMAX` reader - AHB Maximum Burst"]
29pub type BmaxR = crate::FieldReader<Bmaxselect>;
30impl BmaxR {
31 #[doc = "Get enumerated values variant"]
32 #[inline(always)]
33 pub const fn variant(&self) -> Bmaxselect {
34 match self.bits {
35 0 => Bmaxselect::Incr16,
36 1 => Bmaxselect::Incr8,
37 2 => Bmaxselect::Incr4,
38 3 => Bmaxselect::Single,
39 _ => unreachable!(),
40 }
41 }
42 #[doc = "`0`"]
43 #[inline(always)]
44 pub fn is_incr16(&self) -> bool {
45 *self == Bmaxselect::Incr16
46 }
47 #[doc = "`1`"]
48 #[inline(always)]
49 pub fn is_incr8(&self) -> bool {
50 *self == Bmaxselect::Incr8
51 }
52 #[doc = "`10`"]
53 #[inline(always)]
54 pub fn is_incr4(&self) -> bool {
55 *self == Bmaxselect::Incr4
56 }
57 #[doc = "`11`"]
58 #[inline(always)]
59 pub fn is_single(&self) -> bool {
60 *self == Bmaxselect::Single
61 }
62}
63#[doc = "Field `BMAX` writer - AHB Maximum Burst"]
64pub type BmaxW<'a, REG> = crate::FieldWriter<'a, REG, 2, Bmaxselect, crate::Safe>;
65impl<'a, REG> BmaxW<'a, REG>
66where
67 REG: crate::Writable + crate::RegisterSpec,
68 REG::Ux: From<u8>,
69{
70 #[doc = "`0`"]
71 #[inline(always)]
72 pub fn incr16(self) -> &'a mut crate::W<REG> {
73 self.variant(Bmaxselect::Incr16)
74 }
75 #[doc = "`1`"]
76 #[inline(always)]
77 pub fn incr8(self) -> &'a mut crate::W<REG> {
78 self.variant(Bmaxselect::Incr8)
79 }
80 #[doc = "`10`"]
81 #[inline(always)]
82 pub fn incr4(self) -> &'a mut crate::W<REG> {
83 self.variant(Bmaxselect::Incr4)
84 }
85 #[doc = "`11`"]
86 #[inline(always)]
87 pub fn single(self) -> &'a mut crate::W<REG> {
88 self.variant(Bmaxselect::Single)
89 }
90}
91impl R {
92 #[doc = "Bits 0:1 - AHB Maximum Burst"]
93 #[inline(always)]
94 pub fn bmax(&self) -> BmaxR {
95 BmaxR::new((self.bits & 3) as u8)
96 }
97}
98impl W {
99 #[doc = "Bits 0:1 - AHB Maximum Burst"]
100 #[inline(always)]
101 #[must_use]
102 pub fn bmax(&mut self) -> BmaxW<AcrSpec> {
103 BmaxW::new(self, 0)
104 }
105}
106#[doc = "AHB Control\n\nYou can [`read`](crate::Reg::read) this register and get [`acr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`acr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
107pub struct AcrSpec;
108impl crate::RegisterSpec for AcrSpec {
109 type Ux = u32;
110}
111#[doc = "`read()` method returns [`acr::R`](R) reader structure"]
112impl crate::Readable for AcrSpec {}
113#[doc = "`write(|w| ..)` method takes [`acr::W`](W) writer structure"]
114impl crate::Writable for AcrSpec {
115 type Safety = crate::Unsafe;
116 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
117 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
118}
119#[doc = "`reset()` method sets ACR to value 0"]
120impl crate::Resettable for AcrSpec {
121 const RESET_VALUE: u32 = 0;
122}