atsamd11c/usb/
device.rs

1#[repr(C)]
2#[doc = "USB is Device"]
3#[doc(alias = "DEVICE")]
4pub struct Device {
5    ctrla: Ctrla,
6    _reserved1: [u8; 0x01],
7    syncbusy: Syncbusy,
8    qosctrl: Qosctrl,
9    _reserved3: [u8; 0x04],
10    ctrlb: Ctrlb,
11    dadd: Dadd,
12    _reserved5: [u8; 0x01],
13    status: Status,
14    fsmstatus: Fsmstatus,
15    _reserved7: [u8; 0x02],
16    fnum: Fnum,
17    _reserved8: [u8; 0x02],
18    intenclr: Intenclr,
19    _reserved9: [u8; 0x02],
20    intenset: Intenset,
21    _reserved10: [u8; 0x02],
22    intflag: Intflag,
23    _reserved11: [u8; 0x02],
24    epintsmry: Epintsmry,
25    _reserved12: [u8; 0x02],
26    descadd: Descadd,
27    padcal: Padcal,
28    _reserved14: [u8; 0xd6],
29    epcfg: (),
30    _reserved15: [u8; 0x04],
31    epstatusclr: (),
32    _reserved16: [u8; 0x01],
33    epstatusset: (),
34    _reserved17: [u8; 0x01],
35    epstatus: (),
36    _reserved18: [u8; 0x01],
37    epintflag: (),
38    _reserved19: [u8; 0x01],
39    epintenclr: (),
40    _reserved20: [u8; 0x01],
41    epintenset: (),
42}
43impl Device {
44    #[doc = "0x00 - Control A"]
45    #[inline(always)]
46    pub const fn ctrla(&self) -> &Ctrla {
47        &self.ctrla
48    }
49    #[doc = "0x02 - Synchronization Busy"]
50    #[inline(always)]
51    pub const fn syncbusy(&self) -> &Syncbusy {
52        &self.syncbusy
53    }
54    #[doc = "0x03 - USB Quality Of Service"]
55    #[inline(always)]
56    pub const fn qosctrl(&self) -> &Qosctrl {
57        &self.qosctrl
58    }
59    #[doc = "0x08 - DEVICE Control B"]
60    #[inline(always)]
61    pub const fn ctrlb(&self) -> &Ctrlb {
62        &self.ctrlb
63    }
64    #[doc = "0x0a - DEVICE Device Address"]
65    #[inline(always)]
66    pub const fn dadd(&self) -> &Dadd {
67        &self.dadd
68    }
69    #[doc = "0x0c - DEVICE Status"]
70    #[inline(always)]
71    pub const fn status(&self) -> &Status {
72        &self.status
73    }
74    #[doc = "0x0d - Finite State Machine Status"]
75    #[inline(always)]
76    pub const fn fsmstatus(&self) -> &Fsmstatus {
77        &self.fsmstatus
78    }
79    #[doc = "0x10 - DEVICE Device Frame Number"]
80    #[inline(always)]
81    pub const fn fnum(&self) -> &Fnum {
82        &self.fnum
83    }
84    #[doc = "0x14 - DEVICE Device Interrupt Enable Clear"]
85    #[inline(always)]
86    pub const fn intenclr(&self) -> &Intenclr {
87        &self.intenclr
88    }
89    #[doc = "0x18 - DEVICE Device Interrupt Enable Set"]
90    #[inline(always)]
91    pub const fn intenset(&self) -> &Intenset {
92        &self.intenset
93    }
94    #[doc = "0x1c - DEVICE Device Interrupt Flag"]
95    #[inline(always)]
96    pub const fn intflag(&self) -> &Intflag {
97        &self.intflag
98    }
99    #[doc = "0x20 - DEVICE End Point Interrupt Summary"]
100    #[inline(always)]
101    pub const fn epintsmry(&self) -> &Epintsmry {
102        &self.epintsmry
103    }
104    #[doc = "0x24 - Descriptor Address"]
105    #[inline(always)]
106    pub const fn descadd(&self) -> &Descadd {
107        &self.descadd
108    }
109    #[doc = "0x28 - USB PAD Calibration"]
110    #[inline(always)]
111    pub const fn padcal(&self) -> &Padcal {
112        &self.padcal
113    }
114    #[doc = "0x100..0x108 - DEVICE End Point Configuration"]
115    #[inline(always)]
116    pub const fn epcfg(&self, n: usize) -> &Epcfg {
117        #[allow(clippy::no_effect)]
118        [(); 8][n];
119        unsafe {
120            &*(self as *const Self)
121                .cast::<u8>()
122                .add(256)
123                .add(32 * n)
124                .cast()
125        }
126    }
127    #[doc = "Iterator for array of:"]
128    #[doc = "0x100..0x108 - DEVICE End Point Configuration"]
129    #[inline(always)]
130    pub fn epcfg_iter(&self) -> impl Iterator<Item = &Epcfg> {
131        (0..8).map(move |n| unsafe {
132            &*(self as *const Self)
133                .cast::<u8>()
134                .add(256)
135                .add(32 * n)
136                .cast()
137        })
138    }
139    #[doc = "0x104..0x10c - DEVICE End Point Pipe Status Clear"]
140    #[inline(always)]
141    pub const fn epstatusclr(&self, n: usize) -> &Epstatusclr {
142        #[allow(clippy::no_effect)]
143        [(); 8][n];
144        unsafe {
145            &*(self as *const Self)
146                .cast::<u8>()
147                .add(260)
148                .add(32 * n)
149                .cast()
150        }
151    }
152    #[doc = "Iterator for array of:"]
153    #[doc = "0x104..0x10c - DEVICE End Point Pipe Status Clear"]
154    #[inline(always)]
155    pub fn epstatusclr_iter(&self) -> impl Iterator<Item = &Epstatusclr> {
156        (0..8).map(move |n| unsafe {
157            &*(self as *const Self)
158                .cast::<u8>()
159                .add(260)
160                .add(32 * n)
161                .cast()
162        })
163    }
164    #[doc = "0x105..0x10d - DEVICE End Point Pipe Status Set"]
165    #[inline(always)]
166    pub const fn epstatusset(&self, n: usize) -> &Epstatusset {
167        #[allow(clippy::no_effect)]
168        [(); 8][n];
169        unsafe {
170            &*(self as *const Self)
171                .cast::<u8>()
172                .add(261)
173                .add(32 * n)
174                .cast()
175        }
176    }
177    #[doc = "Iterator for array of:"]
178    #[doc = "0x105..0x10d - DEVICE End Point Pipe Status Set"]
179    #[inline(always)]
180    pub fn epstatusset_iter(&self) -> impl Iterator<Item = &Epstatusset> {
181        (0..8).map(move |n| unsafe {
182            &*(self as *const Self)
183                .cast::<u8>()
184                .add(261)
185                .add(32 * n)
186                .cast()
187        })
188    }
189    #[doc = "0x106..0x10e - DEVICE End Point Pipe Status"]
190    #[inline(always)]
191    pub const fn epstatus(&self, n: usize) -> &Epstatus {
192        #[allow(clippy::no_effect)]
193        [(); 8][n];
194        unsafe {
195            &*(self as *const Self)
196                .cast::<u8>()
197                .add(262)
198                .add(32 * n)
199                .cast()
200        }
201    }
202    #[doc = "Iterator for array of:"]
203    #[doc = "0x106..0x10e - DEVICE End Point Pipe Status"]
204    #[inline(always)]
205    pub fn epstatus_iter(&self) -> impl Iterator<Item = &Epstatus> {
206        (0..8).map(move |n| unsafe {
207            &*(self as *const Self)
208                .cast::<u8>()
209                .add(262)
210                .add(32 * n)
211                .cast()
212        })
213    }
214    #[doc = "0x107..0x10f - DEVICE End Point Interrupt Flag"]
215    #[inline(always)]
216    pub const fn epintflag(&self, n: usize) -> &Epintflag {
217        #[allow(clippy::no_effect)]
218        [(); 8][n];
219        unsafe {
220            &*(self as *const Self)
221                .cast::<u8>()
222                .add(263)
223                .add(32 * n)
224                .cast()
225        }
226    }
227    #[doc = "Iterator for array of:"]
228    #[doc = "0x107..0x10f - DEVICE End Point Interrupt Flag"]
229    #[inline(always)]
230    pub fn epintflag_iter(&self) -> impl Iterator<Item = &Epintflag> {
231        (0..8).map(move |n| unsafe {
232            &*(self as *const Self)
233                .cast::<u8>()
234                .add(263)
235                .add(32 * n)
236                .cast()
237        })
238    }
239    #[doc = "0x108..0x110 - DEVICE End Point Interrupt Clear Flag"]
240    #[inline(always)]
241    pub const fn epintenclr(&self, n: usize) -> &Epintenclr {
242        #[allow(clippy::no_effect)]
243        [(); 8][n];
244        unsafe {
245            &*(self as *const Self)
246                .cast::<u8>()
247                .add(264)
248                .add(32 * n)
249                .cast()
250        }
251    }
252    #[doc = "Iterator for array of:"]
253    #[doc = "0x108..0x110 - DEVICE End Point Interrupt Clear Flag"]
254    #[inline(always)]
255    pub fn epintenclr_iter(&self) -> impl Iterator<Item = &Epintenclr> {
256        (0..8).map(move |n| unsafe {
257            &*(self as *const Self)
258                .cast::<u8>()
259                .add(264)
260                .add(32 * n)
261                .cast()
262        })
263    }
264    #[doc = "0x109..0x111 - DEVICE End Point Interrupt Set Flag"]
265    #[inline(always)]
266    pub const fn epintenset(&self, n: usize) -> &Epintenset {
267        #[allow(clippy::no_effect)]
268        [(); 8][n];
269        unsafe {
270            &*(self as *const Self)
271                .cast::<u8>()
272                .add(265)
273                .add(32 * n)
274                .cast()
275        }
276    }
277    #[doc = "Iterator for array of:"]
278    #[doc = "0x109..0x111 - DEVICE End Point Interrupt Set Flag"]
279    #[inline(always)]
280    pub fn epintenset_iter(&self) -> impl Iterator<Item = &Epintenset> {
281        (0..8).map(move |n| unsafe {
282            &*(self as *const Self)
283                .cast::<u8>()
284                .add(265)
285                .add(32 * n)
286                .cast()
287        })
288    }
289}
290#[doc = "CTRLA (rw) register accessor: Control A\n\nYou can [`read`](crate::Reg::read) this register and get [`ctrla::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ctrla::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@ctrla`]
291module"]
292#[doc(alias = "CTRLA")]
293pub type Ctrla = crate::Reg<ctrla::CtrlaSpec>;
294#[doc = "Control A"]
295pub mod ctrla;
296#[doc = "SYNCBUSY (r) register accessor: Synchronization Busy\n\nYou can [`read`](crate::Reg::read) this register and get [`syncbusy::R`]. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@syncbusy`]
297module"]
298#[doc(alias = "SYNCBUSY")]
299pub type Syncbusy = crate::Reg<syncbusy::SyncbusySpec>;
300#[doc = "Synchronization Busy"]
301pub mod syncbusy;
302#[doc = "QOSCTRL (rw) register accessor: USB Quality Of Service\n\nYou can [`read`](crate::Reg::read) this register and get [`qosctrl::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`qosctrl::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@qosctrl`]
303module"]
304#[doc(alias = "QOSCTRL")]
305pub type Qosctrl = crate::Reg<qosctrl::QosctrlSpec>;
306#[doc = "USB Quality Of Service"]
307pub mod qosctrl;
308#[doc = "CTRLB (rw) register accessor: DEVICE Control B\n\nYou can [`read`](crate::Reg::read) this register and get [`ctrlb::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ctrlb::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@ctrlb`]
309module"]
310#[doc(alias = "CTRLB")]
311pub type Ctrlb = crate::Reg<ctrlb::CtrlbSpec>;
312#[doc = "DEVICE Control B"]
313pub mod ctrlb;
314#[doc = "DADD (rw) register accessor: DEVICE Device Address\n\nYou can [`read`](crate::Reg::read) this register and get [`dadd::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`dadd::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@dadd`]
315module"]
316#[doc(alias = "DADD")]
317pub type Dadd = crate::Reg<dadd::DaddSpec>;
318#[doc = "DEVICE Device Address"]
319pub mod dadd;
320#[doc = "STATUS (r) register accessor: DEVICE Status\n\nYou can [`read`](crate::Reg::read) this register and get [`status::R`]. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@status`]
321module"]
322#[doc(alias = "STATUS")]
323pub type Status = crate::Reg<status::StatusSpec>;
324#[doc = "DEVICE Status"]
325pub mod status;
326#[doc = "FSMSTATUS (r) register accessor: Finite State Machine Status\n\nYou can [`read`](crate::Reg::read) this register and get [`fsmstatus::R`]. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@fsmstatus`]
327module"]
328#[doc(alias = "FSMSTATUS")]
329pub type Fsmstatus = crate::Reg<fsmstatus::FsmstatusSpec>;
330#[doc = "Finite State Machine Status"]
331pub mod fsmstatus;
332#[doc = "FNUM (r) register accessor: DEVICE Device Frame Number\n\nYou can [`read`](crate::Reg::read) this register and get [`fnum::R`]. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@fnum`]
333module"]
334#[doc(alias = "FNUM")]
335pub type Fnum = crate::Reg<fnum::FnumSpec>;
336#[doc = "DEVICE Device Frame Number"]
337pub mod fnum;
338#[doc = "INTENCLR (rw) register accessor: DEVICE Device Interrupt Enable Clear\n\nYou can [`read`](crate::Reg::read) this register and get [`intenclr::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`intenclr::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@intenclr`]
339module"]
340#[doc(alias = "INTENCLR")]
341pub type Intenclr = crate::Reg<intenclr::IntenclrSpec>;
342#[doc = "DEVICE Device Interrupt Enable Clear"]
343pub mod intenclr;
344#[doc = "INTENSET (rw) register accessor: DEVICE Device Interrupt Enable Set\n\nYou can [`read`](crate::Reg::read) this register and get [`intenset::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`intenset::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@intenset`]
345module"]
346#[doc(alias = "INTENSET")]
347pub type Intenset = crate::Reg<intenset::IntensetSpec>;
348#[doc = "DEVICE Device Interrupt Enable Set"]
349pub mod intenset;
350#[doc = "INTFLAG (rw) register accessor: DEVICE Device Interrupt Flag\n\nYou can [`read`](crate::Reg::read) this register and get [`intflag::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`intflag::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@intflag`]
351module"]
352#[doc(alias = "INTFLAG")]
353pub type Intflag = crate::Reg<intflag::IntflagSpec>;
354#[doc = "DEVICE Device Interrupt Flag"]
355pub mod intflag;
356#[doc = "EPINTSMRY (r) register accessor: DEVICE End Point Interrupt Summary\n\nYou can [`read`](crate::Reg::read) this register and get [`epintsmry::R`]. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@epintsmry`]
357module"]
358#[doc(alias = "EPINTSMRY")]
359pub type Epintsmry = crate::Reg<epintsmry::EpintsmrySpec>;
360#[doc = "DEVICE End Point Interrupt Summary"]
361pub mod epintsmry;
362#[doc = "DESCADD (rw) register accessor: Descriptor Address\n\nYou can [`read`](crate::Reg::read) this register and get [`descadd::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`descadd::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@descadd`]
363module"]
364#[doc(alias = "DESCADD")]
365pub type Descadd = crate::Reg<descadd::DescaddSpec>;
366#[doc = "Descriptor Address"]
367pub mod descadd;
368#[doc = "PADCAL (rw) register accessor: USB PAD Calibration\n\nYou can [`read`](crate::Reg::read) this register and get [`padcal::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`padcal::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@padcal`]
369module"]
370#[doc(alias = "PADCAL")]
371pub type Padcal = crate::Reg<padcal::PadcalSpec>;
372#[doc = "USB PAD Calibration"]
373pub mod padcal;
374#[doc = "EPCFG (rw) register accessor: DEVICE End Point Configuration\n\nYou can [`read`](crate::Reg::read) this register and get [`epcfg::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`epcfg::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@epcfg`]
375module"]
376#[doc(alias = "EPCFG")]
377pub type Epcfg = crate::Reg<epcfg::EpcfgSpec>;
378#[doc = "DEVICE End Point Configuration"]
379pub mod epcfg;
380#[doc = "EPSTATUSCLR (w) register accessor: DEVICE End Point Pipe Status Clear\n\nYou can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`epstatusclr::W`]. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@epstatusclr`]
381module"]
382#[doc(alias = "EPSTATUSCLR")]
383pub type Epstatusclr = crate::Reg<epstatusclr::EpstatusclrSpec>;
384#[doc = "DEVICE End Point Pipe Status Clear"]
385pub mod epstatusclr;
386#[doc = "EPSTATUSSET (w) register accessor: DEVICE End Point Pipe Status Set\n\nYou can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`epstatusset::W`]. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@epstatusset`]
387module"]
388#[doc(alias = "EPSTATUSSET")]
389pub type Epstatusset = crate::Reg<epstatusset::EpstatussetSpec>;
390#[doc = "DEVICE End Point Pipe Status Set"]
391pub mod epstatusset;
392#[doc = "EPSTATUS (r) register accessor: DEVICE End Point Pipe Status\n\nYou can [`read`](crate::Reg::read) this register and get [`epstatus::R`]. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@epstatus`]
393module"]
394#[doc(alias = "EPSTATUS")]
395pub type Epstatus = crate::Reg<epstatus::EpstatusSpec>;
396#[doc = "DEVICE End Point Pipe Status"]
397pub mod epstatus;
398#[doc = "EPINTFLAG (rw) register accessor: DEVICE End Point Interrupt Flag\n\nYou can [`read`](crate::Reg::read) this register and get [`epintflag::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`epintflag::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@epintflag`]
399module"]
400#[doc(alias = "EPINTFLAG")]
401pub type Epintflag = crate::Reg<epintflag::EpintflagSpec>;
402#[doc = "DEVICE End Point Interrupt Flag"]
403pub mod epintflag;
404#[doc = "EPINTENCLR (rw) register accessor: DEVICE End Point Interrupt Clear Flag\n\nYou can [`read`](crate::Reg::read) this register and get [`epintenclr::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`epintenclr::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@epintenclr`]
405module"]
406#[doc(alias = "EPINTENCLR")]
407pub type Epintenclr = crate::Reg<epintenclr::EpintenclrSpec>;
408#[doc = "DEVICE End Point Interrupt Clear Flag"]
409pub mod epintenclr;
410#[doc = "EPINTENSET (rw) register accessor: DEVICE End Point Interrupt Set Flag\n\nYou can [`read`](crate::Reg::read) this register and get [`epintenset::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`epintenset::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@epintenset`]
411module"]
412#[doc(alias = "EPINTENSET")]
413pub type Epintenset = crate::Reg<epintenset::EpintensetSpec>;
414#[doc = "DEVICE End Point Interrupt Set Flag"]
415pub mod epintenset;