va416xx/src/eth/mac_flow_ctrl.rs

376 lines
11 KiB
Rust

#[doc = "Register `MAC_FLOW_CTRL` reader"]
pub struct R(crate::R<MAC_FLOW_CTRL_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<MAC_FLOW_CTRL_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<MAC_FLOW_CTRL_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<MAC_FLOW_CTRL_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `MAC_FLOW_CTRL` writer"]
pub struct W(crate::W<MAC_FLOW_CTRL_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<MAC_FLOW_CTRL_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<MAC_FLOW_CTRL_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<MAC_FLOW_CTRL_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Field `PT` reader - Pause time"]
pub struct PT_R(crate::FieldReader<u16, u16>);
impl PT_R {
#[inline(always)]
pub(crate) fn new(bits: u16) -> Self {
PT_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for PT_R {
type Target = crate::FieldReader<u16, u16>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `PT` writer - Pause time"]
pub struct PT_W<'a> {
w: &'a mut W,
}
impl<'a> PT_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u16) -> &'a mut W {
self.w.bits = (self.w.bits & !(0xffff << 16)) | ((value as u32 & 0xffff) << 16);
self.w
}
}
#[doc = "Field `DZPQ` reader - Disable Zero-Quanta Pause"]
pub struct DZPQ_R(crate::FieldReader<bool, bool>);
impl DZPQ_R {
#[inline(always)]
pub(crate) fn new(bits: bool) -> Self {
DZPQ_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for DZPQ_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `DZPQ` writer - Disable Zero-Quanta Pause"]
pub struct DZPQ_W<'a> {
w: &'a mut W,
}
impl<'a> DZPQ_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 7)) | ((value as u32 & 0x01) << 7);
self.w
}
}
#[doc = "Field `PLT` reader - Pause Low Threshold"]
pub struct PLT_R(crate::FieldReader<u8, u8>);
impl PLT_R {
#[inline(always)]
pub(crate) fn new(bits: u8) -> Self {
PLT_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for PLT_R {
type Target = crate::FieldReader<u8, u8>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `PLT` writer - Pause Low Threshold"]
pub struct PLT_W<'a> {
w: &'a mut W,
}
impl<'a> PLT_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 4)) | ((value as u32 & 0x03) << 4);
self.w
}
}
#[doc = "Field `UP` reader - Unicast Pause Frame Detect"]
pub struct UP_R(crate::FieldReader<bool, bool>);
impl UP_R {
#[inline(always)]
pub(crate) fn new(bits: bool) -> Self {
UP_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for UP_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `UP` writer - Unicast Pause Frame Detect"]
pub struct UP_W<'a> {
w: &'a mut W,
}
impl<'a> UP_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 3)) | ((value as u32 & 0x01) << 3);
self.w
}
}
#[doc = "Field `RFE` reader - Receive Flow Control Enable"]
pub struct RFE_R(crate::FieldReader<bool, bool>);
impl RFE_R {
#[inline(always)]
pub(crate) fn new(bits: bool) -> Self {
RFE_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for RFE_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `RFE` writer - Receive Flow Control Enable"]
pub struct RFE_W<'a> {
w: &'a mut W,
}
impl<'a> RFE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2);
self.w
}
}
#[doc = "Field `TFE` reader - Transmit Flow Control Enable"]
pub struct TFE_R(crate::FieldReader<bool, bool>);
impl TFE_R {
#[inline(always)]
pub(crate) fn new(bits: bool) -> Self {
TFE_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for TFE_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `TFE` writer - Transmit Flow Control Enable"]
pub struct TFE_W<'a> {
w: &'a mut W,
}
impl<'a> TFE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
self.w
}
}
#[doc = "Field `FCB_BPA` reader - Flow Control Busy or Backpressure Activate"]
pub struct FCB_BPA_R(crate::FieldReader<bool, bool>);
impl FCB_BPA_R {
#[inline(always)]
pub(crate) fn new(bits: bool) -> Self {
FCB_BPA_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for FCB_BPA_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `FCB_BPA` writer - Flow Control Busy or Backpressure Activate"]
pub struct FCB_BPA_W<'a> {
w: &'a mut W,
}
impl<'a> FCB_BPA_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
self.w
}
}
impl R {
#[doc = "Bits 16:31 - Pause time"]
#[inline(always)]
pub fn pt(&self) -> PT_R {
PT_R::new(((self.bits >> 16) & 0xffff) as u16)
}
#[doc = "Bit 7 - Disable Zero-Quanta Pause"]
#[inline(always)]
pub fn dzpq(&self) -> DZPQ_R {
DZPQ_R::new(((self.bits >> 7) & 0x01) != 0)
}
#[doc = "Bits 4:5 - Pause Low Threshold"]
#[inline(always)]
pub fn plt(&self) -> PLT_R {
PLT_R::new(((self.bits >> 4) & 0x03) as u8)
}
#[doc = "Bit 3 - Unicast Pause Frame Detect"]
#[inline(always)]
pub fn up(&self) -> UP_R {
UP_R::new(((self.bits >> 3) & 0x01) != 0)
}
#[doc = "Bit 2 - Receive Flow Control Enable"]
#[inline(always)]
pub fn rfe(&self) -> RFE_R {
RFE_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 1 - Transmit Flow Control Enable"]
#[inline(always)]
pub fn tfe(&self) -> TFE_R {
TFE_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 0 - Flow Control Busy or Backpressure Activate"]
#[inline(always)]
pub fn fcb_bpa(&self) -> FCB_BPA_R {
FCB_BPA_R::new((self.bits & 0x01) != 0)
}
}
impl W {
#[doc = "Bits 16:31 - Pause time"]
#[inline(always)]
pub fn pt(&mut self) -> PT_W {
PT_W { w: self }
}
#[doc = "Bit 7 - Disable Zero-Quanta Pause"]
#[inline(always)]
pub fn dzpq(&mut self) -> DZPQ_W {
DZPQ_W { w: self }
}
#[doc = "Bits 4:5 - Pause Low Threshold"]
#[inline(always)]
pub fn plt(&mut self) -> PLT_W {
PLT_W { w: self }
}
#[doc = "Bit 3 - Unicast Pause Frame Detect"]
#[inline(always)]
pub fn up(&mut self) -> UP_W {
UP_W { w: self }
}
#[doc = "Bit 2 - Receive Flow Control Enable"]
#[inline(always)]
pub fn rfe(&mut self) -> RFE_W {
RFE_W { w: self }
}
#[doc = "Bit 1 - Transmit Flow Control Enable"]
#[inline(always)]
pub fn tfe(&mut self) -> TFE_W {
TFE_W { w: self }
}
#[doc = "Bit 0 - Flow Control Busy or Backpressure Activate"]
#[inline(always)]
pub fn fcb_bpa(&mut self) -> FCB_BPA_W {
FCB_BPA_W { w: self }
}
#[doc = "Writes raw bits to the register."]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.0.bits(bits);
self
}
}
#[doc = "Controls the generation of control frames\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_flow_ctrl](index.html) module"]
pub struct MAC_FLOW_CTRL_SPEC;
impl crate::RegisterSpec for MAC_FLOW_CTRL_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [mac_flow_ctrl::R](R) reader structure"]
impl crate::Readable for MAC_FLOW_CTRL_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [mac_flow_ctrl::W](W) writer structure"]
impl crate::Writable for MAC_FLOW_CTRL_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets MAC_FLOW_CTRL to value 0"]
impl crate::Resettable for MAC_FLOW_CTRL_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}