Moxa Technologies C218 Computer Hardware User Manual


 
4-6 Intellio C218Turbo /PCI User's Manual
UNIX
Programming the MOXA Ports
The system calls that apply to standard tty port can also be applied to MOXA port
since MOXA port conforms to UNIX tty standard. System calls are like open(),
ioctl(), read(), write(), close(), etc. Please refer to your UNIX Programmer's
Reference manual.
However, these system services only provide limited functions and thus may not
satisfy the sophisticated programmers' need. In order to meet the user's special
purpose, MOXA supports extended services through ioctl() command, which are:
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. MLOWATER (= 0x405) To set output buffer low water level.
6. MSTATUS (= 0x407) To read modem line status (CTS/DSR/DCD).
7. MHWFLOW (= 0x40e) To enable/disable the hardware flow control.
The next section details all the commands.
Extended UNIX Ioctl() Commands
The following lists the syntax of MOXA extended functions for both non-SVR4.x
and SVR4.x UNIX. The variable moxa_fd is the returned file descriptor by open() a
specific MOXA port. For example,
int moxa_fd;
moxa_fd = open("/dev/ttya11",O_RDWR);
1. MIBUFED
This function let you know how many bytes queued in input buffer when this
function is issued.