ms_tstdat( )
Cautions | Errors | Example | See Also
Name: int ms_tstdat (devh, tmo) Inputs:
Returns: Includes: Category: Mode: Platform: Description
The ms_tstdat( ) function performs a data test on the MSI board and verifies the integrity of the MSI interface to the PC. The data test is performed by sending a series of bytes to the MSI and by checking the integrity of the bytes returned. The function can operate synchronously or asynchronously.
devh the valid board device handle returned by a call to ms_open( ) tmo the maximum amount of time that the function will block while waiting for a response from the board. If a response is not returned within tmo seconds, an error will be returned. To operate this function in asynchronous (non-blocking) mode, specify 0 for tmo. This allows the application to continue processing while awaiting a completion event. If event handling is properly set up for your application, DTEV_DATRSP will be returned by the sr_getevttype( ) function included in the SRL when the test completes successfully. See the Modular Station Interface API Programming Guide for information on event handling.
To run this function in synchronous (blocking) mode, set tmo to the length of time (in seconds) to await a return. If a response is not returned within tmo seconds, an error is returned.
Cautions
Errors
If this function returns -1 to indicate failure, obtain the reason for the error by calling the SRL standard attribute function ATDV_LASTERR( ) or ATDV_ERRMSGP( ) to retrieve either the error code or a pointer to the error description, respectively.
Refer to the error type tables found in Chapter 5, "Error Codes". Error defines can be found in dtilib.h or msilib.h.
Example
The following code example demonstrates the use of ms_tstdat( ) in the synchronous mode..
#include <windows.h> /* For Windows applications only */ #include <errno.h> #include "srllib.h" #include "dtilib.h" #include "msilib.h" /* Basic error handler */ do_error( devh, funcname ) int devh; char *funcname; { int errorval = ATDV_LASTERR( devh ); printf( "Error while calling function %s.\n", funcname ); printf( "Error value = %d.", errorval ); printf( "\n" ); } main() { int bddev; /* Board device descriptor variable */ /* Open board 1 device */ if ( ( bddev = ms_open( "msiB1", 0 ) ) == -1 ) { printf( "Cannot open board msiB1. errno = %d", errno ); exit( 1 ); } /* Perform a data integrity test between the board and PC. */ if ( ms_tstdat( bddev, 60 ) == -1 ) { do_error( bddev, "ms_tstdat()" ); exit( 1 ); } printf("Data integrity test completed successfully\n"); /* * Continue processing * . * . * . */ /* Done processing - close device */ if ( ms_close( bddev ) == -1 ) { printf( "Cannot close board msiB1. errno = %d", errno ); } }See Also
Click here to contact Telecom Support Resources
Copyright 2003, Intel Corporation