1/*
2 * Copyright (c) 1998-2007 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#ifndef _IOKIT_IOFWUSERVECTORCOMMAND_H_
24#define _IOKIT_IOFWUSERVECTORCOMMAND_H_
25
26// private
27#import "IOFireWireUserClient.h"
28
29// system
30#import <libkern/c++/OSObject.h>
31
32#pragma mark -
33
34class IOFWUserVectorCommand : public OSObject
35{
36	OSDeclareDefaultStructors( IOFWUserVectorCommand );
37
38	protected:
39		IOFireWireUserClient *		fUserClient;
40		IOFireWireController *		fControl;
41
42		IOMemoryDescriptor *		fSubmitDesc;
43		IOMemoryDescriptor *		fResultDesc;
44
45		int							fInflightCmds;
46		mach_vm_size_t				fResultOffset;
47
48		OSAsyncReference64			fAsyncRef;
49		IOReturn					fVectorStatus;
50
51	public:
52
53		// factory
54		static IOFWUserVectorCommand *		withUserClient( IOFireWireUserClient * inUserClient );
55
56		// ctor/dtor
57		virtual bool	initWithUserClient( IOFireWireUserClient * inUserClient );
58		virtual void	free( void );
59
60		IOReturn		setBuffers(	mach_vm_address_t submit_buffer_address, mach_vm_size_t submit_buffer_size,
61									mach_vm_address_t result_buffer_address, mach_vm_size_t result_buffer_size );
62		IOReturn		submit( OSAsyncReference64 async_ref, mach_vm_address_t callback, io_user_reference_t refCon );
63
64		void			asyncCompletion(	void *					refcon,
65											IOReturn 				status,
66											IOFireWireNub *			device,
67											IOFWCommand *			fwCmd );
68
69		void			asyncPHYCompletion(	void *					refcon,
70											IOReturn 				status,
71											IOFireWireBus *			bus,
72											IOFWAsyncPHYCommand *	fwCmd );
73
74	protected:
75		IOReturn		submitOneCommand( CommandSubmitParams * params );
76
77};
78
79#endif