revert between 56095 -> 55830 in arch
[AROS.git] / arch / m68k-amiga / timer / abortio.c
blob05a0abf241369d7d2954607aae4fd31e42ffcaee
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: AbortIO() - abort a running timer request.
6 Lang: english
7 */
8 #include <timer_intern.h>
9 #include <exec/io.h>
10 #include <exec/errors.h>
12 #include <devices/timer.h>
13 #include <proto/exec.h>
14 #include <proto/timer.h>
16 /* See rom/timer/abortio.c for documentation */
18 AROS_LH1(LONG, AbortIO,
19 AROS_LHA(struct timerequest *, timereq, A1),
20 struct TimerBase *, TimerBase, 6,Timer)
22 AROS_LIBFUNC_INIT
24 LONG ret = -1;
27 As the timer.device runs as an interrupt, we had better protect
28 the "waiting timers" list from being corrupted.
31 Disable();
32 if(timereq->tr_node.io_Message.mn_Node.ln_Type != NT_REPLYMSG)
34 ULONG unit = (ULONG)timereq->tr_node.io_Unit;
35 timereq->tr_node.io_Error = IOERR_ABORTED;
36 Remove((struct Node *)timereq);
37 if (unit == UNIT_WAITUNTIL || unit == UNIT_VBLANK) {
38 if (IsListEmpty(&TimerBase->tb_Lists[UNIT_VBLANK]))
39 TimerBase->tb_vblank_on = FALSE;
40 } else {
41 if (IsListEmpty(&TimerBase->tb_Lists[UNIT_MICROHZ]))
42 TimerBase->tb_micro_on = FALSE;
44 ReplyMsg((struct Message *)timereq);
45 ret = 0;
47 Enable();
50 return ret;
52 AROS_LIBFUNC_EXIT
53 } /* AbortIO */