#[doc = "Reader of register FRAMEFLTR"]
pub type R = crate::R<u32, super::FRAMEFLTR>;
#[doc = "Writer for register FRAMEFLTR"]
pub type W = crate::W<u32, super::FRAMEFLTR>;
#[doc = "Register FRAMEFLTR `reset()`'s with value 0"]
impl crate::ResetValue for super::FRAMEFLTR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Reader of field `PR`"]
pub type PR_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `PR`"]
pub struct PR_W<'a> {
w: &'a mut W,
}
impl<'a> PR_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
}
}
#[doc = "Reader of field `HUC`"]
pub type HUC_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `HUC`"]
pub struct HUC_W<'a> {
w: &'a mut W,
}
impl<'a> HUC_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 = "Reader of field `HMC`"]
pub type HMC_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `HMC`"]
pub struct HMC_W<'a> {
w: &'a mut W,
}
impl<'a> HMC_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 = "Reader of field `DAIF`"]
pub type DAIF_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `DAIF`"]
pub struct DAIF_W<'a> {
w: &'a mut W,
}
impl<'a> DAIF_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 = "Reader of field `PM`"]
pub type PM_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `PM`"]
pub struct PM_W<'a> {
w: &'a mut W,
}
impl<'a> PM_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 << 4)) | (((value as u32) & 0x01) << 4);
self.w
}
}
#[doc = "Reader of field `DBF`"]
pub type DBF_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `DBF`"]
pub struct DBF_W<'a> {
w: &'a mut W,
}
impl<'a> DBF_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 << 5)) | (((value as u32) & 0x01) << 5);
self.w
}
}
#[doc = "Pass Control Frames\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum PCF_A {
#[doc = "0: The MAC filters all control frames from reaching application"]
ALL = 0,
#[doc = "1: MAC forwards all control frames except PAUSE control frames to application even if they fail the address filter"]
PAUSE = 1,
#[doc = "2: MAC forwards all control frames to application even if they fail the address Filter"]
NONE = 2,
#[doc = "3: MAC forwards control frames that pass the address Filter"]
ADDR = 3,
}
impl From<PCF_A> for u8 {
#[inline(always)]
fn from(variant: PCF_A) -> Self {
variant as _
}
}
#[doc = "Reader of field `PCF`"]
pub type PCF_R = crate::R<u8, PCF_A>;
impl PCF_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> PCF_A {
match self.bits {
0 => PCF_A::ALL,
1 => PCF_A::PAUSE,
2 => PCF_A::NONE,
3 => PCF_A::ADDR,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `ALL`"]
#[inline(always)]
pub fn is_all(&self) -> bool {
*self == PCF_A::ALL
}
#[doc = "Checks if the value of the field is `PAUSE`"]
#[inline(always)]
pub fn is_pause(&self) -> bool {
*self == PCF_A::PAUSE
}
#[doc = "Checks if the value of the field is `NONE`"]
#[inline(always)]
pub fn is_none(&self) -> bool {
*self == PCF_A::NONE
}
#[doc = "Checks if the value of the field is `ADDR`"]
#[inline(always)]
pub fn is_addr(&self) -> bool {
*self == PCF_A::ADDR
}
}
#[doc = "Write proxy for field `PCF`"]
pub struct PCF_W<'a> {
w: &'a mut W,
}
impl<'a> PCF_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: PCF_A) -> &'a mut W {
{
self.bits(variant.into())
}
}
#[doc = "The MAC filters all control frames from reaching application"]
#[inline(always)]
pub fn all(self) -> &'a mut W {
self.variant(PCF_A::ALL)
}
#[doc = "MAC forwards all control frames except PAUSE control frames to application even if they fail the address filter"]
#[inline(always)]
pub fn pause(self) -> &'a mut W {
self.variant(PCF_A::PAUSE)
}
#[doc = "MAC forwards all control frames to application even if they fail the address Filter"]
#[inline(always)]
pub fn none(self) -> &'a mut W {
self.variant(PCF_A::NONE)
}
#[doc = "MAC forwards control frames that pass the address Filter"]
#[inline(always)]
pub fn addr(self) -> &'a mut W {
self.variant(PCF_A::ADDR)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 6)) | (((value as u32) & 0x03) << 6);
self.w
}
}
#[doc = "Reader of field `SAIF`"]
pub type SAIF_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `SAIF`"]
pub struct SAIF_W<'a> {
w: &'a mut W,
}
impl<'a> SAIF_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 << 8)) | (((value as u32) & 0x01) << 8);
self.w
}
}
#[doc = "Reader of field `SAF`"]
pub type SAF_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `SAF`"]
pub struct SAF_W<'a> {
w: &'a mut W,
}
impl<'a> SAF_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 << 9)) | (((value as u32) & 0x01) << 9);
self.w
}
}
#[doc = "Reader of field `HPF`"]
pub type HPF_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `HPF`"]
pub struct HPF_W<'a> {
w: &'a mut W,
}
impl<'a> HPF_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 << 10)) | (((value as u32) & 0x01) << 10);
self.w
}
}
#[doc = "Reader of field `VTFE`"]
pub type VTFE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `VTFE`"]
pub struct VTFE_W<'a> {
w: &'a mut W,
}
impl<'a> VTFE_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 << 16)) | (((value as u32) & 0x01) << 16);
self.w
}
}
#[doc = "Reader of field `RA`"]
pub type RA_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `RA`"]
pub struct RA_W<'a> {
w: &'a mut W,
}
impl<'a> RA_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 << 31)) | (((value as u32) & 0x01) << 31);
self.w
}
}
impl R {
#[doc = "Bit 0 - Promiscuous Mode"]
#[inline(always)]
pub fn pr(&self) -> PR_R {
PR_R::new((self.bits & 0x01) != 0)
}
#[doc = "Bit 1 - Hash Unicast"]
#[inline(always)]
pub fn huc(&self) -> HUC_R {
HUC_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 2 - Hash Multicast"]
#[inline(always)]
pub fn hmc(&self) -> HMC_R {
HMC_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 3 - Destination Address (DA) Inverse Filtering"]
#[inline(always)]
pub fn daif(&self) -> DAIF_R {
DAIF_R::new(((self.bits >> 3) & 0x01) != 0)
}
#[doc = "Bit 4 - Pass All Multicast"]
#[inline(always)]
pub fn pm(&self) -> PM_R {
PM_R::new(((self.bits >> 4) & 0x01) != 0)
}
#[doc = "Bit 5 - Disable Broadcast Frames"]
#[inline(always)]
pub fn dbf(&self) -> DBF_R {
DBF_R::new(((self.bits >> 5) & 0x01) != 0)
}
#[doc = "Bits 6:7 - Pass Control Frames"]
#[inline(always)]
pub fn pcf(&self) -> PCF_R {
PCF_R::new(((self.bits >> 6) & 0x03) as u8)
}
#[doc = "Bit 8 - Source Address (SA) Inverse Filtering"]
#[inline(always)]
pub fn saif(&self) -> SAIF_R {
SAIF_R::new(((self.bits >> 8) & 0x01) != 0)
}
#[doc = "Bit 9 - Source Address Filter Enable"]
#[inline(always)]
pub fn saf(&self) -> SAF_R {
SAF_R::new(((self.bits >> 9) & 0x01) != 0)
}
#[doc = "Bit 10 - Hash or Perfect Filter"]
#[inline(always)]
pub fn hpf(&self) -> HPF_R {
HPF_R::new(((self.bits >> 10) & 0x01) != 0)
}
#[doc = "Bit 16 - VLAN Tag Filter Enable"]
#[inline(always)]
pub fn vtfe(&self) -> VTFE_R {
VTFE_R::new(((self.bits >> 16) & 0x01) != 0)
}
#[doc = "Bit 31 - Receive All"]
#[inline(always)]
pub fn ra(&self) -> RA_R {
RA_R::new(((self.bits >> 31) & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 0 - Promiscuous Mode"]
#[inline(always)]
pub fn pr(&mut self) -> PR_W {
PR_W { w: self }
}
#[doc = "Bit 1 - Hash Unicast"]
#[inline(always)]
pub fn huc(&mut self) -> HUC_W {
HUC_W { w: self }
}
#[doc = "Bit 2 - Hash Multicast"]
#[inline(always)]
pub fn hmc(&mut self) -> HMC_W {
HMC_W { w: self }
}
#[doc = "Bit 3 - Destination Address (DA) Inverse Filtering"]
#[inline(always)]
pub fn daif(&mut self) -> DAIF_W {
DAIF_W { w: self }
}
#[doc = "Bit 4 - Pass All Multicast"]
#[inline(always)]
pub fn pm(&mut self) -> PM_W {
PM_W { w: self }
}
#[doc = "Bit 5 - Disable Broadcast Frames"]
#[inline(always)]
pub fn dbf(&mut self) -> DBF_W {
DBF_W { w: self }
}
#[doc = "Bits 6:7 - Pass Control Frames"]
#[inline(always)]
pub fn pcf(&mut self) -> PCF_W {
PCF_W { w: self }
}
#[doc = "Bit 8 - Source Address (SA) Inverse Filtering"]
#[inline(always)]
pub fn saif(&mut self) -> SAIF_W {
SAIF_W { w: self }
}
#[doc = "Bit 9 - Source Address Filter Enable"]
#[inline(always)]
pub fn saf(&mut self) -> SAF_W {
SAF_W { w: self }
}
#[doc = "Bit 10 - Hash or Perfect Filter"]
#[inline(always)]
pub fn hpf(&mut self) -> HPF_W {
HPF_W { w: self }
}
#[doc = "Bit 16 - VLAN Tag Filter Enable"]
#[inline(always)]
pub fn vtfe(&mut self) -> VTFE_W {
VTFE_W { w: self }
}
#[doc = "Bit 31 - Receive All"]
#[inline(always)]
pub fn ra(&mut self) -> RA_W {
RA_W { w: self }
}
}