User`s guide

Dialogic
®
System Release 6.0 PCI for Windows
®
Release Update, Rev 62 — January 30, 2008 51
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 <stdio.h>
#include <srllib.h>
#include <dxxxlib.h>
#include <eclib.h>
#include <errno.h> /* include in Linux applications only; exclude in Windows */
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",0)) == -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 the asynchronous mode, ec_stopch() returns immediately,
* without waiting for the channel to go idle.
*/
if (ec_stopch(chdev, FULLDUPLEX, EV_ASYNC) == -1) {
/* process error */
}
/* Wait for the termination events (TEC_STREAM and/or TDX_PLAY) */
/* After waiting for 30 secs, if the channel is still in a busy state,
* issue ec_resetch() to reset both the CSP channel and the voice channel.
* When issued in asynchronous mode, it will return both (TEC_RESET/TEC_RESETERR)
* and (TDX_RESET/TDX_RESETERR) events.
*/
if (ec_resetch(chdev, EV_ASYNC) == -1 ) {
/* process error */
}