
Software
Driver functions
(c) Spectrum Instrumentation GmbH
51
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.
Function spcm_dwInvalidateBuf
Function spcm_dwGetErrorInfo
The function returns complete error information on the last error that has occurred. The error handling itself is explained in a later chapter in
greater detail. When calling this function please be sure to have a text buffer allocated that has at least ERRORTEXTLEN length. The error text
function returns a complete description of the error including the register/value combination that has raised the error and a short description
of the error details. In addition it is possible to get back the error generating register/value for own error handling. If not needed the buffers
for register/value can be left to NULL.
Note that the timeout event (ERR_TIMEOUT) is not counted as an error internally as it is not locking the driver
but as a valid event. Therefore the GetErrorInfo function won’t return the timeout event even if it had occurred
in between. You can only recognize the ERR_TIMEOUT as a direct return value of the wait function that was
called.
Function spcm_dwGetErrorInfo
uint32 _stdcall spcm_dwDefTransfer_i64m(// Defines the transfer 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 transfer 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 = (int16*) pvAllocMemPageAligned (16384);
if (spcm_dwDefTransfer_i64 (hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, 0, (void*) pnBuffer, 0, 16384) != ERR_OK)
printf (“DefTransfer failed\n”);
uint32 _stdcall spcm_dwInvalidateBuf ( // invalidate the transfer buffer
drv_handle hDevice, // handle to an already opened device
uint32 dwBufType); // type of the buffer to invalidate as
// listed above under SPCM_BUF_XXXX
uint32 _stdcall spcm_dwGetErrorInfo_i32 (
drv_handle hDevice, // handle to an already opened device
uint32* pdwErrorReg, // address of the error register (can be zero if not of interest)
int32* plErrorValue, // address of the error value (can be zero if not of interest)
char pszErrorTextBuffer[ERRORTEXTLEN]); // text buffer for text error
Содержание M2p.59 Series
Страница 190: ......