Chapter 4 • • For UNIX Users
~28~
#define MSTATUS 0x407
int status; /* status = RS-232 line status */
/* bit0 - CTS (1:on, 0:off) */
/* bit1 - DSR (1:on, 0:off) */
/* bit2 - DCD (1:on, 0:off) */
ioctl(moxa_fd, MSTATUS, &status);
6. MHWFLOW
This function is used to enable/disable hardware flow control. The
first open() function of a port will set the MHWFLOW to
configuration setting. However, user might want to control the DTR
or RTS signal on their will, thus the RTS flow control bit should be
turned off in order to take over the control of DTR or RTS signal via
function MTCRTS or MTCDTR. MTCRTS and MTCDTR can be
effective only after the RTS flow control bit of MHWFLOW is turned
off.
#define MHWFLOW 0x40e
#define HWFlowControlOff 0x00
#define CTSFlowControlBitOn 0x01
#define RTSFlowControlBitOn 0x02
#define HWFlowControlOn 0x03
ioctl(moxa_fd, MHWFLOW, CTSFlowControlBitOn);
ioctl(moxa_fd, MHWFLOW, RTSFlowControlBitOn);
ioctl(moxa_fd, MHWFLOW, CTSFlowControlBitOn |
RTSFlowControlBitOn);