TSK_create
Application Program Interface
2-483
C Interface
Syntax
task = TSK_create(fxn, attrs, [arg,] ...);
Parameters
Fxn
fxn;
/* pointer to task function */
TSK_Attrs
*attrs;
/* pointer to task attributes */
Arg
arg;
/* task arguments */
Return Value
TSK_Handle task;
/* task object handle */
Description
TSK_create creates a new task object. If successful, TSK_create returns
the handle of the new task object. If unsuccessful, TSK_create returns
NULL unless it aborts (for example, because it directly or indirectly calls
SYS_error, and SYS_error is configured to abort).
The fxn parameter uses the Fxn type to pass a pointer to the function the
TSK object should run. For example, if myFxn is a function in your
program, you can create a TSK object to call that function as follows:
task = TSK_create((Fxn)myFxn, NULL);
You can use Tconf to specify an application-wide Create function that
runs whenever a task is created. This includes tasks that are created
statically and those created dynamically using TSK_create. The default
Create function is a no-op function.
For TSK objects created statically, the Create function is called during the
BIOS_start portion of the program startup process, which runs after the
main() function and before the program drops into the idle loop.
For TSK objects created dynamically, the Create function is called after
the task handle has been initialized but before the task has been placed
on its ready queue.
Any DSP/BIOS function can be called from the Create function.
DSP/BIOS passes the task handle of the task being created to the Create
function. The Create function declaration should be similar to this:
Void myCreateFxn(TSK_Handle task);
The new task is placed in TSK_READY mode, and is scheduled to begin
concurrent execution of the following function call:
(*fxn)(arg1, arg2, ... argN) /* N = TSK_MAXARGS = 8 */
As a result of being made ready to run, the task runs the application-wide
Ready function if one has been specified.
TSK_create
Create a task ready for execution