atsamd51n/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    device_endpoint: (),
30}
31impl Device {
32    #[doc = "0x00 - Control A"]
33    #[inline(always)]
34    pub const fn ctrla(&self) -> &Ctrla {
35        &self.ctrla
36    }
37    #[doc = "0x02 - Synchronization Busy"]
38    #[inline(always)]
39    pub const fn syncbusy(&self) -> &Syncbusy {
40        &self.syncbusy
41    }
42    #[doc = "0x03 - USB Quality Of Service"]
43    #[inline(always)]
44    pub const fn qosctrl(&self) -> &Qosctrl {
45        &self.qosctrl
46    }
47    #[doc = "0x08 - DEVICE Control B"]
48    #[inline(always)]
49    pub const fn ctrlb(&self) -> &Ctrlb {
50        &self.ctrlb
51    }
52    #[doc = "0x0a - DEVICE Device Address"]
53    #[inline(always)]
54    pub const fn dadd(&self) -> &Dadd {
55        &self.dadd
56    }
57    #[doc = "0x0c - DEVICE Status"]
58    #[inline(always)]
59    pub const fn status(&self) -> &Status {
60        &self.status
61    }
62    #[doc = "0x0d - Finite State Machine Status"]
63    #[inline(always)]
64    pub const fn fsmstatus(&self) -> &Fsmstatus {
65        &self.fsmstatus
66    }
67    #[doc = "0x10 - DEVICE Device Frame Number"]
68    #[inline(always)]
69    pub const fn fnum(&self) -> &Fnum {
70        &self.fnum
71    }
72    #[doc = "0x14 - DEVICE Device Interrupt Enable Clear"]
73    #[inline(always)]
74    pub const fn intenclr(&self) -> &Intenclr {
75        &self.intenclr
76    }
77    #[doc = "0x18 - DEVICE Device Interrupt Enable Set"]
78    #[inline(always)]
79    pub const fn intenset(&self) -> &Intenset {
80        &self.intenset
81    }
82    #[doc = "0x1c - DEVICE Device Interrupt Flag"]
83    #[inline(always)]
84    pub const fn intflag(&self) -> &Intflag {
85        &self.intflag
86    }
87    #[doc = "0x20 - DEVICE End Point Interrupt Summary"]
88    #[inline(always)]
89    pub const fn epintsmry(&self) -> &Epintsmry {
90        &self.epintsmry
91    }
92    #[doc = "0x24 - Descriptor Address"]
93    #[inline(always)]
94    pub const fn descadd(&self) -> &Descadd {
95        &self.descadd
96    }
97    #[doc = "0x28 - USB PAD Calibration"]
98    #[inline(always)]
99    pub const fn padcal(&self) -> &Padcal {
100        &self.padcal
101    }
102    #[doc = "0x100..0x150 - DEVICE_ENDPOINT\\[%s\\]"]
103    #[inline(always)]
104    pub const fn device_endpoint(&self, n: usize) -> &DeviceEndpoint {
105        #[allow(clippy::no_effect)]
106        [(); 8][n];
107        unsafe {
108            &*(self as *const Self)
109                .cast::<u8>()
110                .add(256)
111                .add(32 * n)
112                .cast()
113        }
114    }
115    #[doc = "Iterator for array of:"]
116    #[doc = "0x100..0x150 - DEVICE_ENDPOINT\\[%s\\]"]
117    #[inline(always)]
118    pub fn device_endpoint_iter(&self) -> impl Iterator<Item = &DeviceEndpoint> {
119        (0..8).map(move |n| unsafe {
120            &*(self as *const Self)
121                .cast::<u8>()
122                .add(256)
123                .add(32 * n)
124                .cast()
125        })
126    }
127}
128#[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`]
129module"]
130#[doc(alias = "CTRLA")]
131pub type Ctrla = crate::Reg<ctrla::CtrlaSpec>;
132#[doc = "Control A"]
133pub mod ctrla;
134#[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`]
135module"]
136#[doc(alias = "SYNCBUSY")]
137pub type Syncbusy = crate::Reg<syncbusy::SyncbusySpec>;
138#[doc = "Synchronization Busy"]
139pub mod syncbusy;
140#[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`]
141module"]
142#[doc(alias = "QOSCTRL")]
143pub type Qosctrl = crate::Reg<qosctrl::QosctrlSpec>;
144#[doc = "USB Quality Of Service"]
145pub mod qosctrl;
146#[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`]
147module"]
148#[doc(alias = "CTRLB")]
149pub type Ctrlb = crate::Reg<ctrlb::CtrlbSpec>;
150#[doc = "DEVICE Control B"]
151pub mod ctrlb;
152#[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`]
153module"]
154#[doc(alias = "DADD")]
155pub type Dadd = crate::Reg<dadd::DaddSpec>;
156#[doc = "DEVICE Device Address"]
157pub mod dadd;
158#[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`]
159module"]
160#[doc(alias = "STATUS")]
161pub type Status = crate::Reg<status::StatusSpec>;
162#[doc = "DEVICE Status"]
163pub mod status;
164#[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`]
165module"]
166#[doc(alias = "FSMSTATUS")]
167pub type Fsmstatus = crate::Reg<fsmstatus::FsmstatusSpec>;
168#[doc = "Finite State Machine Status"]
169pub mod fsmstatus;
170#[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`]
171module"]
172#[doc(alias = "FNUM")]
173pub type Fnum = crate::Reg<fnum::FnumSpec>;
174#[doc = "DEVICE Device Frame Number"]
175pub mod fnum;
176#[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`]
177module"]
178#[doc(alias = "INTENCLR")]
179pub type Intenclr = crate::Reg<intenclr::IntenclrSpec>;
180#[doc = "DEVICE Device Interrupt Enable Clear"]
181pub mod intenclr;
182#[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`]
183module"]
184#[doc(alias = "INTENSET")]
185pub type Intenset = crate::Reg<intenset::IntensetSpec>;
186#[doc = "DEVICE Device Interrupt Enable Set"]
187pub mod intenset;
188#[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`]
189module"]
190#[doc(alias = "INTFLAG")]
191pub type Intflag = crate::Reg<intflag::IntflagSpec>;
192#[doc = "DEVICE Device Interrupt Flag"]
193pub mod intflag;
194#[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`]
195module"]
196#[doc(alias = "EPINTSMRY")]
197pub type Epintsmry = crate::Reg<epintsmry::EpintsmrySpec>;
198#[doc = "DEVICE End Point Interrupt Summary"]
199pub mod epintsmry;
200#[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`]
201module"]
202#[doc(alias = "DESCADD")]
203pub type Descadd = crate::Reg<descadd::DescaddSpec>;
204#[doc = "Descriptor Address"]
205pub mod descadd;
206#[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`]
207module"]
208#[doc(alias = "PADCAL")]
209pub type Padcal = crate::Reg<padcal::PadcalSpec>;
210#[doc = "USB PAD Calibration"]
211pub mod padcal;
212#[doc = "DEVICE_ENDPOINT\\[%s\\]"]
213pub use self::device_endpoint::DeviceEndpoint;
214#[doc = r"Cluster"]
215#[doc = "DEVICE_ENDPOINT\\[%s\\]"]
216pub mod device_endpoint;