串口中断接收,IntMasterEnable是否是必须的?

2019-03-24 08:26发布

刚做了串口中断的小程序,发现IntMasterEnable加不加都可以。串口中断接收,IntMasterEnable是否是必须的? 此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
4条回答
beloved
2019-03-24 18:23
< :TI_MSP430_内容页_SA7 --> Cortex-M3上电默认是允许中断的到其内核的。

//! eturn Returns  true if interrupts were disabled when the function was
//! called or  false if they were initially enabled.
//
//*****************************************************************************
tBoolean
IntMasterEnable(void)
{
    //
    // Enable processor interrupts.
    //
    return(CPUcpsie());
}

#if defined(ccs)
unsigned long
CPUcpsie(void)
{
    //
    // Read PRIMASK and enable interrupts.
    //
    __asm("    mrs     r0, PRIMASK "
          "    cpsie   i "
          "    bx      lr ");

    //
    // The following keeps the compiler happy, because it wants to see a
    // return value from this function.  It will generate code to return
    // a zero.  However, the real return is the "bx lr" above, so the
    // return(0) is never executed and the function returns with the value
    // you expect in R0.
    //
    return(0);
}
#endif

[ 本帖最后由 beloved 于 2011-7-27 10:03 编辑 ]

一周热门 更多>

相关问题

    相关文章