AlazarAsyncRead#
Function Syntax#
-
RETURN_CODE AlazarAsyncRead(HANDLE handle, void *buffer, U32 bytesToRead, OVERLAPPED *overlapped)#
Adds a buffer to the end of a list of available buffers to be filled by the board. When the board receives sufficient trigger events to fill the buffer, the event in the
OVERLAPPED
will be set to the signaled state.You must call AlazarBeforeAsyncRead() before calling AlazarAsyncRead().
The
bytesToRead
parameter must be equal to the product of the number of bytes per record, the number of records per buffer and the number of enabled channels. If record headers are enabled, the number of bytes per record must include the size of the record header (16 bytes).- Remark
AlazarAsyncRead() is only available under Windows
Warning
You must call AlazarAbortAsyncRead() before your application exits if you have called AlazarAsyncRead() and buffers are pending.
- Parameters
handle – [in] Handle to board
buffer – [in] Pointer to a buffer to receive sample data from the digitizer board
bytesToRead – [in] Number of bytes to read from the board
overlapped – [in] Pointer to an
OVERLAPPED
structure. The event in thestructure is set to the signaled state when the read operation completes.
- Returns
If the function succeeds in adding the buffer to end of the list of buffers available to be filled by the board, it returns ApiDmaPending. When the board fills the buffer, the event in the OVERLAPPED structure is set to the signaled state.
- Returns
If the function fails because the board overflowed its on board memory, it returns ApiBufferOverflow. The board may overflow its on board memory because the rate at which it is acquiring data is faster than the rate at which it is transferring data from on-board memory to host memory. If this is the case, try reducing the sample rate, number of enabled channels, or amount of time spent processing each buffer.
- Returns
If the function fails because the buffer is too large for the driver or operating system to prepare for scatter-gather DMA transfer, it returns ApiLockAndProbePagesFailed. Try reducing the size of each buffer, or reducing the number of buffers queued by the application.
- Returns
If the function fails for some other reason, it returns an error code that indicates the reason that it failed. See RETURN_CODE for more information.