RTEMS Logo

RTEMS 4.9.5 On-Line Library


Task Manager Building a Mode and Mask

PREV UP NEXT Bookshelf RTEMS Ada User's Guide

5.2.10: Building a Mode and Mask

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) or RTEMS.NO_PREEMPT to indicate the desired preemption mode and interrupt level, while the mask parameter should be set to RTEMS.INTERRUPT_MASK or RTEMS.NO_PREEMPT_MASK to indicate that the calling task's interrupt level and preemption mode are being altered.


PREV UP NEXT Bookshelf RTEMS Ada User's Guide

Copyright © 1988-2008 OAR Corporation