ms_tstcom( )
Cautions | Errors | Example | See Also
Name: int ms_tstcom (devh, tmo) Inputs:
Returns: Includes: Category: Mode: Platform: Description
The ms_tstcom( ) function tests the ability of a board to communicate with the system. This function can operate in either blocking or non-blocking mode.
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 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.
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_COMRSP 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.
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
#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 ); } /* * Test the board's ability to communicate with the system. */ if ( ms_tstcom( bddev, 60 ) == -1 ) { do_error( bddev, "ms_tstcom()" ); exit( 1 ); } printf("Communications 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