/* param base USART peripheral base address. param handle USART handle pointer. param callback The callback function. param userData The parameter of the callback function.  */
status_t USART_TransferCreateHandle(USART_Type *base, usart_handle_t *handle, usart_transfer_callback_t callback, void *userData)
/* param base USART peripheral base address. param handle USART handle pointer. param callback The callback function. param userData The parameter of the callback function.  */
status_t USART_TransferCreateHandle(USART_Type *base, usart_handle_t *handle, usart_transfer_callback_t callback, void *userData)
{
    assert(!((NULL == base) || (NULL == handle)));
    uint32_t instance = 0;
    usart_to_flexcomm_t handler;
    handler.usart_master_handler = USART_TransferHandleIRQ;
    if ((NULL == base) || (NULL == handle))
    {
        return kStatus_InvalidArgument;
    }
    instance = USART_GetInstance(base);
    (void)memset(handle, 0, sizeof(*handle));
    handle->rxState = (uint8_t)kUSART_RxIdle;
    handle->txState = (uint8_t)kUSART_TxIdle;
    handle->callback    = callback;
    handle->userData    = userData;
    handle->rxWatermark = (uint8_t)USART_FIFOTRIG_RXLVL_GET(base);
    handle->txWatermark = (uint8_t)USART_FIFOTRIG_TXLVL_GET(base);
    FLEXCOMM_SetIRQHandler(base, handler.flexcomm_handler, handle);
    (void)EnableIRQ(s_usartIRQ[instance]);
    return kStatus_Success;
}