/* Lock the security level of PUF block until key generate, wrap or unwrap operation is completed. Note: Only secure-privilege code can change the security level. */
status_t PUF_SetLock(PUF_Type *base, puf_sec_level_t securityLevel)
/* Lock the security level of PUF block until key generate, wrap or unwrap operation is completed. Note: Only secure-privilege code can change the security level. */
status_t PUF_SetLock(PUF_Type *base, puf_sec_level_t securityLevel)
{
    uint32_t sec_lock_option = 0u;
    if ((securityLevel != kPUF_NonsecureUser) && (securityLevel != kPUF_NonsecurePrivilege) &&
        (securityLevel != kPUF_SecureUser) && (securityLevel != kPUF_SecurePrivilege))
    {
        return kStatus_InvalidArgument;
    }
    while ((base->SR & PUF_SR_BUSY_MASK) != 0u)
    {
    }
    sec_lock_option = SEC_LOCK_PATTERN | securityLevel;
    PUF_CTRL->SEC_LOCK = sec_lock_option;
    if (securityLevel != PUF_CTRL->SEC_LOCK)
    {
        return kStatus_Fail;
    }
    return kStatus_Success;
}