1 Reply Latest reply on Mar 29, 2017 1:12 AM by user_1377889

    Difference between CyEnterCriticalSection, CyGlobalIntDisable, CyDisableInts

    bri_2235981

      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

        • 1. Re: Difference between CyEnterCriticalSection, CyGlobalIntDisable, CyDisableInts
          user_1377889

          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