(Page 21 of 28 in this chapter)


swiGetSwitchCaps

Description

Returns information about the capabilities of the device driver and the switch controlled by it.

Prototype

DWORD swiGetSwitchCaps (SWIHD swihd,
SWI_SWITCHCAPS_ARGS *args,
SWI_LOCALDEVICE_DESC localdevs[],
unsigned maxcount)

swihd Handle returned by swiOpenSwitch.

args Pointer to a switch capabilities parameter structure to where the device driver information is returned.

The SWI_SWITCHCAPS_ARGS structure is:

typedef struct
{
DWORD dvrrevision;
DWORD domain;
DWORD routing;
DWORD blocking;
DWORD swstandard;
DWORD swstdrevision;
DWORD hwstandard;
DWORD hwstandardrevision;
DWORD numlocalstreams;
} SWI_SWITCHCAPS_ARGS;

See the Details section for a description of these fields.

localdevs Array that receives the number of timeslots and the device type of each local stream.

The SWI_LOCALDEVICE_DESC structure is:

typedef struct
{
DWORD timeslots;
DWORD deviceid;
} SWI_LOCALDEVICE_DESC;

See the Details section for a description of these fields.

maxcount Maximum number of elements in the localdevs array.

Return Values

Events

Details

This function queries the device driver and returns the capabilities of the device driver and the switch block. An application can use this function at any time after opening a switch block.

Many applications will use this function to query whether the device driver is an MVIP-90 or MVIP-95 driver. This information is returned in the swstandard field. Certain switching functions are only applicable when the device driver is an MVIP-95 driver.

The SWI_SWITCHCAPS_ARGS structure contains the following fields:

Field

Description

dvrrevision

Returns the revision level of the device driver multiplied by 100 (decimal).

domain

Returns the domain of a switch block. A switch block's domain indicates which MVIP streams have full-duplex connections to the switch block. The representation of these streams is as a bit field. If a full-duplex connection to the switch block is supported, the corresponding bit in the domain parameter is set to one. Bit 0 indicates whether the switch block supports a full-duplex connection to DSo0 (MVIP-90) or HDS0 (MVIP-95).

In the context of MVIP-95 hardware implementations, bits 0 through 23 indicate the switch block's support for full-duplex connections with HDS0 through HDS23. A full-duplex connection means that an MVIP HDS stream can provide both input to the switch block and output from the switch block.

In the context of MVIP-90 hardware implementations, bits 0 through 7 indicate the switch block's support for full-duplex forward connections with DS0 through DS7. Similarly, bits 8 through 15 indicate the switch block's support for full-duplex reverse connections with DS0 through DS7. A full-duplex forward connection means that an MVIP DSo stream can provide input to the switch block and the corresponding MVIP DSi stream can receive output from the switch block.

The domain of all MVIP-95 standard-compliant switches is
1111 1111 1111 1111 (0xffff). A similar definition applies for MVIP-90 implementations.

routing

Returns the switch block's half-duplex routing capabilities. The representation of these capabilities is as a bit field. When the switch block has a routing capability, the bit is set to 1. Refer to the next table for more information on bits and routing capabilities.

blocking

Returns the switch block's possible blocking. Blocking means that a switch block is unable to provide all possible connections. A bit field represents where blocking is possible; a value of 1 signifies this possible restriction. The bit field for the blocking parameter has the same meaning as the bit field for the routing parameter.

swstandard

Returns the MVIP software standard to which the device driver conforms. Acceptable values for swstandard are:

MVIP95_STANDARD_MVIP90

MVIP95_STANDARD_MVIP95

swstdrevision

Returns the revision of the software standard to which the device driver conforms multiplied by 100 (decimal).

If swstandard is MVIP95_STANDARD_MVIP90, then this field is set to zero (0).

hwstandard

Returns the MVIP hardware standard controlled by the device driver. Acceptable values for hwstandard are:

MVIP95_STANDARD_MVIP90

MVIP95_STANDARD_HMVIP

hwstandard-revision

Returns the revision of the hardware standard controlled by the device driver multiplied by 100 (decimal).

If hwstandard is MVIP95_STANDARD_MVIP90, then this field is set to zero (0).

numlocalstreams

Returns the number of streams on the local bus side of the switch block. This number includes both the data and signaling streams for network devices such as T1 framers.

The following table presents the correspondence of bits in the bit field to the switch block's half-duplex routing capabilities:
Bit

Half-Duplex Routing Capability

0

Even-numbered HDS stream (MVIP-90 DSo) to odd-numbered HDS stream (MVIP-90 DSi).

1

Odd-numbered HDS stream (MVIP-90 DSo) to even-numbered HDS stream (MVIP-90 DSi).

2

Even-numbered HDS stream (MVIP-90 DSo) to even-numbered HDS stream (MVIP-90 DSi).

3

Odd-numbered HDS stream (MVIP-90 DSo) to odd-numbered HDS stream (MVIP-90 DSi).

4

Even-numbered HDS stream (MVIP-90 DSo) to local.

5

Local to odd-numbered HDS stream (MVIP-90 DSi).

6

Odd-numbered HDS stream (MVIP-90 DSo) to local.

7

Local to even-numbered HDS stream (MVIP-90 DSi).

8

Local to local.


The SWI_LOCALDEVICE_DESC structure contains the following fields:
Field

Description

timeslots

The number of timeslots on the local stream.

deviceid

The device identifier of the local stream.

Refer to Section 4.6, Querying Switch Capabilities for more information.

If CTAERR_DRIVER_ERROR is returned, call swiGetLastError to retrieve the MVIP device error code.

See Also

swiDisableOutput, swiGetLastError, swiGetLocalStreamInfo, swiGetLocalTimeslotInfo, swiGetOutputState, swiMakeConnection swiMakeFramedConnection, swiResetSwitch, swiSampleInput, swiSendPattern

Example


void myPrintSwitchCaps(SWIHD hd)
{
SWI_SWITCHCAPS_ARGS cp;
SWI_LOCALDEV_DESC *localdevs;

swiGetSwitchCaps(hd, &cp, NULL, 0);

localdevs = (SWI_LOCALDEV_DESC *)malloc(
sizeof(SWI_LOCALDEV_DESC)*cp.numlocalstreams);

swiGetSwitchCaps(hd, &cp, localdevs, cp.numlocalstreams);

printf("Driver Software Std. %s Rev. %2.f\n",
((cp.swstandard == MVIP95_STANDARD_MVIP95)? "MVIP-95" :
"MVIP-90"),
(float)cp.swstdrevision/100.0);

printf("Hardware Std. %s Rev. %2.f.\n",
((cp.hwstandard == MVIP95_STANDARD_HMVIP)? "HMVIP" :
"MVIP-90"),
(float)cp.hwstdrevision/100.0);
printf("Driver Rev. %.2f\n", (float)cp.dvrrevision/100.0);
printf(" Domain %04X, Routing %04X, Blocking %04X.\n",
cp.domain, cp.routing, cp.blocking );

if( cp.numlocalstreams > 0 )
{
DWORD i;

printf("Supports %d local streams:\n\t",
cp.numlocalstreams );
for( i=0; i<cp.numlocalstreams; i++ )
printf( "%2d ", i+16 );
printf("with\n\t");
for( i=0; i<cp.numlocalstreams; i++ )
printf( "%2d ", localdevs[i].timeslots );
printf("timeslots respectively.\n");
}
free(localdevs);
}

Sample Run


The output would be:

Driver Software Std. MVIP-90 Rev. 0.00, Hardware Std. MVIP-90 Rev.  0.
Driver Rev. 17.00, Domain FFFF, Routing 01FF, Blocking 00FF.
Supports 4 local streams:
16 17 18 19 with
24 24 32 32 timeslots respectively.


(Page 21 of 28 in this chapter)


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