\input manualMacros.tex
\manBegin
\manPageInfo{RCI Reference Manual}{}{}
\manTitle{TASKNUM}{3}
\manSection{NAME}
{\rightskip=0ptplus1fil
{\tt \manName{TASKNUM}},
{\tt \manName{TASKMASK}},
{\tt \manName{TASKCPU}},
{\tt \manName{TASKCPUMASK}},
{\tt \manName{TASKTCB}},
{\tt \manName{TASKDEV}}
-- RCI task information macros.

}
\manSection{USAGE}
\cverbatim
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; @endcverbatim
\manSection{ARGUMENTS}
\manItem{{\tt td} --}
Pointer to task descriptor.
\manSection{DESCRIPTION}
These macros obtain information about the RCI task from its descriptor,
and may be called from any part of an RCI program.

{\tt TASKNUM()} returns the {\it 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
{\tt MAX_RCI_TASKS} - 1.

{\tt 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 {\tt rciStart()}).

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

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

        td1 = rciCreate ("foo", 0);
        td2 = rciCreate ("bar", TASKCPUMASK(td1) )  @endcverbatim
{\tt TASKCPUMASK(td)} and {\tt (1<<(TASKCPU(td)))} are effectively
equivalent.

{\tt TASKTCB()} returns a pointer to the {\it task control block},
which contains parameters relating to the operation of the
task.

{\tt TASKDEV()} returns a pointer to the device assigned to the
task (see {\tt IOdevice\-(7)}).
\manSection{SEE ALSO}
\raggedright
{\tt RCI_TCB(3)}, {\tt IOdevice(7)}.
\manEnd
\end
