Compartir a través de


HcdMdd_CreateMemoryObject (Compact 2013)

3/26/2014

This function creates the host controller interface shared memory area.

Syntax

LPVOID HcdMdd_CreateMemoryObject(
  DWORD cbSize,
  DWORD cbHighPrioritySize,
  PUCHAR pVirtAddr,
  PUCHAR pPhysAddr 
);

Parameters

  • cbSize
    [in] Total size of the host controller device shared memory area.
  • cbHighPrioritySize
    [in] Specifies the bytes reserved for high-priority isochronous or interrupt transfers and the host controller interface (HCI) communication area.
  • pVirtAddr
    [in] Pointer to the virtual address of a memory area, which might be NULL.
  • pPhysAddr
    [in] Pointer to the physical address of a memory area, which might be NULL.

Return Value

A pointer to a host controller driver memory object indicates success. NULL indicates failure.

Remarks

This HC driver platform-dependent driver (PDD) calls this function to initialize the shared memory area used by the HCI driver. This memory contains data structures shared by the driver and the host controller hardware. This memory is used to allocate DMA buffers for USB driver data transfers. Two options are available. If a platform has an area of memory set aside that can be used by an HCI, as specified in the Config.bib file, it can pass the virtual and physical address pointers to this function. This is the recommended method. Alternatively, the PDD can pass NULL for the physical and virtual address pointers, in which case the HcdMdd_CreateMemoryObject function attempts to allocate a suitable memory buffer from system RAM.

The HCI shared memory area has two separate areas: a high-priority pool of buffers for the host controller communications area and for isochronous client buffers, and a low-priority pool of buffers for other client transfers. The size of the shared memory area depends on the use of USB within the platform. A recommended value for general-purpose USB operation is 64 KB, with 20 KB reserved for high-priority isochronous transfers. If you anticipate less demand on the USB subsystem, you can safely reduce this or change the split between low and high-priority buffer pools. Reducing the size of the high-priority buffer can cause isochronous transfers to fail if memory cannot be allocated, whereas reducing the size of the low priority buffer reduces performance on bulk interrupt and control transfers. However, reducing the size of the low priority buffer does not cause failures, because bulk transfers can block to wait for memory to become available.

If possible, you should consider placing the HC driver shared memory area in high-speed memory, particularly to support streaming, isochronous, data transfers.

Requirements

Header

Hcdddsi.h or Ohcdddsi.h

See Also

Reference

USB Host Controller Driver MDD Functions
HcdMdd_DestroyMemoryObject