flash_partitioning _s32k144 example project

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

flash_partitioning _s32k144 example project

957 Views
hajianik
Senior Contributor I

Hi ,

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 */

DISABLE_CHECK_RAMSECTION_FUNCTION_CALL

(pSSDConfig->CallBack)();

ENABLE_CHECK_RAMSECTION_FUNCTION_CALL

}

}

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.

That comment is really confusing. 

PLEASE ENLIGHTEN ME.

Thanks,

0 Kudos
0 Replies