1/* 2 * IOFireWireLibDevice.h 3 * IOFireWireFamily 4 * 5 * Created by Niels on Thu Feb 27 2003. 6 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. 7 * 8 * $Log: IOFireWireLibDevice.h,v $ 9 * Revision 1.23 2007/10/16 16:50:21 ayanowit 10 * Removed existing "work-in-progress" support for buffer-fill isoch. 11 * 12 * Revision 1.22 2007/06/21 04:08:45 collin 13 * *** empty log message *** 14 * 15 * Revision 1.21 2007/05/12 01:10:45 arulchan 16 * Asyncstream transmit command interface 17 * 18 * Revision 1.20 2007/05/03 01:21:29 arulchan 19 * Asyncstream transmit APIs 20 * 21 * Revision 1.19 2007/04/28 02:54:23 collin 22 * *** empty log message *** 23 * 24 * Revision 1.18 2007/03/23 01:47:17 collin 25 * *** empty log message *** 26 * 27 * Revision 1.17 2007/03/22 00:30:01 collin 28 * *** empty log message *** 29 * 30 * Revision 1.16 2007/03/14 02:29:35 collin 31 * *** empty log message *** 32 * 33 * Revision 1.15 2007/03/06 04:50:21 collin 34 * *** empty log message *** 35 * 36 * Revision 1.14 2007/02/09 20:36:46 ayanowit 37 * More Leopard IRMAllocation changes. 38 * 39 * Revision 1.13 2007/01/02 18:14:12 ayanowit 40 * Enabled building the plug-in lib 4-way FAT. Also, fixed compile problems for 64-bit. 41 * 42 * Revision 1.12 2006/12/13 21:34:24 ayanowit 43 * For 4222965, replaced all io async method calls with new Leopard API version. 44 * 45 * Revision 1.11 2006/09/28 22:31:31 arulchan 46 * New Feature rdar::3413505 47 * 48 * Revision 1.10 2006/09/27 22:42:12 ayanowit 49 * Merged in Leopard changes for new IRMAllocation API. 50 * 51 * Revision 1.9 2006/09/22 06:45:19 collin 52 * *** empty log message *** 53 * 54 * Revision 1.8 2004/05/04 22:52:20 niels 55 * *** empty log message *** 56 * 57 * Revision 1.7 2003/11/07 21:24:28 niels 58 * *** empty log message *** 59 * 60 * Revision 1.6 2003/09/15 22:17:10 niels 61 * *** empty log message *** 62 * 63 * Revision 1.5 2003/09/12 22:35:52 niels 64 * padding for digidesign 65 * 66 * Revision 1.4 2003/08/20 18:48:44 niels 67 * *** empty log message *** 68 * 69 * Revision 1.3 2003/08/08 21:03:47 gecko1 70 * Merge max-rec clipping code into TOT 71 * 72 * Revision 1.2 2003/07/21 06:53:10 niels 73 * merge isoch to TOT 74 * 75 * Revision 1.1.2.2 2003/07/18 00:17:47 niels 76 * *** empty log message *** 77 * 78 * Revision 1.1.2.1 2003/07/01 20:54:23 niels 79 * isoch merge 80 * 81 */ 82 83#import "IOFireWireLibIUnknown.h" 84#import "IOFireWireLibPriv.h" 85 86namespace IOFireWireLib { 87 88 class Device: public IOFireWireIUnknown 89 { 90 friend class DeviceCOM ; 91 92 protected: 93 94 bool mIsInited ; 95 bool mNotifyIsOn ; 96 mach_port_t mMasterDevicePort ; 97 mach_port_t mPort ; 98 io_object_t mDefaultDevice ; 99 100 void* mReserved[4] ; 101 102 io_connect_t mConnection ; 103 104 CFMachPortRef mAsyncCFPort ; 105 mach_port_t mAsyncPort ; 106 IOFireWireBusResetHandler mBusResetHandler ; 107 IOFireWireBusResetDoneHandler mBusResetDoneHandler ; 108 void* mUserRefCon ; 109 110 CFRunLoopRef mRunLoop ; 111 CFRunLoopSourceRef mRunLoopSource ; 112 CFStringRef mRunLoopMode ; 113 114 bool mIsOpen ; 115 116 // isoch related 117 CFMachPortRef mIsochAsyncCFPort ; 118 mach_port_t mIsochAsyncPort ; 119 CFRunLoopRef mIsochRunLoop ; 120 CFRunLoopSourceRef mIsochRunLoopSource ; 121 CFStringRef mIsochRunLoopMode ; 122 123 public: 124 Device( const IUnknownVTbl & interface, CFDictionaryRef propertyTable, io_service_t service ) ; 125 virtual ~Device() ; 126 127 virtual HRESULT QueryInterface( REFIID iid, LPVOID* ppv ) ; 128 129 // 130 // general user client support 131 // 132 Boolean IsInited() const { return mIsInited; } 133 io_object_t GetDevice() const { return mDefaultDevice; } 134 IOReturn Open() ; 135 IOReturn OpenWithSessionRef( 136 IOFireWireSessionRef session) ; 137 IOReturn Seize( // v3+ 138 IOOptionBits inFlags ) ; 139 void Close() ; 140 141 // 142 // notification methods 143 // 144 const IOReturn AddCallbackDispatcherToRunLoop(CFRunLoopRef inRunLoop) { return AddCallbackDispatcherToRunLoopForMode( inRunLoop, kCFRunLoopCommonModes ) ; } 145 IOReturn AddCallbackDispatcherToRunLoopForMode( // v3+ 146 CFRunLoopRef inRunLoop, 147 CFStringRef inRunLoopMode ) ; 148 void RemoveDispatcherFromRunLoop( 149 CFRunLoopRef inRunLoop, 150 CFRunLoopSourceRef inRunLoopSource, 151 CFStringRef inMode) ; 152 const Boolean TurnOnNotification( 153 void* callBackRefCon) ; 154 void TurnOffNotification() ; 155 156 const IOFireWireBusResetHandler 157 SetBusResetHandler( 158 IOFireWireBusResetHandler inBusResetHandler) ; 159 const IOFireWireBusResetDoneHandler 160 SetBusResetDoneHandler( 161 IOFireWireBusResetDoneHandler inBusResetDoneHandler) ; 162 163 static void BusResetHandler( 164 void* refCon, 165 IOReturn result) ; 166 static void BusResetDoneHandler( 167 void* refCon, 168 IOReturn result) ; 169 170 // Call this function when you have completed processing a notification. 171 void ClientCommandIsComplete( 172 FWClientCommandID commandID, 173 IOReturn status) {} 174 175 // --- FireWire send/recv methods -------------- 176 IOReturn Read( 177 io_object_t device, 178 const FWAddress & addr, 179 void* buf, 180 UInt32* size, 181 Boolean failOnReset = false, 182 UInt32 generation = 0) ; 183 IOReturn ReadQuadlet( 184 io_object_t device, 185 const FWAddress & addr, 186 UInt32* val, 187 Boolean failOnReset = false, 188 UInt32 generation = 0) ; 189 IOReturn Write( 190 io_object_t device, 191 const FWAddress & addr, 192 const void* buf, 193 UInt32* size, 194 Boolean failOnReset = false, 195 UInt32 generation = 0) ; 196 IOReturn WriteQuadlet( 197 io_object_t device, 198 const FWAddress & addr, 199 const UInt32 val, 200 Boolean failOnReset = false, 201 UInt32 generation = 0) ; 202 IOReturn CompareSwap( 203 io_object_t device, 204 const FWAddress & addr, 205 UInt32 cmpVal, 206 UInt32 newVal, 207 Boolean failOnReset = false, 208 UInt32 generation = 0) ; 209 IOReturn CompareSwap64( 210 io_object_t device, 211 const FWAddress & addr, 212 UInt32* expectedVal, 213 UInt32* newVal, 214 UInt32* oldVal, 215 IOByteCount size, 216 Boolean failOnReset, 217 UInt32 generation = 0) ; 218 // 219 // command object methods 220 // 221 IOFireWireLibCommandRef CreateReadCommand( 222 io_object_t device, 223 const FWAddress & addr, 224 void* buf, 225 UInt32 size, 226 IOFireWireLibCommandCallback callback, 227 Boolean failOnReset, 228 UInt32 generation, 229 void* inRefcon, 230 REFIID iid) ; 231 IOFireWireLibCommandRef CreateReadQuadletCommand( 232 io_object_t device, 233 const FWAddress & addr, 234 UInt32 quads[], 235 UInt32 numQuads, 236 IOFireWireLibCommandCallback callback, 237 Boolean failOnReset, 238 UInt32 generation, 239 void* inRefCon, 240 REFIID iid) ; 241 IOFireWireLibCommandRef CreateWriteCommand( io_object_t device, const FWAddress& addr, void* buf, UInt32 size, 242 IOFireWireLibCommandCallback callback, Boolean failOnReset, UInt32 generation, 243 void* inRefCon, REFIID iid) ; 244 IOFireWireLibCommandRef CreateWriteQuadletCommand( io_object_t device, const FWAddress& addr, UInt32 quads[], 245 UInt32 numQuads, IOFireWireLibCommandCallback callback, Boolean failOnReset, 246 UInt32 generation, void* inRefCon, REFIID iid) ; 247 IOFireWireLibCommandRef CreateCompareSwapCommand( io_object_t device, const FWAddress& addr, UInt64 cmpVal, UInt64 newVal, 248 unsigned int quads, IOFireWireLibCommandCallback callback, Boolean failOnReset, 249 UInt32 generation, void* inRefCon, REFIID iid) ; 250 251 // 252 // other methods 253 // 254 IOReturn BusReset() ; 255 IOReturn GetCycleTime( 256 UInt32* cycleTime) ; 257 IOReturn GetBusCycleTime( 258 UInt32* busTime, 259 UInt32 * cycleTime) ; 260 IOReturn GetGenerationAndNodeID( 261 UInt32* outGeneration, 262 UInt16* outNodeID) ; 263 IOReturn GetLocalNodeID( 264 UInt16* outLocalNodeID) ; 265 IOReturn GetResetTime( 266 AbsoluteTime* resetTime) ; 267 268 // address space support 269 IOFireWireLibPseudoAddressSpaceRef 270 CreatePseudoAddressSpace( 271 UInt32 inSize, 272 void* inRefCon, 273 UInt32 inQueueBufferSize, 274 void* inBackingStore, 275 UInt32 inFlags, 276 REFIID iid) { return CreateAddressSpace( inSize, inRefCon, inQueueBufferSize, inBackingStore, inFlags, iid ) ; } 277 IOFireWireLibPhysicalAddressSpaceRef 278 CreatePhysicalAddressSpace( 279 UInt32 inLength, 280 void* inBackingStore, 281 UInt32 inFlags, 282 REFIID iid) ; 283 IOFireWireLibPseudoAddressSpaceRef 284 CreateInitialUnitsPseudoAddressSpace( 285 UInt32 inAddressLo, 286 UInt32 inSize, 287 void* inRefCon, 288 UInt32 inQueueBufferSize, 289 void* inBackingStore, 290 UInt32 inFlags, 291 REFIID iid) { return CreateAddressSpace( inSize, inRefCon, inQueueBufferSize, inBackingStore, inFlags, iid, true, inAddressLo ) ; } 292 IOFireWireLibPseudoAddressSpaceRef 293 CreateAddressSpace( 294 UInt32 inSize, 295 void* inRefCon, 296 UInt32 inQueueBufferSize, 297 void* inBackingStore, 298 UInt32 inFlags, 299 REFIID iid, 300 Boolean isInitialUnits = false, 301 UInt32 inAddressLo = 0 ) ; 302 303 // --- config ROM support ---------------------- 304 IOFireWireLibLocalUnitDirectoryRef 305 CreateLocalUnitDirectory( 306 REFIID iid) ; 307 IOFireWireLibConfigDirectoryRef 308 GetConfigDirectory( 309 REFIID iid) ; 310 IOFireWireLibConfigDirectoryRef 311 CreateConfigDirectoryWithIOObject( 312 io_object_t inObject, 313 REFIID iid) ; 314 315 // --- debugging ------------------------------- 316 IOReturn FireBugMsg( 317 const char* msg) ; 318 IOReturn FireLog( const char * format, va_list ap ) ; 319 IOReturn FireLog( const char* string, ... ) ; 320 321 // --- internal use methods -------------------- 322 IOReturn OpenDefaultConnection() ; 323 const io_object_t GetUserClientConnection() const { return mConnection; } 324 const io_connect_t GetDefaultDevice() const { return mDefaultDevice; } 325 326 const CFMachPortRef GetAsyncCFPort() const { return mAsyncCFPort; } 327 const mach_port_t GetAsyncPort() const { return mAsyncPort ; } 328 IOReturn CreateAsyncPorts() ; 329 Boolean AsyncPortsExist() const { return ((mAsyncCFPort != 0) && (mAsyncPort != 0)); } 330 const CFMachPortRef GetIsochAsyncCFPort() const { return mIsochAsyncCFPort ; } 331 const mach_port_t GetIsochAsyncPort() const { return mIsochAsyncPort ; } 332 IOReturn CreateIsochAsyncPorts() ; 333 const Boolean IsochAsyncPortsExist() const { return ((mIsochAsyncCFPort != 0) && (mIsochAsyncPort != 0)); } 334 335 IOReturn CreateCFStringWithOSStringRef( 336 UserObjectHandle inStringRef, 337 UInt32 inStringLen, 338 CFStringRef*& text) ; 339 IOReturn CreateCFDataWithOSDataRef( 340 UserObjectHandle inDataRef, 341 IOByteCount inDataLen, 342 CFDataRef*& data) ; 343 // --- isoch related ---------- 344 IOReturn AddIsochCallbackDispatcherToRunLoop( 345 CFRunLoopRef inRunLoop) { return AddIsochCallbackDispatcherToRunLoopForMode( inRunLoop, kCFRunLoopCommonModes ) ; } 346 IOReturn AddIsochCallbackDispatcherToRunLoopForMode( // v3+ 347 CFRunLoopRef inRunLoop, 348 CFStringRef inRunLoopMode ) ; 349 void RemoveIsochCallbackDispatcherFromRunLoop() ; // v3+ 350 IOFireWireLibIsochChannelRef 351 CreateIsochChannel( 352 Boolean doIrm, 353 UInt32 packetSize, 354 IOFWSpeed prefSpeed, 355 REFIID iid) ; 356 IOFireWireLibRemoteIsochPortRef 357 CreateRemoteIsochPort( 358 Boolean inTalking, 359 REFIID iid) ; 360 IOFireWireLibLocalIsochPortRef 361 CreateLocalIsochPortWithOptions( 362 Boolean talking, 363 DCLCommand* dclProgram, 364 UInt32 startEvent, 365 UInt32 startState, 366 UInt32 startMask, 367 IOVirtualRange dclProgramRanges[], // optional optimization parameters 368 UInt32 dclProgramRangeCount, 369 IOVirtualRange bufferRanges[], 370 UInt32 bufferRangeCount, 371 IOFWIsochPortOptions options, 372 REFIID iid) ; 373 IOFireWireLibDCLCommandPoolRef 374 CreateDCLCommandPool( 375 IOByteCount size, 376 REFIID iid ) ; 377 IOReturn GetBusGeneration( UInt32* outGeneration ) ; 378 IOReturn GetLocalNodeIDWithGeneration( UInt32 checkGeneration, UInt16* outLocalNodeID ) ; 379 IOReturn GetRemoteNodeID( UInt32 checkGeneration, UInt16* outRemoteNodeID ) ; 380 IOReturn GetSpeedToNode( UInt32 checkGeneration, IOFWSpeed* outSpeed) ; 381 IOReturn GetSpeedBetweenNodes( UInt32 checkGeneration, UInt16 srcNodeID, UInt16 destNodeID, IOFWSpeed* outSpeed) ; 382 IOReturn GetIRMNodeID( UInt32 checkGeneration, UInt16* irmNodeID ) ; 383 IOReturn ClipMaxRec2K( Boolean clipMaxRec ) ; 384 IOFireWireSessionRef GetSessionRef() ; 385 386 static inline MethodSelector MakeSelectorWithObject( MethodSelector selector, UserObjectHandle obj ) { return (MethodSelector)( (unsigned long)obj << 16 | selector & 0xFFFF ) ; } 387 388 IOFireWireLibVectorCommandRef CreateVectorCommand( IOFireWireLibCommandCallback callback, void* inRefCon, REFIID iid ); 389 390 IOReturn AllocateIRMBandwidthInGeneration(UInt32 bandwidthUnits, UInt32 generation) ; 391 392 IOReturn ReleaseIRMBandwidthInGeneration(UInt32 bandwidthUnits, UInt32 generation) ; 393 394 IOReturn AllocateIRMChannelInGeneration(UInt8 isochChannel, UInt32 generation) ; 395 396 IOReturn ReleaseIRMChannelInGeneration(UInt8 isochChannel, UInt32 generation) ; 397 398 IOFireWireLibIRMAllocationRef CreateIRMAllocation(Boolean releaseIRMResourcesOnFree, 399 IOFireWireLibIRMAllocationLostNotificationProc callback, 400 void *pLostNotificationProcRefCon, 401 REFIID iid) ; 402 403 IOFWAsyncStreamListenerInterfaceRef CreateAsyncStreamListener( UInt32 channel, 404 IOFWAsyncStreamListenerHandler callback, 405 void* inRefCon, 406 UInt32 inQueueBufferSize, 407 REFIID iid ) ; 408 409 IOFireWireLibCommandRef CreatePHYCommand( UInt32 data1, 410 UInt32 data2, 411 IOFireWireLibCommandCallback callback, 412 Boolean failOnReset, 413 UInt32 generation, 414 void* inRefCon, 415 REFIID iid ); 416 417 IOFireWireLibPHYPacketListenerRef CreatePHYPacketListener( UInt32 queueCount, REFIID iid ); 418 419 IOFireWireLibCommandRef CreateAsyncStreamCommand( UInt32 channel, 420 UInt32 sync, 421 UInt32 tag, 422 void* buf, 423 UInt32 size, 424 IOFireWireLibCommandCallback callback, 425 Boolean failOnReset, 426 UInt32 generation, 427 void* inRefCon, 428 REFIID iid); 429 430 IOReturn GetCycleTimeAndUpTime( UInt32* outCycleTime, 431 UInt64* outUpTime ); 432 } ; 433 434 435#pragma mark - 436 // ============================================================ 437 // 438 // DeviceCOM 439 // 440 // ============================================================ 441 442 class DeviceCOM: public Device 443 { 444 protected: 445 446 static const IOFireWireDeviceInterface sInterface ; 447 448 public: 449 450 DeviceCOM( CFDictionaryRef propertyTable, io_service_t service ) ; 451// virtual ~DeviceCOM() ; 452 453 // 454 // --- IUnknown ----------------------- 455 // 456 static IOFireWireDeviceInterface** Alloc( CFDictionaryRef propertyTable, io_service_t service ) ; 457 458 // 459 // === STATIC METHODS ========================== 460 // 461 462 // 463 // --- FireWire user client maintenance ----------- 464 // 465 static Boolean SInterfaceIsInited( 466 IOFireWireLibDeviceRef self) ; 467 static io_object_t SGetDevice( 468 IOFireWireLibDeviceRef self) ; 469 static IOReturn SOpen( 470 IOFireWireLibDeviceRef self) ; 471 static IOReturn SOpenWithSessionRef( 472 IOFireWireLibDeviceRef self, 473 IOFireWireSessionRef session) ; 474 static IOReturn SSeize( // v3+ 475 IOFireWireLibDeviceRef self, 476 IOOptionBits inFlags, 477 ... ) ; 478 static void SClose( 479 IOFireWireLibDeviceRef self) ; 480 481 // --- FireWire notification methods -------------- 482 static const Boolean SNotificationIsOn( 483 IOFireWireLibDeviceRef self) ; 484 485 // This function adds the proper event source to the passed in CFRunLoop. Call this 486 // before trying to use any IOFireWireLib notifications. 487 static const IOReturn SAddCallbackDispatcherToRunLoop( 488 IOFireWireLibDeviceRef self, 489 CFRunLoopRef inRunLoop) ; 490 static IOReturn SAddCallbackDispatcherToRunLoopForMode( // v3+ 491 IOFireWireLibDeviceRef self, 492 CFRunLoopRef inRunLoop, 493 CFStringRef inRunLoopMode ) ; 494 static const void SRemoveCallbackDispatcherFromRunLoop( 495 IOFireWireLibDeviceRef self) ; 496 497 // Makes notification active. Returns false if notification could not be activated. 498 static const Boolean STurnOnNotification( 499 IOFireWireLibDeviceRef self) ; 500 501 // Notification callbacks will no longer be called. 502 static void STurnOffNotification( 503 IOFireWireLibDeviceRef self) ; 504 static const IOFireWireBusResetHandler 505 SSetBusResetHandler( 506 IOFireWireLibDeviceRef self, 507 IOFireWireBusResetHandler inBusResetHandler) ; 508 static const IOFireWireBusResetDoneHandler 509 SSetBusResetDoneHandler( 510 IOFireWireLibDeviceRef self, 511 IOFireWireBusResetDoneHandler inBusResetDoneHandler) ; 512 513 // Call this function when you have completed processing a notification. 514 static void SClientCommandIsComplete( 515 IOFireWireLibDeviceRef self, 516 FWClientCommandID commandID, 517 IOReturn status) ; 518 519 // --- FireWire send/recv methods -------------- 520 static IOReturn SRead( 521 IOFireWireLibDeviceRef self, 522 io_object_t device, 523 const FWAddress* addr, 524 void* buf, 525 UInt32* size, 526 Boolean failOnReset = false, 527 UInt32 generation = 0) ; 528 static IOReturn SReadQuadlet( 529 IOFireWireLibDeviceRef self, 530 io_object_t device, 531 const FWAddress* addr, 532 UInt32* val, 533 Boolean failOnReset = false, 534 UInt32 generation = 0) ; 535 static IOReturn SWrite( 536 IOFireWireLibDeviceRef self, 537 io_object_t device, 538 const FWAddress* addr, 539 const void* buf, 540 UInt32* size, 541 Boolean failOnReset = false, 542 UInt32 generation = 0) ; 543 static IOReturn SWriteQuadlet( 544 IOFireWireLibDeviceRef self, 545 io_object_t device, 546 const FWAddress* addr, 547 const UInt32 val, 548 Boolean failOnReset = false, 549 UInt32 generation = 0) ; 550 static IOReturn SCompareSwap( 551 IOFireWireLibDeviceRef self, 552 io_object_t device, 553 const FWAddress* addr, 554 UInt32 cmpVal, 555 UInt32 newVal, 556 Boolean failOnReset = false, 557 UInt32 generation = 0) ; 558 static IOReturn SCompareSwap64( IOFireWireLibDeviceRef self, io_object_t device, 559 const FWAddress* addr, UInt32* expectedVal, UInt32* newVal, UInt32* oldVal, 560 IOByteCount size, Boolean failOnReset, UInt32 generation) ; 561 562 // --- FireWire command object methods --------- 563 564 static IOFireWireLibCommandRef 565 SCreateReadCommand( 566 IOFireWireLibDeviceRef self, 567 io_object_t device, 568 const FWAddress* addr, 569 void* buf, 570 UInt32 size, 571 IOFireWireLibCommandCallback callback, 572 Boolean failOnReset, 573 UInt32 generation, 574 void* inRefcon, 575 REFIID iid) ; 576 static IOFireWireLibCommandRef 577 SCreateReadQuadletCommand( 578 IOFireWireLibDeviceRef self, 579 io_object_t device, 580 const FWAddress * addr, 581 UInt32 quads[], 582 UInt32 numQuads, 583 IOFireWireLibCommandCallback callback, 584 Boolean failOnReset, 585 UInt32 generation, 586 void* inRefCon, 587 REFIID iid) ; 588 static IOFireWireLibCommandRef 589 SCreateWriteCommand( 590 IOFireWireLibDeviceRef self, 591 io_object_t device, 592 const FWAddress* addr, 593 void* buf, 594 UInt32 size, 595 IOFireWireLibCommandCallback callback, 596 Boolean failOnReset, 597 UInt32 generation, 598 void* inRefCon, 599 REFIID iid) ; 600 static IOFireWireLibCommandRef 601 SCreateWriteQuadletCommand( 602 IOFireWireLibDeviceRef self, 603 io_object_t device, 604 const FWAddress * addr, 605 UInt32 quads[], 606 UInt32 numQuads, 607 IOFireWireLibCommandCallback callback, 608 Boolean failOnReset, 609 UInt32 generation, 610 void* inRefCon, 611 REFIID iid) ; 612 static IOFireWireLibCommandRef 613 SCreateCompareSwapCommand( 614 IOFireWireLibDeviceRef self, 615 io_object_t device, 616 const FWAddress * addr, 617 UInt32 cmpVal, 618 UInt32 newVal, 619 IOFireWireLibCommandCallback callback, 620 Boolean failOnReset, 621 UInt32 generation, 622 void* inRefCon, 623 REFIID iid) ; 624 static IOFireWireLibCommandRef 625 SCreateCompareSwapCommand64(IOFireWireLibDeviceRef self, io_object_t device, const FWAddress* addr, 626 UInt64 cmpVal, UInt64 newVal, IOFireWireLibCommandCallback callback, Boolean failOnReset, 627 UInt32 generation, void* inRefCon, REFIID iid ) ; 628 629 // --- other methods ---------- 630 static IOReturn SBusReset( 631 IOFireWireLibDeviceRef self) ; 632 static IOReturn SGetCycleTime( 633 IOFireWireLibDeviceRef self, 634 UInt32* outCycleTime) 635 { return IOFireWireIUnknown::InterfaceMap<Device>::GetThis(self)->GetCycleTime(outCycleTime); } 636 637 static IOReturn SGetCycleTimeAndUpTime( 638 IOFireWireLibDeviceRef self, 639 UInt32* outCycleTime, 640 UInt64* outUpTime ) 641 { return IOFireWireIUnknown::InterfaceMap<Device>::GetThis(self)->GetCycleTimeAndUpTime(outCycleTime, outUpTime); } 642 643 static IOReturn SGetBusCycleTime( 644 IOFireWireLibDeviceRef self, 645 UInt32* outBusTime, 646 UInt32* outCycleTime) 647 { return IOFireWireIUnknown::InterfaceMap<Device>::GetThis(self)->GetBusCycleTime(outBusTime, outCycleTime); } 648 static IOReturn SGetGenerationAndNodeID( 649 IOFireWireLibDeviceRef self, 650 UInt32* outGeneration, 651 UInt16* outNodeID) 652 { return IOFireWireIUnknown::InterfaceMap<Device>::GetThis(self)->GetGenerationAndNodeID(outGeneration, outNodeID); } 653 static IOReturn SGetLocalNodeID( 654 IOFireWireLibDeviceRef self, 655 UInt16* outLocalNodeID) 656 { return IOFireWireIUnknown::InterfaceMap<Device>::GetThis(self)->GetLocalNodeID(outLocalNodeID); } 657 static IOReturn SGetResetTime( 658 IOFireWireLibDeviceRef self, 659 AbsoluteTime* outResetTime) 660 { return IOFireWireIUnknown::InterfaceMap<Device>::GetThis(self)->GetResetTime(outResetTime); } 661 662 // --- config rom support ---------------------- 663 static IOFireWireLibLocalUnitDirectoryRef 664 SCreateLocalUnitDirectory( 665 IOFireWireLibDeviceRef self, 666 REFIID iid) ; 667 668 // --- config directory support ---------------- 669 static IOFireWireLibConfigDirectoryRef 670 SGetConfigDirectory( 671 IOFireWireLibDeviceRef self, 672 REFIID iid) ; 673 static IOFireWireLibConfigDirectoryRef 674 SCreateConfigDirectoryWithIOObject( 675 IOFireWireLibDeviceRef self, 676 io_object_t inObject, 677 REFIID iid) ; 678 679 // --- pseudo address space support ------------ 680 static IOFireWireLibPseudoAddressSpaceRef 681 SCreatePseudoAddressSpace( 682 IOFireWireLibDeviceRef self, 683 UInt32 inLength, 684 void* inRefCon, 685 UInt32 inQueueBufferSize, 686 void* inBackingStore, 687 UInt32 inFlags, 688 REFIID iid) ; 689 static IOFireWireLibPhysicalAddressSpaceRef 690 SCreatePhysicalAddressSpace( 691 IOFireWireLibDeviceRef self, 692 UInt32 inLength, 693 void* inBackingStore, 694 UInt32 inFlags, 695 REFIID iid) ; 696 static IOFireWireLibPseudoAddressSpaceRef 697 SCreateInitialUnitsPseudoAddressSpace( 698 IOFireWireLibDeviceRef self, 699 UInt32 inAddressLo, 700 UInt32 inSize, 701 void* inRefCon, 702 UInt32 inQueueBufferSize, 703 void* inBackingStore, 704 UInt32 inFlags, 705 REFIID iid) ; 706 707 // --- debugging ------------------------------- 708 static IOReturn SFireBugMsg( 709 IOFireWireLibDeviceRef self, 710 const char * msg) 711 { return IOFireWireIUnknown::InterfaceMap<Device>::GetThis(self)->FireBugMsg(msg); } 712 static IOReturn SFireLog( 713 IOFireWireLibDeviceRef self, 714 const char * format, 715 ... ) ; 716 717 // --- isoch ----------------------------------- 718 static IOReturn SAddIsochCallbackDispatcherToRunLoop( 719 IOFireWireLibDeviceRef self, 720 CFRunLoopRef inRunLoop) ; 721 static IOReturn SAddIsochCallbackDispatcherToRunLoopForMode( // v3+ 722 IOFireWireLibDeviceRef self, 723 CFRunLoopRef inRunLoop, 724 CFStringRef inRunLoopMode ) ; 725 static void SRemoveIsochCallbackDispatcherFromRunLoop( // v3+ 726 IOFireWireLibDeviceRef self) ; 727 static IOFireWireLibIsochChannelRef 728 SCreateIsochChannel( 729 IOFireWireLibDeviceRef self, 730 Boolean doIrm, 731 UInt32 packetSize, 732 IOFWSpeed prefSpeed, 733 REFIID iid) ; 734 static IOFireWireLibRemoteIsochPortRef 735 SCreateRemoteIsochPort( 736 IOFireWireLibDeviceRef self, 737 Boolean inTalking, 738 REFIID iid) ; 739 static IOFireWireLibLocalIsochPortRef 740 S_CreateLocalIsochPort( 741 IOFireWireLibDeviceRef self, 742 Boolean inTalking, 743 DCLCommand* inDCLProgram, 744 UInt32 inStartEvent, 745 UInt32 inStartState, 746 UInt32 inStartMask, 747 IOVirtualRange inDCLProgramRanges[], // optional optimization parameters 748 UInt32 inDCLProgramRangeCount, 749 IOVirtualRange inBufferRanges[], 750 UInt32 inBufferRangeCount, 751 REFIID iid) ; 752 static IOFireWireLibDCLCommandPoolRef 753 SCreateDCLCommandPool( 754 IOFireWireLibDeviceRef self, 755 IOByteCount size, 756 REFIID iid ) ; 757 static void* SGetRefCon( 758 IOFireWireLibDeviceRef self) { return IOFireWireIUnknown::InterfaceMap<Device>::GetThis(self)->mUserRefCon ; } 759 static void SSetRefCon( 760 IOFireWireLibDeviceRef self, 761 const void* inRefCon ) { IOFireWireIUnknown::InterfaceMap<Device>::GetThis(self)->mUserRefCon = const_cast<void*>(inRefCon) ; } 762 static void SPrintDCLProgram( IOFireWireLibDeviceRef self, const DCLCommand* dcl, UInt32 dclCount ) ; 763 // 764 // v4 765 // 766 static IOReturn SGetBusGeneration( IOFireWireLibDeviceRef self, UInt32* outGeneration ) ; 767 static IOReturn SGetLocalNodeIDWithGeneration( IOFireWireLibDeviceRef self, UInt32 checkGeneration, UInt16* outLocalNodeID ) ; 768 static IOReturn SGetRemoteNodeID( IOFireWireLibDeviceRef self, UInt32 checkGeneration, UInt16* outRemoteNodeID ) ; 769 static IOReturn SGetSpeedToNode( IOFireWireLibDeviceRef self, UInt32 checkGeneration, IOFWSpeed* outSpeed) ; 770 static IOReturn SGetSpeedBetweenNodes( IOFireWireLibDeviceRef self, UInt32 checkGeneration, UInt16 srcNodeID, UInt16 destNodeID, IOFWSpeed* outSpeed) ; 771 772 773 // 774 // v5 775 // 776 777 static IOReturn S_GetIRMNodeID( IOFireWireLibDeviceRef self, UInt32 checkGeneration, UInt16* outIRMNodeID ) ; 778 779 // 780 // v6 781 // 782 783 static IOReturn S_ClipMaxRec2K( IOFireWireLibDeviceRef self, Boolean clipMaxRec ) ; 784 static IOFireWireLibNuDCLPoolRef S_CreateNuDCLPool( IOFireWireLibDeviceRef self, UInt32 capacity, REFIID iid ) ; 785 786 // 787 // v7 788 // 789 790 static IOFireWireSessionRef S_GetSessionRef( IOFireWireLibDeviceRef self ) ; 791 792 // 793 // v8 794 // 795 796 static IOFireWireLibLocalIsochPortRef 797 S_CreateLocalIsochPortWithOptions( 798 IOFireWireLibDeviceRef self, 799 Boolean inTalking, 800 DCLCommand* inDCLProgram, 801 UInt32 inStartEvent, 802 UInt32 inStartState, 803 UInt32 inStartMask, 804 IOVirtualRange inDCLProgramRanges[], // optional optimization parameters 805 UInt32 inDCLProgramRangeCount, 806 IOVirtualRange inBufferRanges[], 807 UInt32 inBufferRangeCount, 808 IOFWIsochPortOptions options, 809 REFIID iid) ; 810 811 // 812 // v9 813 // 814 815 static IOFireWireLibVectorCommandRef S_CreateVectorCommand( 816 IOFireWireLibDeviceRef self, 817 IOFireWireLibCommandCallback callback, 818 void * inRefCon, 819 REFIID iid); 820 821 static IOReturn S_AllocateIRMBandwidthInGeneration(IOFireWireLibDeviceRef self, UInt32 bandwidthUnits, UInt32 generation) ; 822 823 static IOReturn S_ReleaseIRMBandwidthInGeneration(IOFireWireLibDeviceRef self, UInt32 bandwidthUnits, UInt32 generation) ; 824 825 static IOReturn S_AllocateIRMChannelInGeneration(IOFireWireLibDeviceRef self, UInt8 isochChannel, UInt32 generation) ; 826 827 static IOReturn S_ReleaseIRMChannelInGeneration(IOFireWireLibDeviceRef self, UInt8 isochChannel, UInt32 generation) ; 828 829 static IOFireWireLibIRMAllocationRef S_CreateIRMAllocation( IOFireWireLibDeviceRef self, 830 Boolean releaseIRMResourcesOnFree, 831 IOFireWireLibIRMAllocationLostNotificationProc callback, 832 void *pLostNotificationProcRefCon, 833 REFIID iid) ; 834 835 static IOFWAsyncStreamListenerInterfaceRef S_CreateAsyncStreamListener( IOFireWireLibDeviceRef self, 836 UInt32 channel, 837 IOFWAsyncStreamListenerHandler callback, 838 void* inRefCon, 839 UInt32 inQueueBufferSize, 840 REFIID iid ) ; 841 842 static mach_port_t S_GetIsochAsyncPort( IOFireWireLibDeviceRef self ); 843 844 static IOFireWireLibCommandRef S_CreatePHYCommand( IOFireWireLibDeviceRef self, 845 UInt32 data1, 846 UInt32 data2, 847 IOFireWireLibCommandCallback callback, 848 Boolean failOnReset, 849 UInt32 generation, 850 void * inRefCon, 851 REFIID iid ); 852 853 static IOFireWireLibPHYPacketListenerRef S_CreatePHYPacketListener( IOFireWireLibDeviceRef self, 854 UInt32 queueCount, 855 REFIID iid ); 856 857 static IOFireWireLibCommandRef S_CreateAsyncStreamCommand( IOFireWireLibDeviceRef self, 858 UInt32 channel, 859 UInt32 sync, 860 UInt32 tag, 861 void* buf, 862 UInt32 size, 863 IOFireWireLibCommandCallback callback, 864 Boolean failOnReset, 865 UInt32 generation, 866 void* inRefCon, 867 REFIID iid); 868 869 } ; 870} // namespace 871