1/* 2 * Copyright (c) 2009 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23/* 24 File: DVFamilyPriv.h 25 26 Contains: xxx put contents here xxx 27 28 Version: xxx put version here xxx 29 30 Written by: Steve Smith 31 32 Copyright: � 1996-1999 by Apple Computer, Inc., all rights reserved. 33 34 File Ownership: 35 36 DRI: xxx put dri here xxx 37 38 Other Contact: xxx put other contact here xxx 39 40 Technology: xxx put technology here xxx 41 42 Writers: 43 44 (KW) Kevin Williams 45 (jkl) Jay Lloyd 46 (CP) Collin Pieper 47 (CLP) Collin Pieper 48 (SS) Steve Smith 49 50 Change History (most recent first): 51 52 <16> 6/17/99 jkl Added fwClientID to DVGetLocalFWReferenceID call to make the 53 fwClientID part of the device info so IDH can execute 54 getDeviceStandard by itself. 55 <15> 6/8/99 KW Added a __cplusplus extern c ifdef. 56 <14> 1/4/99 GDW Changed DVFamily names. 57 <13> 12/9/98 SS Changed clock component instance field to clock component in 58 DVDriverData struct. 59 <12> 11/19/98 SS Added fields to family struct to support queuing of DV events. 60 <11> 11/16/98 SS Added AVCisEnabled & enabled count to per-device struct. Changed 61 internal notification structs for PB queuing. 62 <10> 11/16/98 SS Added enum and param struct for setting the deviceID in the 63 driver (for notification purposes). 64 <9> 11/12/98 SS Added localID & clockInstance to per-device data struct. Changed 65 kDVGetID enum & param struct to kDVGetDeviceUniqueID. Added 66 kDVGetLocalFWReferenceID enum and param struct. 67 <8> 10/28/98 SS Added read/write enabled flags and reader count to the device 68 structure. 69 <7> 10/22/98 jkl Nothing. Just removed outdated System7 def. 70 <6> 9/17/98 SS Added generic dv event notification support. Removed AppleEvent 71 support. 72 <5> 3/12/98 SS Added a few "driverID"-based declarations to this file that were 73 originally in DVFamily.h. This is so we can move towards 74 deviceIDs and refNums externally, but maintain the use of 75 driverIDs internally, at least for now. 76 <4> 2/4/98 CP Remove unnecessary dependencies 77 <3> 1/19/98 CP Moved structures that were public ans shouldn't have been here 78 for safe harbour... 79 <2> 1/12/98 SS Checked in Collin's changes: modified data structures and added 80 AppleEvent support. 81 <1> 8/18/97 CLP first checked in 82 <4> 2/19/97 SS Updated to 1.0a2 FSL 83 <3> 2/12/97 AW Updated to 1.0d18 FSL 84 <2> 10/31/96 SS Misc changes to the isoch and buffering data structures. 85 Changes to support Blaze d16 API. 86 87*/ 88 89// 90// DVFamilyPriv.h 91// 92 93#ifndef __DVFAMILYPRIV__ 94#define __DVFAMILYPRIV__ 95 96 97#include <Types.h> 98#include <NameRegistry.h> 99#include <DriverServices.h> 100#include <AppleEvents.h> 101#include <Components.h> 102 103#include "GenericDriverFamily.h" 104#include "FireWire.h" 105#include "DVFamily.h" 106 107#ifdef __cplusplus 108extern "C" { 109#endif 110 111/////////////////////////////////////////////////////////////////////// 112// 113// types 114// 115/////////////////////////////////////////////////////////////////////// 116 117// holds our driver identification... 118// NOTE: for this implementation, DVDriverID, DVDeviceID, 119// and DVDeviceRefNum are synonymous. 120typedef UInt32 DVDriverID; 121 122enum 123{ 124 kInvalidDVDriverID = 0, 125 kMaxQueuedDVEvents = 32 126}; 127 128// one for each driver... 129 130typedef struct DVDriverDataStruct DVDriverData, *DVDriverDataPtr; 131 132struct DVDriverDataStruct 133{ 134 DVDriverDataPtr pNextDVDriverData; // Pointer to next driver in driver list. 135 136 DVDriverID dvDriverID; // ID referencing this data record. 137 DriverRefNum driverRefNum; // Device Manager driver ref num. 138 RegEntryID deviceRegistryID; // Name registry ID of DV device 139 CSRNodeUniqueID uniqueID; // unique device ID 140 FWReferenceID localID; // local FW reference ID 141 FWReferenceID fwClientID; // camera's reference ID 142 Component clock; // this device's clock component 143 144 Str255 name; // DV device name 145 146 Boolean writeEnabled; // true if device is enabled for writing 147 Boolean readEnabled; // true if device is enabled for reading 148 UInt32 numReaders; // Number of readers connected to device 149 Boolean AVCEnabled; // true if device is enabled for AVC transactions 150 UInt32 numControllers; // Number of controllers connected to device 151 152 Boolean driverOpened; // True if we've opened the driver. 153 UInt32 numConnections; // Number of connections to this driver. 154 Boolean deviceDisconnected; // True if device was disconnected. 155}; 156 157// notification stuff 158typedef struct DVNotificationEntryStruct { 159 QElemPtr qLink; // next queue element 160// DVEventRecord eventRec; 161 DVCDeviceID deviceID; 162 UInt32 wantedEvents; 163 DVCNotifyProc notifyProc; 164 void *userRefCon; 165} DVNotificationEntry, *DVNotificationEntryPtr; 166 167typedef struct DVEventEntryStruct { 168 QElemPtr qLink; // next queue element 169 DVCNotifyProc notifyProc; 170 void *userRefCon; 171 DVCEventRecord eventRec; 172} DVEventEntry, *DVEventEntryPtr; 173 174// the main family structure... 175 176typedef struct DVFamilyDataStruct 177{ 178 UInt32 useCount; 179 DVDriverDataPtr pDVDriverList; 180 UInt32 numDVDrivers; 181 QHdrPtr notificationQueue; 182 183 DVEventEntry events[ kMaxQueuedDVEvents ]; 184 QHdrPtr availableDVEvents; 185 QHdrPtr receivedDVEvents; 186 NMRec dvNMRec; 187 UInt32 nmIsInstalled; // for compare and swap 188} DVFamilyData, * DVFamilyDataPtr; 189 190 191/////////////////////////////////////////////////////////////////////// 192// 193// external prototypes 194// 195/////////////////////////////////////////////////////////////////////// 196 197 198// for the expert... 199OSStatus DVHandleDeviceAdded( GDFDeviceEventDataPtr pGDFDeviceEventData ); 200OSStatus DVHandleDeviceRemoved( GDFDeviceEventDataPtr pGDFDeviceEventData ); 201 202OSErr DVCPostEvent( DVCEventRecordPtr pEvent ); 203 204 205 206////////////////////////////////////////////////////////////////////// 207// 208// structures for communicating with the driver 209// 210////////////////////////////////////////////////////////////////////// 211 212// for sending commands with no data to driver 213typedef struct DVBasicCmdParamsStruct 214{ 215 UInt32 interfaceSelector; 216} DVBasicCmdParams, *DVBasicCmdParamsPtr; 217 218 219 220// for getting buffers and sizes 221// used by DVGetEmptyFrame & DVReadFrame 222 223typedef struct DVGetBufferParamsStruct 224{ 225 UInt32 interfaceSelector; 226 Ptr *ppBuffer; 227 UInt32 *pBufferSize; 228} DVGetBufferParams, *DVGetBufferParamsPtr; 229 230 231 232// for handing buffers back to the driver 233// used by DVWriteFrame & DVReleaseFrame 234 235typedef struct DVPassBufferParamsStruct 236{ 237 UInt32 interfaceSelector; 238 Ptr pBuffer; 239} DVPassBufferParams, *DVPassBufferParamsPtr; 240 241 242 243// for getting a unique camera id from the driver 244 245typedef struct DVGetDeviceUniqueIDParamsStruct 246{ 247 UInt32 interfaceSelector; 248 CSRNodeUniqueID id; 249} DVGetDeviceUniqueIDParams, *DVGetDeviceUniqueIDParamsPtr; 250 251 252// for getting the local FW Ref id from the driver 253 254typedef struct DVGetLocalFWReferenceIDParamsStruct 255{ 256 UInt32 interfaceSelector; 257 FWReferenceID id; 258 FWReferenceID fwClientID; 259} DVGetLocalFWReferenceIDParams, *DVGetLocalFWReferenceIDParamsPtr; 260 261 262// for setting the family's deviceID for the driver 263 264typedef struct DVSetFamilyDeviceIDParamsStruct 265{ 266 UInt32 interfaceSelector; 267 DVCDeviceID id; 268 DVCDeviceID fwClientID; 269} DVSetFamilyDeviceIDParams, *DVSetFamilyDeviceIDParamsPtr; 270 271 272// for sending AVC commands 273typedef struct DVAVCTransactionParamsStruct { 274 UInt32 interfaceSelector; 275 Ptr commandBufferPtr; 276 UInt32 commandLength; 277 Ptr responseBufferPtr; 278 UInt32 responseBufferSize; 279 FCPResponseHandlerPtr responseHandler; 280} DVAVCTransactionParams, *DVAVCTransactionParamsPtr; 281 282///////////////////////////////////////////////////////// 283// 284// driver interface selectors 285// 286 287enum { 288 kAVCInitialize = 1, 289 kAVCTerminate = 2, 290 kAVCDoTransaction = 3, 291 292 kDVCEnableIsochRead = 0x10, 293 kDVCDisableIsochRead = 0x11, 294 kDVCReadIsochData = 0x12, 295 kDVCReleaseReadBuffer = 0x13, 296 297 kDVCEnableIsochWrite = 0x20, 298 kDVCDisableIsochWrite = 0x21, 299 kDVCGetEmptyFrame = 0x22, 300 kDVCWriteFrame = 0x23, 301 302 kDVCEnableDVCGrab = 0x100, 303 kDVCDisableDVCGrab = 0x101, 304 kDVCGrabOneDVCFrame = 0x102, 305 kDVCReleaseDVCFrame = 0x103, 306 307 kDVGetDeviceUniqueID = 0x30, 308 kDVGetLocalFWReferenceID = 0x31, 309 kDVSetDeviceFamilyID = 0x32 310}; 311 312enum { 313 kServiceTypeAVCServices = 'avc ' 314}; 315 316 317#ifdef __cplusplus 318} 319#endif 320 321 322#endif __DVFAMILYPRIV__ 323