A special keyword may be associated with a block or a function declaring it as critical. SDCC will generate code to disable all interrupts upon entry to a critical function and restore the interrupt enable to the previous state before returning. Nesting critical functions will need one additional byte on the stack for each call.
int foo () __criticalThe critical attribute maybe used with other attributes like reentrant. The keyword critical may also be used to disable interrupts more locally:
__critical{ i++; }More than one statement could have been included in the block.
2008-02-29 |