1/*
2 * Copyright (c) 1998-2002 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 *  IOFireWireLibIRMAllocation.h
24 *  IOFireWireFamily
25 *
26 *  Created by Andy on 02/06/07.
27 *  Copyright (c) 2007 Apple Computer, Inc. All rights reserved.
28 *
29 *	$Log: IOFireWireLibIRMAllocation.h,v $
30 *	Revision 1.3  2007/02/16 17:41:01  ayanowit
31 *	More Leopard changes.
32 *
33 *	Revision 1.2  2007/02/15 22:02:38  ayanowit
34 *	More fixes for new IRMAllocation stuff.
35 *
36 *	Revision 1.1  2007/02/09 20:38:00  ayanowit
37 *	New IRMAllocation files for user-space lib.
38 *
39 *
40 */
41
42#import "IOFireWireLibIUnknown.h"
43#import "IOFireWireLibPriv.h"
44#import "IOFireWireLib.h"
45
46namespace IOFireWireLib {
47
48	class Device ;
49	class IRMAllocation: public IOFireWireIUnknown
50	{
51		public:
52			IRMAllocation( const IUnknownVTbl& interface,
53						  Device& userclient,
54						  UserObjectHandle inKernIRMAllocationRef,
55						  void* inCallBack = 0,
56						  void* inRefCon = 0) ;
57
58			virtual ~IRMAllocation() ;
59
60		public:
61
62			static void	LostProc( IOFireWireLibIRMAllocationRef refcon, IOReturn result, void** args, int numArgs) ;
63
64			Boolean NotificationIsOn(IOFireWireLibIRMAllocationRef self ) ;
65
66			Boolean TurnOnNotification(IOFireWireLibIRMAllocationRef self ) ;
67
68			void TurnOffNotification(IOFireWireLibIRMAllocationRef self ) ;
69
70			void SetReleaseIRMResourcesOnFree (IOFireWireLibIRMAllocationRef self, Boolean doRelease ) ;
71			IOReturn AllocateIsochResources(IOFireWireLibIRMAllocationRef self, UInt8 isochChannel, UInt32 bandwidthUnits);
72			IOReturn DeallocateIsochResources(IOFireWireLibIRMAllocationRef self);
73			Boolean AreIsochResourcesAllocated(IOFireWireLibIRMAllocationRef self, UInt8 *pAllocatedIsochChannel, UInt32 *pAllocatedBandwidthUnits);
74
75			void SetRefCon(IOFireWireLibIRMAllocationRef self, void* refCon) ;
76			void* GetRefCon(IOFireWireLibIRMAllocationRef self) ;
77
78		protected:
79			Boolean mNotifyIsOn ;
80			Device& mUserClient ;
81			UserObjectHandle mKernIRMAllocationRef ;
82			IOFireWireLibIRMAllocationLostNotificationProc mLostHandler ;
83			void* mUserRefCon ;
84			IOFireWireLibIRMAllocationRef mRefInterface ;
85	} ;
86
87	class IRMAllocationCOM: public IRMAllocation
88	{
89			typedef ::IOFireWireLibIRMAllocationInterface	Interface ;
90
91		public:
92			IRMAllocationCOM( Device&					userclient,
93									UserObjectHandle	inKernIRMAllocationRef,
94									void*				inCallBack,
95									void*				inRefCon ) ;
96
97			virtual ~IRMAllocationCOM() ;
98
99		private:
100			static Interface sInterface ;
101
102		public:
103			static IUnknownVTbl**	Alloc(	Device&				inUserClient,
104											UserObjectHandle	inKernIRMAllocationRef,
105											void*				inCallBack,
106											void*				inRefCon );
107
108			virtual HRESULT			QueryInterface( REFIID iid, void ** ppv ) ;
109
110		protected:
111
112			static Boolean SNotificationIsOn (IOFireWireLibIRMAllocationRef self ) ;
113
114			static Boolean STurnOnNotification (IOFireWireLibIRMAllocationRef self ) ;
115
116			static void STurnOffNotification (IOFireWireLibIRMAllocationRef self ) ;
117
118			static const void SSetReleaseIRMResourcesOnFree (IOFireWireLibIRMAllocationRef self, Boolean doRelease ) ;
119
120			static IOReturn SAllocateIsochResources(IOFireWireLibIRMAllocationRef self, UInt8 isochChannel, UInt32 bandwidthUnits);
121			static IOReturn SDeallocateIsochResources(IOFireWireLibIRMAllocationRef self);
122			static Boolean SAreIsochResourcesAllocated(IOFireWireLibIRMAllocationRef self, UInt8 *pAllocatedIsochChannel, UInt32 *pAllocatedBandwidthUnits);
123
124			static void SSetRefCon(IOFireWireLibIRMAllocationRef self, void* refCon) ;
125			static void* SGetRefCon(IOFireWireLibIRMAllocationRef self) ;
126
127	};
128}