stm32f429/ethernet_mac/
macfcr.rs

1#[doc = r" Value read from the register"]
2pub struct R {
3    bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7    bits: u32,
8}
9impl super::MACFCR {
10    #[doc = r" Modifies the contents of the register"]
11    #[inline]
12    pub fn modify<F>(&self, f: F)
13    where
14        for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15    {
16        let bits = self.register.get();
17        let r = R { bits: bits };
18        let mut w = W { bits: bits };
19        f(&r, &mut w);
20        self.register.set(w.bits);
21    }
22    #[doc = r" Reads the contents of the register"]
23    #[inline]
24    pub fn read(&self) -> R {
25        R {
26            bits: self.register.get(),
27        }
28    }
29    #[doc = r" Writes to the register"]
30    #[inline]
31    pub fn write<F>(&self, f: F)
32    where
33        F: FnOnce(&mut W) -> &mut W,
34    {
35        let mut w = W::reset_value();
36        f(&mut w);
37        self.register.set(w.bits);
38    }
39    #[doc = r" Writes the reset value to the register"]
40    #[inline]
41    pub fn reset(&self) {
42        self.write(|w| w)
43    }
44}
45#[doc = r" Value of the field"]
46pub struct FCBR {
47    bits: bool,
48}
49impl FCBR {
50    #[doc = r" Value of the field as raw bits"]
51    #[inline]
52    pub fn bit(&self) -> bool {
53        self.bits
54    }
55    #[doc = r" Returns `true` if the bit is clear (0)"]
56    #[inline]
57    pub fn bit_is_clear(&self) -> bool {
58        !self.bit()
59    }
60    #[doc = r" Returns `true` if the bit is set (1)"]
61    #[inline]
62    pub fn bit_is_set(&self) -> bool {
63        self.bit()
64    }
65}
66#[doc = r" Value of the field"]
67pub struct TFCER {
68    bits: bool,
69}
70impl TFCER {
71    #[doc = r" Value of the field as raw bits"]
72    #[inline]
73    pub fn bit(&self) -> bool {
74        self.bits
75    }
76    #[doc = r" Returns `true` if the bit is clear (0)"]
77    #[inline]
78    pub fn bit_is_clear(&self) -> bool {
79        !self.bit()
80    }
81    #[doc = r" Returns `true` if the bit is set (1)"]
82    #[inline]
83    pub fn bit_is_set(&self) -> bool {
84        self.bit()
85    }
86}
87#[doc = r" Value of the field"]
88pub struct RFCER {
89    bits: bool,
90}
91impl RFCER {
92    #[doc = r" Value of the field as raw bits"]
93    #[inline]
94    pub fn bit(&self) -> bool {
95        self.bits
96    }
97    #[doc = r" Returns `true` if the bit is clear (0)"]
98    #[inline]
99    pub fn bit_is_clear(&self) -> bool {
100        !self.bit()
101    }
102    #[doc = r" Returns `true` if the bit is set (1)"]
103    #[inline]
104    pub fn bit_is_set(&self) -> bool {
105        self.bit()
106    }
107}
108#[doc = r" Value of the field"]
109pub struct UPFDR {
110    bits: bool,
111}
112impl UPFDR {
113    #[doc = r" Value of the field as raw bits"]
114    #[inline]
115    pub fn bit(&self) -> bool {
116        self.bits
117    }
118    #[doc = r" Returns `true` if the bit is clear (0)"]
119    #[inline]
120    pub fn bit_is_clear(&self) -> bool {
121        !self.bit()
122    }
123    #[doc = r" Returns `true` if the bit is set (1)"]
124    #[inline]
125    pub fn bit_is_set(&self) -> bool {
126        self.bit()
127    }
128}
129#[doc = r" Value of the field"]
130pub struct PLTR {
131    bits: u8,
132}
133impl PLTR {
134    #[doc = r" Value of the field as raw bits"]
135    #[inline]
136    pub fn bits(&self) -> u8 {
137        self.bits
138    }
139}
140#[doc = r" Value of the field"]
141pub struct ZQPDR {
142    bits: bool,
143}
144impl ZQPDR {
145    #[doc = r" Value of the field as raw bits"]
146    #[inline]
147    pub fn bit(&self) -> bool {
148        self.bits
149    }
150    #[doc = r" Returns `true` if the bit is clear (0)"]
151    #[inline]
152    pub fn bit_is_clear(&self) -> bool {
153        !self.bit()
154    }
155    #[doc = r" Returns `true` if the bit is set (1)"]
156    #[inline]
157    pub fn bit_is_set(&self) -> bool {
158        self.bit()
159    }
160}
161#[doc = r" Value of the field"]
162pub struct PTR {
163    bits: u16,
164}
165impl PTR {
166    #[doc = r" Value of the field as raw bits"]
167    #[inline]
168    pub fn bits(&self) -> u16 {
169        self.bits
170    }
171}
172#[doc = r" Proxy"]
173pub struct _FCBW<'a> {
174    w: &'a mut W,
175}
176impl<'a> _FCBW<'a> {
177    #[doc = r" Sets the field bit"]
178    pub fn set_bit(self) -> &'a mut W {
179        self.bit(true)
180    }
181    #[doc = r" Clears the field bit"]
182    pub fn clear_bit(self) -> &'a mut W {
183        self.bit(false)
184    }
185    #[doc = r" Writes raw bits to the field"]
186    #[inline]
187    pub fn bit(self, value: bool) -> &'a mut W {
188        const MASK: bool = true;
189        const OFFSET: u8 = 0;
190        self.w.bits &= !((MASK as u32) << OFFSET);
191        self.w.bits |= ((value & MASK) as u32) << OFFSET;
192        self.w
193    }
194}
195#[doc = r" Proxy"]
196pub struct _TFCEW<'a> {
197    w: &'a mut W,
198}
199impl<'a> _TFCEW<'a> {
200    #[doc = r" Sets the field bit"]
201    pub fn set_bit(self) -> &'a mut W {
202        self.bit(true)
203    }
204    #[doc = r" Clears the field bit"]
205    pub fn clear_bit(self) -> &'a mut W {
206        self.bit(false)
207    }
208    #[doc = r" Writes raw bits to the field"]
209    #[inline]
210    pub fn bit(self, value: bool) -> &'a mut W {
211        const MASK: bool = true;
212        const OFFSET: u8 = 1;
213        self.w.bits &= !((MASK as u32) << OFFSET);
214        self.w.bits |= ((value & MASK) as u32) << OFFSET;
215        self.w
216    }
217}
218#[doc = r" Proxy"]
219pub struct _RFCEW<'a> {
220    w: &'a mut W,
221}
222impl<'a> _RFCEW<'a> {
223    #[doc = r" Sets the field bit"]
224    pub fn set_bit(self) -> &'a mut W {
225        self.bit(true)
226    }
227    #[doc = r" Clears the field bit"]
228    pub fn clear_bit(self) -> &'a mut W {
229        self.bit(false)
230    }
231    #[doc = r" Writes raw bits to the field"]
232    #[inline]
233    pub fn bit(self, value: bool) -> &'a mut W {
234        const MASK: bool = true;
235        const OFFSET: u8 = 2;
236        self.w.bits &= !((MASK as u32) << OFFSET);
237        self.w.bits |= ((value & MASK) as u32) << OFFSET;
238        self.w
239    }
240}
241#[doc = r" Proxy"]
242pub struct _UPFDW<'a> {
243    w: &'a mut W,
244}
245impl<'a> _UPFDW<'a> {
246    #[doc = r" Sets the field bit"]
247    pub fn set_bit(self) -> &'a mut W {
248        self.bit(true)
249    }
250    #[doc = r" Clears the field bit"]
251    pub fn clear_bit(self) -> &'a mut W {
252        self.bit(false)
253    }
254    #[doc = r" Writes raw bits to the field"]
255    #[inline]
256    pub fn bit(self, value: bool) -> &'a mut W {
257        const MASK: bool = true;
258        const OFFSET: u8 = 3;
259        self.w.bits &= !((MASK as u32) << OFFSET);
260        self.w.bits |= ((value & MASK) as u32) << OFFSET;
261        self.w
262    }
263}
264#[doc = r" Proxy"]
265pub struct _PLTW<'a> {
266    w: &'a mut W,
267}
268impl<'a> _PLTW<'a> {
269    #[doc = r" Writes raw bits to the field"]
270    #[inline]
271    pub unsafe fn bits(self, value: u8) -> &'a mut W {
272        const MASK: u8 = 3;
273        const OFFSET: u8 = 4;
274        self.w.bits &= !((MASK as u32) << OFFSET);
275        self.w.bits |= ((value & MASK) as u32) << OFFSET;
276        self.w
277    }
278}
279#[doc = r" Proxy"]
280pub struct _ZQPDW<'a> {
281    w: &'a mut W,
282}
283impl<'a> _ZQPDW<'a> {
284    #[doc = r" Sets the field bit"]
285    pub fn set_bit(self) -> &'a mut W {
286        self.bit(true)
287    }
288    #[doc = r" Clears the field bit"]
289    pub fn clear_bit(self) -> &'a mut W {
290        self.bit(false)
291    }
292    #[doc = r" Writes raw bits to the field"]
293    #[inline]
294    pub fn bit(self, value: bool) -> &'a mut W {
295        const MASK: bool = true;
296        const OFFSET: u8 = 7;
297        self.w.bits &= !((MASK as u32) << OFFSET);
298        self.w.bits |= ((value & MASK) as u32) << OFFSET;
299        self.w
300    }
301}
302#[doc = r" Proxy"]
303pub struct _PTW<'a> {
304    w: &'a mut W,
305}
306impl<'a> _PTW<'a> {
307    #[doc = r" Writes raw bits to the field"]
308    #[inline]
309    pub unsafe fn bits(self, value: u16) -> &'a mut W {
310        const MASK: u16 = 65535;
311        const OFFSET: u8 = 16;
312        self.w.bits &= !((MASK as u32) << OFFSET);
313        self.w.bits |= ((value & MASK) as u32) << OFFSET;
314        self.w
315    }
316}
317impl R {
318    #[doc = r" Value of the register as raw bits"]
319    #[inline]
320    pub fn bits(&self) -> u32 {
321        self.bits
322    }
323    #[doc = "Bit 0 - Flow control busy/back pressure activate"]
324    #[inline]
325    pub fn fcb(&self) -> FCBR {
326        let bits = {
327            const MASK: bool = true;
328            const OFFSET: u8 = 0;
329            ((self.bits >> OFFSET) & MASK as u32) != 0
330        };
331        FCBR { bits }
332    }
333    #[doc = "Bit 1 - Transmit flow control enable"]
334    #[inline]
335    pub fn tfce(&self) -> TFCER {
336        let bits = {
337            const MASK: bool = true;
338            const OFFSET: u8 = 1;
339            ((self.bits >> OFFSET) & MASK as u32) != 0
340        };
341        TFCER { bits }
342    }
343    #[doc = "Bit 2 - Recieve flow control enable"]
344    #[inline]
345    pub fn rfce(&self) -> RFCER {
346        let bits = {
347            const MASK: bool = true;
348            const OFFSET: u8 = 2;
349            ((self.bits >> OFFSET) & MASK as u32) != 0
350        };
351        RFCER { bits }
352    }
353    #[doc = "Bit 3 - Unicast pause frame detect"]
354    #[inline]
355    pub fn upfd(&self) -> UPFDR {
356        let bits = {
357            const MASK: bool = true;
358            const OFFSET: u8 = 3;
359            ((self.bits >> OFFSET) & MASK as u32) != 0
360        };
361        UPFDR { bits }
362    }
363    #[doc = "Bits 4:5 - Pause low threshold"]
364    #[inline]
365    pub fn plt(&self) -> PLTR {
366        let bits = {
367            const MASK: u8 = 3;
368            const OFFSET: u8 = 4;
369            ((self.bits >> OFFSET) & MASK as u32) as u8
370        };
371        PLTR { bits }
372    }
373    #[doc = "Bit 7 - Zero-quanta pause disable"]
374    #[inline]
375    pub fn zqpd(&self) -> ZQPDR {
376        let bits = {
377            const MASK: bool = true;
378            const OFFSET: u8 = 7;
379            ((self.bits >> OFFSET) & MASK as u32) != 0
380        };
381        ZQPDR { bits }
382    }
383    #[doc = "Bits 16:31 - Pause time"]
384    #[inline]
385    pub fn pt(&self) -> PTR {
386        let bits = {
387            const MASK: u16 = 65535;
388            const OFFSET: u8 = 16;
389            ((self.bits >> OFFSET) & MASK as u32) as u16
390        };
391        PTR { bits }
392    }
393}
394impl W {
395    #[doc = r" Reset value of the register"]
396    #[inline]
397    pub fn reset_value() -> W {
398        W { bits: 0 }
399    }
400    #[doc = r" Writes raw bits to the register"]
401    #[inline]
402    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
403        self.bits = bits;
404        self
405    }
406    #[doc = "Bit 0 - Flow control busy/back pressure activate"]
407    #[inline]
408    pub fn fcb(&mut self) -> _FCBW {
409        _FCBW { w: self }
410    }
411    #[doc = "Bit 1 - Transmit flow control enable"]
412    #[inline]
413    pub fn tfce(&mut self) -> _TFCEW {
414        _TFCEW { w: self }
415    }
416    #[doc = "Bit 2 - Recieve flow control enable"]
417    #[inline]
418    pub fn rfce(&mut self) -> _RFCEW {
419        _RFCEW { w: self }
420    }
421    #[doc = "Bit 3 - Unicast pause frame detect"]
422    #[inline]
423    pub fn upfd(&mut self) -> _UPFDW {
424        _UPFDW { w: self }
425    }
426    #[doc = "Bits 4:5 - Pause low threshold"]
427    #[inline]
428    pub fn plt(&mut self) -> _PLTW {
429        _PLTW { w: self }
430    }
431    #[doc = "Bit 7 - Zero-quanta pause disable"]
432    #[inline]
433    pub fn zqpd(&mut self) -> _ZQPDW {
434        _ZQPDW { w: self }
435    }
436    #[doc = "Bits 16:31 - Pause time"]
437    #[inline]
438    pub fn pt(&mut self) -> _PTW {
439        _PTW { w: self }
440    }
441}