CPU_INT_EN

Description

Restores previous interrupt status and/or enables interrupts.

Files

Each specific processor’s/compiler’s cpu.h

Prototype

          CPU_INT_EN();


Arguments

None.

Returned Value

None.

Required Configuration

None.

Notes / Warnings

  1. CPU_INT_EN() should be defined based on the processor port’s configured CPU critical section method, CPU_CFG_CRITICAL_METHOD; and may be defined with inline-assembly directly in cpu.h, or with calls to C functions defined in cpu.c, or calls to assembly subroutines defined in cpu_a.asm (or cpu_a.s). See also CPU Critical Sections.
  2. All side-effects of the code within the critical section must have been observed before re-enabling the interrupts. Weakly ordered and Out-of-Order processors may require a suitable memory barrier to be inserted before enabling the interrupts.
  3. It is NOT required for interrupts to be recognized immediately after the CPU_INT_EN() macro. Architectures/CPUs with interrupt enable delays do not require special considerations. As such it is not guaranteed that pending interrupts are recognized between two closely spaced invocation of CPU_INT_DIS() and CPU_INT_EN().

Implementation Template

The following example templates assume corresponding functions are defined in either cpu.c or cpu_a.asm:

Listing - CPU_INT_EN() implementation template
          #if     (CPU_CFG_CRITICAL_METHOD == CPU_CRITICAL_METHOD_INT_DIS_EN)
                                                         /* Enable  interrupts.       */
          #define  CPU_INT_EN()   do { CPU_IntEn(); } while (0)
          #endif
           
          #if     (CPU_CFG_CRITICAL_METHOD == CPU_CRITICAL_METHOD_STATUS_STK)
                                                         /* Pop     CPU status.       */
          #define  CPU_INT_EN()   do { CPU_SR_Pop(); } while (0)
          #endif
           
          #if     (CPU_CFG_CRITICAL_METHOD == CPU_CRITICAL_METHOD_STATUS_LOCAL)
                                                          /* Restore CPU status.       */
          #define  CPU_INT_EN()   do { CPU_SR_Restore(cpu_sr); } while (0)
          #endif