This is regarding a comment in the main.c of flash_partitioning _s32k144 example project:
/* Set callback function before a long time consuming flash operation
* (ex: erasing) to let the application code do other tasks while flash
* in operation. In this case we use it to enable interrupt for
* Flash Command Complete event */
Then following that,
FLASH_DRV_EraseSector(&flashSSDConfig, address, size); is called which in turn calls
FLASH_DRV_EraseSector where eventually we see the call to the callback:
while (0U == (FTFx_FSTAT & FTFx_FSTAT_CCIF_MASK))
/* Wait till CCIF bit is set
* Serve callback function as often as possible
if (NULL_CALLBACK != pSSDConfig->CallBack)
/* Temporarily disable compiler's check for ROM access call from within a ram function.
* The use of a function pointer type makes this check irrelevant.
* Nevertheless, it is imperative that the user-provided callback be defined in RAMSECTION */
Now I see a while loop that waits until CCIF is set and while it is waiting it enables the CCIF INTERRUPT via callback and the CCIF interrupt disables itself , how is this not blocking , we have to wait until CCIF is set .
HOW IS THIS CALLBACK MAKING THIS NON BLOCKING ? CONTRARY TO WHAT THE COMMENT SAYS.
TO ME THIS WAITS A CERTAIN AMOUNT OF TIME UNTILL CCIF IS SET, INTERRUPT OR NOT.
CCIF GETS SET AND WHILE LOOP IS EXITED BEFORE THE CALLBACK GETS A CHANCE TO ENABLE THE INTERRUPT.