/*================================================================ Copyright (c) 2021, Quectel Wireless Solutions Co., Ltd. All rights reserved. Quectel Wireless Solutions Proprietary and Confidential. =================================================================*/ /*================================================================= EDIT HISTORY FOR MODULE This section contains comments describing changes made to the module. Notice that changes are listed in reverse chronological order. WHEN WHO WHAT, WHERE, WHY ------------ ------- ------------------------------------------------------------------------------- =================================================================*/ /*=========================================================================== * include files ===========================================================================*/ #include #include #include #include "ql_log.h" #include "drv_spi_flash.h" #include "ql_spi6_nor_flash.h" #include "ql_type.h" #include "osi_api.h" #include "hal_chip.h" #include "hal_spi_flash_defs.h" #define SPI6_NOR_FLASH QL_LOG_LEVEL_INFO #define QL_SPI6_NOR_FLASH_LOG(msg, ...) QL_LOG(SPI6_NOR_FLASH, "ql_spi6_nor", msg, ##__VA_ARGS__) #define QL_BOOT_FLASH_END_ADDR CONFIG_BOOT_FLASH_ADDRESS+CONFIG_BOOT_FLASH_SIZE #define QL_APP_FLASH_END_ADDR CONFIG_APP_FLASH_ADDRESS+CONFIG_APP_FLASH_SIZE #define QL_APPIMG_FLASH_END_ADDR CONFIG_APPIMG_FLASH_ADDRESS+CONFIG_APPIMG_FLASH_SIZE #define QL_FS_SYS_FLASH_END_ADDR CONFIG_FS_SYS_FLASH_ADDRESS+CONFIG_FS_SYS_FLASH_SIZE #if (defined CONFIG_EFS_SYS_FLASH2_ADDRESS) && (CONFIG_EFS_SYS_FLASH2_ADDRESS >= CONFIG_NOR_EXT_PHY_ADDRESS) #if (defined CONFIG_EFS_SYS_FLASH2_SIZE) && (CONFIG_EFS_SYS_FLASH2_SIZE != 0) #define QL_EFS_SYS_FLASH2_END_ADDR CONFIG_EFS_SYS_FLASH2_ADDRESS+CONFIG_EFS_SYS_FLASH2_SIZE #endif #endif static bool ql_chk_spi6_embed_flash_addr(uint32 addr,size_t size) { if(addr=CONFIG_FS_MODEM_FLASH_ADDRESS) { return false; } if(addr>=CONFIG_APP_FLASH_ADDRESS&&addr=CONFIG_APPIMG_FLASH_ADDRESS&&addr=CONFIG_FS_SYS_FLASH_ADDRESS&&addr=CONFIG_APP_FLASH_ADDRESS&&addr=CONFIG_APPIMG_FLASH_ADDRESS&&addr=CONFIG_FS_SYS_FLASH_ADDRESS&&addr= CONFIG_NOR_EXT_PHY_ADDRESS) if(addr>=CONFIG_APP_FLASH_ADDRESS&&addr= CONFIG_NOR_EXT_PHY_ADDRESS) if(addr>=CONFIG_APPIMG_FLASH_ADDRESS&&addr= CONFIG_NOR_EXT_PHY_ADDRESS) if(addr>=CONFIG_FS_SYS_FLASH_ADDRESS&&addr= CONFIG_NOR_EXT_PHY_ADDRESS) #if (defined CONFIG_EFS_SYS_FLASH2_SIZE) && (CONFIG_EFS_SYS_FLASH2_SIZE != 0) if(addr>=CONFIG_EFS_SYS_FLASH2_ADDRESS&&addr= CONFIG_NOR_EXT_PHY_ADDRESS) if(addr>=CONFIG_APP_FLASH_ADDRESS&&addr= CONFIG_NOR_EXT_PHY_ADDRESS) if(addr>=CONFIG_APPIMG_FLASH_ADDRESS&&addr= CONFIG_NOR_EXT_PHY_ADDRESS) if(addr>=CONFIG_FS_SYS_FLASH_ADDRESS&&addr= CONFIG_NOR_EXT_PHY_ADDRESS) #if (defined CONFIG_EFS_SYS_FLASH2_SIZE) && (CONFIG_EFS_SYS_FLASH2_SIZE != 0) if(addr>=CONFIG_EFS_SYS_FLASH2_ADDRESS&&addr