Connects inputs to outputs.
DWORD swiMakeConnection ( SWIHD swihd, SWI_TERMINUS input[], SWI_TERMINUS output[], unsigned count)
Argument |
Description |
swihd |
|
input |
Array of terminus structures for the input side of the connection: typedef struct Refer to the Details section for a description of these fields. |
output |
Array of terminus structures for the output side of the connection. |
count |
Number of elements in the input array and in the output array. |
Return value |
Description |
SUCCESS |
|
CTAERR_DRIVER_ERROR |
Underlying driver retrieved an unrecognized error. Call swiGetLastError to retrieve the MVIP device error code. |
CTAERR_INVALID_HANDLE |
swihd is not a valid switch handle. |
CTAERR_SVR_COMM |
Communication error in the server environment. |
SWIERR_INVALID_STREAM |
One or more of the specified streams is invalid. |
SWIERR_INVALID_TIMESLOT |
One or more of the specified timeslots is invalid. |
swiMakeConnection makes connections between the corresponding elements of the output terminus array and the input terminus array.
If multiple connections are made (that is, count is greater than 1), the relative throughput delay of the connections may not all be the same. Use swiMakeFramedConnection if you need identical throughput delays.
Note: Under Solaris, the upper limit for the number of terminuses that can be batched in one call is 32.
The SWI_TERMINUS structure contains the following fields:
Field |
Description |
---|---|
bus |
Interface point of the switch block. Devices can reside directly on the MVIP bus. Devices can also reside on a board's local bus and may require a switch block to access the MVIP bus. Acceptable bus values are: MVIP95_MVIP_BUS MVIP95_LOCAL_BUS |
stream |
A grouping of timeslots that usually corresponds to a particular bit stream of time-division multiplexed (TDM) serial data on an individual track or wire of a bus. |
timeslot |
A particular 64 kbit/s subdivision of a TDM bus stream. Timeslots number from 0 (zero) to n where n is stream dependent. |
Note: Disable an output when the connection or pattern is no longer required. Leftover connections or patterns can cause unpredictable behavior in the application.
Refer to Making connections for more information.
If CTAERR_DRIVER_ERROR is returned, call swiGetLastError to retrieve the MVIP device error code.
swiDisableOutput, swiGetOutputState, swiGetSwitchCaps, swiResetSwitch, swiSampleInput, swiSendPattern
Note: Refer to the MVIP-95 switch block model for information about stream numbering when making duplex connections.
#define SIMPLEX 0
#define DUPLEX 1
void myMakeConnection(SWIHD hd, SWI_TERMINUS input, SWI_TERMINUS output,
unsigned count, DWORD mode)
{
unsigned i;
DWORD duplex = 0;
SWI_TERMINUS *outputs, *inputs;
if (mode == DUPLEX)
duplex = 1;
inputs = (SWI_TERMINUS *)malloc(sizeof(SWI_TERMINUS)*count);
outputs = (SWI_TERMINUS *)malloc(sizeof(SWI_TERMINUS)*count);
for (i = 0; i < count; i++)
{
inputs[i].bus = input.bus;
inputs[i].stream = input.stream;
inputs[i].timeslot = input.timeslot + i;
outputs[i].bus = output.bus;
outputs[i].stream = output.stream;
outputs[i].timeslot = output.timeslot + i;
}
swiMakeConnection(hd, inputs, outputs, count);
if( duplex )
{
for (i = 0; i < count; i++)
{
inputs[i].stream = inputs[i].stream + 1;
outputs[i].stream = outputs[i].stream - 1;
}
swiMakeConnection(hd, outputs, inputs, count);
}
}