corstone300_pac/ethernet/
mac_csr_cmd.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 `MAC_CSR_CMD` reader"]
6pub struct R(crate::R<MAC_CSR_CMD_SPEC>);
7impl core::ops::Deref for R {
8    type Target = crate::R<MAC_CSR_CMD_SPEC>;
9    #[inline(always)]
10    fn deref(&self) -> &Self::Target {
11        &self.0
12    }
13}
14impl From<crate::R<MAC_CSR_CMD_SPEC>> for R {
15    #[inline(always)]
16    fn from(reader: crate::R<MAC_CSR_CMD_SPEC>) -> Self {
17        R(reader)
18    }
19}
20#[doc = "Register `MAC_CSR_CMD` writer"]
21pub struct W(crate::W<MAC_CSR_CMD_SPEC>);
22impl core::ops::Deref for W {
23    type Target = crate::W<MAC_CSR_CMD_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<MAC_CSR_CMD_SPEC>> for W {
36    #[inline(always)]
37    fn from(writer: crate::W<MAC_CSR_CMD_SPEC>) -> Self {
38        W(writer)
39    }
40}
41#[doc = "Field `Address` reader - CSR Address"]
42pub type ADDRESS_R = crate::FieldReader<u8, u8>;
43#[doc = "Field `Address` writer - CSR Address"]
44pub type ADDRESS_W<'a, const O: u8> = crate::FieldWriter<'a, u32, MAC_CSR_CMD_SPEC, u8, u8, 8, O>;
45#[doc = "Field `RnW` reader - R/nW"]
46pub type RN_W_R = crate::BitReader<bool>;
47#[doc = "Field `RnW` writer - R/nW"]
48pub type RN_W_W<'a, const O: u8> = crate::BitWriter<'a, u32, MAC_CSR_CMD_SPEC, bool, O>;
49#[doc = "Field `BSY` reader - CSR Busy"]
50pub type BSY_R = crate::BitReader<bool>;
51#[doc = "Field `BSY` writer - CSR Busy"]
52pub type BSY_W<'a, const O: u8> = crate::BitWriter<'a, u32, MAC_CSR_CMD_SPEC, bool, O>;
53impl R {
54    #[doc = "Bits 0:7 - CSR Address"]
55    #[inline(always)]
56    pub fn address(&self) -> ADDRESS_R {
57        ADDRESS_R::new((self.bits & 0xff) as u8)
58    }
59    #[doc = "Bit 30 - R/nW"]
60    #[inline(always)]
61    pub fn rn_w(&self) -> RN_W_R {
62        RN_W_R::new(((self.bits >> 30) & 1) != 0)
63    }
64    #[doc = "Bit 31 - CSR Busy"]
65    #[inline(always)]
66    pub fn bsy(&self) -> BSY_R {
67        BSY_R::new(((self.bits >> 31) & 1) != 0)
68    }
69}
70impl W {
71    #[doc = "Bits 0:7 - CSR Address"]
72    #[inline(always)]
73    pub fn address(&mut self) -> ADDRESS_W<0> {
74        ADDRESS_W::new(self)
75    }
76    #[doc = "Bit 30 - R/nW"]
77    #[inline(always)]
78    pub fn rn_w(&mut self) -> RN_W_W<30> {
79        RN_W_W::new(self)
80    }
81    #[doc = "Bit 31 - CSR Busy"]
82    #[inline(always)]
83    pub fn bsy(&mut self) -> BSY_W<31> {
84        BSY_W::new(self)
85    }
86    #[doc = "Writes raw bits to the register."]
87    #[inline(always)]
88    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
89        self.0.bits(bits);
90        self
91    }
92}
93#[doc = "MAC CSR Synchronizer Command\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 [mac_csr_cmd](index.html) module"]
94pub struct MAC_CSR_CMD_SPEC;
95impl crate::RegisterSpec for MAC_CSR_CMD_SPEC {
96    type Ux = u32;
97}
98#[doc = "`read()` method returns [mac_csr_cmd::R](R) reader structure"]
99impl crate::Readable for MAC_CSR_CMD_SPEC {
100    type Reader = R;
101}
102#[doc = "`write(|w| ..)` method takes [mac_csr_cmd::W](W) writer structure"]
103impl crate::Writable for MAC_CSR_CMD_SPEC {
104    type Writer = W;
105}
106#[doc = "`reset()` method sets MAC_CSR_CMD to value 0"]
107impl crate::Resettable for MAC_CSR_CMD_SPEC {
108    #[inline(always)]
109    fn reset_value() -> Self::Ux {
110        0
111    }
112}