rio_linux.c
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:42k
- /* rio_linux.c -- Linux driver for the Specialix RIO series cards.
- *
- *
- * (C) 1999 R.E.Wolff@BitWizard.nl
- *
- * Specialix pays for the development and support of this driver.
- * Please DO contact support@specialix.co.uk if you require
- * support. But please read the documentation (rio.txt) first.
- *
- *
- *
- * 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 of
- * the License, 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., 675 Mass Ave, Cambridge, MA 02139,
- * USA.
- *
- * Revision history:
- * $Log: rio.c,v $
- * Revision 1.1 1999/07/11 10:13:54 wolff
- * Initial revision
- *
- * */
- #define RCS_ID "$Id: rio.c,v 1.1 1999/07/11 10:13:54 wolff Exp wolff $"
- #define RCS_REV "$Revision: 1.1 $"
- #include <linux/module.h>
- #include <linux/config.h>
- #include <linux/kdev_t.h>
- #include <asm/io.h>
- #include <linux/kernel.h>
- #include <linux/sched.h>
- #include <linux/ioport.h>
- #include <linux/interrupt.h>
- #include <linux/errno.h>
- #include <linux/tty.h>
- #include <linux/tty_flip.h>
- #include <linux/mm.h>
- #include <linux/serial.h>
- #include <linux/fcntl.h>
- #include <linux/major.h>
- #include <linux/delay.h>
- #include <linux/tqueue.h>
- #include <linux/version.h>
- #include <linux/pci.h>
- #include <linux/slab.h>
- #include <linux/miscdevice.h>
- #include <linux/init.h>
- #include <linux/compatmac.h>
- #include <linux/generic_serial.h>
- #if BITS_PER_LONG != 32
- # error FIXME: this driver only works on 32-bit platforms
- #endif
- #include "linux_compat.h"
- #include "typdef.h"
- #include "pkt.h"
- #include "daemon.h"
- #include "rio.h"
- #include "riospace.h"
- #include "top.h"
- #include "cmdpkt.h"
- #include "map.h"
- #include "riotypes.h"
- #include "rup.h"
- #include "port.h"
- #include "riodrvr.h"
- #include "rioinfo.h"
- #include "func.h"
- #include "errors.h"
- #include "pci.h"
- #include "parmmap.h"
- #include "unixrup.h"
- #include "board.h"
- #include "host.h"
- #include "error.h"
- #include "phb.h"
- #include "link.h"
- #include "cmdblk.h"
- #include "route.h"
- #include "control.h"
- #include "cirrus.h"
- #include "rioioctl.h"
- #include "param.h"
- #include "list.h"
- #include "sam.h"
- #include "protsts.h"
- #include "rioboard.h"
- #include "rio_linux.h"
- /* I don't think that this driver can handle more than 512 ports on
- one machine. Specialix specifies max 4 boards in one machine. I don't
- know why. If you want to try anyway you'll have to increase the number
- of boards in rio.h. You'll have to allocate more majors if you need
- more than 512 ports.... */
- /* Why the hell am I defining these here? */
- #define RIO_TYPE_NORMAL 1
- #define RIO_TYPE_CALLOUT 2
- #ifndef RIO_NORMAL_MAJOR0
- /* This allows overriding on the compiler commandline, or in a "major.h"
- include or something like that */
- #define RIO_NORMAL_MAJOR0 154
- #define RIO_CALLOUT_MAJOR0 155
- #define RIO_NORMAL_MAJOR1 156
- #define RIO_CALLOUT_MAJOR1 157
- #endif
- #ifndef PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8
- #define PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8 0x2000
- #endif
- #ifndef RIO_WINDOW_LEN
- #define RIO_WINDOW_LEN 0x10000
- #endif
- /* Configurable options:
- (Don't be too sure that it'll work if you toggle them) */
- /* Am I paranoid or not ? ;-) */
- #undef RIO_PARANOIA_CHECK
- /* 20 -> 2000 per second. The card should rate-limit interrupts at 1000
- Hz, but it is user configurable. I don't recommend going above 1000
- Hz. The interrupt ratelimit might trigger if the interrupt is
- shared with a very active other device.
- undef this if you want to disable the check....
- */
- #define IRQ_RATE_LIMIT 200
- #if 0
- /* Not implemented */
- /*
- * The following defines are mostly for testing purposes. But if you need
- * some nice reporting in your syslog, you can define them also.
- */
- #define RIO_REPORT_FIFO
- #define RIO_REPORT_OVERRUN
- #endif
- /* These constants are derived from SCO Source */
- static struct Conf
- RIOConf =
- {
- /* locator */ "RIO Config here",
- /* startuptime */ HZ*2, /* how long to wait for card to run */
- /* slowcook */ 0, /* TRUE -> always use line disc. */
- /* intrpolltime */ 1, /* The frequency of OUR polls */
- /* breakinterval */ 25, /* x10 mS XXX: units seem to be 1ms not 10! -- REW*/
- /* timer */ 10, /* mS */
- /* RtaLoadBase */ 0x7000,
- /* HostLoadBase */ 0x7C00,
- /* XpHz */ 5, /* number of Xprint hits per second */
- /* XpCps */ 120, /* Xprint characters per second */
- /* XpOn */ "