October 2017
Intermediate to advanced
586 pages
14h 8m
English
Tasks in the atomic context (such as ISR) can't sleep, and can't be scheduled; it is the reason why busy-wait loops are used for delaying purposes in an atomic context. The kernel exposes the Xdelay family of functions that will spend time in a busy loop, long enough(based on jiffies) to achieve the desired delay:
You should always use udelay() since ndelay() precision depends on how accurate your hardware timer is (not always the case on an embedded SOC). Use of mdelay() is also discouraged.
Timer handlers (callbacks) are executed in an atomic context, meaning that sleeping is not allowed at all. By sleeping, I mean any function that may ...