renesas-rx

Is the following “flag” variable access safe between interrupt and user code?

浪尽此生 提交于 2019-12-12 10:59:01
问题 We have inherited a project which targets Renesas RX231 microcontroller that I have been looking at. This uC has only one instruction that locks the bus for atomicity (XCHG). Because the processor is the only component that accesses RAM memory (no DMA or DTC being used), to manipulate variables in user code that are shared with interrupts, the interrupts are disabled (in the processor status word register) for the access time i.e. disable_interrupts(); /* set_psw(get_psw() & ~(1 << 16)); */ /