Disable interrupt during FTFC operation

This commit is contained in:
Sammy Tran
2024-03-05 14:46:48 -05:00
committed by Alan Carvalho de Assis
parent 89bd6ab74a
commit b4b7710c63
+9
View File
@@ -77,6 +77,13 @@ static uint32_t execute_ftfc_command(void)
uint8_t regval;
uint32_t retval;
/* AN12003: only one FlexNVM operation can be executed at a time.
* Disable ISR during this time so an ISR doesn't cause a hardfault
* from a simultaneous read.
*/
irqstate_t flags = enter_critical_section();
/* Clear CCIF to launch command */
regval = getreg8(S32K1XX_FTFC_FSTAT);
@@ -87,6 +94,8 @@ static uint32_t execute_ftfc_command(void)
retval = getreg8(S32K1XX_FTFC_FSTAT);
leave_critical_section(flags);
if (retval & (FTTC_FSTAT_MGSTAT0 | FTTC_FSTAT_FPVIOL |
FTTC_FSTAT_ACCERR | FTTC_FSTAT_RDCOLERR))
{