<!--
{
  "availability" : [
    "DriverKit: -",
    "iOS: -",
    "iPadOS: -",
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "DriverKit",
  "identifier" : "/documentation/DriverKit/IODMACommand",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "DriverKit"
    ],
    "preciseIdentifier" : "c:@S@IODMACommand"
  },
  "title" : "IODMACommand"
}
-->

# IODMACommand

An object that converts memory references to I/O bus addresses.

```
class IODMACommand;
```

## Overview

The [`IODMACommand`](/documentation/DriverKit/IODMACommand) class supersedes <doc://com.apple.documentation/documentation/kernel/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`](/documentation/DriverKit/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`](/documentation/DriverKit/IODMACommand) objects at driver initialization, and keep each command in an [`IOCommandPool`](/documentation/DriverKit/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`](/documentation/DriverKit/IODMACommand) object in a ‘weak-linked’ manner. To do this you must avoid using any static member functions. Use the much slower, but safe, <doc://com.apple.documentation/documentation/kernel/1547721-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

[`virtual bool init();`](/documentation/DriverKit/IODMACommand/init)

[`virtual void free();`](/documentation/DriverKit/IODMACommand/free)

[`static kern_return_t Create(IOService *device, uint64_t options, const IODMACommandSpecification *specification, IODMACommand **command);`](/documentation/DriverKit/IODMACommand/Create)

### Performing Internal Operations

[`virtual kern_return_t CompleteDMA(uint64_t options);`](/documentation/DriverKit/IODMACommand/CompleteDMA)

[`virtual kern_return_t GetPreparation(uint64_t *offset, uint64_t *length, IOMemoryDescriptor **memory);`](/documentation/DriverKit/IODMACommand/GetPreparation)

[`virtual kern_return_t PerformOperation(uint64_t options, uint64_t dmaOffset, uint64_t length, uint64_t dataOffset, IOMemoryDescriptor *data);`](/documentation/DriverKit/IODMACommand/PerformOperation)

[`virtual kern_return_t PrepareForDMA(uint64_t options, IOMemoryDescriptor *memory, uint64_t offset, uint64_t length, uint64_t *flags, uint32_t *segmentsCount, IOAddressSegment segments[32]);`](/documentation/DriverKit/IODMACommand/PrepareForDMA)

## Relationships

### Inherits From

[`OSObject`](/documentation/DriverKit/OSObject)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)