微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI蓝牙设计交流 > CC2541中断处理函数里为什么要开启中断

CC2541中断处理函数里为什么要开启中断

时间:10-02 整理:3721RD 点击:

在CC2541的中断处理函数里,HAL_ENTER_ISR();的定义为

{ halIntState_t _isrIntState = EA; HAL_ENABLE_INTERRUPTS();

也就是保存当前的EA,再设置EA=1。使能中断。

为什么在进入到中断处理函数后,要使能中断?如下所示。

HAL_ISR_FUNCTION( halDmaIsr, DMA_VECTOR )
{
    HAL_ENTER_ISR();

    DMAIF = 0;

    。。。。。//响应的处理

    HAL_EXIT_ISR();

}

注释里已经说明了

/* IAR library uses XCH instruction with EA. It may cause the higher priority interrupt to be
* locked out, therefore, may increase interrupt latency. It may also create a lockup condition.
* This workaround should only be used with 8051 using IAR compiler. When IAR fixes this by
* removing XCH usage in its library, compile the following macros to null to disable them.
*/
#define HAL_ENTER_ISR() { halIntState_t _isrIntState = EA; HAL_ENABLE_INTERRUPTS();
#define HAL_EXIT_ISR() EA = _isrIntState; }

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top