![Eurotech ReliaGATE 10-14 Series Скачать руководство пользователя страница 69](http://html1.mh-extra.com/html/eurotech/reliagate-10-14-series/reliagate-10-14-series_user-manual_2440372069.webp)
ReliaGATE 10-14 User manual Rev. 0-10
12 How to use the interfaces in Linux
12.6.2.2
Configuring the COM port mode from an application program (using the Eurotech set
serial mode API)
The SDK for the REGATE-10-14 includes a library that allows the mode of the serial port to be controlled
directly from a C or C++ application.
To use this library, complete the following steps:
1. Include the following header in the application source file
#include <ethserialmode.h>
2. Link the application with the libethserialmode.so library file
gcc main.c -lethserialmode
The library uses the following structure defined in
ethserialmode.h
to pass and return information:
struct _eth_serial_mode {
int mode;
int terminator;
int state_after;
int delay_after;
int delay_before;
int state_during;
};
mode
Specifies the mode. It may be one of the following values defined in ethsetserial.h RS232_MODE, RS422_MODE,
or RS485_MODE.
terminator
Specifies the state of the line termination resistors, and may be zero (disabled) or non zero (enabled) .
state-after
Specifies the state of the line driver enable after a transmission is completed and may be one of the following values
defined in ethsetserial.h RTS_AUTO, RTS_HI, RTS_LOW.
state-during
Specified the state of the line driver enable during a transmission and may be one of the following constants defined
in ethsetserial.h RTS_AUTO, RTS_HI, RTS_LOW .
delay-before
Specifies the delay in mS between the line driver being enabled and the start of the first character. NB not used in
the ReliaGATE 10-14 and should be set to 0.
delay-after
Specifies the delay in mS between the end of the last character and the line driver being disabled. NB not used in
the ReliaGATE 10-14 and should be set to 0.
The following functions are available:
int _eth_SetSerialMode(int fd, struct _eth_serial_mode *mode)
Sets the mode of the serial port
fd:
an open file descriptor for the required serial port
mode: pointer to a structure containing the required mode details
Returns 0 on success or -1 on error (errno contains the corresponding error code)
int _eth_GetSerialMode(int fd, struct _eth_serial_mode *mode)
Reads the mode of the serial port
fd:
an open file descriptor for the required serial port
mode: pointer to a structure populated with detailes of the current mode.
The values of state_during and state_after will reflect the actual values, even if
RTS_ AUTO was specified in a previous call to _eth_SetSerialMode()
Returns 0 on success or -1 on error (errno contains the corresponding error code)
69 / 90
Содержание ReliaGATE 10-14 Series
Страница 4: ...This page has been intentionally left blank...
Страница 12: ...This page has been intentionally left blank...
Страница 16: ...This page has been intentionally left blank...
Страница 18: ...This page has been intentionally left blank...
Страница 20: ...This page has been intentionally left blank...
Страница 22: ...This page has been intentionally left blank...
Страница 28: ...This page has been intentionally left blank...
Страница 36: ...This page has been intentionally left blank...
Страница 80: ...This page has been intentionally left blank...
Страница 86: ...This page has been intentionally left blank...
Страница 88: ...This page has been intentionally left blank...
Страница 89: ...ReliaGATE 10 14 User manual Rev 0 10 Notes NOTES 89 90...