mcu/drv/fsl_flash_driver_c90tfs.c
/*FUNCTION**********************************************************************
 *
 * Function Name : FlashGetSecurityState
 * Description   : Retrieves the current Flash security status, including
 * the security enabling state and the back door key enabling state.
 *
 * Implements    : FlashGetSecurityState_Activity
 *END**************************************************************************/
FUNCTION

Function Name : FlashGetSecurityState
Description   : Retrieves the current Flash security status, including
the security enabling state and the back door key enabling state.

Implements    : FlashGetSecurityState_Activity
END
FUNCTION Function Name : FlashGetSecurityState Description : Retrieves the current Flash security status including the security enabling state and the back door key enabling state . Implements : FlashGetSecurityState_Activity END
void FlashGetSecurityState(uint8_t* securityState)
{
#ifdef DEV_ERROR_DETECT
    DEV_ASSERT(securityState != NULL);
#endif
    uint8_t  regValue;
    regValue = FTFx_FSEC;
    if (FLASH_SECURITY_STATE_UNSECURED == (regValue & FTFx_FSEC_SEC_MASK))
    {
        *securityState = FLASH_NOT_SECURE;
    }
    else
    {
        if (0x80U == (regValue & FTFx_FSEC_KEYEN_MASK))
        {
            *securityState = FLASH_SECURE_BACKDOOR_ENABLED;
        }
        else
        {
            *securityState = FLASH_SECURE_BACKDOOR_DISABLED;
        }
    }
}
void FlashGetSecurityState ( uint8_t * securityState ) { #ifdef DEV_ERROR_DETECT DEV_ASSERT ( securityState != NULL ) ; #endif uint8_t regValue ; regValue = FTFx_FSEC ; if ( FLASH_SECURITY_STATE_UNSECURED == ( regValue & FTFx_FSEC_SEC_MASK ) ) { * securityState = FLASH_NOT_SECURE ; } else { if ( 0x80U == ( regValue & FTFx_FSEC_KEYEN_MASK ) ) { * securityState = FLASH_SECURE_BACKDOOR_ENABLED ; } else { * securityState = FLASH_SECURE_BACKDOOR_DISABLED ; } } }
FUNCTION
FUNCTION
/* Store data read from flash register */ /* Get flash security register value */ /* Check the status of the flash security bits in the security register */ /* Flash in unsecured state */ /* Flash in secured state
         * Check for backdoor key security enable bit
         */ /* Backdoor key security enabled */ /* Backdoor key security disabled */