PCCOM PCI HOWTO

Introduction
	This document covers basic information about how to configure 
	DCI(Decision Computer Inc.) PCCOM PCI 2/4/8-port cards for FreeBSD.
	
	The procedure can be achieved through the following steps:
	. To configure the FreeBSD to support DCI PCCOM PCI 2/4/8-port cards
	. To configure Terminals over DCI PCCOM PCI 2/4/8-port cards
	
	The procedure is exercised for FresBSD 4.6-RELEASE. I believe that the
	docuement can also be applied for other FreeBSD releases.
	
	Within this document, all necessary referenced documents useful to 
	this document are also listed.

	
Configuring the FreeBSD Kernel to support DCI PCCOM 2/4/8-ports
	DCI PCCOM PCI 2/4/8-port cards are PCI-type multiple RS-232 ports cards.
	The UART of these cards is compatible to NS16550A.
	
	According to the hardware configuration of DCI PCCOM PCI 2/4/8-port cards
	described above, to enable the support of these cards for the FreeBSD, the
	following kernel options have to be in the kernel configuration file (
	You may reference the document "Configuring the FreeBSD Kernel" to get how
	to customize, build, and install a kernel). 
	
	cd /usr/src/sys/i386/conf
	mkdir /root/kernels
	cp GENERIC /root/kernels/MYKERNEL20030807
	ln -s /root/kernels/MYKERNEL20030807
	vi MYKERNEL20030807
	
	device pci
	device puc
	device sio[4-11]
	options COM_MULTIPORT

	:wq

	For the current kernel releases, they just supports DCI PCCOM PCI 2-port
	4-port cards. If the cards you installed are DCI PCCOM PCI 8-ports card,
	you have to add the 8-port card configuration as follows into the file
	/usr/src/sys/dev/puc/pucdata.c(For most FreeBSD releases, the kernel 
	source directory is located in /usr/src/sys).
	
	cd /usr/src/sys/dev/puc
	vi pucdata.c
		
	{   "Decision Computer Inc, PCCOM 8-port serial",
            {   0x6666, 0x0002, 0,      0       },
            {   0xffff, 0xffff, 0,      0       },
            {
                { PUC_PORT_TYPE_COM, 0x1c, 0x00, COM_FREQ },
                { PUC_PORT_TYPE_COM, 0x1c, 0x08, COM_FREQ },
                { PUC_PORT_TYPE_COM, 0x1c, 0x10, COM_FREQ },
                { PUC_PORT_TYPE_COM, 0x1c, 0x18, COM_FREQ },
                { PUC_PORT_TYPE_COM, 0x1c, 0x20, COM_FREQ },
                { PUC_PORT_TYPE_COM, 0x1c, 0x28, COM_FREQ },
                { PUC_PORT_TYPE_COM, 0x1c, 0x30, COM_FREQ },
                { PUC_PORT_TYPE_COM, 0x1c, 0x38, COM_FREQ },
            },
        },
        
        :wq
	
	After the kernel configuration file is altered with necessary options
        and the 8-port card configuration data have been added, you may 
        configure, build, and install the new customized kernel which enables
        the support of DCI PCCOM PCI 2/4/8-port cards.

        
Configuring Terminals over DCI PCCOM PCI 2/4/8-port cards
	While the new kernel starting up, you should be able to see the kernel
	find your installed DCI PCCOM PCI multiport cards and namd and 
	configure them. To explain the following steps clearly, It is supposed
	that the found ports for your installed 4-port card are sio4, sio5, 
	sio6 and sio7.
	
	The simple way to ensuring these found ports are workable we proposed is
	to configure terminals over these found ports. The following description
	is from the document "Serial Communication". If you would like to know
	more details, you may refernece it.
	
	. To make device special files
	  
	   cd /dev
	   ./MAKEDEV ttyd4 ttyd5 ttyd6 ttyd7 ttyd8 ttyd9 ttyda ttydb
	  
	. To see the settings (to make sure these ports can be configured)
	   stty -a -f /dev/ttyd4	# or ttyd5, or ttyd6, or ttyd7, or ttyd8, or ttyd9,or ttyda,or ttydb
	  
	. To configure them for terminals
	  - To add the following lines to /etc/ttys if there are no such lines
	    
	    cd /etc
	    vi ttys
	    	    
	    ttyd4	"/usr/libexec/getty 3wire.38400" vt100 on secure
	    ttyd5	"/usr/libexec/getty 3wire.38400" vt100 on secure
	    ttyd6	"/usr/libexec/getty 3wire.38400" vt100 on secure
	    ttyd7	"/usr/libexec/getty 3wire.38400" vt100 on secure
	    ttyd8	"/usr/libexec/getty 3wire.38400" vt100 on secure
	    ttyd9	"/usr/libexec/getty 3wire.38400" vt100 on secure
	    ttyda	"/usr/libexec/getty 3wire.38400" vt100 on secure
	    ttydb	"/usr/libexec/getty 3wire.38400" vt100 on secure
	  
            :wq

	  - To enable the changes to /etc/ttys
	    # kill -HUP 1
	    
	 . To make connections to these ports for terminals
	   - 3-wire null-modem cable
	     Signal		Pin#			Pin#		Signal
	     -----------------------------------------------------------------
	     TxD		2	 connects to	2		RxD
	     RxD		3	 connects to	3		TxD
	     SG			7	 connects to 	7		SG
	     
	   - The terminal communication options
	     % Terminal Type: VT100
	     
	     % RS-232 settings
	       baud rate   : 38400
	       data bits   : 8
	       parity      : none
	       stop bits   : 1
	       flow control: none
	   
	   . Then, you should see Login prompt.
	   
	   The above decription to configure terminals over DCI PCCOM PCI 
	   multiport cards is just for as a hint of how to make the installed
	   card can work in FreeBSD.
	   
	
References
	"Configuring the FreeBSD Kernel"
	http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html
	
	cd /usr/src
	make buildkernel KERNCONF=MYKERNEL20030807
	make installkernel KERNCONF=MYKERNEL20030807
        reboot

	"Serial Communication"
	http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/serialcomms.html
	
	"sio - fast interrupt driven asynchronous serial communications interface"
	FreeBSD Man Page - SIO(4)
	
	"puc - PCI ``Universal'' Communications driver"
	FreeBSD Man Page - PUC(4)