1、代码
typedef uint32 tLogicalAddr;
typedef struct
{
tLogicalAddr xBlockStartLogicalAddr;
tLogicalAddr xBlockEndLogicalAddr;
}BlockInfo_t;
typedef enum
{
APP_A_TYPE = 0u,
APP_INVLID_TYPE = 0xFFu,
}tAPPType;
const BlockInfo_t gs_astBlockNumA[] = {
{0x14000u, 0x80000u},
};
const uint32 gs_blockNumA = sizeof(gs_astBlockNumA) / sizeof(gs_astBlockNumA[0u]);
boolean FLASH_HAL_GetFlashConfigInfo(const tAPPType i_appType,
BlockInfo_t ** o_ppBlockInfo,
uint32 *o_pItemLen)
{
boolean result = FALSE;
if(APP_A_TYPE == i_appType)
{
*o_ppBlockInfo = (BlockInfo_t *)gs_astBlockNumA;
*o_pItemLen = gs_blockNumA;
result = TRUE;
}
else
{
}
return result;
}
void TestFunction( uint8* address, uint32 size )
{
tAPPType s_appType = APP_INVLID_TYPE;
BlockInfo_t * s_pAppFlashMemoryInfo = NULL_PTR;
uint32 s_appFlashItem = 0u;
if(TRUE == FLASH_HAL_GetFlashConfigInfo(s_appType, &s_pAppFlashMemoryInfo, &s_appFlashItem))
{
if((s_pAppFlashMemoryInfo->xBlockStartLogicalAddr <= (tLogicalAddr)address) && (s_appFlashItem >= size))
{
printf("get the data successfully !!!");
}
}
}