//***************************************************************************** // // Wrapper function for the CPSIE instruction. Returns the state of PRIMASK // on entry. // //***************************************************************************** #if defined(codered) || defined(gcc) || defined(sourcerygxx) unsigned long __attribute__((naked)) CPUcpsie(void) { unsigned long ulRet;
// // Read PRIMASK and enable interrupts. // __asm(" mrs %0, PRIMASK
" " cpsie i
" " bx lr
" : "=r" (ulRet));
// // The return is handled in the inline assembly, but the compiler will // still complain if there is not an explicit return here (despite the fact // that this does not result in any code being produced because of the // naked attribute). // return(ulRet); } #endif #if defined(ewarm) unsigned long CPUcpsie(void) { // // Read PRIMASK and enable interrupts. // __asm(" mrs r0, PRIMASK
" " cpsie i
");
// // "Warning[Pe940]: missing return statement at end of non-void function" // is suppressed here to avoid putting a "bx lr" in the inline assembly // above and a superfluous return statement here. // #pragma diag_suppress=Pe940 } #pragma diag_default=Pe940 #endif #if defined(rvmdk) || defined(__ARMCC_VERSION) __asm unsigned long CPUcpsie(void) { // // Read PRIMASK and enable interrupts. // mrs r0, PRIMASK; cpsie i; bx lr } #endif
部分 API 函数和头文件有了变化。
是不是跟使用的编译器有关咧?
IntMasterEnable()函数是在interrupt.c里定义的,如下:
tBoolean
IntMasterEnable(void)
{
//
// Enable processor interrupts.
//
return(CPUcpsie());
}
CPUcpsie()是在cpu.c里定义的,如下:
//*****************************************************************************
//
// Wrapper function for the CPSIE instruction. Returns the state of PRIMASK
// on entry.
//
//*****************************************************************************
#if defined(codered) || defined(gcc) || defined(sourcerygxx)
unsigned long __attribute__((naked))
CPUcpsie(void)
{
unsigned long ulRet;
//
// Read PRIMASK and enable interrupts.
//
__asm(" mrs %0, PRIMASK "
" cpsie i "
" bx lr "
: "=r" (ulRet));
//
// The return is handled in the inline assembly, but the compiler will
// still complain if there is not an explicit return here (despite the fact
// that this does not result in any code being produced because of the
// naked attribute).
//
return(ulRet);
}
#endif
#if defined(ewarm)
unsigned long
CPUcpsie(void)
{
//
// Read PRIMASK and enable interrupts.
//
__asm(" mrs r0, PRIMASK "
" cpsie i ");
//
// "Warning[Pe940]: missing return statement at end of non-void function"
// is suppressed here to avoid putting a "bx lr" in the inline assembly
// above and a superfluous return statement here.
//
#pragma diag_suppress=Pe940
}
#pragma diag_default=Pe940
#endif
#if defined(rvmdk) || defined(__ARMCC_VERSION)
__asm unsigned long
CPUcpsie(void)
{
//
// Read PRIMASK and enable interrupts.
//
mrs r0, PRIMASK;
cpsie i;
bx lr
}
#endif
在使用EWARM或RVMDK时,CPUcpsie()是没有返回值的,换换开发环境测试下。
那几句汇编语句,我没看懂, ,有待查证,呵呵。
我在 EEWROLD 上下的那个工程是基于 Luminary 之前很早的库,安装了新的 Keil 之后就产生了问题。
但是 Keil 里的库也还是没有 StellarisWare 里边新。所以我把一些文件复制调整后就好了。
这个问题一般很少遇到。
所以也请朋友们注意一下。
一周热门 更多>