/* Initialize TRNG Interface. 1. Initializes the resources needed for the TRNG interface 2.registers event callback function.  */
trng_handle_t csi_trng_initialize(int32_t idx, trng_event_cb_t cb_event)
/* Initialize TRNG Interface. 1. Initializes the resources needed for the TRNG interface 2.registers event callback function.  */
trng_handle_t csi_trng_initialize(int32_t idx, trng_event_cb_t cb_event)
{
    if (idx < 0 || idx >= CONFIG_TRNG_NUM) {
        return NULL;
    }
    uint32_t base = 0u;
    int32_t real_idx = target_get_trng(idx, &base);
    if (real_idx != idx) {
        return NULL;
    }
    ck_trng_priv_t *trng_priv = &trng_handle[idx];
    trng_priv->base = base;
    trng_reg = (ck_trng_reg_t *)(trng_priv->base);
    trng_priv->cb = cb_event;
    trng_priv->status.busy = 0;
    trng_priv->status.data_valid = 0;
    return (trng_handle_t)trng_priv;
}