]> git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/cdb/IOCDBCommand.h
xnu-123.5.tar.gz
[apple/xnu.git] / iokit / IOKit / cdb / IOCDBCommand.h
1 /*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 *
24 * IOCDBCommand.h
25 *
26 */
27 #ifndef _IOCDBCOMMAND_H
28 #define _IOCDBCOMMAND_H
29
30 #include <IOKit/IOCommand.h>
31
32 typedef void (*CallbackFn)(void *target, void *refcon );
33
34 class IOCDBDevice;
35
36 class IOCDBCommand : public IOCommand
37 {
38 OSDeclareAbstractStructors(IOCDBCommand)
39
40 /*------------------Methods provided to IOCDBCommand users -------------------------*/
41 public:
42 /*
43 * Set/Get IOMemoryDescriptor object to I/O data buffer or sense data buffer.
44 */
45 virtual void setPointers( IOMemoryDescriptor *desc,
46 UInt32 transferCount,
47 bool isWrite,
48 bool isSense = false ) = 0;
49
50 virtual void getPointers( IOMemoryDescriptor **desc,
51 UInt32 *transferCount,
52 bool *isWrite,
53 bool isSense = false ) = 0;
54 /*
55 * Set/Get command timeout (mS)
56 */
57 virtual void setTimeout( UInt32 timeoutmS ) = 0;
58 virtual UInt32 getTimeout() = 0;
59
60 /*
61 * Set async callback routine. Specifying no parameters indicates synchronous call.
62 */
63 virtual void setCallback( void *target = 0, CallbackFn callback = 0, void *refcon = 0 ) = 0;
64
65 /*
66 * Set/Get CDB information. (Generic CDB version)
67 */
68 virtual void setCDB( CDBInfo *cdbInfo ) = 0;
69 virtual void getCDB( CDBInfo *cdbInfo ) = 0;
70
71 /*
72 * Get CDB results. (Generic CDB version)
73 */
74 virtual IOReturn getResults( CDBResults *cdbResults ) = 0;
75
76 /*
77 * Get CDB Device this command is directed to.
78 */
79 virtual IOCDBDevice *getDevice( IOCDBDevice *deviceType ) = 0;
80 #define kIOCDBDevice ((IOCDBDevice *)0)
81
82 /*
83 * Command verbs
84 */
85 virtual bool execute( UInt32 *sequenceNumber = 0 ) = 0;
86 virtual void abort( UInt32 sequenceNumber ) = 0;
87 virtual void complete() = 0;
88
89 /*
90 * Get pointers to client and command data.
91 */
92 virtual void *getCommandData() = 0;
93 virtual void *getClientData() = 0;
94
95 /*
96 * Get unique sequence number assigned to command.
97 */
98 virtual UInt32 getSequenceNumber() = 0;
99 };
100
101 #endif