1/*
2 * Copyright (c) 1998-2001 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#ifndef _IOKIT_IOFireWireAVCCommand_H
23#define _IOKIT_IOFireWireAVCCommand_H
24
25#include <IOKit/firewire/IOFWCommand.h>
26
27/*! @class IOFireWireAVCCommand
28*/
29class IOFireWireAVCCommand : public IOFWCommand
30{
31    OSDeclareDefaultStructors(IOFireWireAVCCommand)
32
33protected:
34    IOFWCommand 		*fWriteCmd;
35    IOMemoryDescriptor	*fMem;
36    const UInt8 		*fCommand;
37
38    UInt32 	fCmdLen;
39    UInt8 	*fResponse;
40    UInt32 	*fResponseLen;
41    int		fCurRetries;
42    int		fMaxRetries;
43
44    UInt32	fWriteGen;
45    UInt16	fWriteNodeID;
46    bool	bypassRobustCommandResponseMatching;
47
48/*! @struct ExpansionData
49    @discussion This structure will be used to expand the capablilties of the class in the future.
50    */
51    struct ExpansionData {
52		bool 	fStarted;
53		bool 	fSyncWakeupSignaled;
54	};
55
56/*! @var reserved
57    Reserved for future use.  (Internal use only)  */
58    ExpansionData *fIOFireWireAVCCommandExpansion;
59
60    static void writeDone(void *refcon, IOReturn status, IOFireWireNub *device, IOFWCommand *fwCmd);
61
62    virtual IOReturn	complete(IOReturn status);
63    virtual IOReturn	execute();
64    virtual void		free();
65
66public:
67    virtual bool init(IOFireWireNub *device, const UInt8 * command, UInt32 cmdLen,
68                                                    UInt8 * response, UInt32 * responseLen);
69    virtual IOReturn reinit(IOFireWireNub *device, const UInt8 * command, UInt32 cmdLen,
70                                                    UInt8 * response, UInt32 * responseLen);
71
72    static IOFireWireAVCCommand *withNub(IOFireWireNub *device, const UInt8 * command, UInt32 cmdLen,
73                                                    UInt8 * response, UInt32 * responseLen);
74
75    static IOFireWireAVCCommand *withNub(IOFireWireNub *device, UInt32 generation,
76                const UInt8 * command, UInt32 cmdLen, UInt8 * response, UInt32 * responseLen);
77
78    virtual UInt32 handleResponse(UInt16 nodeID, UInt32 len, const void *buf);
79
80    virtual IOReturn resetInterimTimeout();
81
82	virtual UInt32 handleResponseWithSimpleMatching(UInt16 nodeID, UInt32 len, const void *buf);
83
84    virtual IOReturn 	submit(bool queue = false);
85
86private:
87    OSMetaClassDeclareReservedUsed(IOFireWireAVCCommand, 0);
88    OSMetaClassDeclareReservedUnused(IOFireWireAVCCommand, 1);
89    OSMetaClassDeclareReservedUnused(IOFireWireAVCCommand, 2);
90    OSMetaClassDeclareReservedUnused(IOFireWireAVCCommand, 3);
91};
92
93#endif // _IOKIT_IOFireWireAVCCommand_H
94
95