OSIntEnter
Description
OSIntEnter()
notifies µC/OS-III that an ISR is being processed. This allows µC/OS-III to keep track of interrupt nesting. OSIntEnter()
is used in conjunction with OSIntExit()
. This function is generally called at the beginning of ISRs. Note that on some CPU architectures, it must be written in assembly language (shown below in pseudo code):
MyISR: Save CPU registers; OSIntEnter(); /* Or, OSIntNestingCtr++ */ : Process ISR; : OSIntExit(); Restore CPU registers; Return from interrupt;
Files
os.h/os_core.c
Prototype
void OSIntEnter (void)
Arguments
None
Returned Values
None
Required Configuration
None
Callers
ISRs only.
Notes/Warnings
- This function must not be called by task-level code.
- You can also increment the interrupt-nesting counter (
OSIntNestingCtr
) directly in the ISR to avoid the overhead of the function call/return. It is safe to incrementOSIntNestingCtr
in the ISR since interrupts are assumed to be disabled whenOSIntNestingCtr
is incremented. However, that is not true for all CPU architectures. You need to make sure that interrupts are disabled in the ISR before directly incrementingOSIntNestingCtr
. - It is possible to nest interrupts up to 250 levels deep.