/* param base FlexCAN peripheral base address. param mbIdx The Message Buffer index. param config Pointer to the FlexCAN Message Buffer configuration structure. param enable Enable/disable Rx Message Buffer. */
void FLEXCAN_SetRxMbConfig(CAN_Type *base, uint8_t mbIdx, const flexcan_rx_mb_config_t *config, bool enable)
/* param base FlexCAN peripheral base address. param mbIdx The Message Buffer index. param config Pointer to the FlexCAN Message Buffer configuration structure. param enable Enable/disable Rx Message Buffer. */
void FLEXCAN_SetRxMbConfig(CAN_Type *base, uint8_t mbIdx, const flexcan_rx_mb_config_t *config, bool enable)
{
    assert(mbIdx <= (base->MCR & CAN_MCR_MAXMB_MASK));
    assert(((NULL != config) || (false == enable)));
    assert(false == FLEXCAN_IsMbOccupied(base, mbIdx));
    uint32_t cs_temp = 0;
    base->MB[mbIdx].CS = 0;
    base->MB[mbIdx].ID    = 0x0;
    base->MB[mbIdx].WORD0 = 0x0;
    base->MB[mbIdx].WORD1 = 0x0;
    if (enable)
    {
        base->MB[mbIdx].ID = config->id;
        if (kFLEXCAN_FrameFormatExtend == config->format)
        {
            cs_temp |= CAN_CS_IDE_MASK;
        }
        if (kFLEXCAN_FrameTypeRemote == config->type)
        {
            cs_temp |= CAN_CS_RTR_MASK;
        }
        cs_temp |= CAN_CS_CODE(kFLEXCAN_RxMbEmpty);
        base->MB[mbIdx].CS = cs_temp;
    }
}