add place-holder directory for the a3000 wd533c93 scsi controller implementation.
[AROS.git] / rom / devs / scsi / waitto.c
blobd4a16e6d65926cf51408dca611c317f9e168e3b8
1 /*
2 Copyright © 2013-2014, The AROS Development Team. All rights reserved
3 $Id: waitto.c 55802 2019-03-08 21:47:59Z wawa $
4 */
6 #include <aros/debug.h>
8 #include <proto/exec.h>
10 /* We want all other bases obtained from our base */
11 #define __NOLIBBASE__
13 #include <proto/timer.h>
15 #include <exec/types.h>
16 #include <devices/timer.h>
17 #include <exec/io.h>
19 #include "timer.h"
20 #include "scsi.h"
22 /* Waits for a signal or a timeout */
23 ULONG scsi_WaitTO(struct IORequest* tmr, ULONG secs, ULONG micro, ULONG sigs)
25 ULONG sig = 1 << tmr->io_Message.mn_ReplyPort->mp_SigBit;
27 D(struct Node *t = (struct Node *)FindTask(NULL));
28 D(bug("[SCSI ] Timed wait %lds %ldu (task='%s')\n", secs, micro,
29 t->ln_Name));
31 tmr->io_Command = TR_ADDREQUEST;
32 ((struct timerequest*)tmr)->tr_time.tv_secs = secs;
33 ((struct timerequest*)tmr)->tr_time.tv_micro = micro;
35 SendIO(tmr);
36 D(bug("[SCSI ] Preset signals: %lx ('%s')\n", SetSignal(0, 0), t->ln_Name));
37 D(bug("[SCSI ] Signals requested: %lx ('%s')\n", sigs, t->ln_Name));
38 D(bug("[SCSI ] Timer signal: %lx ('%s')\n", sig, t->ln_Name));
39 sigs = Wait(sigs | sig);
40 D(bug("[SCSI ] Signals received: %lx ('%s')\n", sigs, t->ln_Name));
41 if (0 == (sigs & sig))
43 if (!CheckIO(tmr))
44 AbortIO(tmr);
46 WaitIO(tmr);
48 SetSignal(0, sig);
50 return sigs & ~sig;