Support rastport clipping rectangle for layerless rastports
[tangerine.git] / rom / exec / addtask.c
blobedf6f0ae821b89699ccd8bff544fe434bbcd3c87
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Add a task.
6 Lang: english
7 */
8 #include <exec/execbase.h>
9 #include <exec/memory.h>
10 #include <aros/libcall.h>
11 #include <aros/config.h>
12 #include <proto/exec.h>
13 #include "etask.h"
14 #include "exec_util.h"
16 #include "exec_debug.h"
17 #ifndef DEBUG_AddTask
18 # define DEBUG_AddTask 0
19 #endif
20 #undef DEBUG
21 #if DEBUG_AddTask
22 # define DEBUG 1
23 #endif
24 #include <aros/debug.h>
26 /*****************************************************************************
28 NAME */
30 AROS_LH3(APTR, AddTask,
32 /* SYNOPSIS */
33 AROS_LHA(struct Task *, task, A1),
34 AROS_LHA(APTR, initialPC, A2),
35 AROS_LHA(APTR, finalPC, A3),
37 /* LOCATION */
38 struct ExecBase *, SysBase, 47, Exec)
40 /* FUNCTION
41 Add a new task to the system. If the new task has the highest
42 priority of all and task switches are allowed it will be started
43 immediately.
45 You must initialise certain fields, and allocate a stack before
46 calling this function. The fields that must be initialised are:
47 tc_SPLower, tc_SPUpper, tc_SPReg, and the tc_Node structure.
49 If any other fields are initialised to zero, then they will be
50 filled in with the system defaults.
52 The value of tc_SPReg will be used as the location for the stack
53 pointer. You can place any arguments you wish to pass to the Task
54 onto the stack before calling AddTask(). However note that you may
55 need to consider the stack direction on your processor.
57 Memory can be added to the tc_MemEntry list and will be freed when
58 the task dies. The new task's registers are set to 0.
60 INPUTS
61 task - Pointer to task structure.
62 initialPC - Entry point for the new task.
63 finalPC - Routine that is called if the initialPC() function
64 returns. A NULL pointer installs the default finalizer.
66 RESULT
67 The address of the new task or NULL if the operation failed.
69 NOTES
71 EXAMPLE
73 BUGS
75 SEE ALSO
76 RemTask()
78 INTERNALS
80 ******************************************************************************/
82 AROS_LIBFUNC_INIT
84 struct Task *t;
86 D(bug("Call AddTask (%08lx (\"%s\"), %08lx, %08lx)\n"
87 , task
88 , task->tc_Node.ln_Name
89 , initialPC
90 , finalPC
91 ));
93 t = NewAddTask(task, initialPC, finalPC, NULL);
95 ReturnPtr ("AddTask", struct Task *, t);
97 AROS_LIBFUNC_EXIT
98 } /* AddTask */