/* Declarations for PIO series.

   Author: Reed Lai

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software Foundation,
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */

/* File level history (record changes for this file here.)

   Use vi or gvim to edit this file and set tabstop=4.

   v 0.1.1 21 Aug 2007 by Golden Wang
     Give support to the VXC-114U and VXC-144U modules

   v 0.1.0 3 May 2007 by Golden Wang
     Support linux kernel 2.6.x	
	
   v 0.0.1 5 Apr 2000 by Moki matsushima 
     create, blah blah... */

/* *INDENT-OFF* */

#ifndef _IXCOM_H
#define _IXCOM_H

#include <linux/pci.h>
#include <linux/version.h>
#include <linux/types.h>

//#include "_flags.h"

#define ICPDAS_LICENSE "GPL"

/* General Definition */
#ifdef SUCCESS
#undef SUCCESS
#endif
#define SUCCESS 0

#ifdef FAILURE
#undef FAILURE
#endif
#define FAILURE -1

#define ADD_PRESENT 1

#ifndef SA_SHIRQ
#define SA_SHIRQ IRQF_SHARED
#endif

/* PIO Device */
#define ORGANIZATION "icpdas"
#define FAMILY "ixcom"			/* name of family */
#define DEVICE_NAME "ixcom"		/* device entry name */
#define DEVICE_NAME_LEN 5
#define DEVICE_MAJOR 0			/* dynamic allocation of major number */

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
extern int vxc_major;
#else
extern int vxc_major,vxc_auxmajor;
#endif

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
#define IXPIO_PROC_FILE "/proc/ixcom/ixcom"
#else
#define IXPIO_PROC_FILE "/proc/ixcom"
#endif

#define CARD_NAME_LENGTH 32
#define CNL CARD_NAME_LENGTH

#define KMSG(fmt, args...) printk(KERN_INFO FAMILY ": " fmt, ## args)

/* PIO PCI IDs */
#define IXCOM_VENDOR_ID PCI_VENDOR_ID_TIGERJET	/* not reliable! */
#define IXCOM_VENDOR_ID2 PCI_VENDOR_ID_OXSEMI 	/* oxford 16C950/954 vendor id 0x1415*/

#define IXCOM_DEVICE_ID 0x0002	/* not reliable! */
#define IXCOM_DEVICE_ID2 0x0001 /* not reliable! */
#define IXCOM_DEVICE_ID3 0x9501 /* not reliable! */
#define IXCOM_DEVICE_ID4 0x9504 /* oxford 16C950/954 device id */
#define IXCOM_DEVICE_ID5 0x9505 /* oxford 16C950/954 device id */
#define IXCOM_DEVICE_ID6 0x9511 /* oxford 16C950/954 device id */

#define	PCI_SUBVENDOR_ID_VXC	0x61
#define	PCI_SUBVENDOR_ID00_VXC	0x61
#define	PCI_SUBVENDOR_ID10_VXC	0x1061
#define	PCI_SUBVENDOR_ID20_VXC	0x2061
#define	PCI_SUBVENDOR_ID30_VXC	0x3061
#define	PCI_SUBVENDOR_ID01_VXC	0x0161
#define	PCI_SUBVENDOR_ID11_VXC	0x1161
#define	PCI_SUBVENDOR_ID13_VXC	0x0061
#define	PCI_SUBVENDOR_ID21_VXC	0x2161
#define	PCI_SUBVENDOR_ID31_VXC	0x3161
#define	PCI_SUBVENDOR_ID02_VXC	0xD61
#define	PCI_SUBVENDOR_ID12_VXC	0x1D61
#define	PCI_SUBVENDOR_ID22_VXC	0x2D61
#define	PCI_SUBVENDOR_ID32_VXC	0x3D61
#define	PCI_SUBVENDOR_ID33_VXC	0x1441	/* VXC-114U/112AU sub-vendor id */
#define	PCI_SUBVENDOR_ID34_VXC	0x1440	/* VXC-144U sub-vendor id */
#define	PCI_SUBVENDOR_ID35_VXC	0x1415	/* VXC-1001AU sub-vendor id */
#define	PCI_SUBVENDOR_ID36_VXC	0x1442	/* VXC-182iAU sub-vendor id */

#define	PCI_SUBDEVICE_ID_182I	0x0005
#define	PCI_SUBDEVICE_ID2_182I	0x0001
#define	PCI_SUBDEVICE_ID3_182IAU 0x0080
#define	PCI_SUBDEVICE_ID_142	0x00
#define	PCI_SUBDEVICE_ID2_142	0x00
#define	PCI_SUBDEVICE_ID_142I	0x02
#define	PCI_SUBDEVICE_ID2_142I	0x02
#define	PCI_SUBDEVICE_ID3_142I	0x06
#define	PCI_SUBDEVICE_ID4_142I	0x80 /* VXC-142iU/142AU sub_device id */
#define	PCI_SUBDEVICE_ID_112A	0x00
#define	PCI_SUBDEVICE_ID2_112A	0x00
#define	PCI_SUBDEVICE_ID3_112AU	0x0080
#define	PCI_SUBDEVICE_ID_114U	0x0090
#define	PCI_SUBDEVICE_ID_144U	0x0090
#define	PCI_SUBDEVICE_ID_1001AU	0x0000


#define IXCOM_SUB_AUX_ID_OFFSET 7
#define IXCOM_SUB_AUX_ID_RANGE  8
#define IXCOM_SUB_AUX_ID_MASK   0xf0

int ixcom_proc_init(void);
void ixcom_proc_exit(void);

#endif							/* _IXPIO_H */
