/* Initialize WDT Interface. 1. Initializes the resources needed for the WDT interface 2.registers event callback function.  */
wdt_handle_t csi_wdt_initialize(int32_t idx, wdt_event_cb_t cb_event)
/* Initialize WDT Interface. 1. Initializes the resources needed for the WDT interface 2.registers event callback function.  */
wdt_handle_t csi_wdt_initialize(int32_t idx, wdt_event_cb_t cb_event)
{
    if (idx < 0 || idx >= CONFIG_WDT_NUM) {
        return NULL;
    }
    uint32_t base = 0u;
    uint32_t irq = 0u;
    int32_t real_idx = target_get_wdt(idx, &base, &irq);
    if (real_idx != idx) {
        return NULL;
    }
    dw_wdt_priv_t *wdt_priv = &wdt_instance[idx];
    wdt_priv->base = base;
    wdt_priv->irq  = irq;
    wdt_priv->cb_event = cb_event;
    drv_nvic_enable_irq(wdt_priv->irq);
    return (wdt_handle_t)wdt_priv;
}