2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: AbortIO() - abort a running timer request.
8 #include "timer_intern.h"
10 #include <exec/errors.h>
12 /*****i***********************************************************************
15 #include <devices/timer.h>
16 #include <proto/exec.h>
17 #include <proto/timer.h>
19 AROS_LH1(LONG
, AbortIO
,
22 AROS_LHA(struct timerequest
*, timereq
, A1
),
25 struct TimerBase
*, TimerBase
, 6,Timer
)
28 Abort a running timer.device request.
31 timereq - The request you wish to abort.
34 0 if the request was aborted, io_Error will also be set
35 to the value IOERR_ABORTED.
37 -1 otherwise (most likely that the request isn't working).
39 If the request is successfully aborted, you should WaitIO() on
40 the message before you try and reuse it.
43 This function may be called from interrupts.
50 exec/AbortIO(), exec/WaitIO()
55 18-02-1997 iaint Implemented.
57 ******************************************************************************/
64 As the timer.device runs as an interrupt, we had better protect
65 the "waiting timers" list from being corrupted.
69 if(timereq
->tr_node
.io_Message
.mn_Node
.ln_Type
!= NT_REPLYMSG
)
71 timereq
->tr_node
.io_Error
= IOERR_ABORTED
;
73 /* We have to fix up the following request if it exists.
74 What we do is add the time remaining for the first request
75 to the second request.
78 #if 0 /* stegerg: ??? */
79 tr
= (struct timerequest
*)timereq
->tr_node
.io_Message
.mn_Node
.ln_Succ
;
80 if( tr
&& tr
->tr_node
.io_Message
.mn_Node
.ln_Succ
!= 0 )
82 tr
->tr_time
.tv_secs
+= timereq
->tr_time
.tv_secs
;
83 tr
->tr_time
.tv_micro
+= timereq
->tr_time
.tv_micro
;
88 XXX: If this is the first in the list, we have to resend
89 XXX the wait request. I can't do that from here yet.
92 if( timereq
->tr_node
.io_Message
.mn_Node
.ln_Pred
== NULL
)
95 Remove((struct Node
*)timereq
);
96 ReplyMsg((struct Message
*)timereq
);