atsams70n21/usbhs/
usbhs_hstfnum.rs1#[doc = "Register `USBHS_HSTFNUM` reader"]
2pub struct R(crate::R<USBHS_HSTFNUM_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<USBHS_HSTFNUM_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<USBHS_HSTFNUM_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<USBHS_HSTFNUM_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `USBHS_HSTFNUM` writer"]
17pub struct W(crate::W<USBHS_HSTFNUM_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<USBHS_HSTFNUM_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<USBHS_HSTFNUM_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<USBHS_HSTFNUM_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `MFNUM` reader - Micro Frame Number"]
38pub struct MFNUM_R(crate::FieldReader<u8, u8>);
39impl MFNUM_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: u8) -> Self {
42 MFNUM_R(crate::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for MFNUM_R {
46 type Target = crate::FieldReader<u8, u8>;
47 #[inline(always)]
48 fn deref(&self) -> &Self::Target {
49 &self.0
50 }
51}
52#[doc = "Field `MFNUM` writer - Micro Frame Number"]
53pub struct MFNUM_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> MFNUM_W<'a> {
57 #[doc = r"Writes raw bits to the field"]
58 #[inline(always)]
59 pub unsafe fn bits(self, value: u8) -> &'a mut W {
60 self.w.bits = (self.w.bits & !0x07) | (value as u32 & 0x07);
61 self.w
62 }
63}
64#[doc = "Field `FNUM` reader - Frame Number"]
65pub struct FNUM_R(crate::FieldReader<u16, u16>);
66impl FNUM_R {
67 #[inline(always)]
68 pub(crate) fn new(bits: u16) -> Self {
69 FNUM_R(crate::FieldReader::new(bits))
70 }
71}
72impl core::ops::Deref for FNUM_R {
73 type Target = crate::FieldReader<u16, u16>;
74 #[inline(always)]
75 fn deref(&self) -> &Self::Target {
76 &self.0
77 }
78}
79#[doc = "Field `FNUM` writer - Frame Number"]
80pub struct FNUM_W<'a> {
81 w: &'a mut W,
82}
83impl<'a> FNUM_W<'a> {
84 #[doc = r"Writes raw bits to the field"]
85 #[inline(always)]
86 pub unsafe fn bits(self, value: u16) -> &'a mut W {
87 self.w.bits = (self.w.bits & !(0x07ff << 3)) | ((value as u32 & 0x07ff) << 3);
88 self.w
89 }
90}
91#[doc = "Field `FLENHIGH` reader - Frame Length"]
92pub struct FLENHIGH_R(crate::FieldReader<u8, u8>);
93impl FLENHIGH_R {
94 #[inline(always)]
95 pub(crate) fn new(bits: u8) -> Self {
96 FLENHIGH_R(crate::FieldReader::new(bits))
97 }
98}
99impl core::ops::Deref for FLENHIGH_R {
100 type Target = crate::FieldReader<u8, u8>;
101 #[inline(always)]
102 fn deref(&self) -> &Self::Target {
103 &self.0
104 }
105}
106#[doc = "Field `FLENHIGH` writer - Frame Length"]
107pub struct FLENHIGH_W<'a> {
108 w: &'a mut W,
109}
110impl<'a> FLENHIGH_W<'a> {
111 #[doc = r"Writes raw bits to the field"]
112 #[inline(always)]
113 pub unsafe fn bits(self, value: u8) -> &'a mut W {
114 self.w.bits = (self.w.bits & !(0xff << 16)) | ((value as u32 & 0xff) << 16);
115 self.w
116 }
117}
118impl R {
119 #[doc = "Bits 0:2 - Micro Frame Number"]
120 #[inline(always)]
121 pub fn mfnum(&self) -> MFNUM_R {
122 MFNUM_R::new((self.bits & 0x07) as u8)
123 }
124 #[doc = "Bits 3:13 - Frame Number"]
125 #[inline(always)]
126 pub fn fnum(&self) -> FNUM_R {
127 FNUM_R::new(((self.bits >> 3) & 0x07ff) as u16)
128 }
129 #[doc = "Bits 16:23 - Frame Length"]
130 #[inline(always)]
131 pub fn flenhigh(&self) -> FLENHIGH_R {
132 FLENHIGH_R::new(((self.bits >> 16) & 0xff) as u8)
133 }
134}
135impl W {
136 #[doc = "Bits 0:2 - Micro Frame Number"]
137 #[inline(always)]
138 pub fn mfnum(&mut self) -> MFNUM_W {
139 MFNUM_W { w: self }
140 }
141 #[doc = "Bits 3:13 - Frame Number"]
142 #[inline(always)]
143 pub fn fnum(&mut self) -> FNUM_W {
144 FNUM_W { w: self }
145 }
146 #[doc = "Bits 16:23 - Frame Length"]
147 #[inline(always)]
148 pub fn flenhigh(&mut self) -> FLENHIGH_W {
149 FLENHIGH_W { w: self }
150 }
151 #[doc = "Writes raw bits to the register."]
152 #[inline(always)]
153 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
154 self.0.bits(bits);
155 self
156 }
157}
158#[doc = "Host Frame Number Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [usbhs_hstfnum](index.html) module"]
159pub struct USBHS_HSTFNUM_SPEC;
160impl crate::RegisterSpec for USBHS_HSTFNUM_SPEC {
161 type Ux = u32;
162}
163#[doc = "`read()` method returns [usbhs_hstfnum::R](R) reader structure"]
164impl crate::Readable for USBHS_HSTFNUM_SPEC {
165 type Reader = R;
166}
167#[doc = "`write(|w| ..)` method takes [usbhs_hstfnum::W](W) writer structure"]
168impl crate::Writable for USBHS_HSTFNUM_SPEC {
169 type Writer = W;
170}
171#[doc = "`reset()` method sets USBHS_HSTFNUM to value 0"]
172impl crate::Resettable for USBHS_HSTFNUM_SPEC {
173 #[inline(always)]
174 fn reset_value() -> Self::Ux {
175 0
176 }
177}