Indentation fix, cleanup.
[AROS.git] / rom / exec / doio.c
blob17933fcd213c52b94fb672678ee5cfce8224dc2e
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Start an IO request and wait until it completes.
6 Lang: english
7 */
8 #include <exec/execbase.h>
9 #include <exec/io.h>
10 #include <aros/libcall.h>
11 #include <proto/exec.h>
12 #include <aros/debug.h>
14 /*****************************************************************************
16 NAME */
18 AROS_LH1(LONG, DoIO,
20 /* SYNOPSIS */
21 AROS_LHA(struct IORequest *, iORequest, A1),
23 /* LOCATION */
24 struct ExecBase *, SysBase, 76, Exec)
26 /* FUNCTION
27 Start an I/O request by calling the devices's BeginIO() vector.
28 It waits until the request is complete.
30 INPUTS
31 iORequest - Pointer to iorequest structure.
33 RESULT
35 NOTES
36 OpenDevice() notes explain LONG return type.
38 EXAMPLE
40 BUGS
42 SEE ALSO
43 OpenDevice(), CloseDevice(), DoIO(), SendIO(), AbortIO(), WaitIO()
45 INTERNALS
47 ******************************************************************************/
49 AROS_LIBFUNC_INIT
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))
72 WaitIO(iORequest);
74 /* All done. Get returncode. */
75 return iORequest->io_Error;
76 AROS_LIBFUNC_EXIT
77 } /* DoIO */