/* This function enables power to PUF block and waits until the block initializes. */
status_t PUF_Init(PUF_Type *base, puf_config_t *conf)
/* This function enables power to PUF block and waits until the block initializes. */
status_t PUF_Init(PUF_Type *base, puf_config_t *conf)
{
    status_t status = kStatus_Fail;
    CLOCK_EnableClock(kCLOCK_Puf);
    RESET_PeripheralReset(kPUF_RST_SHIFT_RSTn);
    base->SRAM_CFG |= PUF_SRAM_CFG_CKGATING(conf->CKGATING);
    puf_powerOn(base, conf);
    status = puf_waitForInit(base);
    if ((status != kStatus_Success) || ((PUF_AR_ALLOW_ENROLL_MASK | PUF_AR_ALLOW_START_MASK) !=
                                        (base->AR & (PUF_AR_ALLOW_ENROLL_MASK | PUF_AR_ALLOW_START_MASK))))
    {
        puf_powerCycle(base, conf);
        status = puf_waitForInit(base);
    }
    if (kStatus_Success == status)
    {
        base->MISC = PUF_MISC_DATA_ENDIANNESS(conf->dataEndianness);
        status = puf_makeStatus(base, kPUF_Init);
    }
    return status;
}