#[doc = "Register `INT_STATUS` reader"]
pub struct R(crate::R<INT_STATUS_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<INT_STATUS_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<INT_STATUS_SPEC>> for R {
    fn from(reader: crate::R<INT_STATUS_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `INT_STATUS` writer"]
pub struct W(crate::W<INT_STATUS_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<INT_STATUS_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 core::convert::From<crate::W<INT_STATUS_SPEC>> for W {
    fn from(writer: crate::W<INT_STATUS_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `ARB_LOSS` writer - The arbitration was lost while sending a message"]
pub struct ARB_LOSS_W<'a> {
    w: &'a mut W,
}
impl<'a> ARB_LOSS_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 `OVR_LOAD` writer - An overload frame was received,?or reactive overload frame condition is detected (ISO-11898-1 section 10.11)"]
pub struct OVR_LOAD_W<'a> {
    w: &'a mut W,
}
impl<'a> OVR_LOAD_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 `BIT_ERR` writer - A bit error was detected"]
pub struct BIT_ERR_W<'a> {
    w: &'a mut W,
}
impl<'a> BIT_ERR_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 = "Field `STUFF_ERR` writer - A bit stuffing error was detected"]
pub struct STUFF_ERR_W<'a> {
    w: &'a mut W,
}
impl<'a> STUFF_ERR_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 = "Field `ACK_ERR` writer - An CAN message acknowledge error was detected"]
pub struct ACK_ERR_W<'a> {
    w: &'a mut W,
}
impl<'a> ACK_ERR_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 << 6)) | ((value as u32 & 0x01) << 6);
        self.w
    }
}
#[doc = "Field `FORM_ERR` writer - A CAN message format error was detected?please ignore this interrupt, when ERROR_STATUS.ERROR_STATE=2'B1x"]
pub struct FORM_ERR_W<'a> {
    w: &'a mut W,
}
impl<'a> FORM_ERR_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 `CRC_ERR` writer - A CAN CRC error was detected"]
pub struct CRC_ERR_W<'a> {
    w: &'a mut W,
}
impl<'a> CRC_ERR_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 = "Field `BUS_OFF` writer - The CAN has reached the bus off state"]
pub struct BUS_OFF_W<'a> {
    w: &'a mut W,
}
impl<'a> BUS_OFF_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 = "Field `RX_MSG_LOSS` writer - when a new message arrives, but the RxMessage flag MSG_AV is set and LINK_FLAG is not set, RX_MSG_LOSS is set, and the new message is discarded."]
pub struct RX_MSG_LOSS_W<'a> {
    w: &'a mut W,
}
impl<'a> RX_MSG_LOSS_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 = "Field `TX_MSG` writer - Indicates that a message was sent?0: Normal operation?1: A message was successfully sent from a transmit buffer?which has its TxIntEbl flag asserted."]
pub struct TX_MSG_W<'a> {
    w: &'a mut W,
}
impl<'a> TX_MSG_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 << 11)) | ((value as u32 & 0x01) << 11);
        self.w
    }
}
#[doc = "Field `RX_MSG` writer - Indicates that a message was received?0: Normal operation?1: A new message was successfully received and stored in a receive?buffer which has its RxIntEBL flag asserted."]
pub struct RX_MSG_W<'a> {
    w: &'a mut W,
}
impl<'a> RX_MSG_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 << 12)) | ((value as u32 & 0x01) << 12);
        self.w
    }
}
#[doc = "Field `RTR_MSG` writer - RTR auto-reply message sent?0: Normal operation?1: Indicates that a RTR auto-reply message was sent"]
pub struct RTR_MSG_W<'a> {
    w: &'a mut W,
}
impl<'a> RTR_MSG_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 << 13)) | ((value as u32 & 0x01) << 13);
        self.w
    }
}
#[doc = "Field `STUCK_AT_0` writer - Stuck at dominant error?0: Normal Operation?1: Indicates if the rx input remains stuack at 0 (dominant level) for?more than 16 consecutive bit times. ?The \"stuck at 0\" condition is checked, only when COMMAND.RUN is set"]
pub struct STUCK_AT_0_W<'a> {
    w: &'a mut W,
}
impl<'a> STUCK_AT_0_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 << 14)) | ((value as u32 & 0x01) << 14);
        self.w
    }
}
#[doc = "Field `SST_FAILURE` writer - Single shot transmission failure?0: Normal operation?1: A buffer set for single shot transmission experienced?an arbitration loss or a bus error during transmission?The sst_failure interrupt is set as well when the CAN controller is being stopped while an SST message is in the transmit buffer. user should transmit or remove respective SST messages before stopping the IP, to avoid triggering SST_FAILURE after writing COMMAND.RUN=0."]
pub struct SST_FAILURE_W<'a> {
    w: &'a mut W,
}
impl<'a> SST_FAILURE_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 << 15)) | ((value as u32 & 0x01) << 15);
        self.w
    }
}
impl W {
    #[doc = "Bit 2 - The arbitration was lost while sending a message"]
    #[inline(always)]
    pub fn arb_loss(&mut self) -> ARB_LOSS_W {
        ARB_LOSS_W { w: self }
    }
    #[doc = "Bit 3 - An overload frame was received,?or reactive overload frame condition is detected (ISO-11898-1 section 10.11)"]
    #[inline(always)]
    pub fn ovr_load(&mut self) -> OVR_LOAD_W {
        OVR_LOAD_W { w: self }
    }
    #[doc = "Bit 4 - A bit error was detected"]
    #[inline(always)]
    pub fn bit_err(&mut self) -> BIT_ERR_W {
        BIT_ERR_W { w: self }
    }
    #[doc = "Bit 5 - A bit stuffing error was detected"]
    #[inline(always)]
    pub fn stuff_err(&mut self) -> STUFF_ERR_W {
        STUFF_ERR_W { w: self }
    }
    #[doc = "Bit 6 - An CAN message acknowledge error was detected"]
    #[inline(always)]
    pub fn ack_err(&mut self) -> ACK_ERR_W {
        ACK_ERR_W { w: self }
    }
    #[doc = "Bit 7 - A CAN message format error was detected?please ignore this interrupt, when ERROR_STATUS.ERROR_STATE=2'B1x"]
    #[inline(always)]
    pub fn form_err(&mut self) -> FORM_ERR_W {
        FORM_ERR_W { w: self }
    }
    #[doc = "Bit 8 - A CAN CRC error was detected"]
    #[inline(always)]
    pub fn crc_err(&mut self) -> CRC_ERR_W {
        CRC_ERR_W { w: self }
    }
    #[doc = "Bit 9 - The CAN has reached the bus off state"]
    #[inline(always)]
    pub fn bus_off(&mut self) -> BUS_OFF_W {
        BUS_OFF_W { w: self }
    }
    #[doc = "Bit 10 - when a new message arrives, but the RxMessage flag MSG_AV is set and LINK_FLAG is not set, RX_MSG_LOSS is set, and the new message is discarded."]
    #[inline(always)]
    pub fn rx_msg_loss(&mut self) -> RX_MSG_LOSS_W {
        RX_MSG_LOSS_W { w: self }
    }
    #[doc = "Bit 11 - Indicates that a message was sent?0: Normal operation?1: A message was successfully sent from a transmit buffer?which has its TxIntEbl flag asserted."]
    #[inline(always)]
    pub fn tx_msg(&mut self) -> TX_MSG_W {
        TX_MSG_W { w: self }
    }
    #[doc = "Bit 12 - Indicates that a message was received?0: Normal operation?1: A new message was successfully received and stored in a receive?buffer which has its RxIntEBL flag asserted."]
    #[inline(always)]
    pub fn rx_msg(&mut self) -> RX_MSG_W {
        RX_MSG_W { w: self }
    }
    #[doc = "Bit 13 - RTR auto-reply message sent?0: Normal operation?1: Indicates that a RTR auto-reply message was sent"]
    #[inline(always)]
    pub fn rtr_msg(&mut self) -> RTR_MSG_W {
        RTR_MSG_W { w: self }
    }
    #[doc = "Bit 14 - Stuck at dominant error?0: Normal Operation?1: Indicates if the rx input remains stuack at 0 (dominant level) for?more than 16 consecutive bit times. ?The \"stuck at 0\" condition is checked, only when COMMAND.RUN is set"]
    #[inline(always)]
    pub fn stuck_at_0(&mut self) -> STUCK_AT_0_W {
        STUCK_AT_0_W { w: self }
    }
    #[doc = "Bit 15 - Single shot transmission failure?0: Normal operation?1: A buffer set for single shot transmission experienced?an arbitration loss or a bus error during transmission?The sst_failure interrupt is set as well when the CAN controller is being stopped while an SST message is in the transmit buffer. user should transmit or remove respective SST messages before stopping the IP, to avoid triggering SST_FAILURE after writing COMMAND.RUN=0."]
    #[inline(always)]
    pub fn sst_failure(&mut self) -> SST_FAILURE_W {
        SST_FAILURE_W { w: self }
    }
    #[doc = "Writes raw bits to the register."]
    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "Interrupt Status\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 [int_status](index.html) module"]
pub struct INT_STATUS_SPEC;
impl crate::RegisterSpec for INT_STATUS_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [int_status::R](R) reader structure"]
impl crate::Readable for INT_STATUS_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [int_status::W](W) writer structure"]
impl crate::Writable for INT_STATUS_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets INT_STATUS to value 0"]
impl crate::Resettable for INT_STATUS_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
