📄 cyclades.c
字号:
* 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 * * Revision 1.34 1994/12/10 12:37:12 steffen * This is the corrected version as suggested by Marcio Saito * * Revision 1.33 1994/12/01 22:41:18 bentson * add hooks to support more high speeds directly; add tytso * patch regarding CLOCAL wakeups * * Revision 1.32 1994/11/23 19:50:04 bentson * allow direct kernel control of higher signalling rates; * look for cards at additional locations * * Revision 1.31 1994/11/16 04:33:28 bentson * ANOTHER fix from Corey Minyard, minyard@wf-rch.cirr.com-- * a problem in chars_in_buffer has been resolved by some * small changes; this should yield smoother output * * Revision 1.30 1994/11/16 04:28:05 bentson * Fix from Corey Minyard, Internet: minyard@metronet.com, * UUCP: minyard@wf-rch.cirr.com, WORK: minyardbnr.ca, to * cy_hangup that appears to clear up much (all?) of the * DTR glitches; also he's added/cleaned-up diagnostic messages * * Revision 1.29 1994/11/16 04:16:07 bentson * add change proposed by Ralph Sims, ralphs@halcyon.com, to * operate higher speeds in same way as other serial ports; * add more serial ports (for up to two 16-port muxes). * * Revision 1.28 1994/11/04 00:13:16 root * turn off diagnostic messages * * Revision 1.27 1994/11/03 23:46:37 root * bunch of changes to bring driver into greater conformance * with the serial.c driver (looking for missed fixes) * * Revision 1.26 1994/11/03 22:40:36 root * automatic interrupt probing fixed. * * Revision 1.25 1994/11/03 20:17:02 root * start to implement auto-irq * * Revision 1.24 1994/11/03 18:01:55 root * still working on modem signals--trying not to drop DTR * during the getty/login processes * * Revision 1.23 1994/11/03 17:51:36 root * extend baud rate support; set receive threshold as function * of baud rate; fix some problems with RTS/CTS; * * Revision 1.22 1994/11/02 18:05:35 root * changed arguments to udelay to type long to get * delays to be of correct duration * * Revision 1.21 1994/11/02 17:37:30 root * employ udelay (after calibrating loops_per_second earlier * in init/main.c) instead of using home-grown delay routines * * Revision 1.20 1994/11/02 03:11:38 root * cy_chars_in_buffer forces a return value of 0 to let * login work (don't know why it does); some functions * that were returning EFAULT, now executes the code; * more work on deciding when to disable xmit interrupts; * * Revision 1.19 1994/11/01 20:10:14 root * define routine to start transmission interrupts (by enabling * transmit interrupts); directly enable/disable modem interrupts; * * Revision 1.18 1994/11/01 18:40:45 bentson * Don't always enable transmit interrupts in startup; interrupt on * TxMpty instead of TxRdy to help characters get out before shutdown; * restructure xmit interrupt to check for chars first and quit if * none are ready to go; modem status (MXVRx) is upright, _not_ inverted * (to my view); * * Revision 1.17 1994/10/30 04:39:45 bentson * rename serial_driver and callout_driver to cy_serial_driver and * cy_callout_driver to avoid linkage interference; initialize * info->type to PORT_CIRRUS; ruggedize paranoia test; elide ->port * from cyclades_port structure; add paranoia check to cy_close; * * Revision 1.16 1994/10/30 01:14:33 bentson * change major numbers; add some _early_ return statements; * * Revision 1.15 1994/10/29 06:43:15 bentson * final tidying up for clean compile; enable some error reporting * * Revision 1.14 1994/10/28 20:30:22 Bentson * lots of changes to drag the driver towards the new tty_io * structures and operation. not expected to work, but may * compile cleanly. * * Revision 1.13 1994/07/21 23:08:57 Bentson * add some diagnostic cruft; support 24 lines (for testing * both -8Y and -16Y cards; be more thorough in servicing all * chips during interrupt; add "volatile" a few places to * circumvent compiler optimizations; fix base & offset * computations in block_til_ready (was causing chip 0 to * stop operation) * * Revision 1.12 1994/07/19 16:42:11 Bentson * add some hackery for kernel version 1.1.8; expand * error messages; refine timing for delay loops and * declare loop params volatile * * Revision 1.11 1994/06/11 21:53:10 bentson * get use of save_car right in transmit interrupt service * * Revision 1.10.1.1 1994/06/11 21:31:18 bentson * add some diagnostic printing; try to fix save_car stuff * * Revision 1.10 1994/06/11 20:36:08 bentson * clean up compiler warnings * * Revision 1.9 1994/06/11 19:42:46 bentson * added a bunch of code to support modem signalling * * Revision 1.8 1994/06/11 17:57:07 bentson * recognize break & parity error * * Revision 1.7 1994/06/05 05:51:34 bentson * Reorder baud table to be monotonic; add cli to CP; discard * incoming characters and status if the line isn't open; start to * fold code into cy_throttle; start to port get_serial_info, * set_serial_info, get_modem_info, set_modem_info, and send_break * from serial.c; expand cy_ioctl; relocate and expand config_setup; * get flow control characters from tty struct; invalidate ports w/o * hardware; * * Revision 1.6 1994/05/31 18:42:21 bentson * add a loop-breaker in the interrupt service routine; * note when port is initialized so that it can be shut * down under the right conditions; receive works without * any obvious errors * * Revision 1.5 1994/05/30 00:55:02 bentson * transmit works without obvious errors * * Revision 1.4 1994/05/27 18:46:27 bentson * incorporated more code from lib_y.c; can now print short * strings under interrupt control to port zero; seems to * select ports/channels/lines correctly * * Revision 1.3 1994/05/25 22:12:44 bentson * shifting from multi-port on a card to proper multiplexor * data structures; added skeletons of most routines * * Revision 1.2 1994/05/19 13:21:43 bentson * start to crib from other sources * *//* If you need to install more boards than NR_CARDS, change the constant in the definition below. No other change is necessary to support up to eight boards. Beyond that you'll have to extend cy_isa_addresses. */#define NR_CARDS 4/* If the total number of ports is larger than NR_PORTS, change this constant in the definition below. No other change is necessary to support more boards/ports. */#define NR_PORTS 256#define ZE_V1_NPORTS 64#define ZO_V1 0#define ZO_V2 1#define ZE_V1 2#define SERIAL_PARANOIA_CHECK#undef CY_DEBUG_OPEN#undef CY_DEBUG_THROTTLE#undef CY_DEBUG_OTHER#undef CY_DEBUG_IO#undef CY_DEBUG_COUNT#undef CY_DEBUG_DTR#undef CY_DEBUG_WAIT_UNTIL_SENT#undef CY_DEBUG_INTERRUPTS#undef CY_16Y_HACK#undef CY_ENABLE_MONITORING#undef CY_PCI_DEBUG#if 0#define PAUSE __asm__("nop");#else#define PAUSE ;#endif/* * Include section */#include <linux/config.h>#include <linux/module.h>#include <linux/errno.h>#include <linux/signal.h>#include <linux/sched.h>#include <linux/timer.h>#include <linux/interrupt.h>#include <linux/tty.h>#include <linux/serial.h>#include <linux/major.h>#include <linux/string.h>#include <linux/fcntl.h>#include <linux/ptrace.h>#include <linux/cyclades.h>#include <linux/mm.h>#include <linux/ioport.h>#include <linux/init.h>#include <linux/delay.h>#include <linux/spinlock.h>#include <asm/system.h>#include <asm/io.h>#include <asm/irq.h>#include <asm/uaccess.h>#include <asm/bitops.h>#define CY_LOCK(info,flags) \ do { \ spin_lock_irqsave(&cy_card[info->card].card_lock, flags); \ } while (0) #define CY_UNLOCK(info,flags) \ do { \ spin_unlock_irqrestore(&cy_card[info->card].card_lock, flags); \ } while (0)#include <linux/types.h>#include <linux/kernel.h>#include <linux/pci.h>#include <linux/version.h>#include <linux/stat.h>#include <linux/proc_fs.h>#define cy_put_user put_userstatic unsigned long cy_get_user(unsigned long *addr){ unsigned long result = 0; int error = get_user (result, addr); if (error) printk ("cyclades: cy_get_user: error == %d\n", error);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -