/* param base MCAN peripheral base address. param idx The MCAN Tx Buffer index. param pTxFrame Pointer to CAN message frame to be sent.  */
status_t MCAN_WriteTxBuffer(CAN_Type *base, uint8_t idx, const mcan_tx_buffer_frame_t *pTxFrame)
/* param base MCAN peripheral base address. param idx The MCAN Tx Buffer index. param pTxFrame Pointer to CAN message frame to be sent.  */
status_t MCAN_WriteTxBuffer(CAN_Type *base, uint8_t idx, const mcan_tx_buffer_frame_t *pTxFrame)
{
    assert(NULL != pTxFrame);
    status_t status;
    uint8_t *elementAddress        = NULL;
    uint8_t *elementPayloadAddress = NULL;
    if (0U == MCAN_IsTransmitRequestPending(base, idx))
    {
        elementAddress        = (uint8_t *)(MCAN_GetMsgRAMBase(base) + MCAN_GetTxBufferElementAddress(base, idx));
        elementPayloadAddress = (uint8_t *)((uint32_t)elementAddress + 8U);
        (void)memcpy(elementAddress, (const uint8_t *)pTxFrame, 8U);
        (void)memcpy(elementPayloadAddress, pTxFrame->data, pTxFrame->size);
        status = kStatus_Success;
    }
    else
    {
        status = kStatus_Fail;
    }
    return status;
}