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

📄 cyclades.c

📁 这是一个SIGMA方案的PMP播放器的UCLINUX程序,可播放DVD,VCD,CD MP3...有很好的参考价值.
💻 C
📖 第 1 页 / 共 5 页
字号:
#undef	BLOCKMOVE#define	Z_WAKE#undef	Z_EXT_CHARS_IN_BUFFERstatic char rcsid[] ="$Revision: 1 $$Date: 6/07/02 12:22p $";/* *  linux/drivers/char/cyclades.c * * This file contains the driver for the Cyclades async multiport * serial boards. * * Initially written by Randolph Bentson <bentson@grieg.seaslug.org>. * Modified and maintained by Marcio Saito <marcio@cyclades.com>. * Currently maintained by Ivan Passos <ivan@cyclades.com>. * * 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 supports shared IRQ's (only for PCI boards). * * $Log: /EM85xx/uClinux-2.4/drivers/char/cyclades.c $* * 1     6/07/02 12:22p Fabrice * Revision 2.3.2.8   2000/07/06 18:14:16 ivan * Fixed the PCI detection function to work properly on Alpha systems. * Implemented support for TIOCSERGETLSR ioctl. * Implemented full support for non-standard baud rates. * * Revision 2.3.2.7   2000/06/01 18:26:34 ivan * Request PLX I/O region, although driver doesn't use it, to avoid * problems with other drivers accessing it. * Removed count for on-board buffer characters in cy_chars_in_buffer * (Cyclades-Z only). * * Revision 2.3.2.6   2000/05/05 13:56:05 ivan * Driver now reports physical instead of virtual memory addresses. * Masks were added to some Cyclades-Z read accesses. * Implemented workaround for PLX9050 bug that would cause a system lockup * in certain systems, depending on the MMIO addresses allocated to the * board. * Changed the Tx interrupt programming in the CD1400 chips to boost up * performance (Cyclom-Y only). * Code is now compliant with the new module interface (module_[init|exit]). * Make use of the PCI helper functions to access PCI resources. * Did some code "housekeeping". * * Revision 2.3.2.5   2000/01/19 14:35:33 ivan * Fixed bug in cy_set_termios on CRTSCTS flag turnoff. * * Revision 2.3.2.4   2000/01/17 09:19:40 ivan * Fixed SMP locking in Cyclom-Y interrupt handler. * * Revision 2.3.2.3   1999/12/28 12:11:39 ivan * Added a new cyclades_card field called nports to allow the driver to * know the exact number of ports found by the Z firmware after its load; * RX buffer contention prevention logic on interrupt op mode revisited * (Cyclades-Z only); * Revisited printk's for Z debug; * Driver now makes sure that the constant SERIAL_XMIT_SIZE is defined; * * Revision 2.3.2.2   1999/10/01 11:27:43 ivan * Fixed bug in cyz_poll that would make all ports but port 0  * unable to transmit/receive data (Cyclades-Z only); * Implemented logic to prevent the RX buffer from being stuck with data * due to a driver / firmware race condition in interrupt op mode * (Cyclades-Z only); * Fixed bug in block_til_ready logic that would lead to a system crash; * Revisited cy_close spinlock usage; * * Revision 2.3.2.1   1999/09/28 11:01:22 ivan * Revisited CONFIG_PCI conditional compilation for PCI board support; * Implemented TIOCGICOUNT and TIOCMIWAIT ioctl support; * _Major_ cleanup on the Cyclades-Z interrupt support code / logic; * Removed CTS handling from the driver -- this is now completely handled * by the firmware (Cyclades-Z only); * Flush RX on-board buffers on a port open (Cyclades-Z only); * Fixed handling of ASYNC_SPD_* TTY flags; * Module unload now unmaps all memory area allocated by ioremap; * * Revision 2.3.1.1   1999/07/15 16:45:53 ivan * Removed CY_PROC conditional compilation; * Implemented SMP-awareness for the driver; * Implemented a new ISA IRQ autoprobe that uses the irq_probe_[on|off]  * functions; * The driver now accepts memory addresses (maddr=0xMMMMM) and IRQs * (irq=NN) as parameters (only for ISA boards); * Fixed bug in set_line_char that would prevent the Cyclades-Z  * ports from being configured at speeds above 115.2Kbps; * Fixed bug in cy_set_termios that would prevent XON/XOFF flow control * switching from working properly; * The driver now only prints IRQ info for the Cyclades-Z if it's  * configured to work in interrupt mode; * * Revision 2.2.2.3   1999/06/28 11:13:29 ivan * Added support for interrupt mode operation for the Z cards; * Removed the driver inactivity control for the Z; * Added a missing MOD_DEC_USE_COUNT in the cy_open function for when  * the Z firmware is not loaded yet; * Replaced the "manual" Z Tx flush buffer by a call to a FW command of  * same functionality; * Implemented workaround for IRQ setting loss on the PCI configuration  * registers after a PCI bridge EEPROM reload (affects PLX9060 only); * * Revision 2.2.2.2  1999/05/14 17:18:15 ivan * /proc entry location changed to /proc/tty/driver/cyclades; * Added support to shared IRQ's (only for PCI boards); * Added support for Cobalt Qube2 systems; * IRQ [de]allocation scheme revisited; * BREAK implementation changed in order to make use of the 'break_ctl' * TTY facility; * Fixed typo in TTY structure field 'driver_name'; * Included a PCI bridge reset and EEPROM reload in the board  * initialization code (for both Y and Z series). * * 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 support 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 __init 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 support 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 *

⌨️ 快捷键说明

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