IODMACommand
An object that converts memory references to I/O bus addresses.
Declaration
class IODMACommand : OSObjectclass IODMACommand : IOCommandOverview
The IODMACommand class supersedes IOMemoryCursor and greatly enhances the functionality and power of it. The command can be specified to output 64 bit physical addresses and also allows driver writers to bypass mapping hardware or get addresses suitable for non-snooped DMA.
The command is designed to be very easily subclassable. Most driver writers need to associate some DMA operations with their memory descriptor, and usually use a C structure for that purpose. This structure is often kept in a linked list. This IODMACommand has built-in <kern/queue.h> linkage and can be derived and 'public:' variables added, giving the developer a structure that can associate a memory descriptor with a particular DMA command but will also allow the developer to generate that command and keep the state necessary for tracking it.
Create a pool of IODMACommand objects at driver initialization, and keep each command in an IOCommandPool when not in use. You may also maintain your own free list of objects if preferred. See the <kern/queue.h> and <xnu/iokit/Kernel/IOCommandPool> for sample code on manipulating the command's doubly linked list entries.
You can use an IODMACommand object in a 'weak-linked' manner. To do this you must avoid using any static member functions. Use the much slower, but safe, weakWithSpecification function. On success, the function returns a DMA command object, which you can use to clone as many commands as needed.
Topics
Creating a DMA Command
withSpecificationwithSpecificationwithSpecificationinitWithSpecificationinitWithSpecificationinitWithSpecificationweakWithSpecificationwithRefConinitWithRefConcloneCommandcloneCommandinitfreeMappingOptionsSynchronizeOptions
Configuring the Memory Descriptor
setMemoryDescriptorsetMemoryDescriptorclearMemoryDescriptorclearMemoryDescriptorgetMemoryDescriptorgetMemoryDescriptorgetIOMemoryDescriptorgetPreparedOffsetAndLengthgetPreparedOffsetAndLengthgenIOVMSegmentsgenIOVMSegmentsgen32IOVMSegmentsgen32IOVMSegmentsgen64IOVMSegmentsgen64IOVMSegmentscreateCopyBuffer
Preparing the Transfer Operation
prepareprepareprepareWithSpecificationprepareWithSpecificationprepareWithSpecificationcompletecompletesynchronizesynchronize
Transferring Data
Managing Memory Segments
Segment32Segment64SegmentFunctionkIODMACommandOutputBig32OutputBig32OutputBig32kIODMACommandOutputBig64OutputBig64OutputBig64kIODMACommandOutputHost32OutputHost32OutputHost32kIODMACommandOutputHost64OutputHost64OutputHost64kIODMACommandOutputLittle32OutputLittle32OutputLittle32kIODMACommandOutputLittle64OutputLittle64OutputLittle64
Getting Configuration Details
getAlignmentgetAlignmentInternalSegmentsgetAlignmentLengthgetMetaClassgetNumAddressBitssetSpecification