/* Copy Tx Message to TX buffer and Request transmission.  */
uint32_t CANFD_TransmitTxMsg(CANFD_T *psCanfd, uint32_t u32TxBufIdx, CANFD_FD_MSG_T *psTxMsg)
/* Copy Tx Message to TX buffer and Request transmission.  */
uint32_t CANFD_TransmitTxMsg(CANFD_T *psCanfd, uint32_t u32TxBufIdx, CANFD_FD_MSG_T *psTxMsg)
{
    uint32_t u32Success = 0;
    uint32_t u32TimeOutCnt = CANFD_TIMEOUT;
    u32Success = CANFD_TransmitDMsg(psCanfd, u32TxBufIdx, psTxMsg);
    if (u32Success == 1)
    {
        while (!(psCanfd->TXBRP & (1UL << u32TxBufIdx)))
        {
            if (--u32TimeOutCnt == 0)
            {
                u32Success = 0;
                break;
            }
        }
    }
    return u32Success;
}