TASKNUM(3)

NAME
TASKNUM, TASKMASK, TASKCPU, TASKCPUMASK, TASKTCB, TASKDEV -- RCI task information macros.

USAGE
TASKNUM(td)
   RCI_DESC *td;

unsigned long TASKMASK(td)
   RCI_DESC *td;

TASKCPU(td)
   RCI_DESC *td;

unsigned long TASKCPUMASK(td)
   RCI_DESC *td;

RCI_TCB *TASKTCB(td)
   RCI_DESC *td;

IO_DEVICE *TASKDEV(td)
   RCI_DESC *td;

ARGUMENTS

td --
    Pointer to task descriptor.

DESCRIPTION
These macros obtain information about the RCI task from its descriptor, and may be called from any part of an RCI program.

TASKNUM() returns the task number, a small integer identifying the task to the system. This can be used by control routines as a index into an array of per-task data structures; the maximum value of this number is MAX_RCI_TASKS - 1.

TASKMASK() returns a bit code derived from the task number; combinations of these bit codes are used in creating "task bitmasks" that are used by some RCI routines (such as rciStart()).

TASKCPU() returns the CPU number describing the CPU that the task is resident on. 0 always denotes the arbiter CPU.

TASKCPUMASK() returns a bit code derived from the CPU number. This code can be used to form CPU selection masks for the function rciCreate(). For instance, if we want two tasks to run on the same CPU, we can do this:
        RCI_DESC *td1, *td2;

        td1 = rciCreate ("foo", 0);
        td2 = rciCreate ("bar", TASKCPUMASK(td1) )

TASKCPUMASK(td) and (1<<(TASKCPU(td))) are effectively equivalent.

TASKTCB() returns a pointer to the task control block, which contains parameters relating to the operation of the task.

TASKDEV() returns a pointer to the device assigned to the task (see IOdevice(7)).

SEE ALSO
RCI_TCB(3), IOdevice(7).