flash erase函数中的CONFIG_SFC_ALLOW_ERASE_WRITEBACK配置找不到

Viewed 41

SFC_SECTION
errcode_t uapi_sfc_reg_erase(uint32_t flash_addr, uint32_t erase_size)
{
errcode_t ret = check_opt_param(flash_addr, erase_size);
if (unlikely(ret != ERRCODE_SUCC)) {
return ret;
}

uint32_t end_addr = flash_addr + erase_size;
uint32_t start_sector = flash_addr & ~BYTES_4K_MASK;
uint32_t end_sector = (end_addr & BYTES_4K_MASK) == 0 ? end_addr : (end_addr & ~BYTES_4K_MASK) + BYTES_4K;
uint32_t hal_erase_size = end_sector - start_sector;

#if defined(CONFIG_SFC_ALLOW_ERASE_WRITEBACK)
/* Backup data to RAM /
uint32_t first_size = flash_addr - start_sector;
if (likely(first_size != 0)) {
uapi_sfc_reg_read(start_sector, g_first_buffer, first_size);
}
uint32_t last_size = end_sector - end_addr;
if (likely(last_size != 0)) {
uapi_sfc_reg_read(end_addr, g_last_buffer, last_size);
}
#else
if (flash_addr != start_sector || end_addr != end_sector) {
return ERRCODE_INVALID_PARAM;
}
#endif /
CONFIG_SFC_ALLOW_ERASE_WRITEBACK */

uint32_t lock_sts = sfc_port_write_lock(flash_addr, flash_addr + erase_size);
/* Erasing with greedy algorithms */
ret = do_greedy_erase(hal_erase_size, start_sector);
sfc_port_write_unlock(lock_sts);

#if defined(CONFIG_SFC_ALLOW_ERASE_WRITEBACK)
/* Write back data from RAM /
if (likely(first_size != 0)) {
uapi_sfc_reg_write(start_sector, g_first_buffer, first_size);
}
if (likely(last_size != 0)) {
uapi_sfc_reg_write(end_addr, g_last_buffer, last_size);
}
#endif /
CONFIG_SFC_ALLOW_ERASE_WRITEBACK */
return ret;
}

1 Answers

CONFIG_开头的是Kconfig配置的,把这个删掉再搜就有了

谢谢!