#include <ctl_api.h> extern unsigned ctl_interrupt_count;
The ctl_interrupt_count variable contains a count of the interrupt nesting level. This variable must be incremented on entry to an interrupt service routine and will be decremented when ctl_exit_isr is invoked.
ctl_interrupt_count is provided in every implementation of the CrossWorks tasking library.