lpmay wrote on Thursday, February 23, 2017:
I’m looking for clarification whether it is safe to call “FromISR” functions from outside an ISR. Below is the broader context of what I’m trying to do that is leading to this question.
I’m writing a software module which uses time from a RTC. My module has a task which consumes commands from a queue (very similar to the software timers in FreeRTOS). One of the functions in my API is called to indicate an RTC alarm went off, and loads a command into the queue. I want to abstract my module to work with several RTCs. If it is an internal RTC, this alarm function will likely be called from an ISR context and I would use the “FromISR” functions. However, if I’m using an external RTC, the interrupt source may have to be read over I2C or another slow bus before I can categorize it as the alarm going off - something I do not want to do in the ISR context. If my code still calls the “FromISR” functions in this case can that corrupt the kernel? I could #define my way through this, but I’d prefer to limit the amount of configuration users need to put in to use this code.
Thanks for your help!