/* param base LPUART peripheral base address. param handle Pointer to lpuart_edma_handle_t structure. param xfer LPUART eDMA transfer structure, see #lpuart_transfer_t. retval kStatus_Success if succeed, others fail. retval kStatus_LPUART_RxBusy Previous transfer ongoing. retval kStatus_InvalidArgument Invalid argument.  */
status_t LPUART_ReceiveEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle, lpuart_transfer_t *xfer)
/* param base LPUART peripheral base address. param handle Pointer to lpuart_edma_handle_t structure. param xfer LPUART eDMA transfer structure, see #lpuart_transfer_t. retval kStatus_Success if succeed, others fail. retval kStatus_LPUART_RxBusy Previous transfer ongoing. retval kStatus_InvalidArgument Invalid argument.  */
status_t LPUART_ReceiveEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle, lpuart_transfer_t *xfer)
{
    assert(handle);
    assert(handle->rxEdmaHandle);
    assert(xfer);
    assert(xfer->data);
    assert(xfer->dataSize);
    edma_transfer_config_t xferConfig;
    status_t status;
    if (kLPUART_RxBusy == handle->rxState)
    {
        status = kStatus_LPUART_RxBusy;
    }
    else
    {
        handle->rxState = kLPUART_RxBusy;
        handle->rxDataSizeAll = xfer->dataSize;
        EDMA_PrepareTransfer(&xferConfig, (void *)LPUART_GetDataRegisterAddress(base), sizeof(uint8_t), xfer->data,
                             sizeof(uint8_t), sizeof(uint8_t), xfer->dataSize, kEDMA_PeripheralToMemory);
        handle->nbytes = sizeof(uint8_t);
        EDMA_SubmitTransfer(handle->rxEdmaHandle, &xferConfig);
        EDMA_StartTransfer(handle->rxEdmaHandle);
        LPUART_EnableRxDMA(base, true);
        status = kStatus_Success;
    }
    return status;
}