ADC Home > Reference Library > Reference > Hardware & Drivers > I/O Kit Framework Reference

 


SCSITaskInterface

Declared In:

Overview

Basic interface for a SCSITask.

Discussion

After rendezvous with a SCSITask Device in the I/O Registry you can create an instance of this interface using the CreateSCSITask method in the SCSITaskDeviceInterface. Once you have this interface, or one of its subclasses, you can manipulate SCSITasks to send to the device.



Functions

AbortTask

Method to abort the SCSITask.

ExecuteTaskAsync

Method to execute the SCSITask asynchronously.

ExecuteTaskSync

Method to execute the SCSITask synchronously.

GetAutoSenseData

Method to get the auto-sense data from the SCSITask.

GetCommandDescriptorBlock

Method to get the task's SCSICommandDescriptorBlock.

GetCommandDescriptorBlockSize

Method to get the task's SCSICommandDescriptorBlock size.

GetRealizedDataTransferCount

Method to get the actual transfer count in bytes from the SCSITask.

GetSCSIServiceResponse

Method to get the SCSIServiceResponse from the SCSITask.

GetTaskAttribute

Method to get the task's attribute.

GetTaskState

Method to get the SCSITaskState from the SCSITask.

GetTaskStatus

Method to get the SCSITaskStatus from the SCSITask.

GetTimeoutDuration

Method to get the timeout duration for the SCSITask.

IsTaskActive

Method to find out if the task is active or not.

SetAutoSenseDataBuffer

Method to set the auto-sense data for the SCSITask.

SetCommandDescriptorBlock

Method to set the task's SCSICommandDescriptorBlock.

SetScatterGatherEntries

Method to set the task's scatter-gather list entries.

SetTaskAttribute

Method to set the task's attribute.

SetTaskCompletionCallback

Method to set the asynchronous completion routine for the SCSITask.

SetTimeoutDuration

Method to set the timeout duration for the SCSITask.


AbortTask


Method to abort the SCSITask.

IOReturn ( *AbortTask ) (
    void *task );  
Parameters
task

Pointer to an instance of an SCSITaskInterface.

Return Value

Returns kIOReturnSuccess, kIOReturnUnsupported or kIOReturnError.

Discussion

This method can be used to abort an SCSITask which is already in progress.


ExecuteTaskAsync


Method to execute the SCSITask asynchronously.

IOReturn ( *ExecuteTaskAsync ) (
    void *task );  
Parameters
task

Pointer to an instance of an SCSITaskInterface.

Return Value

Returns a valid IOReturn code such as kIOReturnSuccess, kIOReturnError, kIOReturnVMError, kIOReturnCannotWire, etc. It will return kIOReturnNotPermitted if the client has not called AddCallbackDispatcherToRunLoop on the SCSITaskDeviceInterface. NOTE: IOReturn is defined as kern_return_t and as such, you may get errors back that do not fall under the IOKit subsystem error domain (sys_iokit) defined in IOReturn.h.

Discussion

This method can be used to execute the SCSITask asynchronously.


ExecuteTaskSync


Method to execute the SCSITask synchronously.

IOReturn ( *ExecuteTaskSync ) (
    void *task, 
    SCSI_Sense_Data *senseDataBuffer, 
    SCSITaskStatus *outStatus, 
    UInt64 *realizedTransferCount );  
Parameters
task

Pointer to an instance of an SCSITaskInterface.

senseDataBuffer

Pointer to a buffer for REQUEST_SENSE data. May be NULL if caller does not wish to have sense data returned. If caller has previously called SetAutoSenseDataBuffer(), this parameter is ignored.

outStatus

Pointer to an SCSITaskStatus. May be NULL if caller does not wish to have task status returned.

realizedTransferCount

Pointer to an UInt64 which reflects how much data was actually transferred. May be NULL if caller does not wish to know how many bytes were transferred.

Return Value

Returns a valid IOReturn code such as kIOReturnSuccess, kIOReturnError, kIOReturnVMError, kIOReturnCannotWire, etc. NOTE: IOReturn is defined as kern_return_t and as such, you may get errors back that do not fall under the IOKit subsystem error domain (sys_iokit) defined in IOReturn.h.

Discussion

This method can be used to execute the SCSITask synchronously.


GetAutoSenseData


Method to get the auto-sense data from the SCSITask.

IOReturn ( *GetAutoSenseData ) (
    void *task,
    SCSI_Sense_Data *senseDataBuffer );  
Parameters
task

Pointer to an instance of an SCSITaskInterface.

senseDataBuffer

Pointer to a buffer the size of the SCSI_Sense_Data structure. If caller has previously called SetAutoSenseDataBuffer(), this routine will return an error.

Return Value

Returns kIOReturnSuccess if sense data is valid, otherwise kIOReturnError.

Discussion

This method can be used to get the auto-sense data from the SCSITask.


GetCommandDescriptorBlock


Method to get the task's SCSICommandDescriptorBlock.

IOReturn ( *GetCommandDescriptorBlock ) (
    void *task,
    UInt8 *outCDB );  
Parameters
task

Pointer to an instance of an SCSITaskInterface.

outCDB

Pointer to an array the size of the SCSICommandDescriptorBlock in question. Clients should call GetCommandDescriptorBlockSize first to find out how large an array should be passed in.

Return Value

Returns kIOReturnSucces or kIOReturnError.

Discussion

This method can be used to get the SCSITasks' SCSICommandDescriptorBlock.


GetCommandDescriptorBlockSize


Method to get the task's SCSICommandDescriptorBlock size.

UInt8 ( *GetCommandDescriptorBlockSize ) (
    void *task );  
Parameters
task

Pointer to an instance of an SCSITaskInterface.

Return Value

UInt8 which is the size of the SCSICommandDescriptorBlock. Valid values are 6, 10, 12, and 16 which have enums defined in SCSITask.h

Discussion

This method can be used to get the size of the SCSITask's SCSICommandDescriptorBlock.


GetRealizedDataTransferCount


Method to get the actual transfer count in bytes from the SCSITask.

UInt64 ( *GetRealizedDataTransferCount ) (
    void *task );  
Parameters
task

Pointer to an instance of an SCSITaskInterface.

outStatus

Pointer to an SCSITaskStatus.

Return Value

Returns a UInt64 value of bytes transferred.

Discussion

This method can be used to get the actual transfer count in bytes from the SCSITask.


GetSCSIServiceResponse


Method to get the SCSIServiceResponse from the SCSITask.

IOReturn ( *GetSCSIServiceResponse ) (
    void *task, 
    SCSIServiceResponse *outServiceResponse );  
Parameters
task

Pointer to an instance of an SCSITaskInterface.

outServiceResponse

Pointer to an SCSIServiceResponse.

Return Value

Returns kIOReturnSuccess or kIOReturnError.

Discussion

This method can be used to get the SCSIServiceResponse from the SCSITask.


GetTaskAttribute


Method to get the task's attribute.

IOReturn ( *GetTaskAttribute ) (
    void *task,
    SCSITaskAttribute *outAttribute );  
Parameters
task

Pointer to an instance of an SCSITaskInterface.

outAttribute

Pointer to the attribute value stored in the SCSITask.

Return Value

Returns kIOReturnSuccess or kIOReturnError.

Discussion

This method can be used to get the SCSITasks' SCSITaskAttribute field. Valid values are defined in SCSITask.h


GetTaskState


Method to get the SCSITaskState from the SCSITask.

IOReturn ( *GetTaskState ) (
    void *task,
    SCSITaskState *outState );  
Parameters
task

Pointer to an instance of an SCSITaskInterface.

outState

Pointer to an SCSITaskState.

Return Value

Returns kIOReturnSuccess or kIOReturnError.

Discussion

This method can be used to get the SCSITaskState from the SCSITask.


GetTaskStatus


Method to get the SCSITaskStatus from the SCSITask.

IOReturn ( *GetTaskStatus ) (
    void *task,
    SCSITaskStatus *outStatus );  
Parameters
task

Pointer to an instance of an SCSITaskInterface.

outStatus

Pointer to an SCSITaskStatus.

Return Value

Returns kIOReturnSuccess or kIOReturnError.

Discussion

This method can be used to get the SCSITaskStatus from the SCSITask.


GetTimeoutDuration


Method to get the timeout duration for the SCSITask.

UInt32 ( *GetTimeoutDuration ) (
    void *task );  
Parameters
task

Pointer to an instance of an SCSITaskInterface.

inTimeoutDurationMS

UInt32 representing the timeout in milliseconds.

Return Value

Returns a value between zero and ULONG_MAX.

Discussion

This method can be used to get the timeout duration for the SCSITask. The timeout duration is counted in milliseconds.


IsTaskActive


Method to find out if the task is active or not.

Boolean ( *IsTaskActive ) (
    void *task );  
Parameters
task

Pointer to an instance of an SCSITaskInterface.

Return Value

Returns 0 if the task is not active, non-zero if it is active.

Discussion

Method to find out if the task is active or not. The task is considered "active" if the SCSITaskState is not kSCSITaskState_NEW nor kSCSITaskState_ENDED.


SetAutoSenseDataBuffer


Method to set the auto-sense data for the SCSITask.

IOReturn ( *SetAutoSenseDataBuffer ) (
    void *task, 
    SCSI_Sense_Data *senseDataBuffer, 
    UInt8 senseDataLength );  
Parameters
task

Pointer to an instance of an SCSITaskInterface.

senseDataBuffer

Pointer to a buffer. May be be NULL if the caller wants to restrict the size to be less than the normal 18 bytes of sense data.

senseDataLength

Amount of sense data to retrieve. Zero is not a valid value.

Return Value

Returns kIOReturnSuccess if sense data buffer was set, otherwise kIOReturnError.

Discussion

This method can be used to set the auto-sense data buffer for the SCSITask.


SetCommandDescriptorBlock


Method to set the task's SCSICommandDescriptorBlock.

IOReturn ( *SetCommandDescriptorBlock ) (
    void *task,
    UInt8 *inCDB,
    UInt8 inSize );  
Parameters
task

Pointer to an instance of an SCSITaskInterface.

inCDB

Pointer to an array of values to be stored in the SCSITask's SCSICommandDescriptorBlock.

inSize

The size of the array inCDB. Valid values are 6, 10, 12, and 16 which have enums defined in SCSITask.h.

Return Value

Returns kIOReturnSuccess or kIOReturnError.

Discussion

This method can be used to set the SCSITasks' SCSICommandDescriptorBlock.


SetScatterGatherEntries


Method to set the task's scatter-gather list entries.

IOReturn ( *SetScatterGatherEntries ) (
    void *task, 
    SCSITaskSGElement *inScatterGatherList, 
    UInt8 inScatterGatherEntries, 
    UInt64 inTransferCount, 
    UInt8 inTransferDirection );  
Parameters
task

Pointer to an instance of an SCSITaskInterface.

inScatterGatherList

Pointer to an array of SCSITaskSGElements.

inScatterGatherEntries

The size of the inScatterGatherList array.

inTransferCount

The TOTAL amount of data to transfer. The length of all the entries in the scatter-gather list should at least add up to the amount in inTransferCount.

inTransferDirection

The transfer direction as defined in SCSITask.h. Valid values are kSCSIDataTransfer_NoDataTransfer, kSCSIDataTransfer_FromTargetToInitiator, and kSCSIDataTransfer_FromInitiatorToTarget.

Return Value

Returns kIOReturnSucces or kIOReturnError.

Discussion

This method can be used to set the SCSITask's scatter-gather list entries. Scatter-gather lists are represented as an array of SCSITaskSGElements. The SCSITaskSGElement structure has two elements, the address of the buffer and the length of the buffer.


SetTaskAttribute


Method to set the task's attribute.

IOReturn ( *SetTaskAttribute ) (
    void *task,
    SCSITaskAttribute inAttribute );  
Parameters
task

Pointer to an instance of an SCSITaskInterface.

inAttribute

The new attribute value to be stored in the SCSITask.

Return Value

Returns kIOReturnSuccess or kIOReturnError.

Discussion

This method can be used to set the SCSITask's SCSITaskAttribute field. Valid values are defined in SCSITask.h


SetTaskCompletionCallback


Method to set the asynchronous completion routine for the SCSITask.

IOReturn ( *SetTaskCompletionCallback ) (
    void *task, 
    SCSITaskCallbackFunction callback, 
    void *refCon );  
Parameters
task

Pointer to an instance of an SCSITaskInterface.

callback

SCSITaskCallbackFunction to be called upon completion of the SCSITask.

refCon

A value to be returned to the caller upon completion of the routine. This field is not used by the SCSITaskInterface.

Return Value

Returns kIOReturnSuccess, kIOReturnError, or kIOReturnNotPermitted if the client has not called AddCallbackDispatcherToRunLoop on the SCSITaskDeviceInterface.

Discussion

This method can be used to set the asynchronous completion routine for the SCSITask.


SetTimeoutDuration


Method to set the timeout duration for the SCSITask.

IOReturn ( *SetTimeoutDuration ) (
    void *task,
    UInt32 inTimeoutDurationMS );  
Parameters
task

Pointer to an instance of an SCSITaskInterface.

inTimeoutDurationMS

UInt32 representing the timeout in milliseconds.

Return Value

Returns kIOReturnSucces or kIOReturnError.

Discussion

This method can be used to set the timeout duration for the SCSITask. The timeout duration is counted in milliseconds. A value of zero is equivalent to "Wait Forever", but on some buses, this isn't possible, so ULONG_MAX is used.


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.

 

Last Updated: 2009-02-23