swiSendPattern

Asserts fixed patterns on specified switch block outputs.

Prototype

DWORD swiSendPattern ( SWIHD swihd, BYTE pattern[], SWI_TERMINUS output[], unsigned count)

Argument

Description

swihd

Switch handle.

pattern

Array of patterns to transmit on the specified switch block outputs.

output

Array of terminus structures specifying the switch block outputs on which the patterns are to be asserted:

typedef struct
{
  DWORD bus;
  DWORD stream;
  DWORD timeslot;
} SWI_TERMINUS;

Refer to swiMakeConnection for a description of these fields.

count

Number of elements in the pattern and output arrays.


Return values

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_PARAMETER

Board-specific clock parameter value is invalid.

SWIERR_INVALID_STREAM

One or more of the specified streams is invalid.

SWIERR_INVALID_TIMESLOT

One or more of the specified timeslots is invalid.


Details

For each element of the specified pattern array, swiSendPattern sends the 8-bit pattern on the output terminus in the corresponding element of the output array.

Note: Under Solaris, the upper limit for the number of terminuses that can be batched in one call is 30.

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 Sending a pattern for more information.

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

See also

swiCloseSwitch, swiDisableOutput, swiGetOutputState, swiGetSwitchCaps, swiMakeFramedConnection, swiOpenSwitch, swiResetSwitch, swiSampleInput

Example

/* Send the same pattern to many output terminuses */
void mySendPattern(SWIHD hd, BYTE pattern, SWI_TERMINUS output, unsigned count)
{
    SWI_TERMINUS *outputs;
    BYTE *patterns;
    unsigned i;

    outputs = (SWI_TERMINUS *)malloc(sizeof(SWI_TERMINUS)*count);
    patterns = (BYTE *)malloc(sizeof(BYTE)*count);
    for (i = 0; i < count; i++)
    {
        outputs[i].bus = output.bus;
        outputs[i].stream = output.stream;
        outputs[i].timeslot = output.timeslot + i;
        patterns[i] = pattern;
    }
    swiSendPattern(hd, patterns, outputs, count);
    free(outputs);
    free(patterns);
}