User's Manual
Chapter 2 Function Reference — Align_DMA_Buffer
NI-DAQ FRM for PC Compatibles 2-24
©
 National Instruments Corporation
bufferSize ≥ count + 1. If neither form of alignment is possible, the function returns an error. 
If 
Align_DMA_Buffer partially aligned the data, the function returns a memPageError 
warning indicating that a page boundary is still in the data.
Note Physical DMA page boundaries do not exist on EISA bus computers. However, 
page boundaries can be introduced on these computers as a side effect of Windows 
386 Enhanced mode and the Windows NT virtual memory management system. 
This happens when a buffer is locked into physical memory in preparation for a 
DAQ operation. If the memory manager cannot find a contiguous space large 
enough, it fragments the buffer, placing pieces of it here and there in physical 
memory. This type of page boundary only affects the performance on an AT bus 
computer. NI-DAQ uses the DMA chaining feature available on EISA computers 
to chain across page boundaries, thus avoiding the delay involved in DMA 
programming.
Call 
Align_DMA_Buffer after your application has loaded buffer with the data samples 
(for waveform generation or digital output) and before calling 
WFM_Op, WFM_Load, 
DIG_Block_In, or DIG_Block_Out. You should pass the aligned buffer to the waveform 
generation and pattern generation functions the same way you would an unaligned buffer. The 
count parameter in the waveform generation or pattern generation function call should be the 
same as the count parameter passed to 
Align_DMA_Buffer, not bufferSize.
If you want to access the data in buffer after calling 
Align_DMA_Buffer, access the data 
starting at buffer[alignIndex] (if your array is zero based).
After using an aligned buffer for waveform generation or pattern generation, NI-DAQ 
unaligns the data. After the buffer has been unaligned, the first data sample is at offset zero 
of the buffer again. If you want to use the buffer for waveform generation or pattern 
generation again after it has been unaligned, you must make another call to 
Align_DMA_Buffer before calling WFM_Op, WFM_Load, DIG_Block_In, or 
DIG_Block_Out.
See Waveform Generation Application Hints and Digital I/O Application Hints in Chapter 3, 
Software Overview, of the NI-DAQ User Manual for PC Compatibles for more information 
on the use of 
Align_DMA_Buffer. See Chapter 4, DMA and Programmed I/O Performance 
Limitations, of the NI-DAQ User Manual for PC Compatibles for a discussion of DMA page 
boundaries and special run-time considerations.










