(Page 27 of 28 in this chapter)


swiSendPattern

Description

Asserts fixed patterns on specified switch block outputs.

Prototype

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

swihd Handle returned by swiOpenSwitch.

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. The terminus structure is:

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

See swiMakeConnection for a description of these fields.

count Number of elements in the pattern and output arrays.

Return Values

Events

Details

For each element of the specified pattern array, this function sends the eight-bit pattern on the output terminus in the corresponding element of the output array.

In MVIP-90 mode, the bus field is ignored and the stream and timeslot fields are interpreted as MVIP-90 streams and timeslots.

Note: It is important to 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 Section 4.3, 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, swiGetLastError, swiGetOutputState, swiGetSwitchCaps, swiMakeConnection, 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);
}


(Page 27 of 28 in this chapter)


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