Permissible functions in an ISR


Hi All,
The Question is: Are there documented restrictions on what operations can be performed inside an ISR? Specifically on T4.0

I thought that there were some timing functions that cannot function properly inside an ISR.
For example, can delayNanoseconds() be called inside an ISR?

It would be useful to have a list of prohibited ops in an ISR. Maybe one exists somewhere, but I havent seen any such discussion

Thanks for any insight you may have.
Anything that waits for (lower priority) interrupts can be an issue, but more generally avoid anything
that takes a lot of time or may block (ie does busy-waiting for anything that's not guaranteed to
happen promptly).

Waiting for interrupts is the worst as it may deadlock the processor. For instance delay() may busy wait for
clock interrupts - worth finding the source code if you want to be sure, delay.c in

Sometimes you are able to enable interrupts early in the ISR (before returning), but you'll need to
understand what re-entrancy means to safely do this as the remainder of the routine has to be
re-entrant (i.e. it may end up running in multiple incarnations simultaneously, and should handle this

Usually an ISR should do the minimum necessary to service the hardware (often just placing an
input entry on a queue or setting a flag). The higher the priority of interrupt the more this matters,
so chosing priorities logically can be important if there's lots going on.

If the ISR is clock driven its normally to drive regular input or output, typically from a queue or buffer.
Any other need for regular operations doesn't need an interrupt, although if you have very low priority
timer interrupts its often handy to act as a simple scheduler, but then you may end up having to make
all sorts of things volatile as a result.
Besides timing and deadlocks, the slightly simplified answer is don't call any non-re-entrant function that might be called from elsewhere. I don't know of a list and non-re-entrant can be hard to spot. And the bugs introduced can be quite rare but severe.