Chameleon

Chameleon Svn Source Tree

Root/branches/rewrite/i386/include/IOKit/avc/IOFireWirePCRSpace.h

Source at commit 1129 created 12 years 11 months ago.
By meklort, Change options.o so that it reloads the system config as well. Also change it so that it uses that config for variables (NOTE: if the calue exists in chameleonConfig, it's used instead.
1/*
2 * Copyright (c) 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/*
23 *
24 *IOFireWirePCRSpace.h
25 *
26 * Class to multiplex access to the PCR addresses.
27 */
28#ifndef _IOKIT_IOFIREWIREPCRSPACE_H
29#define _IOKIT_IOFIREWIREPCRSPACE_H
30
31#include <IOKit/firewire/IOFWAddressSpace.h>
32#include <IOKit/avc/IOFireWireAVCTargetSpace.h>
33
34/*!
35 @typedef IOFireWirePCRCallback
36@abstract Callback called after a successful lock transaction to a plug.
37 @param refcon refcon supplied to the IOFireWireFCPSpace when a client is registered
38@param nodeID is the node originating the request
39@param plugNo is the plug number
40@param oldVal is the value the plug used to contain
41 @param newVal is the quad written into the plug
42
43 */
44typedef void (*IOFireWirePCRCallback)(void *refcon, UInt16 nodeID, UInt32 plug, UInt32 oldVal, UInt32 newVal);
45
46class IOFireWireBus;
47
48/*!
49 @class IOFireWirePCRSpace
50 @abstract object to multiplex users of the PCR plug registers
51*/
52class IOFireWirePCRSpace : public IOFWPseudoAddressSpace
53{
54 OSDeclareDefaultStructors(IOFireWirePCRSpace)
55
56protected:
57 struct Client {
58 IOFireWirePCRCallback func;
59 void * refcon;
60 };
61 UInt32 fBuf[64];
62
63 Client fClients[64];
64 UInt32 fActivations;
65IOFireWireAVCTargetSpace *fAVCTargetSpace;
66IONotifier *fNotifier;
67
68/*! @struct ExpansionData
69 @discussion This structure will be used to expand the capablilties of the class in the future.
70 */
71 struct ExpansionData { };
72
73/*! @var reserved
74 Reserved for future use. (Internal use only) */
75 ExpansionData *reserved;
76
77 // Override to notify client of each plug seperately
78 virtual UInt32 doWrite(UInt16 nodeID, IOFWSpeed &speed, FWAddress addr, UInt32 len,
79 const void *buf, IOFWRequestRefCon refcon);
80
81 virtual IOReturn allocatePlug(void *refcon, IOFireWirePCRCallback func, UInt32 &plug, Client* head);
82 virtual void freePlug(UInt32 plug, Client* head);
83 virtual UInt32 readPlug(UInt32 plug);
84 virtual IOReturn updatePlug(UInt32 plug, UInt32 oldVal, UInt32 newVal);
85
86public:
87
88 // Override to handle multiple activations (one per client)
89 virtual IOReturn activate();
90 virtual void deactivate();
91
92/*!
93 @function init
94 @abstract initializes the IOFireWirePCRSpace object
95*/
96 virtual bool init(IOFireWireBus *bus);
97/*!
98 @function getPCRAddressSpace
99 @abstract returns the IOFireWirePCRSpace object for the given FireWire bus
100 @param bus The FireWire bus
101*/
102 static IOFireWirePCRSpace *getPCRAddressSpace(IOFireWireBus *bus);
103/*!
104 @function allocateInputPlug
105 @abstract allocates an input plug.
106 @param refcon arbitrary value passed back as first argument of callback.
107 @param func callback function when a successful lock transaction to the plug has been performed
108 @param plug set to the plug number if a plug is successfully allocated
109*/
110 virtual IOReturn allocateInputPlug(void *refcon, IOFireWirePCRCallback func, UInt32 &plug);
111/*!
112 @function freeInputPlug
113 @abstract deallocates an input plug.
114 @param plug value returned by allocateInputPlug.
115*/
116 virtual void freeInputPlug(UInt32 plug);
117/*!
118 @function readInputPlug
119 @abstract returns the current value of an input plug.
120 @param plug value returned by allocateInputPlug.
121*/
122 virtual UInt32 readInputPlug(UInt32 plug);
123/*!
124 @function updateInputPlug
125 @abstract updates the value of an input plug (simulating a lock transaction).
126 @param plug value returned by allocateInputPlug.
127 @param oldVal value returned by readInputPlug.
128 @param newVal new value to store in plug if it's current value is oldVal.
129*/
130 virtual IOReturn updateInputPlug(UInt32 plug, UInt32 oldVal, UInt32 newVal);
131/*!
132 @function allocateOutputPlug
133 @abstract allocates an output plug.
134 @param refcon arbitrary value passed back as first argument of callback.
135 @param func callback function when a successful lock transaction to the plug has been performed
136 @param plug set to the plug number if a plug is successfully allocated
137*/
138 virtual IOReturn allocateOutputPlug(void *refcon, IOFireWirePCRCallback func, UInt32 &plug);
139/*!
140 @function freeOutputPlug
141 @abstract deallocates an output plug.
142 @param plug value returned by allocateOutputPlug.
143*/
144 virtual void freeOutputPlug(UInt32 plug);
145/*!
146 @function readOutputPlug
147 @abstract returns the current value of an output plug.
148 @param plug value returned by allocateOutputPlug.
149*/
150 virtual UInt32 readOutputPlug(UInt32 plug);
151/*!
152 @function updateOutputPlug
153 @abstract updates the value of an output plug (simulating a lock transaction).
154 @param plug value returned by allocateOutputPlug.
155 @param oldVal value returned by readOutputPlug.
156 @param newVal new value to store in plug if it's current value is oldVal.
157*/
158 virtual IOReturn updateOutputPlug(UInt32 plug, UInt32 oldVal, UInt32 newVal);
159/*!
160 @function readOutputMasterPlug
161 @abstract returns the current value of the output master plug.
162*/
163 virtual UInt32 readOutputMasterPlug();
164/*!
165 @function updateOutputMasterPlug
166 @abstract updates the value of the master output plug (simulating a lock transaction).
167 @param oldVal value returned by readOutputMasterPlug.
168 @param newVal new value to store in plug if it's current value is oldVal.
169*/
170 virtual IOReturn updateOutputMasterPlug(UInt32 oldVal, UInt32 newVal);
171/*!
172 @function readInputMasterPlug
173 @abstract returns the current value of the input master plug.
174*/
175 virtual UInt32 readInputMasterPlug();
176/*!
177 @function updateInputMasterPlug
178 @abstract updates the value of the master input plug (simulating a lock transaction).
179 @param oldVal value returned by readInputMasterPlug.
180 @param newVal new value to store in plug if it's current value is oldVal.
181*/
182 virtual IOReturn updateInputMasterPlug(UInt32 oldVal, UInt32 newVal);
183
184/*!
185@function setAVCTargetSpacePointer
186 */
187 virtual void setAVCTargetSpacePointer(IOFireWireAVCTargetSpace *pAVCTargetSpace);
188
189/*!
190@function clearAllP2PConnections
191 */
192 virtual void clearAllP2PConnections(void);
193
194private:
195 OSMetaClassDeclareReservedUnused(IOFireWirePCRSpace, 0);
196 OSMetaClassDeclareReservedUnused(IOFireWirePCRSpace, 1);
197 OSMetaClassDeclareReservedUnused(IOFireWirePCRSpace, 2);
198 OSMetaClassDeclareReservedUnused(IOFireWirePCRSpace, 3);
199
200};
201
202#endif /* _IOKIT_IOFIREWIREPCRSPACE_H */
203

Archive Download this file

Revision: 1129