IOLittleMemoryCursor

Inherits from
IOMemoryCursor
Availability
Available in OS X v10.0 and later.
Declared in
IOMemoryCursor.h

Overview

An IOMemoryCursor subclass that outputs a vector of PhysicalSegments in the little endian byte order.

The IOLittleMemoryCursor would be used when the DMA hardware requires a little endian address and length pair. This cursor outputs an array of PhysicalSegments that are encoded in little endian format.

Tasks

Miscellaneous

Instance Methods

getPhysicalSegments

Generates a little endian physical scatter/gather list given a memory descriptor.

virtual UInt32 getPhysicalSegments( IOMemoryDescriptor *descriptor, IOByteCount fromPosition, PhysicalSegment *segments, UInt32 maxSegments, UInt32 inMaxTransferSize = 0, IOByteCount *transferSize = 0)
Parameters
descriptor

IOMemoryDescriptor that describes the data associated with an I/O request.

fromPosition

Starting location of the I/O within a memory descriptor.

segments

Pointer to an array of IOMemoryCursor::PhysicalSegments for the output physical scatter/gather list.

maxSegments

Maximum number of segments that can be written to segments array.

inMaxTransferSize

Maximum transfer size is limited to that many bytes, otherwise it defaults to the maximum transfer size specified when the memory cursor was initialized.

transferSize

Pointer to an IOByteCount variable that can contain the total size of the transfer being described. Defaults to 0 indicating that no transfer size need be returned.

Return Value

If the descriptor is exhausted of memory, a zero is returned, otherwise the number of segments that were filled in is returned.

Discussion

Generates a list of physical segments from the given memory descriptor, relative to the current position of the descriptor. Wraps IOMemoryCursor::genPhysicalSegments.

initWithSpecification

Primary initializer for the IOLittleMemoryCursor class.

virtual bool initWithSpecification( IOPhysicalLength maxSegmentSize, IOPhysicalLength maxTransferSize, IOPhysicalLength alignment = 1);
Parameters
maxSegmentSize

Maximum allowable size for one segment. Defaults to 0.

maxTransferSize

Maximum size of an entire transfer. Defaults to 0 indicating no maximum.

alignment

Alignment restrictions on output physical addresses. Not currently implemented. Defaults to single byte alignment.

Return Value

Returns true if the inherited classes and this instance initialize successfully.

outputSegment

Outputs the given segment into the output segments array in little endian byte order.

static void outputSegment( PhysicalSegment segment, void *segments, UInt32 segmentIndex);
Parameters
segment

The physical address and length that is next to be output.

segments

Base of the output vector of DMA address length pairs.

segmentIndex

Index to output 'segment' in the 'segments' array.

withSpecification

Creates and initializes an IOLittleMemoryCursor in one operation.

static IOLittleMemoryCursor * withSpecification( IOPhysicalLength maxSegmentSize, IOPhysicalLength maxTransferSize, IOPhysicalLength alignment = 1);
Parameters
maxSegmentSize

Maximum allowable size for one segment. Defaults to 0.

maxTransferSize

Maximum size of an entire transfer. Defaults to 0 indicating no maximum.

alignment

Alignment restrictions on output physical addresses. Not currently implemented. Defaults to single byte alignment.

Return Value

Returns a new memory cursor if successfully created and initialized, 0 otherwise.

Discussion

Factory function to create and initialize an IOLittleMemoryCursor in one operation. See also IOLittleMemoryCursor::initWithSpecification.

Constants

Miscellaneous Defines

   
#define littleOutputSegment IOLittleMemoryCursor::outputSegment
Constants
littleOutputSegment

Backward compatibility define for the old global function definition. See also IOLittleMemoryCursor::outputSegment.

Available in OS X v10.0 and later.

Declared in IOMemoryCursor.h.