/* Initialize RTC Interface. 1. Initializes the resources needed for the RTC interface 2.registers event callback function.  */
rtc_handle_t csi_rtc_initialize(int32_t idx, rtc_event_cb_t cb_event)
/* Initialize RTC Interface. 1. Initializes the resources needed for the RTC interface 2.registers event callback function.  */
rtc_handle_t csi_rtc_initialize(int32_t idx, rtc_event_cb_t cb_event)
{
    if (idx < 0 || idx >= CONFIG_RTC_NUM) {
        return NULL;
    }
    int32_t real_idx;
    uint32_t base = 0u;
    uint32_t irq;
    real_idx = target_get_rtc(idx, &base, &irq);
    if (real_idx != idx) {
        return NULL;
    }
    ck_rtc_priv_t *rtc_priv;
    rtc_priv = &rtc_instance[idx];
    rtc_priv->base = base;
    rtc_priv->irq  = irq;
    ck_rtc_reg_t *addr = (ck_rtc_reg_t *)(rtc_priv->base);
    rtc_priv->cb_event = cb_event;
    addr->RTC_CCR = 0;
    drv_nvic_enable_irq(rtc_priv->irq);
    return (rtc_handle_t)rtc_priv;
}