TSK_create
2-484
TSK_exit is automatically called if and when the task returns from fxn.
If attrs is NULL, the new task is assigned a default set of attributes.
Otherwise, the task’s attributes are specified through a structure of type
TSK_Attrs, which is defined as follows.
struct TSK_Attrs { /* task attributes */
Int priority; /* execution priority */
Ptr stack; /* pre-allocated stack */
size_t stacksize; /* stack size in MADUs */
#ifdef _55_
size_t sysstacksize; /*C55x sysstack in MADUs */
#endif
Int stackseg; /* mem seg for stack alloc */
Ptr environ; /* global environ data struct */
String name; /* printable name */
Bool exitflag; /* prog termination requires */
/* this task to terminate */
Bool
initstackflag; /* initialize task stack? */
};
The priority attribute specifies the task’s execution priority and must be
less than or equal to TSK_MAXPRI (15); this attribute defaults to the
value of the configuration parameter Default task priority (preset to
TSK_MINPRI). If priority is less than 0, the task is barred from execution
until its priority is raised at a later time by TSK_setpri. A priority value of
0 is reserved for the TSK_idle task defined in the default configuration.
You should not use a priority of 0 for any other tasks.
The stack attribute specifies a pre-allocated block of stacksize MADUs to
be used for the task’s private stack; this attribute defaults to NULL, in
which case the task’s stack is automatically allocated using MEM_alloc
from the memory segment given by the stackseg attribute. If you specify
a pre-allocated stack for ’C55x, the buffer must be attrs.stacksize plus
attrs.sysstacksize in length.
The stacksize attribute specifies the number of MADUs to be allocated
for the task’s private stack; this attribute defaults to the value of the
configuration parameter Default stack size (preset to 1024). Each stack
must be large enough to handle normal subroutine calls as well as a
single task preemption context. A task preemption context is the context
that gets saved when one task preempts another as a result of an
interrupt thread readying a higher priority task.
The sysstacksize attribute specifies a pre-allocated block of the specified
number of MADUs to be used for the task’s private system stack. This
attribute defaults to NULL, in which case the task’s system stack is
automatically allocated using MEM_alloc from the memory segment
given by the stackseg attribute. The sysstacksize attribute specifies the