/* param base UART peripheral base address. param handle UART handle pointer. param xfer UART eDMA transfer structure. See #uart_transfer_t. retval kStatus_Success if succeeded; otherwise failed. retval kStatus_UART_TxBusy Previous transfer ongoing. retval kStatus_InvalidArgument Invalid argument.  */
status_t UART_SendEDMA(UART_Type *base, uart_edma_handle_t *handle, uart_transfer_t *xfer)
/* param base UART peripheral base address. param handle UART handle pointer. param xfer UART eDMA transfer structure. See #uart_transfer_t. retval kStatus_Success if succeeded; otherwise failed. retval kStatus_UART_TxBusy Previous transfer ongoing. retval kStatus_InvalidArgument Invalid argument.  */
status_t UART_SendEDMA(UART_Type *base, uart_edma_handle_t *handle, uart_transfer_t *xfer)
{
    assert(handle);
    assert(handle->txEdmaHandle);
    assert(xfer);
    assert(xfer->data);
    assert(xfer->dataSize);
    edma_transfer_config_t xferConfig;
    status_t status;
    if (kUART_TxBusy == handle->txState)
    {
        status = kStatus_UART_TxBusy;
    }
    else
    {
        handle->txState = kUART_TxBusy;
        handle->txDataSizeAll = xfer->dataSize;
        EDMA_PrepareTransfer(&xferConfig, xfer->data, sizeof(uint8_t), (void *)UART_GetDataRegisterAddress(base),
                             sizeof(uint8_t), sizeof(uint8_t), xfer->dataSize, kEDMA_MemoryToPeripheral);
        handle->nbytes = sizeof(uint8_t);
        EDMA_SubmitTransfer(handle->txEdmaHandle, &xferConfig);
        EDMA_StartTransfer(handle->txEdmaHandle);
        UART_EnableTxDMA(base, true);
        status = kStatus_Success;
    }
    return status;
}