46
M2i.30xx / M2i.30xx-exp Manual
Driver functions
Software
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
Example:
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
char szErrorBuf[ERRORTEXTLEN];
if (spcm_dwSetParam_i32 (hDrv, SPC_MEMSIZE, -1))
{
spcm_dwGetErrorInfo_i32 (hDrv, NULL, NULL, szErrorBuf);
printf (“Set of memsize failed with error message: %s\n”, szErrorBuf);
}