
Description | Cautions | Example | Errors | See Also
Name: |
int ms_listen(devh,tsinfop) | |
Inputs: |
int devh |
|
|
SC_TSINFO *tsinfop |
|
Returns: |
0 on success | |
|
-1 on failure | |
Includes: |
srllib.h | |
|
dtilib.h | |
|
msilib.h | |
Category: |
SCbus Routing | |
Mode: |
asynchronous | |
The ms_listen( ) function connects the receive of a station to an SCbus time slot. This function uses the information stored in the SC_TSINFO structure to connect the digital receive (listen) channel (T-1/E-1 time slot) to an SCbus time slot. This functon sets up a half-duplex connection. For a full-duplex connection, the receive (listen) channel of the other device must be connected to the digital transmit channel.
Parameter |
Description |
devh: |
The board device handle. |
tsinfop: |
The pointer to the SCbus time slot information structure. |
A pointer to the SC_TSINFO structure is passed to the function. It contains two fields: the first field specifies the total number of SCbus time slots to which the connection is to be made, and the second is a pointer to an array which contains the SCbus time slots (between 0 and 1023) to be connected to the receive of the station device. The SC_TSINFO structure is declared as follows:
typedef struct {
unsigned long sc_numts;
long *sc_tsarrayp;
} SC_TSINFO;
For MSI/SC station devices, the sc_numts element of the SC_TSINFO array should be set to 1. The sc_tsarrayp must point to an array of type long. The first element of the array will contain a valid SCbus time slot number (0 to 1023) which was obtained by issuing the appropriate xx_getxmitslot( ) function call (xx = ag, dt, dx or fx).
This function fails when:
#include "srllib.h"
#include "dtilib.h"
#include "msilib.h"
#include "errno.h"
int chdev1, tsdev4; /* Chan dev descriptor variables */
SC_TSINFO tsinfo; /* Time slot information structure */
long scts; /* SCbus time slot */
/* Open board 1, channel 1 device */
if ((chdev1 = ms_open("msiB1C1",0)) == -1) {
printf( "Cannot open MSI B1, C1: errno=%d", errno);
exit(1);
}
/* Open board 1, time slot 4 device */
if ((tsdev1 = dt_open("dtiB1T4",0)) == -1) {
printf( "Cannot open DTI B1, T4: errno=%d", errno);
exit(1);
}
/* Set up SC_TSINFO structure */
tsinfo.sc_numts = 1;
tsinfo.sc_tsarray = &scts;
/* Get time slot on which DTI board 1, time slot 4 is xmitting */
if (dt_getxmitslot(tsdev4,&tsinfo) == -1) {
printf("Error message = %s", ATDV_ERRMSGP(chdev));
exit(1);
}
/* Make MSI board 1, station 1 listen to transmit time slot
of DTI Board 1 time slot 4 on SCbus */
if (ms_listen(chdev1,&tsinfo) == -1) {
printf("Error Message = %s",ATDV_ERRMSGP(tsdev4));
exit(1);
}
If the function returns a -1 indicating an error, the error code may be retrieved by calling the SRL standard attribute function ATDV_LASTERR( ). A more descriptive error message may be retrieved by using the function ATDV_ERRMSGP( ).
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation