usbdMapMemory

Purpose

Maps memory so that it can be bus mastered by the host controller.

Syntax

#include <usbdi.h>
USBstatus usbdMapMemory(handle, vaddr, size, flags, hmap)
USBhandle handle;
caddr_t vaddr;
int size;
uint flags;
USBhandle *hmap;

Parameter

Item Description
handle Handle of open USB logical device that is returned by the USBD_OPEN_DEVICE fp_ioctl.
vaddr Virtual address of the memory block.
size Size of the memory block in bytes (might cross page boundary).
flags The flags are:
USBDMAP_USER
Memory is in user address space.
USBDMAP_PIN
Pin memory before map.
USBDMAP_READ
Buffer to be used to transfer data from device to host.
hmap Location to return map handle.

Description

The USB client driver uses this function to map host memory so that the host controller might read from or write to the memory by using bus mastered DMA. The USBDMAP_USER flag must be specified whether the memory to be mapped resides in user address space. The owner of the memory must be the process currently active on the processor. The memory is cross memory that is attached, pinned (value of USBDMAP_PIN flag is ignored), and mapped. If USBDMAP_USER is not set, the memory allocated from the kernel’s memory heap. If the USBDMAP_PIN flag is specified, the memory is pinned before it is mapped. Otherwise, the memory is already been pinned. The memory block to be mapped might be greater than one physical page in length and might resides in one or more physical pages. The virtual address of the memory block might not be NULL.

Execution Environment

This function might be called from the process environment only.

Return Values

Value Description
USBD_SUCCESS Success
All others Failure