2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Start an IO request and wait until it completes.
8 #include <exec/execbase.h>
10 #include <aros/libcall.h>
11 #include <proto/exec.h>
12 #include <aros/debug.h>
14 /*****************************************************************************
21 AROS_LHA(struct IORequest
*, iORequest
, A1
),
24 struct ExecBase
*, SysBase
, 76, Exec
)
27 Start an I/O request by calling the devices's BeginIO() vector.
28 It waits until the request is complete.
31 iORequest - Pointer to iorequest structure.
36 OpenDevice() notes explain LONG return type.
43 OpenDevice(), CloseDevice(), DoIO(), SendIO(), AbortIO(), WaitIO()
47 ******************************************************************************/
52 Prepare the message. Tell the device that it is OK to wait in the
53 BeginIO() call by setting the quick bit.
55 ASSERT_VALID_PTR(iORequest
);
56 if (!iORequest
) return -1;
58 iORequest
->io_Flags
=IOF_QUICK
;
59 iORequest
->io_Message
.mn_Node
.ln_Type
=0;
61 ASSERT_VALID_PTR(iORequest
->io_Device
);
62 if (!iORequest
->io_Device
) return -1;
64 /* Call BeginIO() vector */
65 AROS_LVO_CALL1NR(void,
66 AROS_LCA(struct IORequest
*,iORequest
,A1
),
67 struct Device
*,iORequest
->io_Device
,5,
70 /* If the quick flag is cleared it wasn't done quickly. Wait for completion. */
71 if(!(iORequest
->io_Flags
&IOF_QUICK
))
74 /* All done. Get returncode. */
75 return iORequest
->io_Error
;