/** * @brief Gets the CEC flag status * @param CEC_FLAG: specifies the CEC flag to check. * This parameter can be one of the following values: * @arg CEC_FLAG_BTE: Bit Timing Error * @arg CEC_FLAG_BPE: Bit Period Error * @arg CEC_FLAG_RBTFE: Rx Block Transfer Finished Error * @arg CEC_FLAG_SBE: Start Bit Error * @arg CEC_FLAG_ACKE: Block Acknowledge Error * @arg CEC_FLAG_LINE: Line Error * @arg CEC_FLAG_TBTFE: Tx Block Transfer Finished Error * @arg CEC_FLAG_TEOM: Tx End Of Message * @arg CEC_FLAG_TERR: Tx Error * @arg CEC_FLAG_TBTRF: Tx Byte Transfer Request or Block Transfer Finished * @arg CEC_FLAG_RSOM: Rx Start Of Message * @arg CEC_FLAG_REOM: Rx End Of Message * @arg CEC_FLAG_RERR: Rx Error * @arg CEC_FLAG_RBTF: Rx Byte/Block Transfer Finished * @retval The new state of CEC_FLAG (SET or RESET) */ FlagStatus CEC_GetFlagStatus(uint32_t CEC_FLAG) { FlagStatus bitstatus = RESET; uint32_t cecreg = 0, cecbase = 0; /* Check the parameters */ assert_param(IS_CEC_GET_FLAG(CEC_FLAG)); /* Get the CEC peripheral base address */ cecbase = (uint32_t)(CEC_BASE); /* Read flag register index */ cecreg = CEC_FLAG >> 28; /* Get bit[23:0] of the flag */ CEC_FLAG &= FLAG_Mask; if(cecreg != 0) { /* Flag in CEC ESR Register */ CEC_FLAG = (uint32_t)(CEC_FLAG >> 16); /* Get the CEC ESR register address */ cecbase += 0xC; }
/** * @brief Gets the CEC flag status. * @param CEC_FLAG: specifies the CEC flag to check. * This parameter can be one of the following values: * @arg CEC_FLAG_TXACKE: Tx Missing acknowledge Error * @arg CEC_FLAG_TXERR: Tx Error. * @arg CEC_FLAG_TXUDR: Tx-Buffer Underrun. * @arg CEC_FLAG_TXEND: End of transmission (successful transmission of the last byte). * @arg CEC_FLAG_TXBR: Tx-Byte Request. * @arg CEC_FLAG_ARBLST: Arbitration Lost * @arg CEC_FLAG_RXACKE: Rx-Missing Acknowledge * @arg CEC_FLAG_LBPE: Rx Long period Error * @arg CEC_FLAG_SBPE: Rx Short period Error * @arg CEC_FLAG_BRE: Rx Bit Rissing Error * @arg CEC_FLAG_RXOVR: Rx Overrun. * @arg CEC_FLAG_RXEND: End Of Reception. * @arg CEC_FLAG_RXBR: Rx-Byte Received. * @retval The new state of CEC_FLAG (SET or RESET) */ FlagStatus CEC_GetFlagStatus(uint16_t CEC_FLAG) { FlagStatus bitstatus = RESET; assert_param(IS_CEC_GET_FLAG(CEC_FLAG)); /* Check the status of the specified CEC flag */ if ((CEC->ISR & CEC_FLAG) != (uint16_t)RESET) { /* CEC flag is set */ bitstatus = SET; } else { /* CEC flag is reset */ bitstatus = RESET; } /* Return the CEC flag status */ return bitstatus; }