atsamd51p/sdhc0/
bsr.rs
1#[doc = "Register `BSR` reader"]
2pub type R = crate::R<BsrSpec>;
3#[doc = "Register `BSR` writer"]
4pub type W = crate::W<BsrSpec>;
5#[doc = "Field `BLOCKSIZE` reader - Transfer Block Size"]
6pub type BlocksizeR = crate::FieldReader<u16>;
7#[doc = "Field `BLOCKSIZE` writer - Transfer Block Size"]
8pub type BlocksizeW<'a, REG> = crate::FieldWriter<'a, REG, 10, u16>;
9#[doc = "SDMA Buffer Boundary\n\nValue on reset: 0"]
10#[derive(Clone, Copy, Debug, PartialEq, Eq)]
11#[repr(u8)]
12pub enum Boundaryselect {
13 #[doc = "0: 4k bytes"]
14 _4k = 0,
15 #[doc = "1: 8k bytes"]
16 _8k = 1,
17 #[doc = "2: 16k bytes"]
18 _16k = 2,
19 #[doc = "3: 32k bytes"]
20 _32k = 3,
21 #[doc = "4: 64k bytes"]
22 _64k = 4,
23 #[doc = "5: 128k bytes"]
24 _128k = 5,
25 #[doc = "6: 256k bytes"]
26 _256k = 6,
27 #[doc = "7: 512k bytes"]
28 _512k = 7,
29}
30impl From<Boundaryselect> for u8 {
31 #[inline(always)]
32 fn from(variant: Boundaryselect) -> Self {
33 variant as _
34 }
35}
36impl crate::FieldSpec for Boundaryselect {
37 type Ux = u8;
38}
39impl crate::IsEnum for Boundaryselect {}
40#[doc = "Field `BOUNDARY` reader - SDMA Buffer Boundary"]
41pub type BoundaryR = crate::FieldReader<Boundaryselect>;
42impl BoundaryR {
43 #[doc = "Get enumerated values variant"]
44 #[inline(always)]
45 pub const fn variant(&self) -> Boundaryselect {
46 match self.bits {
47 0 => Boundaryselect::_4k,
48 1 => Boundaryselect::_8k,
49 2 => Boundaryselect::_16k,
50 3 => Boundaryselect::_32k,
51 4 => Boundaryselect::_64k,
52 5 => Boundaryselect::_128k,
53 6 => Boundaryselect::_256k,
54 7 => Boundaryselect::_512k,
55 _ => unreachable!(),
56 }
57 }
58 #[doc = "4k bytes"]
59 #[inline(always)]
60 pub fn is_4k(&self) -> bool {
61 *self == Boundaryselect::_4k
62 }
63 #[doc = "8k bytes"]
64 #[inline(always)]
65 pub fn is_8k(&self) -> bool {
66 *self == Boundaryselect::_8k
67 }
68 #[doc = "16k bytes"]
69 #[inline(always)]
70 pub fn is_16k(&self) -> bool {
71 *self == Boundaryselect::_16k
72 }
73 #[doc = "32k bytes"]
74 #[inline(always)]
75 pub fn is_32k(&self) -> bool {
76 *self == Boundaryselect::_32k
77 }
78 #[doc = "64k bytes"]
79 #[inline(always)]
80 pub fn is_64k(&self) -> bool {
81 *self == Boundaryselect::_64k
82 }
83 #[doc = "128k bytes"]
84 #[inline(always)]
85 pub fn is_128k(&self) -> bool {
86 *self == Boundaryselect::_128k
87 }
88 #[doc = "256k bytes"]
89 #[inline(always)]
90 pub fn is_256k(&self) -> bool {
91 *self == Boundaryselect::_256k
92 }
93 #[doc = "512k bytes"]
94 #[inline(always)]
95 pub fn is_512k(&self) -> bool {
96 *self == Boundaryselect::_512k
97 }
98}
99#[doc = "Field `BOUNDARY` writer - SDMA Buffer Boundary"]
100pub type BoundaryW<'a, REG> = crate::FieldWriter<'a, REG, 3, Boundaryselect, crate::Safe>;
101impl<'a, REG> BoundaryW<'a, REG>
102where
103 REG: crate::Writable + crate::RegisterSpec,
104 REG::Ux: From<u8>,
105{
106 #[doc = "4k bytes"]
107 #[inline(always)]
108 pub fn _4k(self) -> &'a mut crate::W<REG> {
109 self.variant(Boundaryselect::_4k)
110 }
111 #[doc = "8k bytes"]
112 #[inline(always)]
113 pub fn _8k(self) -> &'a mut crate::W<REG> {
114 self.variant(Boundaryselect::_8k)
115 }
116 #[doc = "16k bytes"]
117 #[inline(always)]
118 pub fn _16k(self) -> &'a mut crate::W<REG> {
119 self.variant(Boundaryselect::_16k)
120 }
121 #[doc = "32k bytes"]
122 #[inline(always)]
123 pub fn _32k(self) -> &'a mut crate::W<REG> {
124 self.variant(Boundaryselect::_32k)
125 }
126 #[doc = "64k bytes"]
127 #[inline(always)]
128 pub fn _64k(self) -> &'a mut crate::W<REG> {
129 self.variant(Boundaryselect::_64k)
130 }
131 #[doc = "128k bytes"]
132 #[inline(always)]
133 pub fn _128k(self) -> &'a mut crate::W<REG> {
134 self.variant(Boundaryselect::_128k)
135 }
136 #[doc = "256k bytes"]
137 #[inline(always)]
138 pub fn _256k(self) -> &'a mut crate::W<REG> {
139 self.variant(Boundaryselect::_256k)
140 }
141 #[doc = "512k bytes"]
142 #[inline(always)]
143 pub fn _512k(self) -> &'a mut crate::W<REG> {
144 self.variant(Boundaryselect::_512k)
145 }
146}
147impl R {
148 #[doc = "Bits 0:9 - Transfer Block Size"]
149 #[inline(always)]
150 pub fn blocksize(&self) -> BlocksizeR {
151 BlocksizeR::new(self.bits & 0x03ff)
152 }
153 #[doc = "Bits 12:14 - SDMA Buffer Boundary"]
154 #[inline(always)]
155 pub fn boundary(&self) -> BoundaryR {
156 BoundaryR::new(((self.bits >> 12) & 7) as u8)
157 }
158}
159impl W {
160 #[doc = "Bits 0:9 - Transfer Block Size"]
161 #[inline(always)]
162 #[must_use]
163 pub fn blocksize(&mut self) -> BlocksizeW<BsrSpec> {
164 BlocksizeW::new(self, 0)
165 }
166 #[doc = "Bits 12:14 - SDMA Buffer Boundary"]
167 #[inline(always)]
168 #[must_use]
169 pub fn boundary(&mut self) -> BoundaryW<BsrSpec> {
170 BoundaryW::new(self, 12)
171 }
172}
173#[doc = "Block Size\n\nYou can [`read`](crate::Reg::read) this register and get [`bsr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`bsr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
174pub struct BsrSpec;
175impl crate::RegisterSpec for BsrSpec {
176 type Ux = u16;
177}
178#[doc = "`read()` method returns [`bsr::R`](R) reader structure"]
179impl crate::Readable for BsrSpec {}
180#[doc = "`write(|w| ..)` method takes [`bsr::W`](W) writer structure"]
181impl crate::Writable for BsrSpec {
182 type Safety = crate::Unsafe;
183 const ZERO_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
184 const ONE_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
185}
186#[doc = "`reset()` method sets BSR to value 0"]
187impl crate::Resettable for BsrSpec {
188 const RESET_VALUE: u16 = 0;
189}