Chameleon

Chameleon Svn Source Tree

Root/branches/JrCs/i386/include/IOKit/avc/IOFireWireAVCTargetSpace.h

1/*
2 * Copyright (c) 2003 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 *
25 *IOFireWireAVCTargetSpace.h
26 *
27 * Class to centralize the AVC Target mode support
28 *
29 */
30
31#ifndef _IOKIT_IOFIREWIREAVCTARGETSPACE_H
32#define _IOKIT_IOFIREWIREAVCTARGETSPACE_H
33
34#include <IOKit/IOUserClient.h>
35#include <IOKit/IOBufferMemoryDescriptor.h>
36
37#include <IOKit/firewire/IOFWAddressSpace.h>
38#include <IOKit/firewire/IOLocalConfigDirectory.h>
39#include <IOKit/avc/IOFireWireAVCConsts.h>
40#include <IOKit/avc/IOFireWireAVCUserClientCommon.h>
41
42class IOFireWireAVCProtocolUserClient;
43class AVCCommandHandlerInfo;
44class AVCSubunitInfo;
45
46typedef void (*IOFireWireAVCTargetCommandHandlerCallback)(const AVCCommandHandlerInfo *pCmdInfo,
47 UInt32 generation,
48 UInt16 nodeID,
49 const void *command,
50 UInt32 cmdLen,
51 IOFWSpeed &speed,
52 UInt32 handlerSearchIndex);
53
54typedef void (*IOFireWireAVCSubunitPlugHandlerCallback)(const AVCSubunitInfo *pSubunitInfo,
55IOFWAVCSubunitPlugMessages plugMessage,
56IOFWAVCPlugTypes plugType,
57UInt32 plugNum,
58UInt32 messageParams,
59UInt32 generation,
60UInt16 nodeID);
61
62/*!
63@class AVCCommandHandlerInfo
64@abstract internal class to manage installed command handlers
65*/
66class AVCCommandHandlerInfo : public OSObject
67{
68 OSDeclareDefaultStructors(AVCCommandHandlerInfo)
69public:
70IOFireWireAVCProtocolUserClient * userClient;
71IOFireWireAVCTargetCommandHandlerCallback callBack;
72OSAsyncReference64 asyncRef;
73UInt32 subUnitTypeAndID;
74UInt32 opCode;
75uint64_t userCallBack;
76uint64_t userRefCon;
77};
78
79typedef struct _AVCSubunitPlugRecord
80{
81UInt32 plugSignalFormat;
82UInt32 connectionCount;
83}AVCSubunitPlugRecord;
84
85/*!
86@class AVCSubunitInfo
87@abstract internal class to manage installed subunits
88*/
89class AVCSubunitInfo : public OSObject
90{
91 OSDeclareDefaultStructors(AVCSubunitInfo)
92 bool init();
93 void free();
94public:
95static AVCSubunitInfo *create();
96IOFireWireAVCProtocolUserClient * userClient;
97IOFireWireAVCSubunitPlugHandlerCallback callBack;
98OSAsyncReference64 asyncRef;
99UInt32 subunitTypeAndID;
100UInt32 numSourcePlugs;
101UInt32 numDestPlugs;
102uint64_t userCallBack;
103uint64_t userRefCon;
104AVCSubunitPlugRecord *sourcePlugRecords;
105AVCSubunitPlugRecord *destPlugRecords;
106};
107
108typedef struct _AVCUnitPlugRecord
109{
110UInt32 connectionCount;
111}AVCUnitPlugRecord;
112
113typedef struct _AVCUnitPlugs
114{
115UInt32 numIsochInPlugs;
116UInt32 numIsochOutPlugs;
117UInt32 numExternalInPlugs;
118UInt32 numExternalOutPlugs;
119AVCUnitPlugRecord isochInPlugRecord[kAVCMaxNumPlugs];
120AVCUnitPlugRecord isochOutPlugRecord[kAVCMaxNumPlugs];
121AVCUnitPlugRecord externalInPlugRecord[kAVCMaxNumPlugs];
122AVCUnitPlugRecord externalOutPlugRecord[kAVCMaxNumPlugs];
123}AVCUnitPlugs;
124
125/*!
126@class UCInfo
127@abstract internal class to manage multiple protocol user clients
128*/
129class UCInfo : public OSObject
130{
131 OSDeclareDefaultStructors(UCInfo)
132public:
133 IOFireWireAVCProtocolUserClient *fUserClient;
134};
135
136/*!
137@class AVCConnectionRecord
138@abstract internal class to manage AVC connections
139*/
140class AVCConnectionRecord : public OSObject
141{
142 OSDeclareDefaultStructors(AVCConnectionRecord)
143public:
144UInt32 sourceSubunitTypeAndID;
145IOFWAVCPlugTypes sourcePlugType;
146UInt32 sourcePlugNum;
147UInt32 destSubunitTypeAndID;
148IOFWAVCPlugTypes destPlugType;
149UInt32 destPlugNum;
150bool lockConnection;
151bool permConnection;
152};
153
154/*!
155@class IOFireWireAVCTargetSpace
156@abstract object to centralize the AVC Target mode support
157*/
158class IOFireWireAVCTargetSpace : public IOFWPseudoAddressSpace
159{
160 OSDeclareDefaultStructors(IOFireWireAVCTargetSpace)
161
162protected:
163 UInt32 fBuf[512];
164 UInt32 fActivations;
165IOFireWireController *fController;
166IOLocalConfigDirectory * fAVCLocalConfigDirectory;
167 OSArray * fUserClients;
168OSArray * fCommandHandlers;
169OSArray * fSubunits;
170OSArray * fConnectionRecords;
171AVCUnitPlugs fUnitPlugs;
172IORecursiveLock * fLock;
173
174/*! @struct ExpansionData
175@discussion This structure will be used to expand the capablilties of the class in the future.
176*/
177 struct ExpansionData { };
178
179/*! @var reserved
180Reserved for future use. (Internal use only) */
181 ExpansionData *reserved;
182
183 virtual UInt32 doWrite(UInt16 nodeID, IOFWSpeed &speed, FWAddress addr, UInt32 len,
184 const void *buf, IOFWRequestRefCon refcon);
185
186
187IOReturn targetSendAVCResponse(UInt32 generation, UInt16 nodeID, IOBufferMemoryDescriptor *pBufMemDesc, UInt32 size);
188
189// Internal AVC Target Command Handlers
190IOReturn handleUnitInfoCommand(UInt16 nodeID, UInt32 generation, const char *buf, UInt32 len);
191IOReturn handleSubUnitInfoCommand(UInt16 nodeID, UInt32 generation, const char *buf, UInt32 len);
192IOReturn handlePlugInfoCommand(UInt16 nodeID, UInt32 generation, const char *buf, UInt32 len);
193IOReturn handlePowerCommand(UInt16 nodeID, UInt32 generation, const char *buf, UInt32 len);
194IOReturn handleConnectCommand(UInt16 nodeID, UInt32 generation, const char *buf, UInt32 len);
195IOReturn handleDisconnectCommand(UInt16 nodeID, UInt32 generation, const char *buf, UInt32 len);
196IOReturn handleInputPlugSignalFormatCommand(UInt16 nodeID, UInt32 generation, const char *buf, UInt32 len);
197IOReturn handleOutputPlugSignalFormatCommand(UInt16 nodeID, UInt32 generation, const char *buf, UInt32 len);
198IOReturn handleConnectionsCommand(UInt16 nodeID, UInt32 generation, const char *buf, UInt32 len);
199IOReturn handleSignalSourceCommand(UInt16 nodeID, UInt32 generation, const char *buf, UInt32 len);
200
201UInt32 subUnitOfTypeCount(UInt32 type);
202AVCSubunitInfo *getSubunitInfo(UInt32 subunitTypeAndID);
203bool canConnectDestPlug(UInt32 destSubunitTypeAndID,
204 IOFWAVCPlugTypes destPlugType,
205 UInt32 *destPlugNum);
206
207public:
208
209// Activate/Deactivate Functions
210virtual IOReturn activateWithUserClient(IOFireWireAVCProtocolUserClient *userClient);
211 virtual void deactivateWithUserClient(IOFireWireAVCProtocolUserClient *userClient);
212
213/*!
214@function init
215@abstract initializes the IOFireWireAVCTargetSpace object
216*/
217 virtual bool init(IOFireWireController *controller);
218
219/*!
220@function getAVCTargetSpace
221@abstract returns the IOFireWireAVCTargetSpace object for the given FireWire bus
222@param bus The FireWire bus
223*/
224 static IOFireWireAVCTargetSpace *getAVCTargetSpace(IOFireWireController *controller);
225
226/*!
227@function publishAVCUnitDirectory
228@abstract Creates a local AVC Unit directory if it doesn't already exist
229*/
230 virtual IOReturn publishAVCUnitDirectory(void);
231
232virtual IOReturn installAVCCommandHandler(IOFireWireAVCProtocolUserClient *userClient,
233 IOFireWireAVCTargetCommandHandlerCallback callBack,
234 OSAsyncReference64 asyncRef,
235 UInt32 subUnitTypeAndID,
236 UInt32 opCode,
237 uint64_t userCallBack,
238 uint64_t userRefCon);
239
240virtual IOReturn addSubunit(IOFireWireAVCProtocolUserClient *userClient,
241 IOFireWireAVCSubunitPlugHandlerCallback callBack,
242 OSAsyncReference64 asyncRef,
243 UInt32 subunitType,
244 UInt32 numSourcePlugs,
245 UInt32 numDestPlugs,
246 uint64_t userCallBack,
247 uint64_t userRefCon,
248 UInt32 *subUnitID);
249
250virtual IOReturn setSubunitPlugSignalFormat(IOFireWireAVCProtocolUserClient *userClient,
251 UInt32 subunitTypeAndID,
252 IOFWAVCPlugTypes plugType,
253 UInt32 plugNum,
254 UInt32 signalFormat);
255
256virtual IOReturn getSubunitPlugSignalFormat(IOFireWireAVCProtocolUserClient *userClient,
257 UInt32 subunitTypeAndID,
258 IOFWAVCPlugTypes plugType,
259 UInt32 plugNum,
260 UInt32 *pSignalFormat);
261
262virtual IOReturn connectTargetPlugs(IOFireWireAVCProtocolUserClient *userClient,
263 AVCConnectTargetPlugsInParams *inParams,
264 AVCConnectTargetPlugsOutParams *outParams);
265
266virtual IOReturn disconnectTargetPlugs(IOFireWireAVCProtocolUserClient *userClient,
267UInt32 sourceSubunitTypeAndID,
268IOFWAVCPlugTypes sourcePlugType,
269UInt32 sourcePlugNum,
270UInt32 destSubunitTypeAndID,
271IOFWAVCPlugTypes destPlugType,
272UInt32 destPlugNum);
273
274virtual IOReturn getTargetPlugConnection(IOFireWireAVCProtocolUserClient *userClient,
275 AVCGetTargetPlugConnectionInParams *inParams,
276 AVCGetTargetPlugConnectionOutParams *outParams);
277
278 virtual IOReturn findAVCRequestHandler(IOFireWireAVCProtocolUserClient *userClient,
279 UInt32 generation,
280 UInt16 nodeID,
281 IOFWSpeed speed,
282 UInt32 handlerSearchIndex,
283 const char *pCmdBuf,
284 UInt32 cmdLen);
285
286virtual void pcrModified(IOFWAVCPlugTypes plugType,
287 UInt32 plugNum,
288 UInt32 newValue);
289
290private:
291OSMetaClassDeclareReservedUnused(IOFireWireAVCTargetSpace, 0);
292 OSMetaClassDeclareReservedUnused(IOFireWireAVCTargetSpace, 1);
293 OSMetaClassDeclareReservedUnused(IOFireWireAVCTargetSpace, 2);
294 OSMetaClassDeclareReservedUnused(IOFireWireAVCTargetSpace, 3);
295};
296
297#endif /*_IOKIT_IOFIREWIREAVCTARGETSPACE_H */

Archive Download this file

Revision: 1466