HalAllocateCommonBuffer (Compact 2013)

3/26/2014

This function allocates memory, locks it down, and maps it so that it is simultaneously accessible from the processor and a device for direct memory access (DMA) operations.

Syntax

PVOID HalAllocateCommonBuffer(
  PDMA_ADAPTER_OBJECT DmaAdapter,
  ULONG Length,
  PPHYSICAL_ADDRESS LogicalAddress,
  BOOLEAN CacheEnabled
);

Parameters

  • Length
    [in] Size of buffer to allocate.
  • LogicalAddress
    [out] Pointer to the bus-relative, logical address buffer used by the DMA controller on the specified bus.
  • CacheEnabled
    [in] Indicates whether the buffer returned is at a cached virtual address.

Return Value

Returns a pointer to an allocated buffer for the device driver to use if the function succeeds; otherwise, returns NULL.

Remarks

This function allocates a shared buffer of locked, physically contiguous pages. It then returns the virtual address to be used by the DMA device driver and the logical address to be used by the DMA adapter for DMA operations.

When you use this function with CacheEnabled set to true, you must use the CacheRangeFlush function before passing the buffer to the DMA controller.

Requirements

Header

ceddk.h

Library

CEDDK.lib

See Also

Reference

Ceddk.dll DMA Functions
DMA_ADAPTER_OBJECT
HalFreeCommonBuffer