# swiConfigBoardClock

Establishes the clock
source for an MVIP board.

#### Prototype

DWORD swiConfigBoardClock ( SWIHD swihd, SWI_CLOCK_ARGS *args)

Argument | Description
swihd | Switch handle .
args | Pointer to the SWI_CLOCK_ARGS clock parameter structure for configuring the MVIP board clock: typedef struct { DWORD size; DWORD clocktype; DWORD clocksource; DWORD network; union { struct { DWORD clockmode; DWORD autofallback; DWORD netrefclockspeed; DWORD fallbackclocksource; DWORD fallbacknetwork; }h100; } ext; /* specific extensions per board based on clocktype */ } SWI_CLOCK_ARGS; Refer to the Details section for a description of these fields.

#### 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_CLOCK_PARM | Value of a clock configuration parameter is invalid.
SWIERR_INVALID_PARAMETER | Board-specific clock parameter value is invalid.

#### Details

swiConfigBoardClock establishes the clock source for a CT bus board. This function supports clock configuration for all standard MVIP boards, H.100/H.110, and future generations of CT bus boards.

Note: Call swiConfigBoardClock before calling swiConfigSec8KClock for the first time on a particular switch handle, to prevent the clock source from changing to OSC.

The size, clocktype, clocksource, and network fields of the SWI_CLOCK_ARGS structure are identical across all board types:

Field | Description
--- | ---
size | Number of bytes contained in the structure. If size is less than the size of SWI_CLOCK_ARGS, the command uses only the number of bytes specified by size. If size is greater than the size of SWI_CLOCK_ARGS, size is set to the size of SWI_CLOCK_ARGS, and the command uses this number of bytes.
clocktype | MVIP standard to which clocking on the board applies. Acceptable clocktype values are: MVIP95_STD_CLOCKING MVIP95_H100_CLOCKING
clocksource | Where the clock reference originates. Acceptable values for clocksource are: MVIP95_SOURCE_INTERNAL MVIP95_SOURCE_SEC8K MVIP95_SOURCE_MVIP Additional values for clocksource for H.100/H.110 boards are: MVIP95_SOURCE_NETWORK MVIP95_SOURCE_H100_A MVIP95_SOURCE_H100_B MVIP95_SOURCE_H100_NETREF MVIP95_SOURCE_H100_NETREF_1 MVIP95_SOURCE_H100_NETREF_2
network | Device source for the MVIP clock signals. Acceptable values for network are 1 to n where n is the number of devices on the specified board capable of being a clock source. A value for network is valid only when clocksource is equal to MVIP95_SOURCE_NETWORK.

The extension section of the SWI_CLOCK_ARGS structure is a union that currently has a structure for H.100/H.110 boards. Further evolution of MVIP and CT bus standardization work will modify this part of the SWI_CLOCK_ARGS structure.

The following table describes the fields for H.100 and H.110 boards:

Field | Descriptions
--- | ---
clockmode | Board's control of the H.100/H.110 clocks. Acceptable values for clockmode are: MVIP95_H100_SLAVE MVIP95_H100_MASTER_A MVIP95_H100_MASTER_B MVIP95_H100_STAND_ALONE
autofallback | Whether the board is to automatically switch to fallback mode and become a slave to the alternate H.100/H.110 clock. Acceptable values for autofallback are: MVIP95_H100_DISABLE_AUTO_FB MVIP95_H100_ENABLE_AUTO_FB
netrefclockspeed | Speed of the NETREF clock signal. Acceptable values are: MVIP95_H100_NETREF_8KHZ MVIP95_H100_NETREF_1544MHZ MVIP95_H100_NETREF_2048MHZ
fallbackclocksource | Clock reference to be used when an automatic clock fallback occurs. This field is ignored unless autofallback is set to MVIP95_H100_ENABLE_AUTO_FB. Acceptable values are the same as for clocksource.
fallbacknetwork | On-board source of an external network timing for the fallback reference when there are multiple external network connections to the board and fallbackclocksource is set to MVIP95_SOURCE_NETWORK. Acceptable values are: 1..n where n is the number of devices on the specified board capable of being a clock source.

Refer to Configuring the clocks for more information.

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

#### See also

swiGetBoardClock, swiGetTimingReference, swiOpenSwitch

#### Example

void myAGT1ClockFallback(SWIHD swihd)
{
SWI_CLOCK_ARGS boardclock;
/* Make AG-T1 sync off SEC8K */
boardclock.size = sizeof(SWI_CLOCK_ARGS);
boardclock.clocktype = MVIP95_STD_CLOCKING;
boardclock.clocksource = MVIP95_SOURCE_SEC8K;
swiConfigBoardClock(t1hd, &boardclock);
}