MgslSetOption


Prototype  
ULONG MgslSetOption( HANDLE hDevice, UINT option_id, UINT value );
Parameters  
hDevice
handle to open port
option_id
integer that identifies option to set
value
new value of option
Return Value  
ERROR_SUCCESS (0)
opertaion completed successfully
ERROR_INVALID_PARAMETER
invalid option ID or value
ERROR_INVALID_HANDLE
hDevice is invalid

Set the current value for the specified option. The option ID is specified with a macro defined in the mghdlc.h header file. Option values are reset to default values when a port is closed.

MGSL_OPT_ENABLE_LOCALLOOPBACK
default: 0 (off)
This option controls the Local Loopback (LL) output. 0=off, 1=on

MGSL_OPT_ENABLE_REMOTELOOPBACK
default: 0 (off)
This option controls the Remote Loopback (RL) output. 0=off, 1=on

MGSL_OPT_INTERFACE
default: MGSL_INTERFACE_DISABLE
Select the serial interface (RS-232, V.35, RS-422, etc) with the same MGSL_INTERFACE_XXX values used for MgslSetPortConfigEx(). Only the PCMCIA adapter has a software selectable serial interface. Use MgslSetPortConfigEx() to set the serial interface used at system startup. Use this option to change the serial interface at run time.

MGSL_OPT_RTS_DRIVER_CONTROL
default: 0 (disabled)
This option controls the RS-422/485 driver enable with RTS. When set to 1, the RS-422/485 outputs (TxD, AUXCLK, RTS, DTR) are enabled only when RTS is active. Use this option for RS-485 bus applications that require disabling the drivers when not transmitting. Only SyncLink GT/GT2/GT4 and SyncLink AC adapters support this option.

MGSL_OPT_RX_DISCARD_TOO_LARGE
default: 0 (disabled)
0=disabled, 1=enabled, other values are reserved. When enabled, received frames are discarded if they are larger than the size of the buffer passed to MgslReceive. Otherwise a return status of RxStatus_BufferTooSmall is returned, and the frame is available for a subsequent call to MgslReceive using a larger buffer.

MGSL_OPT_UNDERRUN_RETRY_LIMIT
default: 0 (disabled)
The number of times the API automatically resends a frame if an underrun occurs during transmission. If the frame is successfully sent within the specified number of retries, then the returned transmit status is TxStatus_OK. If the resend limit is reached or this option is disabled, TxStatus_Underrun is returned.

MGSL_OPT_RX_ERROR_MASK
default: 0
If set to 1, only valid receive frames are returned to the application. Received frames with an error (CRC, abort, short, etc) are silently discarded. Set this option if the application does not require indication of receive errors and to reduce processing overhead for high speed, low latency environments.

MGSL_OPT_CLOCK_BASE_FREQ
default: Adapter specific base clock frequency
If (and only if) the adapter has a custom base clock frequency (special order), use this option to specify the custom frequency so that the correct DPLL and BRG rates are calculated for a specified data rate. Set this option before calling MgslSetParams(). Never use this option for a stock adapter with the default base clock frequency.

MGSL_OPT_CLOCK_SWITCH
Note: PCMCIA only
default: 0 (disabled)
If set to 1, data clock sources are controlled by DCD and CTS. Receive: DCD on = external RxC pin, DCD off = BRG
Transmit: CTS on = external TxC pin, CTS off = BRG
Enable this option when using a PCMCIA adapter if external clocks stop when the respective status signal is off. This allows the PCMCIA controller to continue working even when external clocks stop.

See also: Configuring the Port, MgslGetOption


Previous Contents Next