User`s guide

Dialogic
®
System Release 6.0 PCI for Windows
®
Release Update, Rev 62 — January 30, 2008 48
Dialogic Corporation
Errors
If the function returns -1, use the Dialogic
®
Standard Runtime Library (SRL) Standard Attribute
function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a
descriptive error message. One of the following error codes may be returned:
EDX_BADPARM
Invalid parameter
EDX_FWERROR
Firmware error
EDX_NOERROR
No error
Example
#include <srllib.h>
#include <dxxxlib.h>
main()
{
int chdev, srlmode;
/* Set SRL to run in polled mode. */
srlmode = SR_POLLMODE;
if (sr_setparm(SRL_DEVICE, SR_MODEID, (void *)&srlmode) == -1) {
/* process error */
}
/* Open the channel using dx_open( ). Get channel device descriptor in
* chdev.
*/
if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) {
/* process error */
}
/* continue processing */
. .
/* Force the channel to idle state. The I/O function that the channel
* is executing will be terminated, and control passed to the handler
* function previously enabled, using sr_enbhdlr(), for the
* termination event corresponding to that I/O function.
* In asynchronous mode, dx_stopch() returns immediately,
* without waiting for the channel to go idle.
*/
if ( dx_stopch(chdev, EV_ASYNC) == -1) {
/* process error */
}
/* Wait for dx_stopch() to stop the channel and return the termination event
* for the present media function.
*/
/* After waiting for 30 secs if the termination event is not returned, issue a
* dx_resetch() to reset the channel.
*/
if (dx_resetch(chdev, EV_ASYNC) <0 )
{
/*process error */