ec_getxmitslot( )
Cautions | Example | Errors | See Also
Name: int ec_getxmitslot(chDev, lpSlot) Inputs: int chDev
SC_TSINFO *lpSlot Returns: 0 for success -1 for failure Includes: srllib.h dxxxlib.h eclib.h Category: routing Mode: synchronous Description
The ec_getxmitslot( ) function returns the echo-cancelled transmit time slot number of a CSP-capable full-duplex channel. It returns the number of the SCbus time slot which transmits the echo-cancelled data. This information is contained in an SC_TSINFO structure.
- Note: On DM3 boards, the ec_getxmitslot( ) function is not supported.
The SC_TSINFO structure is declared as follows:
typedef struct { unsigned long sc_numts; long *sc_tsarrayp; } SC_TSINFO;The sc_numts field must be initialized with the number of TDM bus time slots requested (1 for a voice channel). The sc_tsarrayp field must be initialized with a pointer to a valid array. Upon return from the function, the array contains the time slot on which the voice channel transmits.
A voice channel on an SCbus-based board can transmit on only one SCbus time slot.
For more information, see the SCbus Routing Function Reference.
Parameter
Description
chDev The channel device handle obtained when the CSP-capable device is opened using dx_open( ). lpSlot A pointer to the SC_TSINFO data structure. Cautions
- This function fails if you specify an invalid channel device handle.
- The nr_scroute( ) and nr_scunroute( ) convenience functions do not support CSP. To route echo-cancelled data, use xx_listen( ) and xx_unlisten( ) functions where xx represents the type of device, such as "ag" for analog. See the SCbus Routing Function Reference for more information.
- In Linux applications that use multiple threads, you must avoid having two or more threads call functions that send commands to the same channel; otherwise, the replies can be unpredictable and cause those functions to time out. If you must do this, use semaphores to prevent concurrent access to a particular channel.
Example
#include <windows.h> /* include in Windows applications only; exclude in Linux */ #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; /* Channel device handle */ SC_TSINFO sc_tsinfo; /* Time slot information structure */ long scts; /* SCbus time slot */ int srlmode; /* Standard Runtime Library mode */ /* Set SRL to run in polled mode. */ srlmode = SR_POLLMODE; if (sr_setparm(SRL_DEVICE, SR_MODEID, (void *)&srlmode) == -1) { /* process error */ } /* Open board 1 channel 1 device */ if ((chdev = dx_open("dxxxB1C1", 0)) == -1) { printf("Cannot open channel dxxxB1C1. Check to see if board is started"); exit(1); } /* Fill in the SCbus time slot information */ sc_tsinfo.sc_numts = 1; sc_tsinfo.sc_tsarrayp = &scts; /* Get SCbus time slot connected to transmit of voice channel 1 on board 1 */ if (ec_getxmitslot(chdev, &sc_tsinfo) == -1) { printf("Error message = %s", ATDV_ERRMSGP(chdev)); exit(1); } printf("%s is transmitting on SCbus time slot %ld", ATDV_NAMEP(chdev), scts); }Errors
If the function returns -1, use ATDV_LASTERR( ) to return the error code and ATDV_ERRMSGP( ) to return a descriptive error message.
One of the following error codes may be returned:
See Also
Click here to contact Dialogic Customer Engineering
Copyright 2001, Intel Corporation