status_t FTFx_CMD_VerifyErase(ftfx_config_t *config,
uint32_t start,
uint32_t lengthInBytes,
ftfx_margin_value_t margin)
{
/* Check arguments. */
uint32_t blockSize;
uint32_t nextBlockStartAddress;
uint32_t remainingBytes;
uint8_t aligmentInBytes = config->opsConfig.addrAligment.sectionCmd; //16
status_t returnCode;
returnCode = ftfx_check_mem_range(config, start, lengthInBytes, aligmentInBytes);
if (returnCode)
{
return returnCode;
}
start = config->opsConfig.convertedAddress;
blockSize = config->flashDesc.totalSize / config->flashDesc.blockCount;
//nextBlockStartAddress = ALIGN_UP(start, blockSize); //0x00180000
//if (nextBlockStartAddress == start)
//{
// nextBlockStartAddress += blockSize;
//}
remainingBytes = lengthInBytes;//4096
while (remainingBytes)
{
uint32_t numberOfPhrases;
//uint32_t verifyLength = nextBlockStartAddress - start;
//if (verifyLength > remainingBytes)
//{
// verifyLength = remainingBytes;
//}
uint32_t verifyLength = lengthInBytes;
numberOfPhrases = verifyLength / aligmentInBytes;
/* Fill in verify section command parameters. */
kFCCOBx[0] = BYTE2WORD_1_3(FTFx_VERIFY_SECTION, start);
kFCCOBx[1] = BYTE2WORD_2_1_1(numberOfPhrases, margin, 0xFFU);
/* calling flash command sequence function to execute the command */
returnCode = ftfx_command_sequence(config);
if (returnCode)
{
return returnCode;
}
remainingBytes -= verifyLength;
start += verifyLength;
//nextBlockStartAddress += blockSize;
}
return kStatus_FTFx_Success;
}
uint32_t start,
uint32_t lengthInBytes,
ftfx_margin_value_t margin)
{
/* Check arguments. */
uint32_t blockSize;
uint32_t nextBlockStartAddress;
uint32_t remainingBytes;
uint8_t aligmentInBytes = config->opsConfig.addrAligment.sectionCmd; //16
status_t returnCode;
returnCode = ftfx_check_mem_range(config, start, lengthInBytes, aligmentInBytes);
if (returnCode)
{
return returnCode;
}
start = config->opsConfig.convertedAddress;
blockSize = config->flashDesc.totalSize / config->flashDesc.blockCount;
//nextBlockStartAddress = ALIGN_UP(start, blockSize); //0x00180000
//if (nextBlockStartAddress == start)
//{
// nextBlockStartAddress += blockSize;
//}
remainingBytes = lengthInBytes;//4096
while (remainingBytes)
{
uint32_t numberOfPhrases;
//uint32_t verifyLength = nextBlockStartAddress - start;
//if (verifyLength > remainingBytes)
//{
// verifyLength = remainingBytes;
//}
uint32_t verifyLength = lengthInBytes;
numberOfPhrases = verifyLength / aligmentInBytes;
/* Fill in verify section command parameters. */
kFCCOBx[0] = BYTE2WORD_1_3(FTFx_VERIFY_SECTION, start);
kFCCOBx[1] = BYTE2WORD_2_1_1(numberOfPhrases, margin, 0xFFU);
/* calling flash command sequence function to execute the command */
returnCode = ftfx_command_sequence(config);
if (returnCode)
{
return returnCode;
}
remainingBytes -= verifyLength;
start += verifyLength;
//nextBlockStartAddress += blockSize;
}
return kStatus_FTFx_Success;
}