48
M2i.60xx / M2i.60xx-exp Manual
Driver functions
Software
Function spcm_dwGetContBuf
This function reads out the internal continuous memory buffer if one has been allocated. If no buffer has been allocated the function returns
a size of zero and a NULL pointer. You may use this buffer for data transfers. As the buffer is continuously allocated in memory the data
transfer will speed up by 15% - 25%. Please see further details in the appendix of this manual.
These functions have been added in driver version 1.36. The functions are not available in older driver ver-
sions.
Function spcm_dwDefTransfer
The spcm_dwDefTransfer function defines a buffer for a following data transfer. This function only defines the buffer there is no data transfer
performed when calling this function. Instead the data transfer is started with separate register commands that are documented in a later
chapter. At this position there is also a detailed description of the function parameters.
Please make sure that all parameters of this function match. It is especially necessary that the buffer address is a valid address pointing to
memory buffer that has at least the size that is defined in the function call. Please be informed that calling this function with non valid param-
eters may crash your system as these values are base for following DMA transfers.
The use of this function is described in greater detail in a later chapter.
Function spcm_dwDefTransfer
This function is available in two different formats as the spcm_dwGetParam and spcm_dwSetParam functions are. The background is the
same. As long as you’re using a compiler that supports 64 bit integer values please use the _i64 function. Any other platform needs to use
the _i64m function and split offset and length in two 32 bit words.
Example:
The example defines a data buffer of 8 kSamples of 16 bit integer values = 16 kByte (16384 byte) for a transfer from card to PC memory.
As notify size is set to 0 we only want to get an event when the transfer has finished.
Function spcm_dwInvalidateBuf
The invalidate buffer function is used to tell the driver that the buffer that has been set with spcm_dwDefTransfer call is no longer valid. It is
necessary to use the same buffer type as the driver handles different buffers at the same time. Call this function if you want to delete the buffer
memory after calling the spcm_dwDefTransfer function. If the buffer already has been transferred after calling spcm_dwDefTransfer it is not
necessary to call this function. When calling spcm_dwDefTransfer any further defined buffer is automatically invalidated.
uint32 _stdcall spcm_dwGetContBuf_i64 ( // Return value is an error code
drv_handle hDevice, // handle to an already opened device
uint32 dwBufType, // type of the buffer to read as listed above under SPCM_BUF_XXXX
void** ppvDataBuffer, // address of available data buffer
uint64* pqwContBufLen); // length of available continuous buffer
uint32 _stdcall spcm_dwGetContBuf_i64m (// Return value is an error code
drv_handle hDevice, // handle to an already opened device
uint32 dwBufType, // type of the buffer to read as listed above under SPCM_BUF_XXXX
void** ppvDataBuffer, // address of available data buffer
uint32* pdwContBufLenH, // high part of length of available continuous buffer
uint32* pdwContBufLenL); // low part of length of available continuous buffer
uint32 _stdcall spcm_dwDefTransfer_i64m(// Defines the transer buffer by 2 x 32 bit unsigned integer
drv_handle hDevice, // handle to an already opened device
uint32 dwBufType, // type of the buffer to define as listed above under SPCM_BUF_XXXX
uint32 dwDirection, // the transfer direction as defined above
uint32 dwNotifySize, // no. of bytes after which an event is sent (0=end of transfer)
void* pvDataBuffer, // pointer to the data buffer
uint32 dwBrdOffsH, // high part of offset in board memory
uint32 dwBrdOffsL, // low part of offset in board memory
uint32 dwTransferLenH, // high part of transfer buffer length
uint32 dwTransferLenL); // low part of transfer buffer length
uint32 _stdcall spcm_dwDefTransfer_i64 (// Defines the transer buffer by using 64 bit unsigned integer values
drv_handle hDevice, // handle to an already opened device
uint32 dwBufType, // type of the buffer to define as listed above under SPCM_BUF_XXXX
uint32 dwDirection, // the transfer direction as defined above
uint32 dwNotifySize, // no. of bytes after which an event is sent (0=end of transfer)
void* pvDataBuffer, // pointer to the data buffer
uint64 qwBrdOffs, // offset for transfer in board memory
uint64 qwTransferLen); // buffer length
int16* pnBuffer = new int16[8192];
if (spcm_dwDefTransfer_i64 (hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, 0, (void*) pnBuffer, 0, 16384) != ERR_OK)
printf (“DefTransfer failed\n”);