corstone300_pac/ethernet/
rx_cfg.rs

1// Copyright 2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
2//
3// SPDX-License-Identifier: MIT
4
5#[doc = "Register `RX_CFG` reader"]
6pub struct R(crate::R<RX_CFG_SPEC>);
7impl core::ops::Deref for R {
8    type Target = crate::R<RX_CFG_SPEC>;
9    #[inline(always)]
10    fn deref(&self) -> &Self::Target {
11        &self.0
12    }
13}
14impl From<crate::R<RX_CFG_SPEC>> for R {
15    #[inline(always)]
16    fn from(reader: crate::R<RX_CFG_SPEC>) -> Self {
17        R(reader)
18    }
19}
20#[doc = "Register `RX_CFG` writer"]
21pub struct W(crate::W<RX_CFG_SPEC>);
22impl core::ops::Deref for W {
23    type Target = crate::W<RX_CFG_SPEC>;
24    #[inline(always)]
25    fn deref(&self) -> &Self::Target {
26        &self.0
27    }
28}
29impl core::ops::DerefMut for W {
30    #[inline(always)]
31    fn deref_mut(&mut self) -> &mut Self::Target {
32        &mut self.0
33    }
34}
35impl From<crate::W<RX_CFG_SPEC>> for W {
36    #[inline(always)]
37    fn from(writer: crate::W<RX_CFG_SPEC>) -> Self {
38        W(writer)
39    }
40}
41#[doc = "Field `RXDOFF` reader - RX Data Offset"]
42pub type RXDOFF_R = crate::FieldReader<u8, u8>;
43#[doc = "Field `RXDOFF` writer - RX Data Offset"]
44pub type RXDOFF_W<'a, const O: u8> = crate::FieldWriter<'a, u32, RX_CFG_SPEC, u8, u8, 5, O>;
45#[doc = "Field `RX_DUMP` reader - Force RX Discard"]
46pub type RX_DUMP_R = crate::BitReader<bool>;
47#[doc = "Field `RX_DUMP` writer - Force RX Discard"]
48pub type RX_DUMP_W<'a, const O: u8> = crate::BitWriter<'a, u32, RX_CFG_SPEC, bool, O>;
49#[doc = "Field `RX_DMA_CNT` reader - RX DMA Count"]
50pub type RX_DMA_CNT_R = crate::FieldReader<u16, u16>;
51#[doc = "Field `RX_DMA_CNT` writer - RX DMA Count"]
52pub type RX_DMA_CNT_W<'a, const O: u8> = crate::FieldWriter<'a, u32, RX_CFG_SPEC, u16, u16, 12, O>;
53#[doc = "Field `RX_END_ALIGN` reader - RX End Alignment"]
54pub type RX_END_ALIGN_R = crate::FieldReader<u8, u8>;
55#[doc = "Field `RX_END_ALIGN` writer - RX End Alignment"]
56pub type RX_END_ALIGN_W<'a, const O: u8> = crate::FieldWriter<'a, u32, RX_CFG_SPEC, u8, u8, 2, O>;
57impl R {
58    #[doc = "Bits 8:12 - RX Data Offset"]
59    #[inline(always)]
60    pub fn rxdoff(&self) -> RXDOFF_R {
61        RXDOFF_R::new(((self.bits >> 8) & 0x1f) as u8)
62    }
63    #[doc = "Bit 15 - Force RX Discard"]
64    #[inline(always)]
65    pub fn rx_dump(&self) -> RX_DUMP_R {
66        RX_DUMP_R::new(((self.bits >> 15) & 1) != 0)
67    }
68    #[doc = "Bits 16:27 - RX DMA Count"]
69    #[inline(always)]
70    pub fn rx_dma_cnt(&self) -> RX_DMA_CNT_R {
71        RX_DMA_CNT_R::new(((self.bits >> 16) & 0x0fff) as u16)
72    }
73    #[doc = "Bits 30:31 - RX End Alignment"]
74    #[inline(always)]
75    pub fn rx_end_align(&self) -> RX_END_ALIGN_R {
76        RX_END_ALIGN_R::new(((self.bits >> 30) & 3) as u8)
77    }
78}
79impl W {
80    #[doc = "Bits 8:12 - RX Data Offset"]
81    #[inline(always)]
82    pub fn rxdoff(&mut self) -> RXDOFF_W<8> {
83        RXDOFF_W::new(self)
84    }
85    #[doc = "Bit 15 - Force RX Discard"]
86    #[inline(always)]
87    pub fn rx_dump(&mut self) -> RX_DUMP_W<15> {
88        RX_DUMP_W::new(self)
89    }
90    #[doc = "Bits 16:27 - RX DMA Count"]
91    #[inline(always)]
92    pub fn rx_dma_cnt(&mut self) -> RX_DMA_CNT_W<16> {
93        RX_DMA_CNT_W::new(self)
94    }
95    #[doc = "Bits 30:31 - RX End Alignment"]
96    #[inline(always)]
97    pub fn rx_end_align(&mut self) -> RX_END_ALIGN_W<30> {
98        RX_END_ALIGN_W::new(self)
99    }
100    #[doc = "Writes raw bits to the register."]
101    #[inline(always)]
102    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
103        self.0.bits(bits);
104        self
105    }
106}
107#[doc = "Receive Configuration\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 [rx_cfg](index.html) module"]
108pub struct RX_CFG_SPEC;
109impl crate::RegisterSpec for RX_CFG_SPEC {
110    type Ux = u32;
111}
112#[doc = "`read()` method returns [rx_cfg::R](R) reader structure"]
113impl crate::Readable for RX_CFG_SPEC {
114    type Reader = R;
115}
116#[doc = "`write(|w| ..)` method takes [rx_cfg::W](W) writer structure"]
117impl crate::Writable for RX_CFG_SPEC {
118    type Writer = W;
119}
120#[doc = "`reset()` method sets RX_CFG to value 0"]
121impl crate::Resettable for RX_CFG_SPEC {
122    #[inline(always)]
123    fn reset_value() -> Self::Ux {
124        0
125    }
126}