/* Initialize USART Interface. 1. Initializes the resources needed for the USART interface 2.registers event callback function.  */
usart_handle_t csi_usart_initialize(int32_t idx, usart_event_cb_t cb_event)
/* Initialize USART Interface. 1. Initializes the resources needed for the USART interface 2.registers event callback function.  */
usart_handle_t csi_usart_initialize(int32_t idx, usart_event_cb_t cb_event)
{
    uint64_t base = 0u;
    uint32_t irq = 0u;
    void *handler;
    int32_t ret = target_usart_init(idx, &base, &irq, &handler);
    if (ret < 0 || ret >= CONFIG_USART_NUM) {
        return NULL;
    }
    ck_usart_priv_t *usart_priv = &usart_instance[idx];
    usart_priv->base = base;
    usart_priv->irq = irq;
    usart_priv->cb_event = cb_event;
    usart_priv->idx = idx;
    ck_usart_reg_t *addr = (ck_usart_reg_t *)(usart_priv->base);
    addr->IER = IER_RDA_INT_ENABLE | IIR_RECV_LINE_ENABLE;
    drv_irq_register(usart_priv->irq, handler);
    drv_irq_enable(usart_priv->irq);
    return usart_priv;
}