============================================================================

 MOXA Intellio Family Device Driver Ver. 5.0 Installation Guide for QNX 4.2x 

=============================================================================

Table of Contents

Chapter 1   Introduction
Chapter 2   Driver Installation
Chapter 3   Driver Configuration
Chapter 4   Administration Tools
Chapter 5   Port Naming Convention
Chapter 6   Setting Moxa Ports to Terminals
Chapter 7   Programming the Moxa Ports
Appendix A  Options of Moxa Device Driver Dev.mx
Appendix B  Troubleshooting by Error Message


Chapter 1                                                          Introduction
-------------------------------------------------------------------------------
The MOXA QNX driver Ver 5.x supports MOXA Intellio Family multiport boards.
(Including CP-204J, C218Turbo, C218Turbo/PCI, C320Turbo, C320Turbo/PCI)
Up to 3 of combination of MOXA Intellio Family multiport boards are allowed 
to be installed in the system. If more than two  boards  are installed, all 
ISA boards must use the same IRQ but their own unique base memory addresses.
Max. of 96 ports could be used if 3 C320Turbo Series multiport boards are
installed. For more hardware installation details, please refer to the 
Intellio Family User's Manual.

Both 16-bit and 32-bit QNX drivers are supported, which can be selected in
driver installation procedure to suit your need.

Inside the driver diskette, you can see the following files (in tar format):

    mxinst        -     Driver installation shell program.
    qnx.tar       -     Tar-compressed driver files.
    readme.txt    -     This documentation file.
    release.note  -     Release note for the last version.

Comparing to standard QNX serial driver, MOXA driver has the following
enhancements:

    . Supports up to 96 ports in the QNX system.
    . Supports speeds up to 921600 bps for C218Turbo Series & CP-204J, and
      460800 bps for C320Turbo Series.
    . Guarantees no data lose, especially at higher speeds.
    . Less system overhead.


Chapter 2                                                   Driver Installation
-------------------------------------------------------------------------------

Before driver installation, please refer to the hardware installation section
of Intellio Family User's Manual to install the boards with the right
settings.

The target directory for driver files is /usr/lib/moxa. Here is how to install
the MOXA QNX driver into a QNX system.

Step 1. Boot the system and login from the console as a super user (root).

Step 2. Insert driver diskette into a 1.44MB floppy drive, A: or B:. If driver
        files are obtained from MOXA FTP service, put them under /tmp/moxa
        directory and skip the following 'tar' command.

Step 3. Change to root directory by entering the following command:

        # cd /

Step 4. Enter the following command to extract the install script file first.

        # tar  xvf  /dev/fd0  /tmp/moxa/mxinst   (if 1.44MB A:; skip if FTP)

        # sh /tmp/moxa/mxinst   (Follow the instructions prompted to install)

        =======================================================================
          Copyright (C) 1999 Moxa Technologies Co., Ltd. All Rights Reserved.

          Moxa Device Driver Installation (Ver. 5.x)
        =======================================================================

        Please select one of the devices where the driver files put:
                1. /dev/fd0          (A Floppy Drive)
                2. /dev/fd1          (B Floppy Drive)
                3. Hard Disk         (/tmp/moxa directory)

        Select :

        Tar files from driver diskette, please wait ...

        Select driver:
          1. 32-bit driver (for 32-bit QNX)
          2. 16-bit driver (for 16-bit QNX)

        Please select:

        Then the MOXA Multiport Board Installation Utility will show for board
        installation and configuration. Please follow the instructions to
        install and configure.

Step 5. Now you may shutdown the system and restart.

        After the system starts up again, similar messages as follows will
        show.

        Intellio Family Driver (Ver 5.x) Copyright(c) 1998-2000 Moxa Technologies Co.,LTD.

        .......


        If a message like the following appears

        *** C218Turbo [XX000] not found or memory occupied by others!
           or
        *** C320Turbo (x ports) [XX000] not found or memory occupied by others!

        This message means that the configured C218Turbo or C320Turbo 
	is not found.


        For more error messages details,see Intellio Family User's Manual,
        Appendix Troubleshooting.


Step 6. Enable the "Terminal" port for login purpose.

        If the prefix of the MOXA ports' device name is ttym, to enable the
        terminal ports, you have to add the following line to the system
        initialization file, /etc/config/sysinit.1:

        tinit -t /dev/ttym* &

        anywhere after the MOXA driver line similar to the following:

        Dev.mx -Cx -By -Iz &

        Or refer to QNX OS Utilities Reference books for more details.

Chapter 3                                                  Driver Configuration
-------------------------------------------------------------------------------

We have two methods to do driver configuration.

The first one is to run MOXA administration tool "moxaadm" and to do the
[Basic Configuration] and [Advanced Configuration] utilities. For more details
about basic/advanced configuration, please refer to Chapter 4.

The second method is to edit the options of MOXA device driver "Dev.mx"
recording on the system initialization file, /etc/config/sysinit.1. For more
details about Dev.mx options, please refer to Appendix A.


Chapter 4                                                  Administration Tools
-------------------------------------------------------------------------------

Just type "moxaadm" in any directory, you can execute all the utilities like
basic/advanced configuration, port monitoring and driver removal.

Basic Configuration
-------------------

You can select board type, memory base, and interrupt at will as long as no
conflict occurs.

Advanced Configuration
----------------------

Prefix Name (default 'ttym'):
        The device name of QNX serial ports can be specified with user-defined
        prefix along with sequence number. For example, if the device name
        prefix is ttym and the 16th MOXA ports according to the configuration
        will has the device name, /dev/ttym16.

Baud Rate (default 9600):
        The initial baud rate for subsequent ports.

Raw Mode (default ON):
        Set all subsequent ports to "raw" mode or "edited" mode.
        For more details about "raw" mode and "edited" mode, please refer to
        QNX OS System Architecture book.

Hardware Flow Control (default ON):
        Enable and lock or disable locked hardware flow control on all
        subsequent ports.

Software Flow Control (default OFF):
        Enable and lock or disable locked software flow control (XON/XOFF) on
        all subsequent ports.

RTS Initial Status (default ON):
        Set initial state of RTS to on or off.

DTR Initial Status (default ON):
        Set initial state of DTR to on or off.

Power OFF Signal (default OFF):
        Enable or disable hardware shutdown on SIGPWR (Power off Signal).

DCD Change Signal (default ON):
        Enable or disable modem carrier processing (HUP).

Modem Status Change Signal (default OFF):
        Enable or disable packet mode (Modem status change causes "packet"
        event).


Port Monitoring
---------------

This utility gives the user a quick view about all the MOXA ports' activities.
One can easily learn each port's total received/transmitted (Rx/Tx) character
count since the time when the monitoring is started. Rx/Tx throughputs per
second are also reported on interval basis (e.g. the last 5 seconds) and on
average basis (since the time the monitoring is started). You can reset all
ports' count by <HOME> key. <+> <-> (plus/minus) keys to change the displaying
time interval. Press <ENTER> on the port, that cursor stay, to view the port's
communication parameters, signal status, and input/output queue.

Driver Removal
--------------

If you want to remove the MOXA QNX device driver and return to your system
configuration, just press ENTER in this function entry and answer "y" to
confirm. Then the driver will be removed from the system. If you answer "n",
no action will be taken.


Chapter 5                                           MOXA Port Naming Convention
-------------------------------------------------------------------------------

The device name of the MOXA serial port is /dev/ttym[1-96] if the device name
prefix is 'ttym', which can be defined in [Advanced configuration] of moxaadm.
The sequence number of the device names is defined in [Basic configuration]
of moxaadm. For example, if there are 3 C320Turbo configured and each with 32
ports, then the last MOXA port will have device name /dev/ttym96. Or if there
are one 8-port C320Turbo and a C218Turbo configured, then the last MOXA port
will have device name /dev/ttym16.


Chapter 6                                       Setting Moxa Ports to Terminals
-------------------------------------------------------------------------------

Normally, you have to use "tinit" command to set Moxa ports to terminals.
For example, if the prefix of the MOXA ports' device name is ttym, and you want
to enable the second MOXA port to a terminal, you have to enter the following
command:

        tinit -t /dev/ttym2 &

If you want to start this terminal port after system rebooted immediately, add
the command line to the system initialization file, /etc/config/sysinit.1,
anywhere after the MOXA driver line which is similar to the following:

        Dev.mx -Cx ....... &

For more details about "tinit", please refer to QNX OS Utilities Reference
book.


Chapter 7                                            Programming the MOXA Ports
-------------------------------------------------------------------------------

The system services that apply to standard tty port can also be applied to 
MOXA port since MOXA port conforms to UNIX tty standard. For example: open(), 
ioctl(),read(), write(), close(), etc. Functions tcgetattr(), tcsendbreak(),
tcflush(), tcflow(), cfgetospeed(), cfgetispeed(), etc, conforming to POSIX 
are also available. Please refer to your QNX Programmer's Reference Manual.

For setting the MOXA ports to speed higher than 38400 and up to 460800,
cfsetospeed() function should be used with speed parameter specified.
The parameter speed has data type long which means it accept user-defined
baud rate.

For more accurate operations, two ioctl() commands are added.

1. MoxaFlushQueue (0x428)
    This function is to flush data in input queue and output queue of
    the MOXA board.In addition to calling QNX POSIX function tcflush(),
    calling qnx_ioctl() with command MoxaFlushQueue subsequently is
    recommended to flush data in input/output queue. Below is the
    calling example.

    #define     MoxaFlushQueue          0x428

    char        in;

    tcflush(fd, TCIOFLUSH);             /* Call system's flush function */
    in = TCIOFLUSH;
    qnx_ioctl(fd, MoxaFlushQueue, &in, 1, &in, 1);


 2. MoxaSetFlow (0x429) and MoxaGetFlow (0x430)
     This function is to handle software flow control feature on MOXA board.
     In addition to calling QNX POSIX function tcsetattr() to set termios
     parameters, calling qnx_ioctl() with command MoxaSetSwFlow subsequently is
     recommended to handle software flow control. Below is the calling example.

     #define    MoxaSetSwFlow           0x429
     #define    MoxaGetSwFlow           0x430
     #define    Tx_FlowCtl              4
     #define    Rx_FlowCtl              8

     char       flow, getflow;

     flow = Tx_FlowCtl | Rx_FlowCtl;
     qnx_ioctl(fd, MoxaSetSwFlow, &flow, 1, &flow, 1);
     qnx_ioctl(fd, MoxaGetSwFlow, &getflow, 1, &getflow, 1);


Appendix A                               Options of Moxa Device Driver  Dev.mx
-------------------------------------------------------------------------------

The driver process, Dev.mx, can be found in the system initialization file,
/etc/config/sysinit.1.

It has parameters which have driver-wide effect to every MOXA ports:

 -b number  Define initial baud rate (default 9600)
            (Any speeds in range of [0, 921600])
 -B x,x,x   Set address : 0-C8000, 1-CC000, 2-D0000, 3-D4000, 4-D8000, 5-DC000
 -C x,x,x   Set board type : 
		1-C218Turbo, 
		2-C320Turbo 8ports, 
		3-C320Turbo 16ports, 
		4-C320Turbo 24ports, 
		5-C320Turbo 32ports,
	    	6-CP-204J
	    Note: For PCI boards, you should specify the bus number and
 		the device number by using "-i" and "-j" option, and the
		address option "-B" and IRQ option "-I" will be ignored. 
		If you set the bus number and device number 0, driver 
		will try to configure the specified board to ISA boards.

 -I irq     Set interrupt number for all ISA bus
 -i x,x,x   Set PCI bus number of boards
 -j x,x,x   Set PCI device number of boards
 -d         Set DSR on initially (default)
 -D         Set DSR off initially
 -e         Set options to "edited" mode
 -E         Set options to "raw" mode (default)
 -f         Enable and lock hardware flow control (default)
 -F         Disable hardware flow control
 -m         Disable modem carrier processing (DCD change signal HUP)
 -M         Enable modem processing (default)
 -N name    Prefix to register (default "ttym")
 -p         Enable packet mode. (Modem status change causes "packet" event).
 -P         Disable packet mode (default).
 -r         Set RTS on initially (default)
 -R         Set RTS off initially
 -x         Enable and lock software flow control
 -X         Disable software flow control (default)
 -w         Enable hardware shutdown on SIGPWR (Power off Signal).
 -W         Disable hardware shutdown on SIGPWR. (default)

For the simplest examples:
        Set one C32016(C320Turbo 16ports), address C8000, IRQ 11:

             Dev.mx -C3 -B0 -I11 &

        Set one C32016(C320Turbo 16ports) and one C218Turbo, address 
        C8000 for C320Turbo and D4000 for C218Turbo, IRQ 12:

             Dev.mx -C31 -B03 -I12 &

If you do not want to type parameters on your own, you may specify parameters
by running [Advanced configuration] of 'moxaadm'.


Appendix B                                     Troubleshooting by Error Message
-------------------------------------------------------------------------------

1. MOXA device driver dev_drvr_register (ntty=XX) fail !

   The problem usually occurs when not enough terminal devices are supported
   by Dev (Device Manager). You have to edit the Device Manager command in the
   file /etc/config/sysinit.1. For example, if the original command is "Dev &",
   it means the Device Manager will support maximum 16 terminal devices.
   If more than 16 serial ports are required, please change the command to
   "Dev -n xx &", where xx must be larger than the total number of serial 
   ports. For more information, please refer to the Dev command in the book
   "QNX OS Utilities Reference - A to M".

   Sometimes it also happens when 16-bit driver is installed on 32-bit 
   QNX or 32-bit driver is installed on 16-bit QNX.


2. C218Turbo (or C320Turbo) [XX000] not found or memory occupied by others !

   To avoid this, please DOUBLE CHECK the board settings of configuration.

   - Plug in the Intellio Family board(s) properly.
   - Inspect carefully on the settings of address switch(es) and IRQ jumper
     for each board installed.
   - Make sure that the specific shadow RAM area(s) in BIOS settings is (are)
     disabled.
   - Sometimes slot(s) for plugging Intellio Family board(s) is(are)
     malfunctioned .In this case, please try other slots until good one is 
     found.
   - Sometimes it happens when the total consumption of power in the system
     is higher than the power adapter can provide.
     Especially when many interface boards including MOXA board(s) are plugged
     in the system.
     It is recommended to replace the current power adapter with higher watt
     one. Or choose the external power option if C320Turbo board is used.

   If all the possible methods fail, the Intellio Family board(s) might be
   defective. Please check the Intellio Family board(s) ONE AT A TIME in the
   system and find out the defective one.
   It is also recommended to check it on DOS with utility "SETUP" or "SCOPE"
   to verify the hardware conditions.

   Contact and report it to your dealer at once for replacement or repair.

3. C218Turbo (or C320Turbo)[XX000] download failure !

   For C320Turbo, please shutdown the system first, then
   - Power on the CPU/Basic Module.
   - Or fasten the connection cable between the C320Turbo board and  
     CPU/Basic Module.
   - The CPU/Basic Module might be defective.

   For both C218Turbo and C320Turbo,
   - Sometimes it happens when the total consumption of power in the system
     is higher than the power adapter can provide.
     Especially when many interface boards including MOXA board(s) are plugged
     in the system.
     It is recommended to replace the current power adapter with higher watt
     one. Or choose the external power option if C320Turbo board is used.
   - May be the MOXA board is defective.

   To find out the defective part, it is recommended to check it on DOS
   with utility "SETUP" or "SCOPE" to verify the hardware conditions.

   Contact and report it to your dealer at once for replacement or repair.

4. C320Turbo [XX000] ports number mismatch !

   To avoid this, please shutdown the system first, then
   - Connect the CPU/Basic Module with proper number of UART/Extensive 
     Module(s) as configured in "moxaadm".
   - Make sure that the UART/Extensive Module(s) is(are) fastened properly.

   If all the possible methods fail, one of the UART/Extensive Module(s) 
   might be defective. Please check the UART/Extensive Module(s) ONE AT A 
   TIME in the system to find out the defective one. It is also recommended 
   to check it on DOS with utility "SETUP" or "SCOPE" to verify the hardware
   conditions.

   Contact and report it to your dealer at once for replacement or repair.

5. C320Turbo CPU/Basic Module not found!

   To avoid this, please shutdown the system first, then
   - Power on the CPU/Basic Module.
   - Or fasten the connection cable between the C320Turbo board and CPU/Basic
     Module.
   - Sometimes it happens when the total consumption of power in the system
     is higher than the power adapter can provide.
     Especially when many interface boards including MOXA board(s) are plugged
     in the system.
     It is recommended to replace the current power adapter with higher watt
     one. Or choose the external power option if C320Turbo board is used.

   If all the possible methods fail, the CPU/Basic Module might be defective.
   It is recommended to check it on DOS with utility "SETUP" or "SCOPE"
   to verify the hardware conditions.

   Contact and report it to your dealer at once for replacement or repair.


6. ERROR! file c218tqnx.cod (or c320tqnx.cod) not found !
   ERROR! file c218tqnx.cod (or c320tqnx.cod) read fail !
   ERROR! file c218tqnx.cod (or c320tqnx.cod) data content error !

   It means something is wrong with driver installation or the file has been
   deleted accidentally or corrupted somehow.

