Hi Dhananjay,
In the FreeRTOS, it also needs to disable the interrupt before enter the critical code region and enable the interrupt again after quit the critical code region.
So I'd highly recommend the FreeRTOS's approach to make it.
func()
{ __asm volatile( "cpsid i" ); //Disable Interrupt
....
....
__asm volatile( "cpsie i" ); //Ensable Interrupt }
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------