WinDriver does not impose any inherent limitation on the size of the DMA buffer
that can be allocated with WD_DMALock(). However, the success of
the DMA allocation is dependent of the amount of available system resources at
the time of the attempted allocation. (Therefore, the earlier your try to
allocate the buffer, the better your chances of succeeding.)
For Contiguous Buffer DMA allocation, there must be enough
contiguous physical memory for the allocation.
If your are performing Scatter/Gather DMA, please be sure to set the
DMA_LARGE_BUFFER flag in the dwOptions field
of the WD_DMA structure that is passed to WD_DMALock() when allocating a buffer larger than 1MB.
The DMA buffer allocated by WD_DMALock() uses page-locked memory
(to ensure a safe DMA operation), which is allocated from Windows' non-paged
kernel pool of memory.
The size of this pool is fixed at boot time by a Registry setting.
You can increase the allocated memory by increasing the value of the
NonPagedPoolSize Registry entry, found under:
HKEY_LOCAL_MACHINE\SYSTEM\ CurrentControlSet\Control\Session
Manager\Memory Management.
Sometimes, there is enough contiguous memory, but there are not enough page
table entries to map the memory — see
Technical Document #59 for
more information.
Even after increasing the value of the relevant Registry entries, the memory
allocation might still fail, specifically when trying to allocate a very large
buffer (such as 1GB). The solution in this case is to try decreasing the size
of the buffer you are trying to lock, until you succeed.
Please note that WD_DMALock() also maps the physical memory of the
allocated buffer into virtual user mode space. Therefore, there must also be
enough free virtual memory to enable the mapping of the entire buffer.
|