本文整理汇总了C++中FLASH_Unlock函数的典型用法代码示例。如果您正苦于以下问题:C++ FLASH_Unlock函数的具体用法?C++ FLASH_Unlock怎么用?C++ FLASH_Unlock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FLASH_Unlock函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: conf_general_init
void conf_general_init(void) {
// First, make sure that all relevant virtual addresses are assigned for page swapping.
memset(VirtAddVarTab, 0, sizeof(VirtAddVarTab));
int ind = 0;
for (unsigned int i = 0;i < (sizeof(app_configuration) / 2);i++) {
VirtAddVarTab[ind++] = EEPROM_BASE_MCCONF + i;
}
for (unsigned int i = 0;i < (sizeof(app_configuration) / 2);i++) {
VirtAddVarTab[ind++] = EEPROM_BASE_APPCONF + i;
}
FLASH_Unlock();
EE_Init();
}
示例2: Flash_SaveLastGUI
void Flash_SaveLastGUI(void)
{
uint8 buff[1024] = {0};
FLASH_Unlock();
FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR );
if(FLASH_COMPLETE != FLASH_ErasePage(STORE_LAST_GUI_PAGE_ADDR))
{
return;
}
memcpy(buff, (uint8*)&backgroud, 1024);
Flash_WriteData(STORE_LAST_GUI_PAGE_ADDR, (uint16*)buff, 1024/2);
FLASH_Lock();
}
示例3: Flash_SaveTagState
void Flash_SaveTagState(void)
{
uint8 buff[64] = {0};
FLASH_Unlock();
FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR );
if(FLASH_COMPLETE != FLASH_ErasePage(STORE_SYS_STATE_PAGE_ADDR))
{
return;
}
memcpy(buff, (uint8*)&state_para.ackflag_set, sizeof(state_para));
Flash_WriteData(STORE_SYS_STATE_PAGE_ADDR, (uint16*)buff, (sizeof(state_para)+1)/2);
FLASH_Lock();
}
示例4: Flash_WritePageU8
/*=====================================================================================================*/
int8_t Flash_WritePageU8( uint32_t writeAddr, const uint8_t *writeData, uint32_t lens )
{
int8_t status = ERROR;
uint32_t count = 0;
FLASH_Unlock();
FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR |
FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR);
do {
status = FLASH_ProgramByte(writeAddr + count, writeData[count]);
} while((++count < lens) && (status == FLASH_COMPLETE));
FLASH_Lock();
return status;
}
示例5: PIOS_Flash_Internal_StartTransaction
static int32_t PIOS_Flash_Internal_StartTransaction(uintptr_t flash_id)
{
struct pios_internal_flash_dev * flash_dev = (struct pios_internal_flash_dev *)flash_id;
if (!PIOS_Flash_Internal_Validate(flash_dev))
return -1;
#if defined(PIOS_INCLUDE_FREERTOS)
if (xSemaphoreTake(flash_dev->transaction_lock, portMAX_DELAY) != pdTRUE)
return -2;
#endif /* defined(PIOS_INCLUDE_FREERTOS) */
/* Unlock the internal flash so we can write to it */
FLASH_Unlock();
return 0;
}
示例6: erase_flash_page
void erase_flash_page(uint32_t page_addr)
{
FLASH_Status FLASHStatus = FLASH_COMPLETE;
__disable_irq();
FLASH_Unlock();
FLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR);
FLASHStatus = FLASH_ErasePage(page_addr);
if(FLASHStatus != FLASH_COMPLETE)
myprintf("FLASH_ErasePage Error\r\n");
FLASH_Lock();
__enable_irq();
}
示例7: hal_nvm_init_sector
int hal_nvm_init_sector(HAL_NVM_HANDLE handle, unsigned long address)
{
int sector = get_sector(address);
int rv = HAL_NVM_E_SUCCESS;
FLASH_Unlock();
if (FLASH_EraseSector(sector, VoltageRange_3) != FLASH_COMPLETE)
{
rv = HAL_NVM_E_ERROR;
}
FLASH_Lock();
return rv;
}
示例8: clear_CardID
//----清除全部刷卡记录-----------------------------------------------------
void clear_CardID()
{
char DateSt[12], TimeSt[12];
storeaddrlist.RecordCount = 0;
storeaddrlist.CountAddrOffset = 0;
timeoutaddrlist.RecordCount = 0;
timeoutaddrlist.CountAddrOffset = 0;
LastSaveTime = GetRTC(DateSt, TimeSt);///获取当前时间,秒数 //需要优化;
//清除记录区
FLASH_Unlock();
FLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR);
FLASH_ErasePage(PLACELASTID);
FLASH_ErasePage(POINTOFSECTION);
FLASH_Lock();
}
示例9: WriteflashBoatInfo
/***********************************************************
* 函数名:WriteflashBoatInfo
* 描述 :把activation_flag从CPU写入Flash,位置信息
* 输入 : 无
* 输出 : 无
***********************************************************/
void WriteflashBoatInfo(void)
{
FLASHStatus = FLASH_COMPLETE;
MemoryProgramStatus = PASSED;
FLASH_Unlock(); //FLASH解锁
FLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR);//清标志位
NbrOfPage = (EndAddr[7] - StartAddr[7]) / FLASH_PAGE_SIZE; //页面擦除子程序
FLASHStatus = FLASH_ErasePage(StartAddr[7] + (FLASH_PAGE_SIZE * NbrOfPage));
FlashAddress = StartAddr[7];
FLASHStatus = FLASH_ProgramWord(FlashAddress, boatlong);
FlashAddress = FlashAddress + 4;
FLASHStatus = FLASH_ProgramWord(FlashAddress, boatwidth);
}
示例10: FLASH_Config
void FLASH_Config(void)
{
/* Define flash programming Time*/
FLASH_SetProgrammingTime(FLASH_PROGRAMTIME_STANDARD);
/*
FLASH_Unlock(FLASH_MEMTYPE_PROG);
// Wait until Flash Program area unlocked flag is set
while (FLASH_GetFlagStatus(FLASH_FLAG_PUL) == RESET)
{}
*/
/* Unlock flash data eeprom memory */
FLASH_Unlock(FLASH_MEMTYPE_DATA);
/* Wait until Data EEPROM area unlocked flag is set*/
while (FLASH_GetFlagStatus(FLASH_FLAG_DUL) == RESET)
{}
}
示例11: Flash_SaveTagInfo
void Flash_SaveTagInfo(void)
{
uint8 buff[1024] = {0};
FLASH_Unlock();
FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR );
if(FLASH_COMPLETE != FLASH_ErasePage(STORE_SYS_INFO_PAGE_ADDR))
{
return;
}
memcpy(buff, (uint8*)&tag_flash_info.net_flag_set, sizeof(tag_flash_info));
Flash_WriteData(STORE_SYS_INFO_PAGE_ADDR, (uint16*)buff, (sizeof(tag_flash_info)+1)/2);
FLASH_Lock();
}
示例12: FLASH_Erase
/**-----------------------------------------------------------------------------
* @brief Effacement d'un secteur de Flash.
*
* @param[in] FlashSector Secteur a effacer.
*
* @return Status Statut de l'ecriture.
*/
uint8_t FLASH_Erase(uint8_t FlashSector)
{
uint32_t FLASH_Sector;
FLASH_Status Status;
// Effacement du secteur
switch (FlashSector)
{
case 0: FLASH_Sector = FLASH_Sector_0; break;
case 1: FLASH_Sector = FLASH_Sector_1; break;
case 2: FLASH_Sector = FLASH_Sector_2; break;
case 3: FLASH_Sector = FLASH_Sector_3; break;
case 4: FLASH_Sector = FLASH_Sector_4; break;
case 5: FLASH_Sector = FLASH_Sector_5; break;
case 6: FLASH_Sector = FLASH_Sector_6; break;
case 7: FLASH_Sector = FLASH_Sector_7; break;
case 8: FLASH_Sector = FLASH_Sector_8; break;
case 9: FLASH_Sector = FLASH_Sector_9; break;
case 10: FLASH_Sector = FLASH_Sector_10; break;
case 11: FLASH_Sector = FLASH_Sector_11; break;
case 0xFF: FLASH_Sector = 0xFF; break;
default: return Status_KO; break;
}
// Desactivation des interruptions
__disable_irq();
// Deverrouillage de la flash
FLASH_Unlock();
if (FLASH_Sector == 0xFF)
Status = FLASH_EraseAllSectors(VoltageRange_3);
else
Status = FLASH_EraseSector(FLASH_Sector, VoltageRange_3);
// Verrouillage de la flash
FLASH_Lock();
// ReActivation des interruptions
__enable_irq();
if (Status == FLASH_COMPLETE)
return Status_OK;
return Status_KO;
}
示例13: bsp_MCU_Write
u8* bsp_MCU_Write(u8* writebuffer,u8 blockid,u16 writelength)
{
u8 status=0;
u16 index=0;
SleepTime=0;
__set_PRIMASK(1);
memcpy(MCU_ROM_Write,(u8*)ADDR_FLASH_SECTOR_7,1024+16); //在擦除之前,先把数据读出来放在内存buffer
__set_PRIMASK(0);
if(blockid==1)
{
memcpy(MCU_ROM_Write,writebuffer,writelength); //将512byte数据写入第一个block区域
}
if(blockid==2)
{
memcpy(MCU_ROM_Write+512,writebuffer,writelength); //将512byte数据写入第二个block区域
}
FLASH_Unlock(); //解锁
FLASH_DataCacheCmd(DISABLE);//FLASH擦除期间,必须禁止数据缓存
FLASH_ClearFlag(FLASH_FLAG_EOP|FLASH_FLAG_OPERR|FLASH_FLAG_WRPERR| FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR|FLASH_FLAG_PGSERR);
status=FLASH_EraseSector(FLASH_Sector_7 ,VoltageRange_3);//VCC=2.7~3.6V之间!!
if(status==FLASH_COMPLETE)
{
__set_PRIMASK(1);
for(index=0;index<(1024+16);index++)
{
status=FLASH_ProgramByte(ADDR_FLASH_SECTOR_7+index,MCU_ROM_Write[index]); //SysID
}
__set_PRIMASK(0);
}
FLASH_DataCacheCmd(ENABLE); //FLASH擦除结束,开启数据缓存
FLASH_Lock();//上锁
if(status==FLASH_COMPLETE)
{
MCU_WriteStatus=0;
}
else
{
MCU_WriteStatus=status;
}
return &MCU_WriteStatus;
}
示例14: mal_flash_erase_page
mal_error_e mal_flash_erase_page(uint32_t page) {
// Unlock flash registers
FLASH_Unlock();
// Clear pending flags
FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPERR);
// Erase page
FLASH_Status result;
uint32_t offset = mal_flash_get_page_size(page) * page;
result = FLASH_ErasePage(FLASH_START_ADDRESS + offset);
// Lock flash registers
FLASH_Lock();
// Return result
if (FLASH_COMPLETE != result) {
return MAL_ERROR_MEMORY;
}
return MAL_ERROR_OK;
}
示例15: IAC_Init
void IAC_Init(void)
{
delay_init(72);
MCO_INIT();
Nvic_Init();
LED_GPIO_Config();
I2C_INIT();
delay(0XFFF);
TIM3_Init(2500);
usart1_config();
ADC1_Init();
NRF24L01_Init();
Moto_Init();
LED_SHOW();
FLASH_Unlock();
EE_Init();
}