Chameleon

Chameleon Svn Source Tree

Root/branches/Chimera/i386/include/IOKit/firewire/IOFireWireIRMAllocation.h

1/*
2 * Copyright (c) 1998-2006 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_IOFIREWIREIRMALLOCATION_H
24#define _IOKIT_IOFIREWIREIRMALLOCATION_H
25
26#include <libkern/c++/OSObject.h>
27
28class IOFireWireController;
29
30//#include <IOKit/firewire/IOFireWireController.h>
31//#include <IOKit/firewire/IOFireWireFamilyCommon.h>
32
33/*! @class IOFireWireIRMAllocation
34*/
35
36class IOFireWireIRMAllocation : public OSObject
37{
38friend class IOFireWireController;
39
40 OSDeclareDefaultStructors(IOFireWireIRMAllocation)
41
42public:
43
44// Prototype for the callback if reallocation after bus-reset is unsuccessful.
45typedef IOReturn (*AllocationLostNotificationProc)(void* refCon, class IOFireWireIRMAllocation* allocation);
46
47// Initialize the IRM allocation object.
48 virtual bool init( IOFireWireController * control,
49 Boolean releaseIRMResourcesOnFree = true,
50 AllocationLostNotificationProc allocationLostProc = NULL,
51 void *pLostProcRefCon = NULL);
52
53// Specify whether of not the IRM resources should automatically
54// be released when freeing this allocation object.
55virtual void setReleaseIRMResourcesOnFree(Boolean doRelease);
56
57// Use the IRMAllocation object to allocate isoch resources
58virtual IOReturn allocateIsochResources(UInt8 isochChannel, UInt32 bandwidthUnits);
59
60// Free isoch resources previously allocated with a call to allocateIsochResources
61virtual IOReturn deallocateIsochResources(void);
62
63// Returns true if isoch resources are currently allocated, and if true, the allocated channel, and amount of isoch bandwidth.
64virtual Boolean areIsochResourcesAllocated(UInt8 *pAllocatedIsochChannel, UInt32 *pAllocatedBandwidthUnits);
65
66// Get the refcon
67virtual void * GetRefCon(void);
68virtual void SetRefCon(void* refCon);
69
70// Override the base-class release function for special processing
71virtual void release() const;
72
73protected:
74
75/*! @struct ExpansionData
76@discussion This structure will be used to expand the capablilties of the class in the future.
77*/
78struct ExpansionData { };
79
80/*! @var reserved
81Reserved for future use. (Internal use only) */
82ExpansionData *reserved;
83
84// Free the allocation object (and release IRM resources if needed)
85virtual void free( void );
86
87// Controller will call this to notify about bus-reset complete.
88virtual void handleBusReset(UInt32 generation);
89
90virtual void failedToRealloc(void);
91virtual UInt32 getAllocationGeneration(void);
92static void threadFunc( void * arg );
93
94private:
95
96AllocationLostNotificationProc fAllocationLostProc;
97void *fLostProcRefCon;
98Boolean fReleaseIRMResourcesOnFree;
99UInt8 fIsochChannel;
100UInt32 fBandwidthUnits;
101UInt32 fAllocationGeneration;
102IORecursiveLock *fLock ;
103IOFireWireController *fControl;
104Boolean isAllocated;
105
106OSMetaClassDeclareReservedUnused(IOFireWireIRMAllocation, 0);
107OSMetaClassDeclareReservedUnused(IOFireWireIRMAllocation, 1);
108OSMetaClassDeclareReservedUnused(IOFireWireIRMAllocation, 2);
109OSMetaClassDeclareReservedUnused(IOFireWireIRMAllocation, 3);
110OSMetaClassDeclareReservedUnused(IOFireWireIRMAllocation, 4);
111OSMetaClassDeclareReservedUnused(IOFireWireIRMAllocation, 5);
112OSMetaClassDeclareReservedUnused(IOFireWireIRMAllocation, 6);
113OSMetaClassDeclareReservedUnused(IOFireWireIRMAllocation, 7);
114};
115
116#endif // _IOKIT_IOFIREWIREIRMALLOCATION_H
117

Archive Download this file

Revision: 2225