Partager via


DMAAllocateChannel (Compact 2013)

3/26/2014

This function prepares the system for a DMA operation on behalf of the target device and also returns a handle that can be used by DMAIssueTransfer.

Syntax

DMA_CHANNEL_HANDLE DMAAllocateChannel(
  PCE_DMA_ADAPTER pDmaAdapter,
  ULONG ulRequestedChannel,
  ULONG ulAddressSpace,
  PHYSICAL_ADDRESS phDeviceIoAddress
);

Parameters

  • pDmaAdapter
    [in] Pointer to a DMA adapter structure, populated after a successful return from DMAGetAdapter.
  • ulRequestedChannel
    [in] Specifies the channel number that the device driver wants to use. If the device driver does not care which channel number is used, the value DMA_CHANNEL_ANY should be used.
  • ulAddressSpace
    [in] A value of 0x0 indicates that phDeviceIoAddress is an address in memory and a value of 0x1 indicates that phDeviceIoAddress is in the I/O address space.
  • phDeviceIoAddress
    [in] Specifies the physical address of the device that DMA is working on. This physical address is a system address and should be the return value of a call to TranslateBusAddr.

Return Value

Returns a handle to a DMA adapter channel object on success. Returns NULL on failure. Extended error information can be obtained through a call to GetLastError.

Remarks

The user client driver that calls DMAAllocateChannel must also call DMAFreeChannel to release all resource allocated to the channel. Failure to call DMAFreeChannel results in a resource leak and the failure of future calls to DMAAllocateChannel.

Requirements

Header

oaldma.h

Library

CEDDK.lib

See Also

Reference

Ceddk.dll DMA Functions
Ceddk.dll DMA Structures