Porting Guide - Interrupt Handlers

The only ISR required for an Atomthreads port is the timer tick, described here. If you wish to add your own ISRs, and you expect to make any operating system calls (such as to post a semaphore to signal a thread), then you must call atomIntEnter() and atomIntExit() on entry to and exit from the ISR. This allows the scheduler to run on ISR exit to handle any thread rescheduling that has taken place due to your OS calls, for example to wake up a thread which has now been made ready by a semaphore post. It also provides some book-keeping by keeping the RTOS kernel informed about what context the system is currently running in (i.e. thread context or interrupt context), and thus prevents errors like calls being made to an OS routine which blocks while at interrupt context.

If you know that a particular interrupt handler will never make an OS kernel call, and do not require the scheduler to be run on exit from the ISR, then you may skip these calls.