Moxa Technologies C360 Computer Hardware User Manual


 
Chapter 4 For UNIX Users
~26~
open( ), ioctl( ) , read( ), write( ), close( ), etc. Please refer to the UNIX
Programmer's Reference manual. However, these system services only
provide a limited functions and thus may not satisfy the sophisticated
programmers' need. In order to meet the user's special needs, MOXA supports
extended services through ioctl( ) command which are listed below.
Note that UNIX system services can not be applied to MOXA Non-TTY ports
and please refer to the next Section for more details.
Extended Function List for MOXA TTY Ports :
1.MIBUFED (=0x401) To get byte count in input buffer.
2.MOBUFED (=0x402) To get byte count in output buffer.
3.MTCRTS (=0x403) To control RTS output signal.
4.MTCDTR (=0x404) To control DTR output signal.
5.MSTATUS (=0x407) To read modem line status (CTS/DSR/DCD).
6.MHWFLOW (=0x40e) To enable/disable the hardware flow control.
Function Description :
The following lists the syntax of MOXA extended functions for SCO UNIX.
The variable moxa_fd is the returned file descriptor by open( ) a specific
MOXA TTY port. For example,
int moxa_fd;
moxa_fd = open("/dev/ttya11",O_RDWR);
1. MIBUFED
This function let user know how many bytes queued in input buffer
when this function is issued.
#define MIBUFED 0x401
int count; /*number of bytes queued in the input buffer*/
ioctl(moxa_fd, MIBUFED, &count);