apple manual

1392
I/O Kit Framework Reference

Upload: tommaso-scigliuzzo

Post on 01-Nov-2014

928 views

Category:

Documents


49 download

DESCRIPTION

As title

TRANSCRIPT

I/O Kit Framework Reference

Contents

I/O Kit Framework Reference 20 COMInterfaces 23 IOATASMARTInterface 24Overview 24 Tasks 24 Instance Methods 25

IOFireWireAsyncStreamCommandInterface 30Overview 30 Tasks 30 Instance Methods 32 Instance Variables 45

IOFireWireAVCLibConsumerInterface 47Overview 47

IOFireWireAVCLibProtocolInterface 48Overview 48 Tasks 48 Instance Methods 50

IOFireWireAVCLibUnitInterface 64Overview 64 Tasks 64 Instance Methods 66

IOFireWireCommandInterface 76Overview 76 Tasks 76 Instance Methods 78 Instance Variables 90

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

2

Contents

IOFireWireCompareSwapCommandInterface 92Overview 92 Tasks 92 Instance Methods 93 Instance Variables 103

IOFireWireCompareSwapCommandInterface_v3 104Overview 104 Tasks 104 Instance Methods 106 Instance Variables 121

IOFireWireConfigDirectoryInterface 122Overview 122 Tasks 122 Instance Methods 124 Instance Variables 129

IOFireWireDCLCommandPoolInterface 130Overview 130 Tasks 130 Instance Methods 132 Instance Variables 138

IOFireWireDeviceInterface 139Overview 139 Tasks 140 Instance Methods 145 Instance Variables 193

IOFireWireIsochChannelInterface 195Overview 195 Tasks 195 Instance Methods 196 Instance Variables 201

IOFireWireIsochPortInterface 202Overview 202 Tasks 202 Instance Methods 203

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

3

Contents

Instance Variables 206

IOFireWireLibIRMAllocationInterface 207Overview 207 Tasks 207 Instance Methods 208

IOFireWireLibPHYPacketListenerInterface 212Overview 212 Tasks 212 Instance Methods 213 Instance Variables 216

IOFireWireLibVectorCommandInterface 217Overview 217 Tasks 217 Instance Methods 218 Instance Variables 227

IOFireWireLocalIsochPortInterface 228Overview 228 Tasks 228 Instance Methods 229 Instance Variables 237

IOFireWireLocalUnitDirectoryInterface 238Overview 238 Tasks 238 Instance Methods 239 Instance Variables 241

IOFireWireNubInterface 242Overview 242

IOFireWireNuDCLPoolInterface 244Overview 244 Tasks 244 Instance Methods 247 Instance Variables 266

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

4

Contents

IOFireWirePHYCommandInterface 267Overview 267 Tasks 267 Instance Methods 269 Instance Variables 282

IOFireWirePhysicalAddressSpaceInterface 283Overview 283 Tasks 283 Instance Methods 284 Instance Variables 286

IOFireWirePseudoAddressSpaceInterface 287Overview 287 Tasks 287 Instance Methods 288 Instance Variables 292

IOFireWireReadCommandInterface 293Overview 293 Tasks 293 Instance Methods 295 Instance Variables 308

IOFireWireReadQuadletCommandInterface 309Overview 309 Tasks 309 Instance Methods 310 Instance Variables 318

IOFireWireRemoteIsochPortInterface 319Overview 319 Tasks 319 Instance Methods 320 Instance Variables 325

IOFireWireSBP2LibLoginInterface 326Overview 326 Tasks 326 Instance Methods 328

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

5

Contents

IOFireWireSBP2LibLUNInterface 340Overview 340 Tasks 340 Instance Methods 341

IOFireWireSBP2LibMgmtORBInterface 348Overview 348 Tasks 348 Instance Methods 349

IOFireWireSBP2LibORBInterface 353Overview 353 Tasks 353 Instance Methods 354

IOFireWireUnitInterface 362Overview 362

IOFireWireWriteCommandInterface 364Overview 364 Tasks 364 Instance Methods 366 Instance Variables 378

IOFireWireWriteQuadletCommandInterface 380Overview 380 Tasks 380 Instance Methods 381 Instance Variables 388

IOFWAsyncStreamListenerInterface 390Overview 390 Tasks 390 Instance Methods 391 Instance Variables 395

IOHIDDeviceDeviceInterface 396Overview 396 Tasks 396 Instance Methods 397

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

6

Contents

IOHIDDeviceInterface 407Overview 407 Tasks 407 Instance Methods 408

IOHIDDeviceInterface121 414Overview 414 Tasks 414 Instance Methods 414

IOHIDDeviceInterface122 417Overview 417 Tasks 417 Instance Methods 417

IOHIDDeviceQueueInterface 420Overview 420 Tasks 420 Instance Methods 421

IOHIDDeviceTransactionInterface 427Overview 427 Tasks 427 Instance Methods 428

IOHIDOutputTransactionInterface 435Overview 435 Tasks 435 Instance Methods 436

IOHIDQueueInterface 443Overview 443 Tasks 443 Instance Methods 444

IOUPSPlugInInterface 451Overview 451 Tasks 451 Instance Methods 452

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

7

Contents

IOUSBDeviceInterface 456Overview 456 Tasks 456 Instance Methods 458

IOUSBDeviceInterface182 471Overview 471 Tasks 471 Instance Methods 472

IOUSBDeviceInterface187 477Overview 477 Tasks 477 Instance Methods 477

IOUSBDeviceInterface197 479Overview 479 Tasks 479 Instance Methods 479

IOUSBDeviceInterface245 482Overview 482

IOUSBDeviceInterface300 483Overview 483 Tasks 483 Instance Methods 483

IOUSBDeviceInterface320 485Overview 485 Tasks 485 Instance Methods 486

IOUSBDeviceInterface500 489Overview 489 Tasks 489 Instance Methods 489

IOUSBInterfaceInterface 491Overview 491

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

8

Contents

Tasks 491 Instance Methods 493

IOUSBInterfaceInterface182 514Overview 514 Tasks 514 Instance Methods 515

IOUSBInterfaceInterface183 522Overview 522 Tasks 522 Instance Methods 522

IOUSBInterfaceInterface190 524Overview 524 Tasks 524 Instance Methods 525

IOUSBInterfaceInterface192 529Overview 529 Tasks 529 Instance Methods 530

IOUSBInterfaceInterface197 537Overview 537 Tasks 537 Instance Methods 537

MMCDeviceInterface 540Overview 540 Tasks 540 Instance Methods 541 Instance Variables 560

SCSITaskDeviceInterface 561Overview 561 Tasks 561 Instance Methods 562 Instance Variables 565

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

9

Contents

SCSITaskInterface 566Overview 566 Tasks 566 Instance Methods 567 Instance Variables 578

Other References 579 ATASMARTLib.h Reference 580Overview 580 Constants 580

IOAudioDefines.h User-Space Reference 583Overview 583 Constants 583

IOAudioLib.h Reference 591Overview 591 Functions 591

IOAudioTypes.h User-Space Reference 593Overview 593 Data Types 593 Constants 599

IOBDBlockStorageDevice.h User-Space Reference 601Overview 601 Constants 601

IOBDMedia.h User-Space Reference 602Overview 602 Constants 602

IOBlockStorageDevice.h User-Space Reference 604Overview 604 Constants 604

IOBlockStorageDriver.h User-Space Reference 605Overview 605 Constants 605

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

10

Contents

IOCDBlockStorageDevice.h User-Space Reference 610Overview 610 Constants 610

IOCDMedia.h User-Space Reference 611Overview 611 Constants 611

IODVDBlockStorageDevice.h User-Space Reference 613Overview 613 Constants 613

IODVDMedia.h User-Space Reference 614Overview 614 Constants 614

IODataQueueClient.h Reference 617Overview 617 Functions 617

IODataQueueShared.h User-Space Reference 623Overview 623 Data Types 623 Constants 625

IOEthernetController.h User-Space Reference 626Overview 626 Constants 626

IOEthernetInterface.h User-Space Reference 629Overview 629 Constants 629

IOEthernetStats.h User-Space Reference 631Overview 631 Data Types 631 Constants 634

IOFilterScheme.h User-Space Reference 635Overview 635

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

11

Contents

Constants 635

IOFireWireAVCLib.h Reference 636Overview 636 Callbacks 636

IOFireWireFamilyCommon.h User-Space Reference 640Overview 640 Constants 640

IOFireWireLib.h Reference 643Overview 643 Functions 644 Callbacks 644 Data Types 651 Constants 652

IOFireWireSBP2Lib.h Reference 654Overview 654 Callbacks 654 Data Types 658 Constants 660

IOFireWireStorageCharacteristics.h User-Space Reference 663Overview 663 Constants 663

IOFramebufferShared.h User-Space Reference 665Overview 665 Data Types 665 Constants 671

IOGraphicsLib.h Reference 674Overview 674 Functions 675 Constants 696

IOGraphicsTypes.h User-Space Reference 698Overview 698 Data Types 698

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

12

Contents

IOHIDBase.h Reference 714Overview 714 Callbacks 714 Data Types 718 Constants 719

IOHIDDevice.h User-Space Reference 721Overview 721 Functions 721

IOHIDDevicePlugIn.h Reference 745Overview 745 Constants 746

IOHIDElement.h Reference 751Overview 751 Functions 751

IOHIDKeys.h User-Space Reference 774Overview 774 Data Types 774 Constants 775

IOHIDLibObsolete.h Reference 813Overview 813 Callbacks 813 Constants 816

IOHIDManager.h Reference 819Overview 819 Functions 819 Data Types 832

IOHIDQueue.h Reference 834Overview 834 Functions 835 Data Types 844

IOHIDTransaction.h Reference 845Overview 845

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

13

Contents

Functions 845 Data Types 855

IOHIDValue.h Reference 856Overview 856 Functions 856

IOI2CInterface.h User-Space Reference 864Overview 864 Functions 864 Data Types 868

IOKitLib.h Reference 872Overview Functions Callbacks Constants 872 873 927 930

IOKitServer.h User-Space Reference 932Overview 932 Constants 932

IOMedia.h User-Space Reference 936Overview 936 Constants 936

IOMessage.h User-Space Reference 941Overview 941 Functions 941 Constants 942

IONetworkController.h User-Space Reference 945Overview 945 Constants 945

IONetworkData.h User-Space Reference 952Overview 952 Constants 952

IONetworkInterface.h User-Space Reference 955

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

14

Contents

Overview 955 Constants 955

IONetworkLib.h Reference 959Overview 959 Functions 959 Constants 965

IONetworkMedium.h User-Space Reference 966Overview 966 Data Types 966 Constants 966

IONetworkStats.h User-Space Reference 968Overview 968 Data Types 968 Constants 969

IOPM.h User-Space Reference 970Overview 970 Data Types 970 Constants 971

IOPMKeys.h Reference 979Overview 979 Constants 979

IOPMLib.h Reference 981Overview 981 Functions by Task 981 Functions 984 Data Types 1009 Constants 1010

IOPSKeys.h Reference 1021Overview 1021 Constants 1021

IOPartitionScheme.h User-Space Reference 1036Overview 1036

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

15

Contents

Constants 1036

IOPowerSources.h Reference 1038Overview 1038 Functions by Task 1038 Functions 1039 Data Types 1045 Constants 1046

IOStorage.h User-Space Reference 1047Overview 1047 Constants 1047

IOStorageCardCharacteristics.h User-Space Reference 1049Overview 1049 Constants 1049

IOStorageDeviceCharacteristics.h User-Space Reference 1059Overview 1059 Constants 1059

IOStorageProtocolCharacteristics.h User-Space Reference 1075Overview 1075 Constants 1075

IOStreamLib.h Reference 1116Overview 1116 Functions by Task 1116 Functions 1119 Callbacks 1129 Data Types 1129

IOStreamShared.h User-Space Reference 1131Overview 1131 Data Types 1131 Constants 1133

IOTypes.h User-Space Reference 1136Overview 1136 Constants 1136

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

16

Contents

IOUPSPlugIn.h Reference 1138Overview 1138 Callbacks 1139 Constants 1140

IOUSBLib.h Reference 1142Overview 1142 Functions 1142 Constants 1146

IOVideoDeviceLib.h User-Space Reference 1175Overview 1175 Functions 1175 Callbacks 1180 Data Types 1181 Constants 1182

IOVideoDeviceShared.h User-Space Reference 1184Overview 1184 Constants 1184

IOVideoDeviceUserClient.h User-Space Reference 1186Overview 1186 Constants 1186

IOVideoTypes.h User-Space Reference 1188Overview 1188 Data Types 1188 Constants 1190

KextManager.h Reference 1199Overview 1199 Functions 1199

SCSICmds_INQUIRY_Definitions.h User-Space Reference 1205Overview 1205 Data Types 1205 Constants 1211

SCSICmds_MODE_Definitions.h User-Space Reference 1238

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

17

Contents

Overview 1238 Data Types 1238 Constants 1244

SCSICmds_READ_CAPACITY_Definitions.h User-Space Reference 1256Overview 1256 Data Types 1256 Constants 1257

SCSICmds_REPORT_LUNS_Definitions.h User-Space Reference 1260Overview 1260 Data Types 1260 Constants 1262

SCSICmds_REQUEST_SENSE_Defs.h User-Space Reference 1264Overview 1264 Data Types 1264 Constants 1265

SCSICommandDefinitions.h User-Space Reference 1272Overview 1272 Data Types 1272 Constants 1289

SCSITask.h User-Space Reference 1297Overview 1297 Callbacks 1297 Data Types 1298 Constants 1308

SCSITaskLib.h Reference 1311Overview 1311 Callbacks 1311 Constants 1312

USB.h User-Space Reference 1318Overview 1318 Functions by Task 1318 Functions 1319 Callbacks 1320

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

18

Contents

Data Types 1323 Constants 1350

USBSpec.h User-Space Reference 1378Overview 1378 Constants 1378

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

19

Framework Header file directories Companion guide Declared in

/System/Library/Frameworks/IOKit.framework /System/Library/Frameworks/IOKit.framework/Headers I/O Kit Fundamentals ATASMARTLib.h Controls.h IOAudioDefines.h IOAudioTypes.h IOBDBlockStorageDevice.h IOBDMedia.h IOBlockStorageDevice.h IOBlockStorageDriver.h IOCDBlockStorageDevice.h IOCDMedia.h IODVDBlockStorageDevice.h IODVDMedia.h IODataQueue.h IODataQueueClient.h IODataQueueShared.h IOEthernetController.h IOEthernetInterface.h IOEthernetStats.h IOFilterScheme.h IOFireWireAVCLib.h IOFireWireFamilyCommon.h IOFireWireLib.h IOFireWireSBP2Lib.h IOFireWireSBP2Login.h IOFireWireStorageCharacteristics.h IOFramebufferShared.h IOGraphicsLib.h

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

20

IOHIDBase.h IOHIDDevice.h IOHIDDevicePlugIn.h IOHIDElement.h IOHIDKeys.h IOHIDLibObsolete.h IOHIDManager.h IOHIDQueue.h IOHIDTransaction.h IOHIDValue.h IOI2CInterface.h IOKitLib.h IOKitServer.h IOLib.h IOMedia.h IOMessage.h IONetworkController.h IONetworkData.h IONetworkInterface.h IONetworkLib.h IONetworkMedium.h IONetworkStats.h IOPM.h IOPMKeys.h IOPMLib.h IOPSKeys.h IOPartitionScheme.h IOPowerSources.h IOSharedDataQueue.h IOStorage.h IOStorageCardCharacteristics.h IOStorageDeviceCharacteristics.h IOStorageProtocolCharacteristics.h IOStreamLib.h IOStreamShared.h IOTypes.h IOUPSPlugIn.h

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

21

IOUSBLib.h IOVideoDeviceLib.h IOVideoDeviceShared.h IOVideoDeviceUserClient.h IOVideoTypes.h KextManager.h SCSICmds_INQUIRY_Definitions.h SCSICmds_MODE_Definitions.h SCSICmds_READ_CAPACITY_Definitions.h SCSICmds_REPORT_LUNS_Definitions.h SCSICmds_REQUEST_SENSE_Defs.h SCSICommandDefinitions.h SCSITask.h SCSITaskLib.h USB.h USBSpec.h

The I/O Kit framework implements non-kernel access to I/O Kit objects (drivers and nubs) through the device-interface mechanism.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

22

COMInterfaces

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

23

IOATASMARTInterface

Declared in

ATASMARTLib.h (page 580)

OverviewSelf-Monitoring, Analysis, and Reporting Technology Interface. See section 6.14 and section 8.54 of T13:1410D ATA/ATAPI-6 for details on Self-Monitoring, Analysis, and Reporting Technology feature set.

TasksMiscellaneousGetATAIdentifyData

(page 25) Reads the 512-byte data provided by the drive in response to the ATA IDENTIFY DEVICE command. (page 26) (page 26) toggle SMART Autosave.

SMARTEnableDisableAutosave

SMARTEnableDisableOperations

toggle SMART Operations.SMARTExecuteOffLineImmediate

(page 26) immediately initiate collection of SMART data. (page 27) Retrieves 512 byte device SMART data structure. (page 27) Retrieves 512 byte device SMART data thresholds structure. (page 27) Reads the 512-byte log at the specified logOffset in the log.

SMARTReadData

SMARTReadDataThresholds

SMARTReadLogAtAddress

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

24

IOATASMARTInterface Instance Methods

SMARTReadLogDirectory

(page 28) Reads the 512-byte log directory. (page 28) see if device has detected a threshold exceeded condition. (page 29) Test the integrity of the device SMART data structure. (page 29) Writes to the 512-byte log at the specified logOffset in the log.

SMARTReturnStatus

SMARTValidateReadData

SMARTWriteLogAtAddress

Instance MethodsGetATAIdentifyDataReads the 512-byte data provided by the drive in response to the ATA IDENTIFY DEVICE command.IOReturn ( *GetATAIdentifyData ) ( void *interface, void *buffer, UInt32 inSize, UInt32 *outSize );

Parametersinterface

A valid IOATASMARTInterface**.buffer

A valid buffer.inSize

The number of bytes to place in the buffer.outSize

The number of bytes placed in the buffer. Can be NULL if the information is not required by the caller. Return Value An IOReturn result code. If inSize is greater than 512 or less than 1, kIOReturnBadArgument is returned. Discussion Reads the 512-byte data provided by the drive in response to the ATA IDENTIFY DEVICE command. See section 8.15 of ATA/ATAPI-6. The data placed in buffer is guaranteed to be in native endian form on return. (i.e. it will be byte swapped on big endian platforms, so the caller need not do anything)

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

25

IOATASMARTInterface Instance Methods

SMARTEnableDisableAutosavetoggle SMART Autosave.IOReturn ( *SMARTEnableDisableAutosave ) ( void *interface, Boolean enable );

Parametersenable

Passing true will ENABLE SMART Autosave, false will DISABLE SMART Autosave. Return Value Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService, kIOReturnExclusiveAccess if it is already opened by another client. Discussion See section 8.54.2 of ATA/ATAPI-6.

SMARTEnableDisableOperationstoggle SMART Operations.IOReturn ( *SMARTEnableDisableOperations ) ( void *interface, Boolean enable );

Parametersenable

Passing true will ENABLE SMART operations, false will DISABLE SMART operations. Return Value Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService, kIOReturnExclusiveAccess if it is already opened by another client. Discussion See section 8.54.1 and 8.54.3 of ATA/ATAPI-6.

SMARTExecuteOffLineImmediateimmediately initiate collection of SMART data.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

26

IOATASMARTInterface Instance Methods

IOReturn ( *SMARTExecuteOffLineImmediate ) ( void *interface, Boolean extendedTest );

ParametersextendedTest

passing true will collect "off-line" extended test, false short test. Return Value Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService, kIOReturnExclusiveAccess if it is already opened by another client. Discussion See section 8.54.4 of ATA/ATAPI-6.

SMARTReadDataRetrieves 512 byte device SMART data structure.IOReturn ( *SMARTReadData ) ( void *interface, ATASMARTData *data );

Discussion See section 8.54.5 of ATA/ATAPI-6. Will return an appropiate error if command can not be completed.

SMARTReadDataThresholdsRetrieves 512 byte device SMART data thresholds structure.IOReturn ( *SMARTReadDataThresholds ) ( void *interface, ATASMARTDataThresholds *dataThresholds );

Discussion Retrieves 512 byte device SMART data thresholds structure. This command is not defined as part of ATA/ATAPI-6, but is implemented by a large variety of manufacturers. Will return an appropiate error if command can not be completed.

SMARTReadLogAtAddressReads the 512-byte log at the specified logOffset in the log.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

27

IOATASMARTInterface Instance Methods

IOReturn ( *SMARTReadLogAtAddress ) ( void *interface, UInt32 logOffset, void *buffer, UInt32 size );

Discussion Reads the 512-byte log at the specified logOffset in the log. See section 8.54.6.4 of ATA/ATAPI-6.

SMARTReadLogDirectoryReads the 512-byte log directory.IOReturn ( *SMARTReadLogDirectory ) ( void *interface, ATASMARTLogDirectory *logData );

Discussion The log directory is a directory of all possible SMART logs available from the drive.

SMARTReturnStatussee if device has detected a threshold exceeded condition.IOReturn ( *SMARTReturnStatus ) ( void *interface, Boolean *exceededCondition );

ParametersexceededCondition

if exceededCondition is non-zero the device threshold exceeded condition. Return Value Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService, kIOReturnExclusiveAccess if it is already opened by another client. Discussion The caller will poll this function and if exceededCondition is non-zero and we returned kIOReturnSuccess the device threshold exceeded condition. This would prompt the caller to call ATASMARTReadData to get more information. See section 8.54.7 of ATA/ATAPI-6.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

28

IOATASMARTInterface Instance Methods

SMARTValidateReadDataTest the integrity of the device SMART data structure.IOReturn ( *SMARTValidateReadData ) ( void *interface, const ATASMARTData *data );

Discussion The data structure checksum is the two's complement of the sum of the first 511 bytes in the data structure. The sum of all 512 bytes will be zero when the checksum is correct. See section 8.54.5.8.7 of ATA/ATAPI-6. Will return an error if checksum fails.

SMARTWriteLogAtAddressWrites to the 512-byte log at the specified logOffset in the log.IOReturn ( *SMARTWriteLogAtAddress ) ( void *interface, UInt32 logOffset, const void *buffer, UInt32 size );

Discussion Writes to the 512-byte log at the specified logOffset in the log. See section 8.54.8.4 of ATA/ATAPI-6.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

29

IOFireWireAsyncStreamCommandInterface

Declared in

IOFireWireLib.h (page 643)

OverviewDescription forthcoming

TasksMiscellaneousCancel

(page 32) Cancel command execution (page 32) Gets the most recently received ack code for this transaction. (page 33) Set the command refCon value and callback handler, and submit the command to FireWire for execution. (page 33) Gets the refcon associated with this command (page 34) Gets the most recently received response code for this transaction. (page 34) Return command completion status. (page 35) Get command target address. (page 35) Return number of bytes transferred by this command object when it last completed execution. (page 36) Is this command object currently executing?

GetAckCode

GetBuffer

GetRefCon

GetResponseCode

GetStatus

GetTargetAddress

GetTransferredBytes

IsExecuting

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

30

IOFireWireAsyncStreamCommandInterface Tasks

SetBuffer

(page 37) Set the buffer where read data should be stored. (page 37) Set the completion handler to be called once the command completes asynchronous execution . (page 38) Set the new channel to transmit the AsyncStream command. (page 38) Set flags governing this command's execution. (page 40) Set FireWire bus generation for which the command object shall be valid. If the failOnReset attribute has been set, the command will only be considered for execution during the bus generation specified by this function. (page 40) Set the maximum size in bytes of packets transferred by this command. (page 41) Gets the most recently received ack code for this transaction. (page 41) Sets the maximum number of retries for this command. (page 42) Set the user refCon value. This is the user defined value that will be passed in the refCon argument to the completion function. (page 42) Set the sync bits for the AsynStream packets. (page 43) Set the tag bits for the AsynStream packets. (page 43) Set command target address (page 44) Sets the duration of the timeout for this command. (page 44)

SetCallback

SetChannel

SetFlags

SetGeneration

SetMaxPacket

SetMaxPacketSpeed

SetMaxRetryCount

SetRefCon

SetSyncBits

SetTagBits

SetTarget

SetTimeoutDuration

Submit

SubmitWithRefconAndCallback

(page 45) Set the command refCon value and callback handler, and submit the command to FireWire for execution.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

31

IOFireWireAsyncStreamCommandInterface Instance Methods

Instance MethodsCancelCancel command executionIOReturn ( *Cancel)( IOFireWireLibCommandRef self, IOReturn reason);

Parametersself

The command object interface of interest Return Value An IOReturn result code Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES YES YES YES YES YES YES YES

GetAckCodeGets the most recently received ack code for this transaction.UInt32 ( *GetAckCode)( IOFireWireLibCommandRef self );

Parametersself

A reference to the command

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

32

IOFireWireAsyncStreamCommandInterface Instance Methods

Return Value The FireWire ack code.

GetBufferSet the command refCon value and callback handler, and submit the command to FireWire for execution.void ( *GetBuffer)( IOFireWireLibCommandRef self, UInt32 *outSize, void **outBuf);

Parametersself

The command object interface of interest Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES NO NO NO YES NO YES NO

GetRefConGets the refcon associated with this commandvoid * ( *GetRefCon)( IOFireWireLibCommandRef self );

Parametersself

A reference to the command Return Value void

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

33

IOFireWireAsyncStreamCommandInterface Instance Methods

GetResponseCodeGets the most recently received response code for this transaction.UInt32 ( *GetResponseCode)( IOFireWireLibCommandRef self );

Parametersself

A reference to the command Return Value The FireWire response code.

GetStatusReturn command completion status.IOReturn ( *GetStatus)( IOFireWireLibCommandRef self);

Parametersself

The command object interface of interest Return Value An IOReturn error code indicating the completion error (if any) returned the last time this command object was executed Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES YES YES YES YES YES YES YES

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

34

IOFireWireAsyncStreamCommandInterface Instance Methods

GetTargetAddressGet command target address.void ( *GetTargetAddress)( IOFireWireLibCommandRef self, FWAddress *outAddr);

Parametersself

The command object interface of interestoutAddr

A pointer to an FWAddress to contain the function result. Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID NO YES YES YES YES YES YES YES

GetTransferredBytesReturn number of bytes transferred by this command object when it last completed execution.UInt32 ( *GetTransferredBytes)( IOFireWireLibCommandRef self);

Parametersself

The command object interface of interest Return Value A UInt32 containing the bytes transferred value

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

35

IOFireWireAsyncStreamCommandInterface Instance Methods

Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES YES YES YES YES YES YES YES

IsExecutingIs this command object currently executing?const Boolean ( *IsExecuting)( IOFireWireLibCommandRef self);

Parametersself

The command object interface of interest Return Value Returns true if the command object is executing. Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES YES YES YES YES YES YES YES

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

36

IOFireWireAsyncStreamCommandInterface Instance Methods

SetBufferSet the buffer where read data should be stored.void ( *SetBuffer)( IOFireWireLibCommandRef self, UInt32 size, void *buf);

Parametersself

The command object interface of interestsize

Size in bytes of the receive buffer.buf

A pointer to the receive buffer. Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES NO NO NO YES NO YES NO

SetCallbackSet the completion handler to be called once the command completes asynchronous execution .void ( *SetCallback)( IOFireWireLibCommandRef self, IOFireWireLibCommandCallback inCallback);

Parametersself

The command object interface of interest

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

37

IOFireWireAsyncStreamCommandInterface Instance Methods

inCallback

A callback handler. Passing nil forces the command object to execute synchronously. Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES YES YES YES YES YES YES YES

SetChannelSet the new channel to transmit the AsyncStream command.void ( *SetChannel)( IOFireWireLibAsyncStreamCommandRef self, UInt32 channel );

Parametersself

The command object interface of interestchannel

The channel for AsyncStream command transmit. Discussion Available in v1 and newer.

SetFlagsSet flags governing this command's execution.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

38

IOFireWireAsyncStreamCommandInterface Instance Methods

void ( *SetFlags)( IOFireWireLibCommandRef self, UInt32 inFlags);

Parametersself

The command object interface of interestinFlags

A UInt32 with bits set corresponding to the flags that should be set for this command object. The following values may be used:

kFWCommandNoFlags -- all flags off kFWCommandInterfaceForceNoCopy -- data sent by this command should always be received/sent directly from the buffer set with SetBuffer(). Whatever data is in the buffer when the command is submitted will be used. kFWCommandInterfaceForceCopyAlways -- data will always be copied out of the command object data buffer when SetBuffer() is called, up to a maximum allowed size (kFWUserCommandSubmitWithCopyMaxBufferBytes). This can result in faster data transfer. Changes made to the data buffer contents after calling SetBuffer() will be ignored; SetBuffer() should be called whenever the data buffer contents change. kFWCommandInterfaceSyncExecute -- Setting this flag causes the command object to execute synchronously. The calling context will block until the command object has completed execution or an error occurs. Using synchronous execution can avoid kernel transitions associated with asynchronous completion and often remove the need for a state machine. kFWCommandInterfaceForceBlockRequest -- Setting this flag causes read and write transactions to use block request packets even if the payload is 4 bytes. If this flag is not set 4 byte transactions will occur using quadlet transactions.

Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES NO NO NO YES NO YES NO

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

39

IOFireWireAsyncStreamCommandInterface Instance Methods

SetGenerationSet FireWire bus generation for which the command object shall be valid. If the failOnReset attribute has been set, the command will only be considered for execution during the bus generation specified by this function.void ( *SetGeneration)( IOFireWireLibCommandRef self, UInt32 generation);

Parametersself

The command object interface of interestgeneration

A bus generation. The current bus generation can be obtained from IOFireWireDeviceInterface::GetBusGeneration(). Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES YES YES YES YES YES YES YES

SetMaxPacketSet the maximum size in bytes of packets transferred by this command.IOReturn ( *SetMaxPacket)( IOFireWireLibCommandRef self, IOByteCount maxPacketSize);

Parametersself

The command object interface of interest

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

40

IOFireWireAsyncStreamCommandInterface Instance Methods

maxPacketSize

Size in bytes of largest packet that should be transferred by this command. Return Value An IOReturn result code indicating whether or not the command was successfully submitted Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES NO NO NO YES NO YES NO

SetMaxPacketSpeedGets the most recently received ack code for this transaction.void ( *SetMaxPacketSpeed)( IOFireWireLibCommandRef self, IOFWSpeed speed );

Parametersself

A reference to the commandspeed

the desired maximum packet speed Return Value void

SetMaxRetryCountSets the maximum number of retries for this command.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

41

IOFireWireAsyncStreamCommandInterface Instance Methods

void ( *SetMaxRetryCount)( IOFireWireLibCommandRef self, UInt32 count );

Parametersself

A reference to the commandcount

The number of retires Return Value void

SetRefConSet the user refCon value. This is the user defined value that will be passed in the refCon argument to the completion function.void ( *SetRefCon)( IOFireWireLibCommandRef self, void *refCon);

Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES YES YES YES YES YES YES YES

SetSyncBitsSet the sync bits for the AsynStream packets.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

42

IOFireWireAsyncStreamCommandInterface Instance Methods

void ( *SetSyncBits)( IOFireWireLibAsyncStreamCommandRef self, UInt16 sync );

Parametersself

The command object interface of interestsync

The value for sync bits in the AsyncStream packet Discussion Available in v1 and newer.

SetTagBitsSet the tag bits for the AsynStream packets.void ( *SetTagBits)( IOFireWireLibAsyncStreamCommandRef self, UInt16 tag );

Parametersself

The command object interface of interesttag

The value for tag bits in the AsyncStream packet Discussion Available in v1 and newer.

SetTargetSet command target addressvoid ( *SetTarget)( IOFireWireLibCommandRef self, const FWAddress *addr);

Parametersself

The command object interface of interest

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

43

IOFireWireAsyncStreamCommandInterface Instance Methods

addr

A pointer to an FWAddress. Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID NO YES YES YES YES YES YES YES

SetTimeoutDurationSets the duration of the timeout for this command.void ( *SetTimeoutDuration)( IOFireWireLibCommandRef self, UInt32 duration );

Parametersself

A reference to the commandduration

A timeout value in microseconds Return Value void

SubmitIOReturn ( *Submit)( IOFireWireLibCommandRef self);

Discussion Description forthcoming

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

44

IOFireWireAsyncStreamCommandInterface Instance Variables

SubmitWithRefconAndCallbackSet the command refCon value and callback handler, and submit the command to FireWire for execution.IOReturn ( *SubmitWithRefconAndCallback)( IOFireWireLibCommandRef self, void *refCon, IOFireWireLibCommandCallback inCallback);

Parametersself

The command object interface of interest Return Value An IOReturn result code indicating whether or not the command was successfully submitted Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES YES YES YES YES YES YES YES

Instance VariablesrevisionUInt32 revision;

Interface revision.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

45

IOFireWireAsyncStreamCommandInterface Instance Variables

versionUInt32 version;

Interface version.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

46

IOFireWireAVCLibConsumerInterface

Declared in

IOFireWireAVCLib.h (page 636)

OverviewInterface for an asynchronous connection consumer. Used to receive data from an asynchronous connection producer.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

47

IOFireWireAVCLibProtocolInterface

Declared in

IOFireWireAVCLib.h (page 636)

OverviewInitial interface discovered for all AVC protocol drivers. The IOFireWireAVCLibProtocolInterface is used to set up local plug control registers and to receive AVC requests.

TasksMiscellaneousaddCallbackDispatcherToRunLoop

(page 50) Adds a dispatcher for kernel callbacks to the specified run loop. (page 50) Installs a virtual AVC subunit. (page 51) Allocates an input plug. (page 52) Allocates an output plug. (page 52) Establishes an internal AVC plug connection between subunit/unit plugs. (page 53) Breaks an internal AVC plug connection between subunit/unit plugs. (page 54) Deallocates an input plug. (page 55) Deallocates an output plug.

addSubunit

allocateInputPlug

allocateOutputPlug

connectTargetPlugs

disconnectTargetPlugs

freeInputPlug

freeOutputPlug

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

48

IOFireWireAVCLibProtocolInterface Tasks

getSubunitPlugSignalFormat

(page 55) Gets the signal format of the specifed plug. (page 55) Gets the connection details for a specific plug. (page 56) Installs a command handler for handling specific incoming AVC commands. (page 57) Publishes an AVC unit directory in the config ROM. (page 57) Returns the current value of the input master plug. (page 58) Returns the current value of an input plug. (page 58) Returns the current value of the output master plug. (page 58) Returns the current value of an output plug. (page 59) Removes a dispatcher for kernel callbacks to the specified run loop. (page 59) Sends an AVC response packet. (page 59) This function has been deprecated. Use installAVCCommandHandler instead. (page 60) Sets callback for user space message routine. (page 60) Sets the signal format of the specifed plug. (page 61) Updates the value of the master input plug (simulating a lock transaction). (page 61) Updates the value of an input plug (simulating a lock transaction). (page 62) Updates the value of the master output plug (simulating a lock transaction). (page 62) Updates the value of an output plug (simulating a lock transaction).

getTargetPlugConnection

installAVCCommandHandler

publishAVCUnitDirectory

readInputMasterPlug

readInputPlug

readOutputMasterPlug

readOutputPlug

removeCallbackDispatcherFromRunLoop

sendAVCResponse

setAVCRequestCallback

setMessageCallback

setSubunitPlugSignalFormat

updateInputMasterPlug

updateInputPlug

updateOutputMasterPlug

updateOutputPlug

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

49

IOFireWireAVCLibProtocolInterface Instance Methods

Instance MethodsaddCallbackDispatcherToRunLoopAdds a dispatcher for kernel callbacks to the specified run loop.IOReturn ( *addCallbackDispatcherToRunLoop)( void *self, CFRunLoopRef cfRunLoopRef );

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.cfRunLoopRef

Reference to a run loop. Return Value Returns kIOReturnSuccess on success. Discussion The user space portions of the AVC API communicate with the in-kernel services by messaging the kernel. Similarly, the kernel messages the user space services in response. These responses need to be picked up by a piece of code. This call adds that code to the specified run loop. Most drivers will call this method on the run loop that was created when your task was created. To avoid deadlock you must avoid sleeping (or spin waiting) the run loop to wait for AVC response. If you do this the dispatcher will never get to run and you will wait forever.

addSubunitInstalls a virtual AVC subunit.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

50

IOFireWireAVCLibProtocolInterface Instance Methods

IOReturn ( *addSubunit)( void *self, UInt32 subunitType, UInt32 numSourcePlugs, UInt32 numDestPlugs, void *refCon, IOFWAVCSubunitPlugHandlerCallback callback, UInt32 *pSubunitTypeAndID);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.subunitType

The type of subunit to create.numSourcePlugs

The number of source plugs for this subunit.numDestPlugs

The number of destination plugs for this subunit.refCon

Arbitrary value passed back as first argument of callback.callback

A pointer to the callback to receive plug management messages.pSubunitTypeAndID

A pointer to a byte to hold the returned subunit address for the new subunit.

allocateInputPlugAllocates an input plug.IOReturn ( *allocateInputPlug)( void *self, void *refcon, IOFWAVCPCRCallback func, UInt32 *plug);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.refcon

Arbitrary value passed back as first argument of callback.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

51

IOFireWireAVCLibProtocolInterface Instance Methods

func

Callback function when a successful lock transaction to the plug has been performed.plug

Set to the plug number if a plug is successfully allocated.

allocateOutputPlugAllocates an output plug.IOReturn ( *allocateOutputPlug)( void *self, void *refcon, IOFWAVCPCRCallback func, UInt32 *plug);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.refcon

Arbitrary value passed back as first argument of callback.func

Callback function when a successful lock transaction to the plug has been performed.plug

Set to the plug number if a plug is successfully allocated.

connectTargetPlugsEstablishes an internal AVC plug connection between subunit/unit plugs.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

52

IOFireWireAVCLibProtocolInterface Instance Methods

IOReturn ( *connectTargetPlugs)( void *self, UInt32 sourceSubunitTypeAndID, IOFWAVCPlugTypes sourcePlugType, UInt32 *pSourcePlugNum, UInt32 destSubunitTypeAndID, IOFWAVCPlugTypes destPlugType, UInt32 *pDestPlugNum, bool lockConnection, bool permConnection);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.sourceSubunitTypeAndID

The subunit type and ID for the source plugsourcePlugType

The source plug type.pSourcePlugNum

A pointer to the source plug num. Will return the actual source plug num here.destSubunitTypeAndID

The subunit type and ID for the destination plug.destPlugType

The dest plug type.pDestPlugNum

A pointer to the dest plug num. Will return the actual dest plug num here.lockConnection

A flag to specify if this connection should be locked.permConnection

A flag to specify if this connection is permanent.

disconnectTargetPlugsBreaks an internal AVC plug connection between subunit/unit plugs.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

53

IOFireWireAVCLibProtocolInterface Instance Methods

IOReturn ( *disconnectTargetPlugs)( void *self, UInt32 sourceSubunitTypeAndID, IOFWAVCPlugTypes sourcePlugType, UInt32 sourcePlugNum, UInt32 destSubunitTypeAndID, IOFWAVCPlugTypes destPlugType, UInt32 destPlugNum);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.sourceSubunitTypeAndID

The subunit type and ID for the source plug.sourcePlugType

The source plug type.sourcePlugNum

The source plug num.destSubunitTypeAndID

The subunit type and ID for the destination plug.destPlugType

The dest plug type.destPlugNum

The dest plug num.

freeInputPlugDeallocates an input plug.void ( *freeInputPlug)( void *self, UInt32 plug);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.plug

Value returned by allocateInputPlug.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

54

IOFireWireAVCLibProtocolInterface Instance Methods

freeOutputPlugDeallocates an output plug.void ( *freeOutputPlug)( void *self, UInt32 plug);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.plug

Value returned by allocateOutputPlug.

getSubunitPlugSignalFormatGets the signal format of the specifed plug.IOReturn ( *getSubunitPlugSignalFormat)( void *self, UInt32 subunitTypeAndID, IOFWAVCPlugTypes plugType, UInt32 plugNum, UInt32 *pSignalFormat);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.subunitTypeAndID

The subunit type and ID of the plug.plugType

The plug type.plugNum

The plug number.pSignalFormat

A pointer to the location to return the signal format value.

getTargetPlugConnectionGets the connection details for a specific plug.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

55

IOFireWireAVCLibProtocolInterface Instance Methods

IOReturn ( *getTargetPlugConnection)( void *self, UInt32 subunitTypeAndID, IOFWAVCPlugTypes plugType, UInt32 plugNum, UInt32 *pConnectedSubunitTypeAndID, IOFWAVCPlugTypes *pConnectedPlugType, UInt32 *pConnectedPlugNum, bool *pLockConnection, bool *pPermConnection);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.subunitTypeAndID

The subunit type and ID of the plug.plugType

The plug type.plugNum

The plug number.pConnectedSubunitTypeAndID

The subunit type and ID of the connected plug.pConnectedPlugType

The type of the connected plug.pConnectedPlugNum

The number of the connected plug.pLockConnection

A pointer for returning the lock status of the connection.pPermConnection

A pointer for returning the perm status of the connection.

installAVCCommandHandlerInstalls a command handler for handling specific incoming AVC commands.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

56

IOFireWireAVCLibProtocolInterface Instance Methods

IOReturn ( *installAVCCommandHandler)( void *self, UInt32 subUnitTypeAndID, UInt32 opCode, void *refCon, IOFWAVCCommandHandlerCallback callback);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.subUnitTypeAndID

The subunit type and ID for this command handler.opCode

The opcode for this command handler.refCon

Arbitrary value passed back as first argument of callback.callback

A pointer to the callback function

publishAVCUnitDirectoryPublishes an AVC unit directory in the config ROM.IOReturn ( *publishAVCUnitDirectory)( void *self);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.

readInputMasterPlugReturns the current value of the input master plug.UInt32 ( *readInputMasterPlug)( void *self);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

57

IOFireWireAVCLibProtocolInterface Instance Methods

readInputPlugReturns the current value of an input plug.UInt32 ( *readInputPlug)( void *self, UInt32 plug);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.plug

Value returned by allocateInputPlug.

readOutputMasterPlugReturns the current value of the output master plug.UInt32 ( *readOutputMasterPlug)( void *self);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.

readOutputPlugReturns the current value of an output plug.UInt32 ( *readOutputPlug)( void *self, UInt32 plug);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.plug

Value returned by allocateOutputPlug.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

58

IOFireWireAVCLibProtocolInterface Instance Methods

removeCallbackDispatcherFromRunLoopRemoves a dispatcher for kernel callbacks to the specified run loop.void ( *removeCallbackDispatcherFromRunLoop)( void *self );

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface. Discussion Undoes the work of addCallbackDispatcherToRunLoop.

sendAVCResponseSends an AVC response packet.IOReturn ( *sendAVCResponse)( void *self, UInt32 generation, UInt16 nodeID, const char *response, UInt32 responseLen);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.generation

The Firewire bus generation that this response should be sent in.nodeID

The node ID of the device we are sending this response to.response

A pointer to the response bytes.responseLen

The number of response bytes.

setAVCRequestCallbackThis function has been deprecated. Use installAVCCommandHandler instead.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

59

IOFireWireAVCLibProtocolInterface Instance Methods

IOReturn ( *setAVCRequestCallback)( void *self, UInt32 subUnitType, UInt32 subUnitID, void *refCon, IOFWAVCRequestCallback callback);

setMessageCallbackSets callback for user space message routine.void ( *setMessageCallback)( void *self, void *refCon, IOFWAVCMessageCallback callback);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.refCon

RefCon to be returned as first argument of completion routine.callback

Address of completion routine. Discussion In FireWire and AVC, bus status messages are delivered via IOKit's message routine. This routine is emulated in user space for AVC and FireWire messages via this callback. You should register here for bus reset and reconnect messages.

setSubunitPlugSignalFormatSets the signal format of the specifed plug.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

60

IOFireWireAVCLibProtocolInterface Instance Methods

IOReturn ( *setSubunitPlugSignalFormat)( void *self, UInt32 subunitTypeAndID, IOFWAVCPlugTypes plugType, UInt32 plugNum, UInt32 signalFormat);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.subunitTypeAndID

The subunit type and ID of the plug.plugType

The plug type.plugNum

The plug number.signalFormat

The 32-bit signal format value.

updateInputMasterPlugUpdates the value of the master input plug (simulating a lock transaction).IOReturn ( *updateInputMasterPlug)( void *self, UInt32 oldVal, UInt32 newVal);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.oldVal

Value returned by readInputMasterPlug.newVal

New value to store in plug if its current value is oldVal.

updateInputPlugUpdates the value of an input plug (simulating a lock transaction).

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

61

IOFireWireAVCLibProtocolInterface Instance Methods

IOReturn ( *updateInputPlug)( void *self, UInt32 plug, UInt32 oldVal, UInt32 newVal);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.plug

Value returned by allocateInputPlug.oldVal

Value returned by readInputPlug.newVal

New value to store in plug if its current value is oldVal.

updateOutputMasterPlugUpdates the value of the master output plug (simulating a lock transaction).IOReturn ( *updateOutputMasterPlug)( void *self, UInt32 oldVal, UInt32 newVal);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.oldVal

Value returned by readOutputMasterPlug.newVal

New value to store in plug if its current value is oldVal.

updateOutputPlugUpdates the value of an output plug (simulating a lock transaction).

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

62

IOFireWireAVCLibProtocolInterface Instance Methods

IOReturn ( *updateOutputPlug)( void *self, UInt32 plug, UInt32 oldVal, UInt32 newVal);

Parametersself

Pointer to IOFireWireAVCLibProtocolInterface.plug

Value returned by allocateOutputPlug.oldVal

Value returned by readOutputPlug.newVal

New value to store in plug if its current value is oldVal.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

63

IOFireWireAVCLibUnitInterface

Declared in

IOFireWireAVCLib.h (page 636)

OverviewInitial interface discovered for all AVC Unit drivers. The IOFireWireAVCLibUnitInterface is the initial interface discovered by most drivers. It supplies the methods that control the operation of the AVC unit as a whole. Finally, the Unit can supply a reference to the IOFireWireUnit. This can be useful if a driver wishes to access the standard FireWire APIs.

TasksMiscellaneousaddCallbackDispatcherToRunLoop

(page 66) Adds a dispatcher for kernel callbacks to the specified runloop. (page 67) (page 67) (page 67)

AVCAsynchronousCommandCancel

AVCAsynchronousCommandReinit

AVCAsynchronousCommandReinitWithCommandBytes

AVCAsynchronousCommandRelease

(page 67)

AVCAsynchronousCommandSubmit

(page 67)

AVCCommand

(page 67) Sends an AVC command to the device and returns the response.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

64

IOFireWireAVCLibUnitInterface Tasks

AVCCommandInGeneration

(page 68) Sends an AVC command to the device and returns the response. (page 69) Decrements the point-to-point connection count of a unit input plug. (page 69) Decrements the point-to-point connection count of a unit output plug. (page 69) Closes an exclusive access to the device. (page 70)

breakP2PInputConnection

breakP2POutputConnection

close

createAVCAsynchronousCommand

getAncestorInterface

(page 70) Creates a plug-in object for an ancestor (in the I/O Registry) of the AVC unit and returns an interface to it. (page 71) Creates a plug-in object for a protocol driver for the FireWire bus the AVC unit is connected to and returns an interface to it. (page 71) Get the session reference. (page 72) Increments the point-to-point connection count of a unit input plug. (page 72) Increments the point-to-point connection count of a unit output plug.

getProtocolInterface

getSessionRef

makeP2PInputConnection

makeP2POutputConnection

open

(page 72) Exclusively opens a connection to the in-kernel device. (page 73) Opens a connection to a device that is not already open. (page 74) Removes a dispatcher for kernel callbacks to the specified run loop. (page 74) Sets callback for user space message routine. (page 75) Updates an AVCCommand's timeout back to 10 seconds.

openWithSessionRef

removeCallbackDispatcherFromRunLoop

setMessageCallback

updateAVCCommandTimeout

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

65

IOFireWireAVCLibUnitInterface Instance Methods

Instance MethodsaddCallbackDispatcherToRunLoopAdds a dispatcher for kernel callbacks to the specified runloop.IOReturn ( *addCallbackDispatcherToRunLoop)( void *self, CFRunLoopRef cfRunLoopRef );

Parametersself

Pointer to IOFireWireAVCLibUnitInterface.cfRunLoopRef

Reference to a run loop. Return Value Returns kIOReturnSuccess on success. Discussion The user space portions of the AVC API communicate with the in-kernel services by messaging the kernel. Similarly, the kernel messages the user space services in response. These responses need to be picked up by a piece of code. This call adds that code to the specified run loop. Most drivers will call this method on the run loop that was created when your task was created. To avoid deadlock you must avoid sleeping (or spin waiting) the run loop to wait for AVC response. If you do this the dispatcher will never get to run and you will wait forever.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

66

IOFireWireAVCLibUnitInterface Instance Methods

AVCAsynchronousCommandCancelIOReturn ( *AVCAsynchronousCommandCancel)( void *self, IOFireWireAVCLibAsynchronousCommand *pCommandObject);

AVCAsynchronousCommandReinitIOReturn ( *AVCAsynchronousCommandReinit)( void *self, IOFireWireAVCLibAsynchronousCommand *pCommandObject);

AVCAsynchronousCommandReinitWithCommandBytesIOReturn ( *AVCAsynchronousCommandReinitWithCommandBytes)( void *self, IOFireWireAVCLibAsynchronousCommand *pCommandObject, const UInt8 *command, UInt32 cmdLen);

AVCAsynchronousCommandReleaseIOReturn ( *AVCAsynchronousCommandRelease)( void *self, IOFireWireAVCLibAsynchronousCommand *pCommandObject);

AVCAsynchronousCommandSubmitIOReturn ( *AVCAsynchronousCommandSubmit)( void *self, IOFireWireAVCLibAsynchronousCommand *pCommandObject);

AVCCommandSends an AVC command to the device and returns the response.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

67

IOFireWireAVCLibUnitInterface Instance Methods

IOReturn ( *AVCCommand)( void *self, const UInt8 *command, UInt32 cmdLen, UInt8 *response, UInt32 *responseLen);

Parametersself

Pointer to IOFireWireAVCLibUnitInterface.command

Pointer to command to send.cmdLen

Length (in bytes) of command.response

Pointer to place to store the response sent by the device.responseLen

Pointer to place to store the length of the response. Discussion This function will block until the device returns a response or the kernel driver times out.

AVCCommandInGenerationSends an AVC command to the device and returns the response.IOReturn ( *AVCCommandInGeneration)( void *self, UInt32 busGeneration, const UInt8 *command, UInt32 cmdLen, UInt8 *response, UInt32 *responseLen);

Parametersself

Pointer to IOFireWireAVCLibUnitInterface.busGeneration

FireWire bus generation that the command is valid in.command

Pointer to command to send.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

68

IOFireWireAVCLibUnitInterface Instance Methods

cmdLen

Length (in bytes) of command.response

Pointer to place to store the response sent by the device.responseLen

Pointer to place to store the length of the response. Discussion Sends an AVC command to the device and returns the response. The command must complete in the specified bus generation. This function is only available if the interface version is > 1 (MacOSX 10.2.0 or later?). This function will block until the device returns a response or the kernel driver times out.

breakP2PInputConnectionDecrements the point-to-point connection count of a unit input plug.IOReturn ( *breakP2PInputConnection)( void *self, UInt32 inputPlug);

Discussion This function is only available if the interface version is > 3.

breakP2POutputConnectionDecrements the point-to-point connection count of a unit output plug.IOReturn ( *breakP2POutputConnection)( void *self, UInt32 outputPlug);

Discussion This function is only available if the interface version is > 3.

closeCloses an exclusive access to the device.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

69

IOFireWireAVCLibUnitInterface Instance Methods

void ( *close)( void *self );

Parametersself

Pointer to IOFireWireAVCLibUnitInterface. Discussion Closes an exclusive access to the device. When a device is closed it may be unloaded by the kernel. If it is unloaded and then later reappears it will be represented by a different object. You won't be able to use this user client on the new object. The new object will have to be looked up in the I/O Registry and a new user client will have to be opened on it.

createAVCAsynchronousCommandIOReturn ( *createAVCAsynchronousCommand)( void *self, const UInt8 *command, UInt32 cmdLen, IOFireWireAVCLibAsynchronousCommandCallback completionCallback, void *pRefCon, IOFireWireAVCLibAsynchronousCommand **ppCommandObject);

getAncestorInterfaceCreates a plug-in object for an ancestor (in the I/O Registry) of the AVC unit and returns an interface to it.void * ( *getAncestorInterface)( void *self, char *object_class, REFIID pluginType, REFIID iid);

Parametersself

Pointer to IOFireWireAVCLibUnitInterface.object_class

Class name of ancestor of the device to get an interface for.pluginType

An ID number, of type CFUUIDBytes (see CFUUID.h), identifying the type of plug-in service to be returned for the ancestor.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

70

IOFireWireAVCLibUnitInterface Instance Methods

iid

An ID number, of type CFUUIDBytes (see CFUUID.h), identifying the type of interface to be returned for the created plug-in object. Return Value Returns a COM-style interface pointer. Returns 0 upon failure. Discussion This function is only available if the interface version is > 1 (MacOSX 10.2.0 or later?).

getProtocolInterfaceCreates a plug-in object for a protocol driver for the FireWire bus the AVC unit is connected to and returns an interface to it.void * ( *getProtocolInterface)( void *self, REFIID pluginType, REFIID iid);

Parametersself

Pointer to IOFireWireAVCLibUnitInterface.pluginType

An ID number, of type CFUUIDBytes (see CFUUID.h), identifying the type of plug-in service to be returned for the created protocol object.iid

An ID number, of type CFUUIDBytes (see CFUUID.h), identifying the type of interface to be returned for the created protocol device object. Return Value Returns a COM-style interface pointer. Returns 0 upon failure. Discussion This function is only available if the interface version is > 1 (MacOSX 10.2.0 or later?).

getSessionRefGet the session reference.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

71

IOFireWireAVCLibUnitInterface Instance Methods

IOFireWireSessionRef ( *getSessionRef)( void *self);

Parametersself

Pointer to IOFireWireAVCLibUnitInterface. Return Value Returns a sessionRef on success. Discussion Gets the sessionRef to be used with openWithSessionRef.

makeP2PInputConnectionIncrements the point-to-point connection count of a unit input plug.IOReturn ( *makeP2PInputConnection)( void *self, UInt32 inputPlug, UInt32 chan);

Discussion This function is only available if the interface version is > 3.

makeP2POutputConnectionIncrements the point-to-point connection count of a unit output plug.IOReturn ( *makeP2POutputConnection)( void *self, UInt32 outputPlug, UInt32 chan, IOFWSpeed speed);

Discussion This function is only available if the interface version is > 3.

openExclusively opens a connection to the in-kernel device.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

72

IOFireWireAVCLibUnitInterface Instance Methods

IOReturn ( *open)( void *self );

Parametersself

Pointer to IOFireWireAVCLibUnitInterface. Return Value Returns kIOReturnSuccess on success. Discussion Exclusively opens a connection to the in-kernel device. As long as the in-kernel device object is open, no other drivers will be able to open a connection to the device. When open, the device on the bus may disappear, but the in-kernel object representing it will stay instantiated and can begin communicating with the device again if it ever reappears.

openWithSessionRefOpens a connection to a device that is not already open.IOReturn ( *openWithSessionRef)( void *self, IOFireWireSessionRef sessionRef );

ParameterssessionRef

SessionRef returned from getSessionRef call.self

Pointer to IOFireWireAVCLibUnitInterface. Return Value Returns kIOReturnSuccess on success. Discussion Sometimes it is desirable to open multiple user clients on a device. In the case of FireWire sometimes we wish to have both the FireWire User Client and the AVC User Client open at the same time. The technique to arbitrate this is as follows: First open normally the device furthest from the root in the I/O Registry. Second, get its sessionRef with the getSessionRef call.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

73

IOFireWireAVCLibUnitInterface Instance Methods

Third, open the device further up the chain by calling this method and passing the sessionRef returned from the call in step 2.

removeCallbackDispatcherFromRunLoopRemoves a dispatcher for kernel callbacks to the specified run loop.void ( *removeCallbackDispatcherFromRunLoop)( void *self );

Parametersself

Pointer to IOFireWireAVCLibUnitInterface. Discussion Undoes the work of addCallbackDispatcherToRunLoop.

setMessageCallbackSets callback for user space message routine.void ( *setMessageCallback)( void *self, void *refCon, IOFWAVCMessageCallback callback);

Parametersself

Pointer to IOFireWireAVCLibUnitInterface.refCon

RefCon to be returned as first argument of completion routine.callback

Address of completion routine. Discussion In FireWire and AVC, bus status messages are delivered via IOKit's message routine. This routine is emulated in user space for AVC and FireWire messages via this callback. You should register here for bus reset and reconnect messages.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

74

IOFireWireAVCLibUnitInterface Instance Methods

updateAVCCommandTimeoutUpdates an AVCCommand's timeout back to 10 seconds.IOReturn ( *updateAVCCommandTimeout)( void *self);

Discussion AVCCommands will time out after 10 seconds unless this function is called (from another thread) to update the command's timeout back to 10 seconds. This function is only available if the interface version is > 2.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

75

IOFireWireCommandInterface

Declared in

IOFireWireLib.h (page 643)

OverviewIOFireWireLib command object. Represents an object that is configured and submitted to issue synchronous and asynchronous bus commands. This is a superclass containing all command object functionality not specific to any kind of bus transaction. Note that data may not always be transferred to or from the data buffer for command objects at the time the command is submitted. In some cases the transfer may happen as soon as SetBuffer() (below, v2 interfaces and newer) is called. You can use the SetFlags() call (below, v2 interfaces and newer) to control this behavior.

TasksMiscellaneousCancel

(page 78) Cancel command execution (page 78) Gets the most recently received ack code for this transaction. (page 79) Set the command refCon value and callback handler, and submit the command to FireWire for execution. (page 79) Gets the refcon associated with this command (page 80) Gets the most recently received response code for this transaction. (page 80) Return command completion status.

GetAckCode

GetBuffer

GetRefCon

GetResponseCode

GetStatus

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

76

IOFireWireCommandInterface Tasks

GetTargetAddress

(page 81) Get command target address. (page 81) Return number of bytes transferred by this command object when it last completed execution. (page 82) Is this command object currently executing? (page 83) Set the buffer where read data should be stored. (page 83) Set the completion handler to be called once the command completes asynchronous execution . (page 84) Set flags governing this command's execution. (page 85) Set FireWire bus generation for which the command object shall be valid. If the failOnReset attribute has been set, the command will only be considered for execution during the bus generation specified by this function. (page 86) Set the maximum size in bytes of packets transferred by this command. (page 87) Gets the most recently received ack code for this transaction. (page 87) Sets the maximum number of retries for this command. (page 88) Set the user refCon value. This is the user defined value that will be passed in the refCon argument to the completion function. (page 88) Set command target address (page 89) Sets the duration of the timeout for this command. (page 89)

GetTransferredBytes

IsExecuting

SetBuffer

SetCallback

SetFlags

SetGeneration

SetMaxPacket

SetMaxPacketSpeed

SetMaxRetryCount

SetRefCon

SetTarget

SetTimeoutDuration

Submit

SubmitWithRefconAndCallback

(page 90) Set the command refCon value and callback handler, and submit the command to FireWire for execution.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

77

IOFireWireCommandInterface Instance Methods

Instance MethodsCancelCancel command executionIOReturn ( *Cancel)( IOFireWireLibCommandRef self, IOReturn reason);

Parametersself

The command object interface of interest Return Value An IOReturn result code Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES YES YES YES YES YES YES YES

GetAckCodeGets the most recently received ack code for this transaction.UInt32 ( *GetAckCode)( IOFireWireLibCommandRef self );

Parametersself

A reference to the command

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

78

IOFireWireCommandInterface Instance Methods

Return Value The FireWire ack code.

GetBufferSet the command refCon value and callback handler, and submit the command to FireWire for execution.void ( *GetBuffer)( IOFireWireLibCommandRef self, UInt32 *outSize, void **outBuf);

Parametersself

The command object interface of interest Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES NO NO NO YES NO YES NO

GetRefConGets the refcon associated with this commandvoid * ( *GetRefCon)( IOFireWireLibCommandRef self );

Parametersself

A reference to the command Return Value void

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

79

IOFireWireCommandInterface Instance Methods

GetResponseCodeGets the most recently received response code for this transaction.UInt32 ( *GetResponseCode)( IOFireWireLibCommandRef self );

Parametersself

A reference to the command Return Value The FireWire response code.

GetStatusReturn command completion status.IOReturn ( *GetStatus)( IOFireWireLibCommandRef self);

Parametersself

The command object interface of interest Return Value An IOReturn error code indicating the completion error (if any) returned the last time this command object was executed Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES YES YES YES YES YES YES YES

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

80

IOFireWireCommandInterface Instance Methods

GetTargetAddressGet command target address.void ( *GetTargetAddress)( IOFireWireLibCommandRef self, FWAddress *outAddr);

Parametersself

The command object interface of interestoutAddr

A pointer to an FWAddress to contain the function result. Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID NO YES YES YES YES YES YES YES

GetTransferredBytesReturn number of bytes transferred by this command object when it last completed execution.UInt32 ( *GetTransferredBytes)( IOFireWireLibCommandRef self);

Parametersself

The command object interface of interest Return Value A UInt32 containing the bytes transferred value

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

81

IOFireWireCommandInterface Instance Methods

Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES YES YES YES YES YES YES YES

IsExecutingIs this command object currently executing?const Boolean ( *IsExecuting)( IOFireWireLibCommandRef self);

Parametersself

The command object interface of interest Return Value Returns true if the command object is executing. Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES YES YES YES YES YES YES YES

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

82

IOFireWireCommandInterface Instance Methods

SetBufferSet the buffer where read data should be stored.void ( *SetBuffer)( IOFireWireLibCommandRef self, UInt32 size, void *buf);

Parametersself

The command object interface of interestsize

Size in bytes of the receive buffer.buf

A pointer to the receive buffer. Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES NO NO NO YES NO YES NO

SetCallbackSet the completion handler to be called once the command completes asynchronous execution .void ( *SetCallback)( IOFireWireLibCommandRef self, IOFireWireLibCommandCallback inCallback);

Parametersself

The command object interface of interest

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

83

IOFireWireCommandInterface Instance Methods

inCallback

A callback handler. Passing nil forces the command object to execute synchronously. Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES YES YES YES YES YES YES YES

SetFlagsSet flags governing this command's execution.void ( *SetFlags)( IOFireWireLibCommandRef self, UInt32 inFlags);

Parametersself

The command object interface of interest

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

84

IOFireWireCommandInterface Instance Methods

inFlags

A UInt32 with bits set corresponding to the flags that should be set for this command object. The following values may be used:

kFWCommandNoFlags -- all flags off kFWCommandInterfaceForceNoCopy -- data sent by this command should always be received/sent directly from the buffer set with SetBuffer(). Whatever data is in the buffer when the command is submitted will be used. kFWCommandInterfaceForceCopyAlways -- data will always be copied out of the command object data buffer when SetBuffer() is called, up to a maximum allowed size (kFWUserCommandSubmitWithCopyMaxBufferBytes). This can result in faster data transfer. Changes made to the data buffer contents after calling SetBuffer() will be ignored; SetBuffer() should be called whenever the data buffer contents change. kFWCommandInterfaceSyncExecute -- Setting this flag causes the command object to execute synchronously. The calling context will block until the command object has completed execution or an error occurs. Using synchronous execution can avoid kernel transitions associated with asynchronous completion and often remove the need for a state machine. kFWCommandInterfaceForceBlockRequest -- Setting this flag causes read and write transactions to use block request packets even if the payload is 4 bytes. If this flag is not set 4 byte transactions will occur using quadlet transactions.

Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES NO NO NO YES NO YES NO

SetGenerationSet FireWire bus generation for which the command object shall be valid. If the failOnReset attribute has been set, the command will only be considered for execution during the bus generation specified by this function.

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

85

IOFireWireCommandInterface Instance Methods

void ( *SetGeneration)( IOFireWireLibCommandRef self, UInt32 generation);

Parametersself

The command object interface of interestgeneration

A bus generation. The current bus generation can be obtained from IOFireWireDeviceInterface::GetBusGeneration(). Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES YES YES YES YES YES YES YES

SetMaxPacketSet the maximum size in bytes of packets transferred by this command.IOReturn ( *SetMaxPacket)( IOFireWireLibCommandRef self, IOByteCount maxPacketSize);

Parametersself

The command object interface of interestmaxPacketSize

Size in bytes of largest packet that should be transferred by this command. Return Value An IOReturn result code indicating whether or not the command was successfully submitted

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

86

IOFireWireCommandInterface Instance Methods

Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES NO NO NO YES NO YES NO

SetMaxPacketSpeedGets the most recently received ack code for this transaction.void ( *SetMaxPacketSpeed)( IOFireWireLibCommandRef self, IOFWSpeed speed );

Parametersself

A reference to the commandspeed

the desired maximum packet speed Return Value void

SetMaxRetryCountSets the maximum number of retries for this command.void ( *SetMaxRetryCount)( IOFireWireLibCommandRef self, UInt32 count );

Parametersself

A reference to the command

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

87

IOFireWireCommandInterface Instance Methods

count

The number of retires Return Value void

SetRefConSet the user refCon value. This is the user defined value that will be passed in the refCon argument to the completion function.void ( *SetRefCon)( IOFireWireLibCommandRef self, void *refCon);

Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES YES YES YES YES YES YES YES

SetTargetSet command target addressvoid ( *SetTarget)( IOFireWireLibCommandRef self, const FWAddress *addr);

Parametersself

The command object interface of interest

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

88

IOFireWireCommandInterface Instance Methods

addr

A pointer to an FWAddress. Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID NO YES YES YES YES YES YES YES

SetTimeoutDurationSets the duration of the timeout for this command.void ( *SetTimeoutDuration)( IOFireWireLibCommandRef self, UInt32 duration );

Parametersself

A reference to the commandduration

A timeout value in microseconds Return Value void

SubmitIOReturn ( *Submit)( IOFireWireLibCommandRef self);

Discussion Description forthcoming

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

89

IOFireWireCommandInterface Instance Variables

SubmitWithRefconAndCallbackSet the command refCon value and callback handler, and submit the command to FireWire for execution.IOReturn ( *SubmitWithRefconAndCallback)( IOFireWireLibCommandRef self, void *refCon, IOFireWireLibCommandCallback inCallback);

Parametersself

The command object interface of interest Return Value An IOReturn result code indicating whether or not the command was successfully submitted Discussion Availability: (for interfaces obtained with ID)kIOFireWireAsyncStreamCommandInterfaceID kIOFireWireCompareSwapCommandInterfaceID kIOFireWireWriteQuadletCommandInterfaceID kIOFireWireReadQuadletCommandInterfaceID kIOFireWireWriteCommandInterfaceID_v2 kIOFireWireWriteCommandInterfaceID kIOFireWireReadCommandInterfaceID_v2 kIOFireWireReadCommandInterfaceID YES YES YES YES YES YES YES YES

Instance VariablesrevisionUInt32 revision;

Interface revision

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

90

IOFireWireCommandInterface Instance Variables

versionUInt32 version;

Interface version

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

91

IOFireWireCompareSwapCommandInterface

Declared in

IOFireWireLib.h (page 643)

OverviewDescription forthcoming

TasksMiscellaneousCancel

(page 93) Cancel command execution (page 94) Was the last lock operation successful? (page 94) Return command completion status. (page 95) Get command target address. (page 96) Return number of bytes transferred by this command object when it last completed execution. (page 96) Is this command object currently executing? (page 97) Get the 32-bit value returned on the last compare swap operation. (page 98) Get the 64-bit value returned on the last compare swap operation. (page 98) Set the completion handler to be called once the command completes asynchronous execution .

DidLock

GetStatus

GetTargetAddress

GetTransferredBytes

IsExecuting

Locked

Locked64

SetCallback

2011-05-05 | 2011 Apple Inc. All Rights Reserved.

92

IOFireWireCompareSwapCommandInterface Instance Methods

SetFlags

(page 99) Set flags governing this command's execution. (page 99) Set FireWire bus generation for which the command object shall be valid. If the failOnReset attribute has been set, the command will only be considered for execution during the bus generation specified by this function. (page 100) Set the user refCon value. This is the user defined value that will be passed in the refCon argument to the completion function. (page 100) Set command target address (page 101) Set values for 32-bit compare swap operation. Calling this function will make the command object perform 32-bit compare swap transactions on the bus. To perform 64-bit compare swap operations, use the SetValues64() call, below. (page 102) Set values for 64-bit compare swap operation. Calling this function will make the command object perform 64-