@newcastle
该部分对应的代码是:src/pm/pm.c : pm_check_wakeup_irqs
/* Check if there are any interrupts pending */
addr = (unsigned int *)NVIC->ISPR;
for (i = 0; i < DIV_ROUND_UP(NVIC_PERIPH_IRQ_NUM, 32); i++) {
val = addr[i];
irq[i] = val & nvic_int_mask[i];
if (irq[i]) {
PM_LOGD("nvic[%d]:%x, mask:%x en:%x\n", i, val,
nvic_int_mask[i], NVIC->ISER[i]);
ret |= PM_WAKEUP_SRC_DEVICES;
}
}
NVIC->ISPR寄存器也就是中断挂起控制寄存器组,代表有中断产生,每一位对应一个中断,可以看到唤醒中断是nvic[1],8也就是0b1000,也就是对应(nvic[0])31 + 4 = 35号中断。
XR806对应的芯片中断序号在include/driver/chip/chip.h里面定义。
/*!< Interrupt Number Definition */
typedef enum {
/* Cortex-M4/3 Processor Exceptions Numbers*/
NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */
MemoryManagement_IRQn = -12, /*!< 4 Cortex-M3 Memory Management Interrupt */
BusFault_IRQn = -11, /*!< 5 Cortex-M3 Bus Fault Interrupt */
UsageFault_IRQn = -10, /*!< 6 Cortex-M3 Usage Fault Interrupt */
#if defined(CONFIG_CPU_CM33F)
SecureFault_IRQn = -9, /*!< 7 Cortex-M33 Secure Fault Interrupt */
#endif
SVCall_IRQn = -5, /*!< 11 Cortex-M3 SV Call Interrupt */
DebugMonitor_IRQn = -4, /*!< 12 Cortex-M3 Debug Monitor Interrupt */
PendSV_IRQn = -2, /*!< 14 Cortex-M3 Pend SV Interrupt */
SysTick_IRQn = -1, /*!< 15 Cortex-M3 System Tick Interrupt */
/* Specific Interrupt Numbers */
DMA_IRQn = 0,
GPIOA_IRQn = 1,
#if (CONFIG_CHIP_ARCH_VER == 2)
SDC0_IRQn = 2,
#endif
UART0_IRQn = 4,
UART1_IRQn = 5,
SPI0_IRQn = 6,
#if (CONFIG_CHIP_ARCH_VER == 2)
SPI1_IRQn = 7,
#endif
I2C0_IRQn = 8,
I2C1_IRQn = 9,
WDG_IRQn = 10,
TIMER0_IRQn = 11,
TIMER1_IRQn = 12,
RTC_SEC_ALARM_IRQn = 13,
RTC_WDAY_ALARM_IRQn = 14,
#if (CONFIG_CHIP_ARCH_VER == 2)
CSI_JPEG_IRQn = 15,
#endif
I2S_IRQn = 16,
PWM_ECT_IRQn = 17,
CE_IRQn = 18,
GPADC_IRQn = 19,
GPIOB_IRQn = 20,
IRRX_IRQn = 22,
IRTX_IRQn = 23,
A_WAKEUP_IRQn = 25,
FLASHC_IRQn = 26,
UART2_IRQn = 27,
#if (CONFIG_CHIP_ARCH_VER == 2)
SDC1_IRQn = 28,
#endif
WIFIC_IRQn = 29,
CODEC_DAC_IRQn = 30,
CODEC_ADC_IRQn = 31,
AVS_IRQn = 32, /* AVS psensor */
#if (CONFIG_CHIP_ARCH_VER == 2)
GPIOC_IRQn = 33,
PSRAMC_IRQn = 34,
#endif
#if (CONFIG_CHIP_ARCH_VER == 3)
BLE_LL_IRQn = 35,
BTCOEX_IRQn = 36,
KEYSCAN_IRQn = 37,
SMCARD_IRQn = 38,
DMA_SEC_IRQn = 39,
CAPSEN_IRQn = 40,
LPUART0_IRQn = 41,
LPUART1_IRQn = 42,
TZASC_IRQn = 43,
#endif
} IRQn_Type;
可以看到是因为蓝牙中断唤醒的,在休眠关闭蓝牙前关闭广播可以解决。