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_HALF_DUPLEX
default: 0 (disabled)
This option automatically controls the RS-422/485 output enable and receive data input based on the transmitter state. When set to 1, RS-422/485 outputs (TxD, AUXCLK, RTS, DTR) are enabled only when sending data. The receive data input is ignored while sending data. Use this option for RS-485 bus applications that require disabling the drivers when not transmitting and disabling the receiver while transmitting. Only SyncLink GT (1 to 4 ports) and SyncLink AC adapters support this option.

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 under application control. Only SyncLink GT (1 to 4 ports) 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.

MGSL_OPT_TX_COUNT
Return the number of bytes queued to send. This is a read only value.

MGSL_OPT_RX_COUNT
Return the number of data bytes available in the receive buffers . This is a read only value.

MGSL_OPT_MSB_FIRST
Note: custom feature available only on special order hardware, contact Microgate for more information
default: 0 (LSB first bit order)
If set to 1, the serial bit order is MSB first for monosync, bisync, and raw synchronous modes. Most applications use LSB first bit order. Asynchronous and HDLC modes always use LSB first.

See also: Configuring the Port, MgslGetOption


Previous Contents Next