I'm developing software for an ARM Cortex M3 (NXP LPC1769) microncontroller. At the moment I'm searching for a mechansim to detect if my function is called within an ISR. I asume that I have to check a register. Based on this information I would like to call difficult functions.
I already checked the reference manual, if there is a register containing the necessary information.
For example I tried to detect if I'm called from an ISR (I used SysTick-ISR) based on the "Interrupt Active Bit Register" (IABR) register. This register should be != 0 if an ISR is active. But the value was 0x00000000. This implies that no interrupt is active. Besides this test I checked the NVIC and SC register in the reference manual searching for a register containing the necessary flag but I didn't found one.
Does anybody know a suitable register / mechanism for my problem?
os_evt_setandisr_evt_set; when writing reusable code, it may not always be possible to predict what contexts it might be used in in the future so you might create a genericevt_setwrapper, which can be used anywhere. Also the OS will behave incorrectly if the wrong API is accidentally called, so run-time selection is safer at the expense of a small overhead. - Clifford