(Page 1 of 1 in this chapter) Version


Chapter 6

AG 2000 Configuration Parameters


6.1 Introduction
6.2 Using the Switching Service
6.2.1 Function Information
6.3 Line Gain
6.3.1 Getting the Line Gain
6.3.2 Setting the Line Gain
6.4 Identifying the Line Interface Type for a Timeslot

6.1 Introduction

There are configuration parameters specific to the AG 2000 hardware and device driver that are accessible to applications. This chapter describes the parameters and the methods for accessing them.

The sections that follow refer to a variety of macros that are defined in mvip95.h, nmshw.h, and swidef.h. These macros are redefined here for clarity but are subject to change. To ensure accuracy, use the definitions contained in the *.h files.

6.2 Using the Switching Service

Local device configuration on the AG 2000 board is controlled by the CT Access Switching service. The Switching service provides generic API functions for accessing device configuration parameters defined by the underlying hardware and device driver.

swiConfigLocalTimeslot and swiGetLocalTimeslotInfo allow applications to configure a device on a given local stream and timeslot by specifying a particular parameter and providing a data structure specific to that parameter. The prototypes for these functions are repeated here for convenience.

For more information about the Switching service, refer to the Switching Service Developer's Reference Manual.

6.2.1 Function Information

The syntax of swiConfigLocalTimeslot and swiConfigLocalTimeslotInfo is:

Prototype

DWORD swiConfigLocalTimeslot ( SWIHD swihd,
SWI_LOCALTIMESLOT_ARGS *args,
void *buffer,
unsigned size )

DWORD swiGetLocalTimeslotInfo ( SWIHD swihd,
SWI_LOCALTIMESLOT_ARGS *args,
void *buffer,
unsigned size )

swihd Switch handle returned by swiOpenSwitch.

args Pointer to a SWI_LOCALTIMESLOT_ARGS structure. This structure indicates the specific parameter to be configured on the device indicated by localstream and localtimeslot.

typedef struct
{
DWORD localstream;
DWORD localtimeslot;
DWORD deviceid;
DWORD parameterid;
} SWI_LOCALTIMESLOT_ARGS;
buffer Pointer to a structure that is specific to the parameterid.

size Size of buffer, in bytes.

Return Values

SUCCESS, or an error code from ctaerr.h or swidef.h.

Details

Applications using swiConfigLocalTimeslot and swiGetLocalTimeslotInfo must open the Switching service. Refer to the CT Access Developer's Reference Manual for more information about opening services.

6.3 Line Gain

The AG 2000 supports input and output gain configuration on network voice ports (timeslots) from -6 dB to +6 dB in one dB increments.

Input gain is applied to the signal received from the network. Output gain is applied to the signal transmitted to the network. The default value for both input line gain and output line gain on the AG 2000 loop start board is nominal 0 dB.
Caution:

Increasing gain may also increase noise, echo, and possibly cause oscillations on the telephone network. There also may be regulatory authority implications. Use gain with caution.

Decreasing gain may reduce echo and other noise.

6.3.1 Getting the Line Gain

Use swiGetLocalTimeslotInfo to query the input or output line gain. The arguments to this function should be set as follows:
Argument

Field

Value

swihd

Handle returned by swiOpenSwitch.

args

localstream

0 or 1. Refer to the AG 2000 switch model presented in Section 5.2.

localtimeslot

0..7. Refer to the AG 2000 switch model presented in Section 5.2.

deviceid

MVIP95_ANALOG_LINE_DEVICE

parameterid

MVIP95_INPUT_GAIN or MVIP95_OUTPUT_GAIN

buffer

Points to the NMS_LINE_GAIN_PARMS structure. Refer to the structure presented in this section.

size

Size of buffer, in bytes.

The NMS_LINE_GAIN_PARMS structure is:

typedef struct
{
INT32 gain;

} NMS_LINE_GAIN_PARMS;

The value returned in the gain component of NMS_LINE_GAIN_PARMS will be the gain in dB multiplied by 1000. For example, if the input gain on a particular network timeslot is currently set to -3 dB, after calling swiGetLocalTimeslotInfo for parameter MVIP95_INPUT_GAIN, the gain field will be -3000.

The following sample code shows how to retrieve line gain applied to a signal received from the network:

#include "swidef.h"  /*  CT Access Switching service                   */
#include "mvip95.h"  /*  MVIP-95 definitions                   */
#include "nmshw.h"   /*  NMS hardware-specific definitions                   */

DWORD myGetReceiveGain ( SWIHD swihd, SWI_TERMINUS terminus, INT32*
gain_dB )
{ SWI_LOCALTIMESLOT_ARGS args; NMS_LINE_GAIN_PARMS device ; DWORD rc ; args.localstream = terminus.stream ; args.localtimeslot = terminus.timeslot ; args.deviceid = MVIP95_ANALOG_LINE_DEVICE ; args.parameterid = MVIP95_INPUT_GAIN ; rc = swiGetLocalTimeslotInfo( /* CT Access switch handle */ swihd, /* target device and config item */ & args, /* buffer (defined by parameterid) */(void*) & device, /* buffer size in bytes */ sizeof(device)); *gain_dB = device.gain / 1000 ; return rc ; }
The following sample code shows how to retrieve line gain applied to a signal transmitted to the network:

#include "swidef.h"  /*  CT Access Switching service                   */
#include "mvip95.h"  /*  MVIP-95 definitions                   */
#include "nmshw.h"   /*  NMS hardware-specific definitions                   */

DWORD myGetTransmitGain ( SWIHD swihd, SWI_TERMINUS terminus,
INT32* gain_dB )
{ SWI_LOCALTIMESLOT_ARGS args; NMS_LINE_GAIN_PARMS device ; DWORD rc ; args.localstream = terminus.stream ; args.localtimeslot = terminus.timeslot ; args.deviceid = MVIP95_ANALOG_LINE_DEVICE ; args.parameterid = MVIP95_OUTPUT_GAIN ; rc = swiGetLocalTimeslotInfo( /* CT Access switch handle */ swihd, /* target device and config item */ & args, /* buffer (defined by parameterid) */(void*) & device, /* buffer size in bytes */ sizeof(device)); *gain_dB = device.gain / 1000 ; return rc ; }

6.3.2 Setting the Line Gain

Use swiConfigLocalTimeslot to set the the input or output line gain. The arguments to this function should be set as follows:
Argument

Field

Value

swihd

Handle returned by swiOpenSwitch.

args

localstream

0 or 1. Refer to the AG 2000 switch model presented in Section 5.2.

localtimeslot

0..7. Refer to the AG 2000 switch model presented in Section 5.2.

deviceid

MVIP95_ANALOG_LINE_DEVICE

parameterid

MVIP95_INPUT_GAIN or MVIP95_OUTPUT_GAIN

buffer

Points to the NMS_LINE_GAIN_PARMS structure. Refer to the structure below.

size

Size of buffer, in bytes.

The NMS_LINE_GAIN_PARMS structure is

typedef struct
{
INT32 gain;

} NMS_LINE_GAIN_PARMS;
Multiply the desired gain setting in dB by 1000. For example, to set the input line gain on a network voice port to -4 dB, the gain field of NMS_LINE_GAIN_PARMS should be set to -4000.

The following sample code shows how to configure gain applied to a signal received from the network:

#include "swidef.h"  /*  CT Access Switching service                   */
#include "mvip95.h"  /*  MVIP-95 definitions                   */
#include "nmshw.h"   /*  NMS hardware-specific definitions                     */
*/
DWORD mySetReceiveGain ( SWIHD swihd, SWI_TERMINUS terminus, INT32 gain_dB )
{
     SWI_LOCALTIMESLOT_ARGS  args;
     NMS_LINE_GAIN_PARMS     device ;
     
     args.localstream      = terminus.stream ;
     args.localtimeslot    = terminus.timeslot ;
     args.deviceid         = MVIP95_ANALOG_LINE_DEVICE ;
     args.parameterid      = MVIP95_INPUT_GAIN ;
     
     device.gain  =  gain_dB * 1000  ;
     
     return swiConfigLocalTimeslot (
               /* CT Access switch handle                */ swihd,
               /* target device and config item                */ & args,
               /* buffer (defined by parameterid)                */ (void*) &
device,
/* buffer size in bytes */
sizeof(device));
}
The following sample code shows how to configure line gain applied to a signal transmitted to the network:

#include "swidef.h"  /*  CT Access Switching service                   */
#include "mvip95.h"  /*  MVIP-95 definitions                   */
#include "nmshw.h"   /*  NMS hardware-specific definitions                   */
*/
DWORD mySetTransmitGain ( SWIHD swihd, SWI_TERMINUS terminus, INT32 gain_dB )
{
     SWI_LOCALTIMESLOT_ARGS  args;
     NMS_LINE_GAIN_PARMS     device ;
     
     args.localstream      = terminus.stream ;
     args.localtimeslot    = terminus.timeslot ;
     args.deviceid         = MVIP95_ANALOG_LINE_DEVICE ;
     args.parameterid      = MVIP95_OUTPUT_GAIN ;
     
     device.gain  =  gain_dB * 1000  ;
     
     return swiConfigLocalTimeslot (
               /* CT Access switch handle         */ swihd,
               /* target device and config item   */ & args,
               /* buffer (defined by parameterid) */ (void*) &
device,
/* buffer size in bytes */
sizeof(device));
}

6.4 Identifying the Line Interface Type for a Timeslot

To determine the type of line interface associated with a specific timeslot, an application can call the CT Access Switching service function swiGetLocalTimeslotInfo. In the SWI_LOCALTIMESLOT_ARGS structure referenced in this call, the fields are set as follows:
Field

Setting to Get Line Interface Type

localstream

MVIP-95: 0

localtimeslot

A value corresponding to the timeslot to query (0 - 7).

deviceid

MVIP95_ANALOG_LINE_DEVICE (0x0000002)

parameterid

NMS_ANALOG_INTERFACE_TYPE

swiGetLocalTimeslotInfo also points to a buffer specific to the parameterid. When identifying the line interface type, this structure is defined as:

    typedef struct
    {
        DWORD type; 
    
    } NMS_ANALOG_INTERFACE_TYPE_PARMS ;
The type component of the NMS_ANALOG_INTERFACE_TYPE_PARMS structure is formatted in the following way:

The Class is NMS_INTERFACE_SIGNALING_MODULE. Type is identified with one of the numbers included in the table below:
Value

Line Interface Type

0x00

Loop start

0x02

Subscriber loop

0x03

DID

0x04

E&M 2 wire

0x05

E&M 4 wire

0x0F

No interface

The following example code shows how to retrieve the type of each line interface on a board:

/*
 *   Identify the type of signaling module on a given terminus
 *   ---------------------------------------------------------
 */

#include "ctadef.h"   /* For CT Access                   */
#include "swidef.h"   /* For CT Access Switching Service */
#include "mvip95.h"   /* For MVIP95_ANALOG_LINE_DEVICE   */
#include "nmshw.h"    /* For NMS_LINE_INTERFACE_TYPE     */
#include <stdlib.h>
#include <stdio.h>

DWORD myGetInterfaceType ( 
    SWIHD    swihd,     /* From swiOpenSwitch()       */
    SWI_TERMINUS    terminus,     /* Target port       */
    DWORD    *generation,     /* Hardware generation       */
    DWORD    *type     /* Physical interface type */
                         )
{
     SWI_LOCALTIMESLOT_ARGS           args;   
     NMS_ANALOG_INTERFACE_TYPE_PARMS  parms ;
     DWORD                            rc ;

     if ( terminus.bus != MVIP95_LOCAL_BUS )
         return -1 ;  /*  Error - only applies to local bus */
     
     args.localstream      = terminus.stream ;
     args.localtimeslot    = terminus.timeslot ;
     args.deviceid         = MVIP95_ANALOG_LINE_DEVICE ;
     args.parameterid      = NMS_ANALOG_INTERFACE_TYPE ;

     rc = swiGetLocalTimeslotInfo (
              /* CT Access switch handle         */           swihd,
              /* target device and config item   */         & args,
              /* buffer (defined by parameterid) */ (void*) & parms,
              /* buffer size in bytes            */ sizeof(parms));







     if ( rc == SUCCESS )
     {           

        *generation = GET_ANALOG_INTERFACE_CLASS(parms.type);
        *type       = GET_ANALOG_INTERFACE_TYPE(parms.type);

         switch (*generation)
         {
         case NMS_INTERFACE_AG_HYBRID:           
              printf("Class: NMS_INTERFACE_AG_HYBRID\n");
              break;
              
         case NMS_INTERFACE_AG_SIGNALING_MODULE:
              printf("Class: NMS_INTERFACE_AG_SIGNALING_MODULE\n");
              break;
         default:
              printf("Class: Unknown\n");
         }
         printf ("Type : %02X\n", *type ) ;
     }
     else
     {
         printf ("swiGetLocalTimeslotInfo returns %d\n", rc ) ;
     }
     
     return rc ;
}




(Page 1 of 1 in this chapter) Version


tech_support@nmss.com
Copyright © 1999, Natural MicroSystems, Inc. All rights reserved.