ms_listen( )
Cautions | Errors | Example | See Also
Name: int ms_listen (devh, tsinfop) Inputs:
Returns: Includes: Category: Mode: Platform: Description
The ms_listen( ) function connects the receive channel of a station to a TDM bus time slot.
devh the board device handle tsinfop pointer to the TDM bus time slot information structure, see SC_TSINFO for details.
- Notes:
- 1. An MSI station device can listen to one and only one time slot at a time, however, multiple devices may listen to the same time slot at the same time.
2. We recommend that you issue a call to ms_unlisten( ) before invoking this function.Cautions
- The ms_listen( ) function can take up to 30 msec to execute when running under the Linux® operating system. On the Windows® operating system, this function executes in approximately 1 msec.
- This function fails when:
- By default, MSI stations do not drive audio data onto their assigned TDM bus time slot. MSI stations only transmit audio data after receiving an ms_listen( ) command. An application requiring an MSI station to transmit audio data without listening to another device (as in half-duplex mode) can have the MSI station listen to its own TDM bus time slot. This is accomplished as shown in the code sample below:
#include <windows.h> /* For Windows applications only */ #include "srllib.h" #include "dtilib.h" #include "msilib.h" #include "errno.h" int chdev1; /* Channel dev descriptor */ int tsdev1; /* Time slot dev desc */ SC_TSINFO tsinfo; /* Time slot info */ long scts; /* SCbus time slot */ /* Open board 1, channel 1 device */ if ((chdev1 = ms_open("msiB1C1",0) == -1) { printf("Cannot open MSIB1C1. errno = %d", errno); exit(1); } if ((tsdev1 = dt_open("dtiB1T1",0) == -1) { printf("Cannot open dtiB1T1. errno = %d", errno); exit(1); } /* Setup SC_TSINFO structure */ tsinfo.sc_numts = 1; tsinfo.sc_tsarray = &scts; /* Get transmit time slot of MSI/SC device chdev1*/ if (ms_getxmitslot(chdev1, &tsinfo) == -1){ printf("Error Message = %s",ATDV_ERRMSGP(chdev1)); exit(1); } /* Make chdev1 listen to itself */ if (ms_listen(chdev1, &tsinfo) == -1){ printf("Error Message = %s",ATDV_ERRMSGP(chdev1)); exit(1); } /* chdev1 is now transmitting on its SCbus time slot. Now, make tsdev1 listen to chdev1 */ if (dt_listen(tsdev1, &tsinfo) == -1){ printf("Error Message = %s",ATDV_ERRMSGP(tsdev1)); exit(1); } /* Continue processing */ if (dt_close(tsdev1) == -1){ printf("Could not Close msiB1C1. errno = %d", errno); exit(1); } if (ms_close(chdev1) == -1){ printf("Could not Close msiB1C1. errno = %d", errno); exit(1); }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".
Example
#include <windows.h> /* For Windows applications only */ #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 transmitting */ 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); }See Also
Click here to contact Telecom Support Resources
Copyright 2003, Intel Corporation