Opens a switching device and returns a switch handle.
DWORD swiOpenSwitch ( CTAHD ctahd, char *devname, unsigned swno, unsigned flags, SWIHD *swihd)
Argument |
Description |
ctahd |
|
devname |
Pointer to the base name of the switching device, for example, agsw. |
swno |
Logical switch number. |
flags |
Flags for the open call. Refer to the Details section for a description of these fields. |
swihd |
Pointer to the returned switch handle. |
Return value |
Description |
SUCCESS |
|
CTAERR_DRIVER_OPEN_FAILED |
Driver open failed. Refer to the board installation manual. |
CTAERR_NOT_FOUND |
Driver dynamic link library or the device was not found. Refer to the board installation manual. |
CTAERR_INVALID_CTAHD |
ctahd referenced by swihd is invalid. |
CTAERR_SVR_COMM |
Communication error in the server environment. |
swiOpenSwitch opens a switching device and returns a handle to the switch block for use in subsequent switching calls.
devname identifies the switching driver. AG and CG boards use the devname agsw. The CX 2000 board uses the devname cxsw.
swno is the board number and must match the logical number assigned to the board when performing OAM configuration.
Caution: |
Since MVIP-95 device drivers can be opened only in MVIP-95 mode, NMS recommends writing all applications that may use MVIP-95 device drivers in the future to use MVIP-95 mode, even if the application is not currently using MVIP-95 device drivers. |
The SWI_ENABLE_RESTORE bit is used to save the state of the switch block outputs so that the state of the switch block outputs can be restored when it is closed using swiCloseSwitch.
Acceptable values for flags are:
Zero (0)
The switch is opened in MVIP-95 mode and restoration is disabled.
SWI_ENABLE_RESTORE
SWI_ENABLE_ RESTORE | SWI_MVIP90
Refer to Opening a switch handle for more information.
If CTAERR_DRIVER_ERROR is returned, call swiGetLastError to retrieve the MVIP device error code.
void myApplicationInit(CTAHD ctahd, SWIHD hd[], int count)
{
int i;
for (i = 0; i < count; i++)
{
swiOpenSwitch(ctahd, "agsw", i, SWI_ENABLE_RESTORE, &hd[i]);
}
}