In the MCAL+AUTOSAR BSW software using TDA4, we found that the processJobs function driven by flash did a lock interrupt operation during the operation of the flash. Due to the time-consuming FLASH operation, the interrupt and task scheduling were blocked.
May I ask: 1. What is the purpose of the lock interrupt?
2. If I can ensure the serializability of flash operations (as well as the serializability of the bus used by flash) in the upper layer application, can I remove the lock interrupt operation?
3. Or what better way to solve the problem.
The following are the relevant codes:
FLS_FUNC_TEXT_SECTION void processJobs(Fls_JobType job)
{
uint32 chunkSize;
Std_ReturnType retVal = E_NOT_OK;
/*Get the MIN of two*/
if (Fls_DrvObj.length < Fls_DrvObj.jobChunkSize)
{
chunkSize = Fls_DrvObj.length;
}
else
{
chunkSize = Fls_DrvObj.jobChunkSize;
}
SchM_Enter_Fls_FLS_EXCLUSIVE_AREA_0();
switch(job) {
case FLS_JOB_COMPARE:
retVal = Fls_norCompare(chunkSize);
break;
case FLS_JOB_ERASE:
retVal = Fls_norErase(chunkSize);
break;
case FLS_JOB_READ:
retVal = Fls_norRead(chunkSize);
break;
case FLS_JOB_WRITE:
retVal = Fls_norWrite(chunkSize);
break;
case FLS_JOB_BLANKCHECK:
retVal = Fls_norBlankCheck(chunkSize);
break;
default:
retVal = E_NOT_OK;
break;
}
if (retVal == E_OK)
{
Fls_DrvObj.ramAddr = &Fls_DrvObj.ramAddr[chunkSize];
if (job != FLS_JOB_ERASE)
{
Fls_DrvObj.flashAddr += chunkSize;
/*Erase FlashAddr updated in Fls_norErase*/
}
Fls_DrvObj.length -= chunkSize;
Fls_DrvObj.transferred += chunkSize;
if( 0U == Fls_DrvObj.length )
{
Fls_DrvObj.jobResultType = MEMIF_JOB_OK;
Fls_DrvObj.status = MEMIF_IDLE;
Fls_DrvObj.jobType = FLS_JOB_NONE;
Fls_DrvObj.transferred = 0;
if( Fls_DrvObj.Fls_JobEndNotification != NULL )
{
Fls_DrvObj.Fls_JobEndNotification();
}
}
}
else /*if retval == E_NOT_OK or E_COMPARE_MISMATCH*/
{
if ((E_BLANKCHECK_MISMATCH == retVal) || (E_COMPARE_MISMATCH == retVal))
{
Fls_DrvObj.status = MEMIF_IDLE;
Fls_DrvObj.jobType = FLS_JOB_NONE;
Fls_DrvObj.transferred = 0;
if (FLS_JOB_BLANKCHECK == job)
{
Fls_reportDetRuntimeError(FLS_SID_BLANK_CHECK, FLS_E_VERIFY_ERASE_FAILED);
}
else /*if (FLS_JOB_COMPARE == job)*/
{
Fls_DrvObj.jobResultType = MEMIF_BLOCK_INCONSISTENT;
Fls_reportDetRuntimeError(FLS_SID_COMPARE, FLS_E_VERIFY_WRITE_FAILED);
}
if( Fls_DrvObj.Fls_JobErrorNotification != NULL )
{
Fls_DrvObj.Fls_JobErrorNotification();
}
}
else /*if retVal == E_NOT_OK*/
{
/*Hardware/driver internal error occured*/
ReportFlsError(job);
if( Fls_DrvObj.Fls_JobErrorNotification != NULL )
{
Fls_DrvObj.Fls_JobErrorNotification();
}
}
}
SchM_Exit_Fls_FLS_EXCLUSIVE_AREA_0();
return;
}

