In general, a mode and its corresponding mask is built by a bitwise OR of the desired components. The set of valid mode constants and each mode's corresponding mask constant is listed below:
Mode Constant | Mask Constant | Description |
RTEMS_PREEMPT | RTEMS_PREEMPT_MASK | enables preemption |
RTEMS_NO_PREEMPT | RTEMS_PREEMPT_MASK | disables preemption |
RTEMS_NO_TIMESLICE | RTEMS_TIMESLICE_MASK | disables timeslicing |
RTEMS_TIMESLICE | RTEMS_TIMESLICE_MASK | enables timeslicing |
RTEMS_ASR | RTEMS_ASR_MASK | enables ASR processing |
RTEMS_NO_ASR | RTEMS_ASR_MASK | disables ASR processing |
RTEMS_INTERRUPT_LEVEL(0) | RTEMS_INTERRUPT_MASK | enables all interrupts |
RTEMS_INTERRUPT_LEVEL(n) | RTEMS_INTERRUPT_MASK | sets interrupts level n |
Mode values are specifically designed to be mutually exclusive, therefore
bitwise OR and addition operations are equivalent as long as each mode
appears exactly once in the component list. A mode component listed as a
default is not required to appear in the mode component list, although it
is a good programming practice to specify default components. If all
defaults are desired, the mode RTEMS_DEFAULT_MODES
and the
mask RTEMS_ALL_MODE_MASKS
should be used.
The following example demonstrates the mode and mask parameters used with
the rtems_task_mode
directive to place a task at interrupt level 3 and make it
non-preemptible. The mode should be set to
RTEMS_INTERRUPT_LEVEL(3) | RTEMS_NO_PREEMPT
to indicate the desired preemption mode and
interrupt level, while the mask parameter should be set to
RTEMS_INTERRUPT_MASK | RTEMS_NO_PREEMPT_MASK
to indicate that the calling task's
interrupt level and preemption mode are being altered.
Copyright © 1988-2007OAR Corporation