				 README

=============================================================================
	   ADVANTECH industial comunication cards device driver, Ver. 2.0,
			Installation Guide
		    for Linux Kernel 2.4.xx
	       Copyright (C) 2000, ADVANTECH Co, Ltd.
=============================================================================
Contents

1. Introduction
2. System Requirement
3. Installation
4. Utilities
5. Troubleshooting

-----------------------------------------------------------------------------
1. Introduction
   
   ADVANTECH industial comunication cards device driver, Ver. 1.0,
   supports following multiport boards.
    
    - PCI-1601, PCI-1602: 	   2 ports PCI high speed multiport board.
    - PCI-1610, PCI-1612: 	   4 ports PCI high speed multiport board.
    - PCI-1620		: 	   8 ports PCI high speed multiport board.
    - UNO2050 on board COM3/COM4:  2 ports 
    - UNO2059 on board COM:	   4 ports
    - MIC-3612:			   4 ports
    - MIC-3620:	 		   8 ports
    
   This driver supports Linux Kernel 2.0.x to 2.4.x, Intel x86  hardware 
   platform. Any problem occurs, please contact ADVANTECH at 
   support@ADVANTECH.com.tw.

   In addition to device driver, useful utilities are also provided in this
   version. They are
    - pclterm  A Advantech's simple terminal program which is useful in testing 
		serial ports.
    - setserial(ver 2.7)  A new system tool,can be used to get/set serial 
		ports infomations.

   This driver and utilities are published in form of source code under
   GNU General Public License in this version. Please refer to GNU General
   Public License announcement in each source code file for more detail.

   This version of driver can be installed as Loadable Module (Module driver)
   or built-in into kernel (Static driver). You may refer to following
   installation procedure for suitable one. Before you install the driver,
   please refer to hardware installation procedure in the User's Manual.

   We assume the user should be familiar with following documents.
   - Serial-HOWTO
   - Kernel-HOWTO

-----------------------------------------------------------------------------
2. System Requirement
   - Hardware platform: Intel x86 
   - Kernel version: 2.4.x
   - gcc version 2.72 or later
   - Any number boards can be installed in combination

-----------------------------------------------------------------------------
3. Installation

   3.1 Hardware installation

       Just pulg the comunication cards into any unused slot.
	(Device number for the card in the linux system will be assigned 
	according to the slot number. )
     
   3.2 Driver files and device naming convention

       The driver file may be obtained from ftp, CD-ROM or floppy disk. The
       first step, anyway, is to copy driver file "pclicom.tgz" into specified
       directory. e.g. /pcl. The execute commands as below.

       # cd /pcl
       # tar zxvf pclicom.tar.gz
      
      
       Dialin and callout port
       -----------------------
       This driver remains traditional serial device properties. There're
       two special file name for each serial port. One is dial-in port
       which is named "ttyPxx". For callout port, the naming convention
       is "cupxx".

	Hint: device name-"ttyS*" is used for standard serial port for example ttyS0 is com1, ttyS1 is com2


       Device name
       -----------------------------------------------
       Naming convention for each PCL multiport board 
       ttyP0 ----- ttyP3    reserved for system use
       ttyP4 ----- ttyP127  each corresponding a serial port

       cup0  ----- cup4     reserved for system use
       cup4  ----- cup127   each corresponding a serial port.

   3.3 Module driver configuration
       Module driver is easiest way to install. If you prefer static driver
       installation, please skip this paragraph.
       1. Find "Makefile" in /pcl/pclicom/driver/, then run
          # make

	  # make install

	  The driver files "pclicom.o"  will be properly compiled
	  and copied to system directories respectively.

       2. Create device files by executing "pclmknod".
	  # cd /pcl/pclicom/driver/
	  # ./pclmknod
		
	  Default major numbers for dial-in device and callout device are
	  30, 35. pclmknod will delete any special files occuping the same
	  device naming.

	  warning: reserved four  serial device number  for serial port 
		   build-in mainboard.

   3.4 Remove General serial support in your kernel.
       The default serial driver of the linux kernel will try to probe the PCL
       communication card, but it can't probely config the card and use the
       sources, this will lead to the pclicom driver can't work probely.
       
       To solve this problem, you need to rebuild a kernel disable the general
       serial support in the kernel:

       First you need to config a new kernel:
       # cd /usr/src/linux
       # make menuconfig
       
       In the menu, find the following item:
       
       Character devices -->  Standard/generic <8250/16550 and compatible UARTs> serial support
       
       and disable it. Then you can build a new kernel without serial support.
       
       
   3.4 Driver load.
       After configure your driver, you can load the driver manully or automatic
       load it at the boot time.
       1. Manully load
	  You can load the driver by following command:
	  # cd /pcl/pclicom/driver/
	  # insmod pclicom.o

	  This will activate the moduler driver. You can see PCL Cards found
          and device number assined.

	  You may run "lsmod" to check if "pclicom.o" is activated.

       2. Auto load driver at the boot time.
	  For the above description, you may manually execute "insmod pclicom" 
          to activate this driver. 
          However, it's better to have a boot time configuration to 
          eliminate manual operation. Boot time configuration can be 
          achieved by rc file. We offer one "rc.pcl" file to simplify 
          the procedure under "pclicom/driver".
	  
	  Run following command for setting rc files.

	  # cd /pcl/pclicom/driver
	  # cp ./rc.pcl /etc/rc.d
	  # cd /etc/rc.d

	  Then modify the /etc/rc.d/rc.local,
	  Add "/etc/rc.d/rc.pcl" in last line, 

          Reboot and check if pclicom.o activated by "lsmod" command.

   3.5.Driver rmmove.
          You can use the following command to remove the driver from the system:
	  # rmmod pclicom

   3.6 Static driver configuration

        1.install in kernel source tree
          # cd /pcl/pclicom/driver
          # ./install-in-kernel
	  (Note: you may need to update some defines in include/linux/pci.h 
	   if you take this approach.)
    
       
        2. Rebuild kernel
	  3.1 configure kernel
          # make config
         warning:serial support must include in kernel
         For appropriate details, please refer to the Linux document.

        3. Make utility
	  # cd /pcl/pclicom/utility/pclterm
	  # make 
	  # make install
       
        4. Make device file
          # cd /pcl/pcl/icom/driver
          # ./pclmknod
        5.  Create device link
           # rm /dev/ttyS[0-3]
           # ln -s /dev/ttyP0 /dev/ttyS0
           # ln -s /dev/ttyP1 /dev/ttyS1
	   # ln -s /dev/ttyP2 /dev/ttyS2
	   # ln -s /dev/ttyP3 /dev/ttyS3
        6. Reboot

   3.7 Custom configuration
       Although this driver already provides you default configuration, you
       still can change the device name and major number.The instruction to
       change these parameters are shown as below.

       Change Device name
       ------------------
       If you'd like to use other device names instead of default naming
       convention, all you have to do is to modify the internal code
       within the shell script "pclmknod". First, you have to open "pclmknod"
       by vi. Locate each line contains "ttyP" and "cup" and change them
       to the device name you desired. "pclmknod" creates the device names
       you need next time executed.

       Change Major number
       -------------------
       If major number 30 and 35 had been occupied, you may have to select
       two free major numbers for this driver. There are 3 steps to change
       major numbers.

       1. Find free major numbers
	  In /proc/devices, you may find all the major numbers occupied
	  in the system. Please select 2 major numbers that are available.
	  e.g. 40, 45.
       2. Create special files
	  Run /pcl/pclicom/driver/pclmknod to create special files with
	  specified major numbers.
       3. Modify driver with new major number
	  Run vi to open /pcl/pclicom/driver/serial.c. Locate the line
	  contains "TTY_MAJOR_ADVANTECH". Change the content as below.
	  #define	  TTY_MAJOR_ADVANTECH		  40
	  #define	  TTYAUX_MAJOR_ADVANTECH	  45
       4. Run: 
	 # make  
	 # make install 
	 under /pcl/pclicom/driver.
        
       Change  timer resource
        ----------------------
	If you encounter the following text :

          " RS_TIMER already set ,another driver already loaded?"
	   Just change RS_TIMER define
	   Can't load serial driver module over built-in driver
	   Can't load module:pclicom "

	when you run "# insmod pclicom" in console,it means timer resource 
	was occupied by other device.

       	  
       1.1 If your kernel doesn't have built-in serial ports support,
          you can use pclicom.o to support serial ports both on mainboard
          and Advatech industrial comunication cards.
         	
	  Run vi to open /pcl/pclicom/driver/serial.c. Locate the line
	  contains "RS_TIMER". Delete the content as below:
	   #undef RS_TIMER
           #define RSTIMER 11

       1.2 Run :
	   # make  #make install in /pcl/pclicom/driver.
           # rm /dev/ttyS[0-3]
           # ln -s /dev/ttyP0 /dev/ttyS0
           # ln -s /dev/ttyP1 /dev/ttyS1
	   # ln -s /dev/ttyP2 /dev/ttyS2
	   # ln -s /dev/ttyP3 /dev/ttyS3
		
       2 If your kernel supports built-in serial ports
       2.1
         Find timer resource  number .you can reference
         "usr/src/linux/include/linux/timer.h"  you may 
	  find all the TIMER define  in the system. Please 
	  select one timer numbers that are available.
	  e.g. 25 
	 
       2.2
        
         Run vi to open /pcl/pclicom/driver/serial.c. Locate the line
	 contains "RS_TIMER". change the content as below.
	 #define RSTIMER 25    
	
	2.3
     	Run:
	 # make
	 # make install 
	under /pcl/pclicom/driver.
            
   3.8 Verify driver installation
       1 You may refer to /var/log/messages to check the latest status
         log reported by this driver whenever it's activated.
       2 You may refer to /proc/tty/driver/pclicom to check the current
	serial status		
		
-----------------------------------------------------------------------------
4. Utilities
   There are 2 utilities ships with this driver. They are pclterm and
   setserial.  These utilities are released in form of source code. 
   They should  be compiled into executable file and copied into /usr/bin.
   
   
   pclterm - Terminal Emulation
   ---------------------------
   This utility provides data sending and receiving ability of all tty ports,
   especially for ADVANTECH communication ports. It is quite useful for testing
   application, for example, sending AT command to a modem connected to the
   port or used as a terminal for login purpose. Note that this is only a
   dumb terminal emulation without handling full screen operation.
   for detail please reference htp://htp/advantech.com
   Run:
   # cd /pcl/pclicom/utility/pclterm
   # make
   # make install
   # pclterm
    
   Setserial
   ---------
   Supported Setserial parameters are listed as below.

   uart 	  set UART type(16450,16550,16550a,16650,1650v2,16554,16750
				16850,16950/16954)
   close_delay	  set the amount of time(in 1/100 of a second) that DTR
		  should be kept low while being closed.
   closing_wait   set the amount of time(in 1/100 of a second) that the
		  serial port should wait for data to be drained while
		  being closed, before the receiver is disable.
   spd_hi	  Use  57.6kb  when  the application requests 38.4kb.
   spd_vhi	  Use  115.2kb	when  the application requests 38.4kb.
   spd_normal	  Use  38.4kb  when  the application requests 38.4kb.
   Run:
   #cd /pcl/pclicom/utility/setserial-2.17
   #./configure
   # make
   # make install  
-----------------------------------------------------------------------------
5. Troubleshooting

   The boot time error mesages and solutions are stated as clearly as
   possible. If all the possible solutions fail, please contact our technical
   support team to get more help.


   Error msg:Couldn't register serial driver!
   Solution:
   Load pclicom driver fail, the major number may conflict with other devices.
   Please refer to previous section 3.5 to change a free major number for
   pclicom driver.

  Error msg:
   " RS_TIMER already set ,another driver already loaded?"
	   Just change RS_TIMER define
	   Can't load serial driver module over built-in driver
	   Can't load module:pclicom "
    Solution:
     Load pclicom driver fail, RS_TIMER conflict with other devices.
     when you run "# insmod pclicom" in console,it means timer resource 
     was occupied by other device.
     Please refer to previous section 3.5 to change a free RS_TIMER resource for
     pclicom driver.
