Updated PCI IDs to latest snapshot.
[tangerine.git] / arch / ppc-sam440 / exec / signal.c
blob963f9ef31468d8cd6b20fc40eb444bf2b721811f
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Send some signal to a given task
6 Lang: english
7 */
9 #include <exec/execbase.h>
10 #include <aros/libcall.h>
11 #include <proto/exec.h>
12 #include <aros/debug.h>
14 /*****************************************************************************
16 NAME */
18 AROS_LH2(void, Signal,
20 /* SYNOPSIS */
21 AROS_LHA(struct Task *, task, A1),
22 AROS_LHA(ULONG, signalSet, D0),
24 /* LOCATION */
25 struct ExecBase *, SysBase, 54, Exec)
27 /* FUNCTION
28 Send some signals to a given task. If the task is currently waiting
29 on these signals, has a higher priority as the current one and if
30 taskswitches are allowed the new task begins to run immediately.
32 INPUTS
33 task - Pointer to task structure.
34 signalSet - The set of signals to send to the task.
36 RESULT
38 NOTES
39 This function may be used from interrupts.
41 EXAMPLE
43 BUGS
45 SEE ALSO
46 AllocSignal(), FreeSignal(), Wait(), SetSignal(), SetExcept()
48 INTERNALS
50 HISTORY
52 ******************************************************************************/
54 AROS_LIBFUNC_INIT
56 /* Protect the task lists against other tasks that may use Signal(). */
57 Disable();
59 /* Set the signals in the task structure. */
60 task->tc_SigRecvd|=signalSet;
62 /* Do those bits raise exceptions? */
63 if(task->tc_SigExcept&task->tc_SigRecvd)
65 /* Yes. Set the exception flag. */
66 task->tc_Flags|=TF_EXCEPT;
68 /* task is running? Raise the exception or defer it for later. */
69 if(task->tc_State==TS_RUN)
71 /* Are taskswitches allowed? (Don't count own Disable() here) */
72 if(SysBase->TDNestCnt>=0||SysBase->IDNestCnt>0)
73 /* No. Store it for later. */
74 SysBase->AttnResched|=0x80;
75 else
77 /* Switches are allowed. Move the current task away. */
78 // SysBase->ThisTask->tc_State=TS_READY;
79 // Enqueue(&SysBase->TaskReady,&SysBase->ThisTask->tc_Node);
81 /* And force a rescedule. */
82 Reschedule(task);
85 /* All done. */
86 Enable();
87 return;
92 Is the task receiving the signals waiting on them
93 (or on a exception) ?
96 if((task->tc_State==TS_WAIT)&&
97 (task->tc_SigRecvd&(task->tc_SigWait|task->tc_SigExcept)))
99 /* Yes. Move him to the ready list. */
100 task->tc_State=TS_READY;
101 Remove(&task->tc_Node);
102 Enqueue(&SysBase->TaskReady,&task->tc_Node);
104 /* Has it a higher priority as the current one? */
105 if(task->tc_Node.ln_Pri>SysBase->ThisTask->tc_Node.ln_Pri)
108 Yes. A taskswitch is necessary. Prepare one if possible.
109 (If the current task is not running it is already moved)
111 if(SysBase->ThisTask->tc_State==TS_RUN)
113 /* Are taskswitches allowed? */
114 if(SysBase->TDNestCnt>=0||SysBase->IDNestCnt>0)
116 /* No. Store it for later. */
117 SysBase->AttnResched|=0x80;
119 else
121 /* Switches are allowed. Move the current task away. */
122 //SysBase->ThisTask->tc_State=TS_READY;
123 //Enqueue(&SysBase->TaskReady,&SysBase->ThisTask->tc_Node);
125 /* And force a rescedule. */
126 Reschedule(task);
132 Enable();
133 AROS_LIBFUNC_EXIT