#define __bsp_ISTATE_T__ istate_t
#define __bsp_ENABLE_INTERRUPTS__() __enable_interrupt()
#define __bsp_DISABLE_INTERRUPTS__() __disable_interrupt()
#define __bsp_INTERRUPTS_ARE_ENABLED__() (__get_SR_register() & GIE)
#define __bsp_GET_ISTATE__() __get_interrupt_state()
#define __bsp_RESTORE_ISTATE__(x) __set_interrupt_state(x)
typedef __bsp_ISTATE_T__ bspIState_t;
#define BSP_ENTER_CRITICAL_SECTION(x) st( x = __bsp_GET_ISTATE__(); __bsp_DISABLE_INTERRUPTS__(); )
#define BSP_EXIT_CRITICAL_SECTION(x) __bsp_RESTORE_ISTATE__(x)
#define BSP_CRITICAL_STATEMENT(x) st( bspIState_t s; \
BSP_ENTER_CRITICAL_SECTION(s); \
x; \
BSP_EXIT_CRITICAL_SECTION(s); )
这里的istate_t 好像是IAR内部定义的类型,请问在IAR中是个什么类型, 这里的x 是GIE的状态吗 还是其它什么的状态?
有时候会这样用到:
bspIState_t intState;
BSP_ENTER_CRITICAL_SECTION(intState);
sJoinSem--;
BSP_EXIT_CRITICAL_SECTION(intState); |