Mac Developer Library

Developer

IOATACommand Class Reference

Options
Deployment Target:

On This Page

IOATACommand

Command structure superclass, created and freed only by IOATADevice objects populated by disk device drivers with command parameters then submitted for operation to their IOATADevice provider for execution.

IOATACommand is a virtual class, a concrete subclass contains the methods and fields needed by IOATAControllers. Subclasses may be specific to particular controller hardware. Disk device drivers will only have visibility to this interface and may not subclass this object. Disk device drivers should instead make use of the void* refcon field which the controllers will not touch

  • The byte count on the ending result, as best as can be determined by the controller. May be zero, but partial transfer may have occurred on error in some cases.

    Declaration

    virtual IOByteCount getActualTransfer ( void );

  • the IOMemoryDescriptor used in this transaction.

    Declaration

    virtual IOMemoryDescriptor* getBuffer ( void );

  • returns true if IOATAController is still in control of the command.

    Declaration

    virtual bool getCommandInUse( void );

  • Taskfile access. Registers are named in accordance with ATA Standards conventions

    Declaration

    virtual UInt8 getCylHi ( void );

  • Taskfile access. Registers are named in accordance with ATA Standards conventions

    Declaration

    virtual UInt8 getCylLo ( void );

  • Taskfile access. Registers are named in accordance with ATA Standards conventions

    Declaration

    virtual UInt8 getDevice_Head ( void );

  • If the error bit was set in the status register, the value of the error register is returned at the end of a command.

    Declaration

    virtual UInt8 getEndErrorReg( void );

  • the value of the status register on the end of the command.

    Declaration

    virtual UInt8 getEndStatusReg ( void);

  • Taskfile access. Registers are named in accordance with ATA Standards conventions

    Declaration

    virtual UInt8 getErrorReg ( void );

  • IOReturn value of the result of this command. ATA family errors are defined in IOATATypes.h

    Declaration

    virtual IOReturn getResult ( void);

  • Taskfile access. Registers are named in accordance with ATA Standards conventions

    Declaration

    virtual UInt8 getSectorCount ( void );

  • Taskfile access. Registers are named in accordance with ATA Standards conventions

    Declaration

    virtual UInt8 getSectorNumber ( void );

  • Taskfile access. Registers are named in accordance with ATA Standards conventions

    Declaration

    virtual UInt8 getStatus ( void );

  • set the IIOMemoryDescriptor for this transaction.

    Declaration

    virtual void setBuffer ( IOMemoryDescriptor *inDesc);

  • set the byte count for this transaction. Should agree with the device command and the memory descriptor in use.

    Declaration

    virtual void setByteCount ( IOByteCount numBytes);

  • set the function pointer to call when this command completes.

    Declaration

    virtual void setCallbackPtr ( IOATACompletionFunction *inCompletion);

  • Taskfile access. Registers are named in accordance with ATA Standards conventions

    Declaration

    virtual void setCommand ( UInt8 in);

  • Taskfile access. Registers are named in accordance with ATA Standards conventions

    Declaration

    virtual void setCylHi( UInt8 in);

  • Taskfile access. Registers are named in accordance with ATA Standards conventions

    Declaration

    virtual void setCylLo ( UInt8 in);

  • Taskfile access. Registers are named in accordance with ATA Standards conventions

    Declaration

    virtual void setDevice_Head( UInt8 in);

  • Taskfile access. Registers are named in accordance with ATA Standards conventions

    Declaration

    virtual void setFeatures( UInt8 in);

  • set the flags for this command, as defined in IOATATypes.

    Declaration

    virtual void setFlags( UInt32 inFlags);

  • convenience method that sets the taskfile registers into a 28-bit LBA address, with unit selected and LBA bit set. return err if param out of range, return kIOSuccess (kATANoErr) = 0 on return if successful

    Declaration

    virtual IOReturn setLBA28( UInt32 lba, ataUnitID inUnit);

  • command opcode as defined in IOATATypes.

    Declaration

    virtual void setOpcode( ataOpcode inCode);

  • ATAPI command packet max size is 16 bytes. Makes deep copy of data.

    Declaration

    virtual IOReturn setPacketCommand( UInt16 packetSizeBytes, UInt8 *command);

  • used to set an offset into the memory descriptor for this transfer.

    Declaration

    virtual void setPosition ( IOByteCount fromPosition);

  • used when accessing registers or reading registers on an error result. Mask is defined in IOATATypes.h

    Declaration

    virtual void setRegMask( ataRegMask mask);

  • Taskfile access. Registers are named in accordance with ATA Standards conventions

    Declaration

    virtual void setSectorCount( UInt8 in);

  • Taskfile access. Registers are named in accordance with ATA Standards conventions

    Declaration

    virtual void setSectorNumber( UInt8 in);

  • how long to allow this command to complete, in milliseconds, once issued to the hardware. if the time period expires, this command will return with a timeout error.

    Declaration

    virtual void setTimeoutMS( UInt32 inMs);

  • set the size of transfer between intervening interrupts. necessary when doing PIO Read/Write Multiple, etc. so the controller knows when to expect an interrupt during multi-sector data transfers.

    Declaration

    virtual void setTransferChunkSize( IOByteCount chunk = kATADefaultSectorSize);

  • set the unit number for this command.

    Declaration

    virtual void setUnit( ataUnitID inUnit);

  • set to blank state, MUST call prior to re-use of this object

    Declaration

    virtual void zeroCommand( void);

Data Types

  • Declaration

    struct ExpansionData { IOExtendedLBA *extLBA; };

    Discussion

    This structure will be used to expand the capablilties of the IOWorkLoop in the future.

Instance Variables

  • Reserved for future use. (Internal use only)

    Declaration

    ExpansionData *fExpansionData;

  • for use by disk drivers, clients of IOATADevice only. IOATADevice and IOATAControllers shall not use this field in any manner.

    Declaration

    void* refCon2;

  • for use by disk drivers, clients of IOATADevice only. IOATADevice and IOATAControllers shall not use this field in any manner.

    Declaration

    void* refCon;

  • Reserved for future use. (Internal use only)

    Declaration

    ExpansionData *fExpansionData;