Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 8 months ago.
Is there a function pair for disarming and rearming all interrupts
Typically, the disarm function returns the interrupt state before the call, and the rearm function uses that state for the restoration.
I assume that arithmetic on long long variables is an interruptible sequence of instructions.
1 Answer
6 years, 8 months ago.
Hello Alfred,
Maybe this could help you:
... core_util_critical_section_enter(); // disables all interrupts ... // code section that is not going to be interrupted core_util_critical_section_exit(); // re-enables all interrupts ...
Wow! Thanks. I never found that. Documentation says you can have nested calls of this pair.
I saw an article where someone was having a problem in which core_util_critical_section_enter/exit was being used. This scares the heck out of me.
posted by 26 Mar 2018Don't be afraid. Since these functions are used for the implementation of many mbed APIs, if it was like that almost each program built with mbed would crash.
posted by 27 Mar 2018There is also a C++ interface for this. You can use either RAII or the static enable/disable members. Code within these blocks should be very small and fast. If misused, you can miss system wide interrupt events. https://os.mbed.com/docs/v5.8/reference/criticalsectionlock.html
posted by 27 Mar 2018