# swiCallDriver

Makes a direct call to the MVIP device driver.

#### Prototype

DWORD swiCallDriver ( SWIHD swihd, DWORD command, DWORD *args, DWORD size, DWORD *errorcode)

Argument | Description
swihd | Switch handle .
command | MVIP driver command to call.
args | Pointer to the arguments to the driver call.
size | Size, in bytes, of the arguments to the driver call.
errorcode | Pointer to the device driver return code.

#### Return values

Return value | Description
SUCCESS |
CTAERR_INVALID_HANDLE | swihd is not a valid switch handle.
CTAERR_SVR_COMM | Communication error in the server environment.
SWIERR_CONNECTION_NOT_SUPPORTED | Switch block does not support the requested connection. A permanent limitation in the switch block prevents the connection.
SWIERR_DEVICE_ERROR | MVIP device driver encountered an error while using the services of another device driver.
SWIERR_DLL_INVALID_DEVICE | Dynamic link library (DLL) could not find the requested device.
SWIERR_INTERNAL_CONFLICT | Switch component of a switch matrix conflicts with another switch component. (The state of the switch matrix is ambiguous.)
SWIERR_INVALID_CLOCK_PARM | Value of a clock configuration parameter is invalid.
SWIERR_INVALID_COMMAND | Device driver does not support the requested operation.
SWIERR_INVALID_MINOR_SWITCH | Value of the switch parameter is invalid.
SWIERR_INVALID_MODE | Value of the mode parameter is incorrect or the device driver does not support the mode.
SWIERR_INVALID_PARAMETER | Value of a parameter that does not have its own error code is invalid.
SWIERR_INVALID_SPEED | Value of the speed parameter is out of range.
SWIERR_INVALID_STREAM | Value of the stream parameter is out of range.
SWIERR_INVALID_TIMESLOT | Value of the timeslot parameter is out of range.
SWIERR_MISSING_PARAMETER | Insufficient number of parameters were provided for the driver to complete the command.
SWIERR_MVIP_BUS_NOT_ENABLED | Switching command was called on a switch block on which the MVIP bus was not enabled.
SWIERR_NO_PATH | Device driver is unable to complete the connection because there is blocking or some other temporary switch limitation encountered.
SWIERR_NOT_CONFIGURABLE | Device does not support configuration of the parameters and/or values requested.
SWIERR_SWITCH_VERIFY_ERROR | Verification of the switch operation failed.
SWIERR_UNSUPPORTED_MODE | Mode is not supported by either the device driver or the hardware below the driver.

#### Details

swiCallDriver is an escape mechanism that allows the application to make a direct call to the underlying MVIP device driver. The error codes returned by the device driver are returned to the application in the errorcode argument.

This function does no error checking on the parameters or on the MVIP command code. Elements affected by this function are not restored even if the SWI_ENABLE_RESTORE flag is set in swiOpenSwitch.

Note: All commands to the drivers are synchronous; that is, they do not return until the driver completes the command. Some functions take a long time to return. When this happens, all other activity on the context is blocked until the function returns. It is advisable to create a new thread, a new context
, and a new switch handle to use a blocking function on a switch handle.

For more information about the MVIP driver command, refer to the MVIP-95 Device Driver Standard Manual.

#### Example

/* Supervision Monitoring using MVIP-95 Driver Extensions */
int MonitorSupervision(SWIHD hd)
{
struct start_supv_parms supvparms;
struct wait_supv_parms waitparms;
LONG SupvId;
DWORD errorcode;
/* Enable supervision on signalling stream 17, timeslot 0 (MVIP-95) */
supvparms.stream = 17;
supvparms.slot = 0;
/* Wait for hangup */
supvparms.target_pattern = SWI_A_BIT_OFF;
/* Assert hangup from our side */
supvparms.output_pattern = SWI_A_BIT_OFF + SWI_B_BIT_OFF;
supvparms.qualify_time = 100;
/* Use MVIP-95 supervision monitoring command */
swiCallDriver(hd, START_SUPV, (void *)&supvparms,
sizeof(supvparms), &errorcode);
if (errorcode != SUCCESS)
{
fprintf(stderr, "** MVIP driver error code: %d\n", errorcode);
return -1;
}
SupvId = supvparms.handle_ret;
/* Wait until target condition is detected, no time limit on wait */
waitparms.handle = SupvId;
waitparms.timeout = -1L;
/* Use MVIP-95 supervision monitoring command */
swiCallDriver(hd, WAIT_SUPV, (void *)&waitparms,
sizeof(waitparms), &errorcode);
if (errorcode != SUCCESS)
{
fprintf(stderr, "** MVIP driver error code: %d\n", errorcode);
return -1;
}
return 0;
}