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
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 incpu.h
, or with calls to C functions defined incpu.c
, or calls to assembly subroutines defined incpu_a.asm
(orcpu_a.s
). See also CPU Critical Sections.- 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.
- 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 ofCPU_INT_DIS()
andCPU_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