Difference between CyEnterCriticalSection, CyGlobalIntDisable, CyDisableInts

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

What is the difference between CyEnterCriticalSection, CyGlobalIntDisable, CyDisableInts and their associated exit/enable functions?

   

Each of the above functions disables all interrupts.  I can't find any documentation on which, if any, is preferred - and under what circumstances.

   

Thanks for any help!

   

Brian

3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

CyDisableInts writes to the interrupt controller unit. The information which interrupt has been enabled before is lost.

   

CyGlobalIntDisable sets a bit in the CPU status which prevents (nearly) all interrupts from being processed. Previous state is lost.

   

CyEnterCriticalSection does the same as CyGlobalIntDisable but returns the current state. So this can be securely nested.

   

I (personally) start at begin of the initialization phase with CyGlobalIntEnable. Later. only when required I use the critical section scheme to keep the system responsive.

   

 

   

Bob

Bob,

CyGlobalIntDisable - you wrote nearly all interrupts are disabled, can you specify which ones are still active?

thanks.

0 Likes

Reset, Hardfault and NMI (Non-Maskable Interrupt) will always fire.

See "ARM M0 Generic User Guide" from ARM's website.

Bob