Date: Fri, 27 Dec 1996 09:28:45 -0500 (EST) From: root To: FreeBSD-gnats-submit@freebsd.org Cc: andrew@fortress.org Subject: kern/2298: DCD/DSR swap support for sio.c Message-ID: <199612271428.JAA25479@stills.pubnix.net> Resent-Message-ID: <199612271430.GAA20397@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 2298 >Category: kern >Synopsis: Support for DSR/DCD swapping on serial ports (sio) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Dec 27 06:30:01 PST 1996 >Last-Modified: >Originator: root@pubnix.net >Organization: PubNIX Montreal >Release: FreeBSD 2.1.6-RELEASE >Environment: ISP with multi port serial cards using 10 pin RJ45s >Description: This change can benefit anyone using multiport serial cards that employ 10 pin RJ45 connectors (also known as RJ68) to distribute the data signals. These include but are not limited to the Boca 16 port serial board and and Digi PC/x cards with RJ68 fanout plugs. The pinout of the RJ68 connections has DCD on pin 1 and RI on pin 10. As the RI signal is not generally required in an ISP environment, and DCD is, I've added a flag bit in sio.c to support swapping DCD and DSR. This is also a common feature found on most Digi drivers, the company being aware that RJ68 connectors and all the related stuff are hard to find and/or expensive. >How-To-Repeat: N/R >Fix: *** sio.c.orig Fri Nov 15 18:36:37 1996 --- sio.c Fri Dec 20 11:24:46 1996 *************** *** 90,95 **** --- 90,99 ---- #define COM_LOSESOUTINTS(dev) ((dev)->id_flags & 0x08) #define COM_NOFIFO(dev) ((dev)->id_flags & 0x02) #define COM_VERBOSE(dev) ((dev)->id_flags & 0x80) + #define COM_SWAPDCDDSR(dev) ((dev)->id_flags & 0x10) + #define SWAPMASKDCD (MSR_DCD | MSR_DDCD) + #define SWAPMASKDSR (MSR_DSR | MSR_DDSR) + #define SWAPMASKDCDDSR (SWAPMASKDCD | SWAPMASKDSR) #define com_scr 7 /* scratch register for 16450-16550 (R/W) */ *************** *** 168,173 **** --- 172,178 ---- #ifdef COM_MULTIPORT bool_t multiport; /* is this unit part of a multiport device? */ #endif /* COM_MULTIPORT */ + bool_t swapdcddsr; /* We want to swap DCD and DSR */ bool_t no_irq; /* nonzero if irq is not attached */ bool_t poll; /* nonzero if polling is required */ bool_t poll_output; /* nonzero if polling for output is required */ *************** *** 410,415 **** --- 415,421 ---- } } #endif /* COM_MULTIPORT */ + if (idev->id_irq == 0) mcr_image = 0; *************** *** 683,688 **** --- 689,698 ---- outb(iobase + com_fifo, 0); determined_type: ; + if (COM_SWAPDCDDSR(isdp)) { + com->swapdcddsr = TRUE; + printf (" DSR<->DCD "); + } #ifdef COM_MULTIPORT if (COM_ISMULTIPORT(isdp)) { com->multiport = TRUE; *************** *** 752,757 **** --- 762,768 ---- int s; struct tty *tp; int unit; + u_char tmp1; mynor = minor(dev); unit = MINOR_TO_UNIT(mynor); *************** *** 857,864 **** disable_intr(); (void) inb(com->line_status_port); (void) inb(com->data_port); ! com->prev_modem_status = com->last_modem_status ! = inb(com->modem_status_port); outb(iobase + com_ier, IER_ERXRDY | IER_ETXRDY | IER_ERLS | IER_EMSC); enable_intr(); --- 868,884 ---- disable_intr(); (void) inb(com->line_status_port); (void) inb(com->data_port); ! tmp1 = inb(com->modem_status_port); ! if (com->swapdcddsr) ! com->prev_modem_status = com->last_modem_status = ! ((tmp1 & ~SWAPMASKDCDDSR) ! | ((tmp1 & SWAPMASKDCD) >> 2) ! | ((tmp1 & SWAPMASKDSR) << 2)); ! else ! com->prev_modem_status = com->last_modem_status = tmp1; ! ! ! outb(iobase + com_ier, IER_ERXRDY | IER_ETXRDY | IER_ERLS | IER_EMSC); enable_intr(); *************** *** 1102,1107 **** --- 1122,1128 ---- u_char modem_status; u_char *ioptr; u_char recv_data; + u_char tmp1; if (com->do_timestamp) /* XXX a little bloat here... */ *************** *** 1187,1193 **** } /* modem status change? (always check before doing output) */ ! modem_status = inb(com->modem_status_port); if (modem_status != com->last_modem_status) { /* * Schedule high level to handle DCD changes. Note --- 1208,1220 ---- } /* modem status change? (always check before doing output) */ ! tmp1 = inb(com->modem_status_port); ! if (com->swapdcddsr) ! modem_status = ((tmp1 & ~SWAPMASKDCDDSR) ! | ((tmp1 & SWAPMASKDCD) >> 2) ! | ((tmp1 & SWAPMASKDSR) << 2)); ! else ! modem_status = tmp1; if (modem_status != com->last_modem_status) { /* * Schedule high level to handle DCD changes. Note >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612271428.JAA25479>