cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

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

0 Likes
Reply
3 Replies
Esteemed Contributor II

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

New Contributor II

Bob,

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

thanks.

0 Likes
Reply
Esteemed Contributor II

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

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

Bob