/* Start sending data to UART transmitter,(received data is ignored). The function is non-blocking,UART_EVENT_TRANSFER_COMPLETE is signaled when transfer completes. csi_usart_get_status can indicates if transmission is still in progress or pending.  */
int32_t csi_usart_send(usart_handle_t handle, const void *data, uint32_t num)
/* Start sending data to UART transmitter,(received data is ignored). The function is non-blocking,UART_EVENT_TRANSFER_COMPLETE is signaled when transfer completes. csi_usart_get_status can indicates if transmission is still in progress or pending.  */
int32_t csi_usart_send(usart_handle_t handle, const void *data, uint32_t num)
{
    USART_NULL_PARAM_CHK(handle);
    USART_NULL_PARAM_CHK(data);
    if (num == 0) {
        return ERR_USART(EDRV_PARAMETER);
    }
    dw_usart_priv_t *usart_priv = handle;
    uint8_t *source = NULL;
    source = (uint8_t *)data;
    usart_priv->tx_buf = (uint8_t *)data;
    usart_priv->tx_total_num = num;
    usart_priv->tx_cnt = 0;
    usart_priv->tx_busy = 1;
    dw_usart_reg_t *addr = (dw_usart_reg_t *)(usart_priv->base);
    addr->IER |= IER_THRE_INT_ENABLE;
    return 0;
}