Date: Wed, 14 Oct 1998 15:26:06 -0700 (PDT) From: "Andrew J. Korty" <ajk@physics.purdue.edu> To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: kern/8318: Update to cy driver. Message-ID: <199810142226.PAA29825@time.cdrom.com>
next in thread | raw e-mail | index | archive | help
>Number: 8318
>Category: kern
>Synopsis: Add break support to cy driver.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Wed Oct 14 15:30:00 PDT 1998
>Last-Modified:
>Originator: "Andrew J. Korty" <ajk@physics.purdue.edu>
>Organization:
Purdue University
>Release: FreeBSD 3.0-current i386
>Environment:
>Description:
Patch to add support for the TIOCSBRK and TIOCCBRK ioctls to
the FreeBSD driver for the Cyclades Cyclom-Y (cy). We use our
Cyclades on our console server, so it's more than just a convenience
to be able to ioctl() a break and drop into the PROM or DDB. We'd
been living with it for a while until last week when I got fed up
and fixed the driver.
>How-To-Repeat:
>Fix:
*** sys/i386/isa/cy.c.orig Sun Aug 23 03:26:40 1998
--- sys/i386/isa/cy.c Wed Oct 14 16:42:02 1998
***************
*** 37,43 ****
/*
* TODO:
- * Implement BREAK.
* Fix overflows when closing line.
* Atomic COR change.
* Consoles.
--- 37,42 ----
***************
*** 308,313 ****
--- 307,315 ----
u_char channel_control;/* CD1400 CCR control command shadow */
u_char cor[3]; /* CD1400 COR1-3 shadows */
u_char intr_enable; /* CD1400 SRER shadow */
+ u_char brk;
+ #define COM_SBRK 0x01 /* start break */
+ #define COM_CBRK 0x02 /* end break */
/*
* Ping-pong input buffers. The extra factor of 2 in the sizes is
***************
*** 1333,1350 ****
& CD1400_xIVR_CHAN));
#endif
if (com->state >= (CS_BUSY | CS_TTGO | CS_ODEVREADY)) {
u_char *ioptr;
u_int ocount;
ioptr = com->obufq.l_head;
ocount = com->obufq.l_tail - ioptr;
if (ocount > CD1400_TX_FIFO_SIZE)
ocount = CD1400_TX_FIFO_SIZE;
com->bytes_out += ocount;
do
! cd_outb(iobase, CD1400_TDR, cy_align,
! *ioptr++);
while (--ocount != 0);
com->obufq.l_head = ioptr;
if (ioptr >= com->obufq.l_tail) {
--- 1335,1379 ----
& CD1400_xIVR_CHAN));
#endif
+ if (com->brk & COM_SBRK) {
+ cd_outb(iobase, CD1400_TDR, cy_align, 0);
+ cd_outb(iobase, CD1400_TDR, cy_align, 0x81);
+ }
+ if (com->brk & COM_CBRK) {
+ cd_outb(iobase, CD1400_TDR, cy_align, 0);
+ cd_outb(iobase, CD1400_TDR, cy_align, 0x83);
+ }
+
if (com->state >= (CS_BUSY | CS_TTGO | CS_ODEVREADY)) {
u_char *ioptr;
u_int ocount;
ioptr = com->obufq.l_head;
ocount = com->obufq.l_tail - ioptr;
+ if (com->brk)
+ ocount -= 2;
if (ocount > CD1400_TX_FIFO_SIZE)
ocount = CD1400_TX_FIFO_SIZE;
com->bytes_out += ocount;
do
! /*
! * Check for NULs and double them up.
! * We've turned on Embedded Trasmit
! * Commands, for which NUL is the escape
! * character. Therefore, bona-fide NULs
! * must be escaped.
! */
! if (*ioptr)
! cd_outb(iobase, CD1400_TDR,
! cy_align, *ioptr++);
! else
! if (1 < ocount) {
! cd_outb(iobase, CD1400_TDR,
! cy_align, *ioptr++);
! cd_outb(iobase, CD1400_TDR,
! cy_align, 0);
! --ocount;
! }
while (--ocount != 0);
com->obufq.l_head = ioptr;
if (ioptr >= com->obufq.l_tail) {
***************
*** 1373,1378 ****
--- 1402,1408 ----
}
}
}
+ com->brk = 0;
/* terminate service context */
#ifdef PollMode
***************
*** 1502,1515 ****
cd_outb(iobase, CD1400_CAR, com->cy_align,
MINOR_TO_UNIT(mynor) & CD1400_CAR_CHAN);
switch (cmd) {
- #if 0
case TIOCSBRK:
! outb(iobase + com_cfcr, com->cfcr_image |= CFCR_SBREAK);
break;
case TIOCCBRK:
! outb(iobase + com_cfcr, com->cfcr_image &= ~CFCR_SBREAK);
break;
- #endif /* 0 */
case TIOCSDTR:
(void)commctl(com, TIOCM_DTR, DMBIS);
break;
--- 1532,1547 ----
cd_outb(iobase, CD1400_CAR, com->cy_align,
MINOR_TO_UNIT(mynor) & CD1400_CAR_CHAN);
switch (cmd) {
case TIOCSBRK:
! com->brk |= COM_SBRK;
! if (!(tp->t_state & TS_BUSY))
! comstart(tp);
break;
case TIOCCBRK:
! com->brk |= COM_CBRK;
! if (!(tp->t_state & TS_BUSY))
! comstart(tp);
break;
case TIOCSDTR:
(void)commctl(com, TIOCM_DTR, DMBIS);
break;
***************
*** 1888,1893 ****
--- 1920,1927 ----
if (cflag & CCTS_OFLOW)
opt |= CD1400_COR2_CCTS_OFLOW;
#endif
+ /* enable Embedded Transmit Commands */
+ opt |= CD1400_COR2_ETC;
if (opt != com->cor[1]) {
cor_change |= CD1400_CCR_COR2;
cd_outb(iobase, CD1400_COR2, com->cy_align, com->cor[1] = opt);
***************
*** 2113,2118 ****
--- 2147,2155 ----
cd_outb(iobase, CD1400_SRER, com->cy_align,
com->intr_enable |= CD1400_SRER_TXRDY);
}
+ if (com->brk)
+ cd_outb(iobase, CD1400_SRER, com->cy_align,
+ com->intr_enable |= CD1400_SRER_TXRDY);
if (tp->t_state & TS_TBLOCK) {
if (com->mcr_image & com->mcr_rts && com->state & CS_RTS_IFLOW)
#if 0
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810142226.PAA29825>
