⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cyclades.c

📁 powerpc内核mpc8241linux系统下char驱动程序
💻 C
📖 第 1 页 / 共 5 页
字号:
#define BLOCKMOVE#define	Z_WAKEstatic char rcsid[] ="$Revision: 2.2.2.1 $$Date: 1999/04/08 16:17:43 $";/* *  linux/drivers/char/cyclades.c * * This file contains the driver for the Cyclades Cyclom-Y multiport * serial boards. * * Maintained by Ivan Passos (ivan@cyclades.com), * Marcio Saito (marcio@cyclades.com) and  * Randolph Bentson (bentson@grieg.seaslug.org). * * For Technical support and installation problems, please send e-mail * to support@cyclades.com. * * Much of the design and some of the code came from serial.c * which was copyright (C) 1991, 1992  Linus Torvalds.  It was * extensively rewritten by Theodore Ts'o, 8/16/92 -- 9/14/92, * and then fixed as suggested by Michael K. Johnson 12/12/92. * * This version does not support shared irq's. * * This module exports the following rs232 io functions: *   int cy_init(void); *   int cy_open(struct tty_struct *tty, struct file *filp); * and the following functions for modularization. *   int init_module(void); *   void cleanup_module(void); * * $Log: cyclades.c,v $ * Revision 2.2.2.1  1999/04/08 16:17:43 ivan * Fixed a bug in cy_wait_until_sent that was preventing the port to be  * closed properly after a SIGINT; * Module usage counter scheme revisited; * Added support to the upcoming Y PCI boards (i.e., support to additional * PCI Device ID's). *  * Revision 2.2.1.10 1999/01/20 16:14:29 ivan * Removed all unnecessary page-alignement operations in ioremap calls * (ioremap is currently safe for these operations). * * Revision 2.2.1.9  1998/12/30 18:18:30 ivan * Changed access to PLX PCI bridge registers from I/O to MMIO, in  * order to make PLX9050-based boards work with certain motherboards. * * Revision 2.2.1.8  1998/11/13 12:46:20 ivan * cy_close function now resets (correctly) the tty->closing flag; * JIFFIES_DIFF macro fixed. * * Revision 2.2.1.7  1998/09/03 12:07:28 ivan * Fixed bug in cy_close function, which was not informing HW of * which port should have the reception disabled before doing so; * fixed Cyclom-8YoP hardware detection bug. * * Revision 2.2.1.6  1998/08/20 17:15:39 ivan * Fixed bug in cy_close function, which causes malfunction * of one of the first 4 ports when a higher port is closed * (Cyclom-Y only). * * Revision 2.2.1.5  1998/08/10 18:10:28 ivan * Fixed Cyclom-4Yo hardware detection bug. * * Revision 2.2.1.4  1998/08/04 11:02:50 ivan * /proc/cyclades implementation with great collaboration of  * Marc Lewis <marc@blarg.net>; * cyy_interrupt was changed to avoid occurence of kernel oopses * during PPP operation. * * Revision 2.2.1.3  1998/06/01 12:09:10 ivan * General code review in order to comply with 2.1 kernel standards; * data loss prevention for slow devices revisited (cy_wait_until_sent * was created); * removed conditional compilation for new/old PCI structure support  * (now the driver only supports the new PCI structure). * * Revision 2.2.1.1  1998/03/19 16:43:12 ivan * added conditional compilation for new/old PCI structure support; * removed kernel series (2.0.x / 2.1.x) conditional compilation. * * Revision 2.1.1.3  1998/03/16 18:01:12 ivan * cleaned up the data loss fix; * fixed XON/XOFF handling once more (Cyclades-Z); * general review of the driver routines; * introduction of a mechanism to prevent data loss with slow  * printers, by forcing a delay before closing the port. * * Revision 2.1.1.2  1998/02/17 16:50:00 ivan * fixed detection/handling of new CD1400 in Ye boards; * fixed XON/XOFF handling (Cyclades-Z); * fixed data loss caused by a premature port close; * introduction of a flag that holds the CD1400 version ID per port * (used by the CYGETCD1400VER new ioctl). * * Revision 2.1.1.1  1997/12/03 17:31:19 ivan * Code review for the module cleanup routine; * fixed RTS and DTR status report for new CD1400's in get_modem_info; * includes anonymous changes regarding signal_pending. *  * Revision 2.1  1997/11/01 17:42:41 ivan * Changes in the driver to support Alpha systems (except 8Zo V_1); * BREAK fix for the Cyclades-Z boards; * driver inactivity control by FW implemented; * introduction of flag that allows driver to take advantage of  * a special CD1400 feature related to HW flow control; * added support for the CD1400  rev. J (Cyclom-Y boards); * introduction of ioctls to: *  - control the rtsdtr_inv flag (Cyclom-Y); *  - control the rflow flag (Cyclom-Y); *  - adjust the polling interval (Cyclades-Z); * * Revision 1.36.4.33  1997/06/27 19:00:00  ivan * Fixes related to kernel version conditional  * compilation. *   * Revision 1.36.4.32  1997/06/14 19:30:00  ivan * Compatibility issues between kernels 2.0.x and  * 2.1.x (mainly related to clear_bit function). *   * Revision 1.36.4.31  1997/06/03 15:30:00  ivan * Changes to define the memory window according to the  * board type. *   * Revision 1.36.4.30  1997/05/16 15:30:00  daniel * Changes to suport new cycladesZ boards. * * Revision 1.36.4.29  1997/05/12 11:30:00  daniel * Merge of Bentson's and Daniel's version 1.36.4.28. * Corrects bug in cy_detect_pci: check if there are more * ports than the number of static structs allocated. * Warning message during initialization if this driver is * used with the new generation of cycladesZ boards.  Those * will be supported only in next release of the driver. * Corrects bug in cy_detect_pci and cy_detect_isa that * returned wrong number of VALID boards, when a cyclomY * was found with no serial modules connected. * Changes to use current (2.1.x) kernel subroutine names * and created macros for compilation with 2.0.x kernel, * instead of the other way around. * * Revision 1.36.4.28  1997/05/?? ??:00:00  bentson * Change queue_task_irq_off to queue_task_irq. * The inline function queue_task_irq_off (tqueue.h) * was removed from latest releases of 2.1.x kernel. * Use of macro __initfunc to mark the initialization * routines, so memory can be reused. * Also incorporate implementation of critical region * in function cleanup_module() created by anonymous * linuxer. * * Revision 1.36.4.28  1997/04/25 16:00:00  daniel * Change to support new firmware that solves DCD problem: * application could fail to receive SIGHUP signal when DCD * varying too fast. * * Revision 1.36.4.27  1997/03/26 10:30:00  daniel * Changed for suport linux versions 2.1.X. * Backward compatible with linux versions 2.0.X. * Corrected illegal use of filler field in * CH_CTRL struct. * Deleted some debug messages. * * Revision 1.36.4.26  1997/02/27 12:00:00  daniel * Included check for NULL tty pointer in cyz_poll. * * Revision 1.36.4.25  1997/02/26 16:28:30  bentson * Bill Foster at Blarg! Online services noticed that * some of the switch elements of -Z modem control * lacked a closing "break;" * * Revision 1.36.4.24  1997/02/24 11:00:00  daniel * Changed low water threshold for buffer xmit_buf * * Revision 1.36.4.23  1996/12/02 21:50:16  bentson * Marcio provided fix to modem status fetch for -Z * * Revision 1.36.4.22  1996/10/28 22:41:17  bentson * improve mapping of -Z control page (thanks to Steve * Price <stevep@fa.tdktca.com> for help on this) * * Revision 1.36.4.21  1996/09/10 17:00:10  bentson * shift from CPU-bound to memcopy in cyz_polling operation * * Revision 1.36.4.20  1996/09/09 18:30:32  Bentson * Added support to set and report higher speeds. * * Revision 1.36.4.19c  1996/08/09 10:00:00  Marcio Saito * Some fixes in the HW flow control for the BETA release. * Don't try to register the IRQ. * * Revision 1.36.4.19  1996/08/08 16:23:18  Bentson * make sure "cyc" appears in all kernel messages; all soft interrupts * handled by same routine; recognize out-of-band reception; comment * out some diagnostic messages; leave RTS/CTS flow control to hardware; * fix race condition in -Z buffer management; only -Y needs to explictly * flush chars; tidy up some startup messages; * * Revision 1.36.4.18  1996/07/25 18:57:31  bentson * shift MOD_INC_USE_COUNT location to match * serial.c; purge some diagnostic messages; * * Revision 1.36.4.17  1996/07/25 18:01:08  bentson * enable modem status messages and fetch & process them; note * time of last activity type for each port; set_line_char now * supports more than line 0 and treats 0 baud correctly; * get_modem_info senses rs_status; * * Revision 1.36.4.16  1996/07/20 08:43:15  bentson * barely works--now's time to turn on * more features 'til it breaks * * Revision 1.36.4.15  1996/07/19 22:30:06  bentson * check more -Z board status; shorten boot message * * Revision 1.36.4.14  1996/07/19 22:20:37  bentson * fix reference to ch_ctrl in startup; verify return * values from cyz_issue_cmd and cyz_update_channel; * more stuff to get modem control correct; * * Revision 1.36.4.13  1996/07/11 19:53:33  bentson * more -Z stuff folded in; re-order changes to put -Z stuff * after -Y stuff (to make changes clearer) * * Revision 1.36.4.12  1996/07/11 15:40:55  bentson * Add code to poll Cyclades-Z.  Add code to get & set RS-232 control. * Add code to send break.  Clear firmware ID word at startup (so * that other code won't talk to inactive board). * * Revision 1.36.4.11  1996/07/09 05:28:29  bentson * add code for -Z in set_line_char * * Revision 1.36.4.10  1996/07/08 19:28:37  bentson * fold more -Z stuff (or in some cases, error messages) * into driver; add text to "don't know what to do" messages. * * Revision 1.36.4.9  1996/07/08 18:38:38  bentson * moved compile-time flags near top of file; cosmetic changes * to narrow text (to allow 2-up printing); changed many declarations * to "static" to limit external symbols; shuffled code order to * coalesce -Y and -Z specific code, also to put internal functions * in order of tty_driver structure; added code to recognize -Z * ports (and for moment, do nothing or report error); add cy_startup * to parse boot command line for extra base addresses for ISA probes; * * Revision 1.36.4.8  1996/06/25 17:40:19  bentson * reorder some code, fix types of some vars (int vs. long), * add cy_setup to support user declared ISA addresses * * Revision 1.36.4.7  1996/06/21 23:06:18  bentson * dump ioctl based firmware load (it's now a user level * program); ensure uninitialzed ports cannot be used * * Revision 1.36.4.6  1996/06/20 23:17:19  bentson * rename vars and restructure some code * * Revision 1.36.4.5  1996/06/14 15:09:44  bentson * get right status back after boot load * * Revision 1.36.4.4  1996/06/13 19:51:44  bentson * successfully loads firmware * * Revision 1.36.4.3  1996/06/13 06:08:33  bentson * add more of the code for the boot/load ioctls * * Revision 1.36.4.2  1996/06/11 21:00:51  bentson * start to add Z functionality--starting with ioctl * for loading firmware * * Revision 1.36.4.1  1996/06/10 18:03:02  bentson * added code to recognize Z/PCI card at initialization; report * presence, but card is not initialized (because firmware needs * to be loaded) * * Revision 1.36.3.8  1996/06/07 16:29:00  bentson * starting minor number at zero; added missing verify_area * as noted by Heiko Eissfeldt <heiko@colossus.escape.de> * * Revision 1.36.3.7  1996/04/19 21:06:18  bentson * remove unneeded boot message & fix CLOCAL hardware flow * control (Miquel van Smoorenburg <miquels@Q.cistron.nl>); * remove unused diagnostic statements; minor 0 is first; * * Revision 1.36.3.6  1996/03/13 13:21:17  marcio * The kernel function vremap (available only in later 1.3.xx kernels) * allows the access to memory addresses above the RAM. This revision * of the driver supports PCI boards below 1Mb (device id 0x100) and * above 1Mb (device id 0x101). * * Revision 1.36.3.5  1996/03/07 15:20:17  bentson * Some global changes to interrupt handling spilled into * this driver--mostly unused arguments in system function * calls.  Also added change by Marcio Saito which should * reduce lost interrupts at startup by fast processors. * * Revision 1.36.3.4  1995/11/13  20:45:10  bentson * Changes by Corey Minyard <minyard@wf-rch.cirr.com> distributed * in 1.3.41 kernel to remove a possible race condition, extend * some error messages, and let the driver run as a loadable module * Change by Alan Wendt <alan@ez0.ezlink.com> to remove a * possible race condition. * Change by Marcio Saito <marcio@cyclades.com> to fix PCI addressing. * * Revision 1.36.3.3  1995/11/13  19:44:48  bentson * Changes by Linus Torvalds in 1.3.33 kernel distribution * required due to reordering of driver initialization. * Drivers are now initialized *after* memory management. * * Revision 1.36.3.2  1995/09/08  22:07:14  bentson * remove printk from ISR; fix typo * * Revision 1.36.3.1  1995/09/01  12:00:42  marcio * Minor fixes in the PCI board support. PCI function calls in * conditional compilation (CONFIG_PCI). Thanks to Jim Duncan * <duncan@okay.com>. "bad serial count" message removed. * * Revision 1.36.3  1995/08/22  09:19:42  marcio * Cyclom-Y/PCI support added. Changes in the cy_init routine and * board initialization. Changes in the boot messages. The driver * supports up to 4 boards and 64 ports by default. * * Revision 1.36.1.4  1995/03/29  06:14:14  bentson * disambiguate between Cyclom-16Y and Cyclom-32Ye; * * Revision 1.36.1.3  1995/03/23  22:15:35  bentson * add missing break in modem control block in ioctl switch statement * (discovered by Michael Edward Chastain <mec@jobe.shell.portal.com>); * * Revision 1.36.1.2  1995/03/22  19:16:22  bentson * make sure CTS flow control is set as soon as possible (thanks * to note from David Lambert <lambert@chesapeake.rps.slb.com>); * * Revision 1.36.1.1  1995/03/13  15:44:43  bentson * initialize defaults for receive threshold and stale data timeout; * cosmetic changes; * * Revision 1.36  1995/03/10  23:33:53  bentson * added support of chips 4-7 in 32 port Cyclom-Ye; * fix cy_interrupt pointer dereference problem * (Joe Portman <baron@aa.net>); * give better error response if open is attempted on non-existent port * (Zachariah Vaum <jchryslr@netcom.com>); * correct command timeout (Kenneth Lerman <lerman@@seltd.newnet.com>); * conditional compilation for -16Y on systems with fast, noisy bus; * comment out diagnostic print function; * cleaned up table of base addresses; * set receiver time-out period register to correct value, * set receive threshold to better default values, * set chip timer to more accurate 200 Hz ticking, * add code to monitor and modify receive parameters * (Rik Faith <faith@cs.unc.edu> Nick Simicich * <njs@scifi.emi.net>); * * Revision 1.35  1994/12/16  13:54:18  steffen * additional patch by Marcio Saito for board detection * Accidently left out in 1.34 *

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -