各位好,雅特力读保护函数是那个呀?
以下是STM32的读保护函数,请各位大佬帮改改
uint32_t Flash_EnableReadProtection(void) //读保护
{
/* Returns the FLASH Read Protection level. */
if( FLASH_OB_GetRDP() == RESET )
{
/* Unlock the Option Bytes */
FLASH_OB_Unlock();
/* Sets the read protection level. */
FLASH_OB_RDPConfig(OB_RDP_Level_1);
/* Start the Option Bytes programming process. */
if (FLASH_OB_Launch() != FLASH_COMPLETE)
{
/* Disable the Flash option control register access (recommended to protect
the option Bytes against possible unwanted operations) */
FLASH_OB_Lock();
/* Error: Flash read unprotection failed */
return (2);
}
/* Disable the Flash option control register access (recommended to protect
the option Bytes against possible unwanted operations) */
FLASH_OB_Lock();
/* Read Protection successfully enable */
return (1);
}
return(0);
}
|