Deleted Added
full compact
si.c (50671) si.c (51654)
1/*
2 * Device driver for Specialix range (SI/XIO) of serial line multiplexors.
3 *
4 * Copyright (C) 1990, 1992, 1998 Specialix International,
5 * Copyright (C) 1993, Andy Rutter <andy@acronym.co.uk>
6 * Copyright (C) 1995, Peter Wemm <peter@netplex.com.au>
7 *
8 * Originally derived from: SunOS 4.x version

--- 16 unchanged lines hidden (view full) ---

25 * International may be used to endorse or promote products derived from
26 * this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY EXPRESS OR IMPLIED
29 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
31 * NO EVENT SHALL THE AUTHORS BE LIABLE.
32 *
1/*
2 * Device driver for Specialix range (SI/XIO) of serial line multiplexors.
3 *
4 * Copyright (C) 1990, 1992, 1998 Specialix International,
5 * Copyright (C) 1993, Andy Rutter <andy@acronym.co.uk>
6 * Copyright (C) 1995, Peter Wemm <peter@netplex.com.au>
7 *
8 * Originally derived from: SunOS 4.x version

--- 16 unchanged lines hidden (view full) ---

25 * International may be used to endorse or promote products derived from
26 * this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY EXPRESS OR IMPLIED
29 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
31 * NO EVENT SHALL THE AUTHORS BE LIABLE.
32 *
33 * $FreeBSD: head/sys/dev/si/si.c 50671 1999-08-30 20:52:14Z phk $
33 * $FreeBSD: head/sys/dev/si/si.c 51654 1999-09-25 16:21:39Z phk $
34 */
35
36#ifndef lint
37static const char si_copyright1[] = "@(#) Copyright (C) Specialix International, 1990,1992,1998",
38 si_copyright2[] = "@(#) Copyright (C) Andy Rutter 1993",
39 si_copyright3[] = "@(#) Copyright (C) Peter Wemm 1995";
40#endif /* not lint */
41

--- 66 unchanged lines hidden (view full) ---

108
109enum si_mctl { GET, SET, BIS, BIC };
110
111static void si_command __P((struct si_port *, int, int));
112static int si_modem __P((struct si_port *, enum si_mctl, int));
113static void si_write_enable __P((struct si_port *, int));
114static int si_Sioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
115static void si_start __P((struct tty *));
34 */
35
36#ifndef lint
37static const char si_copyright1[] = "@(#) Copyright (C) Specialix International, 1990,1992,1998",
38 si_copyright2[] = "@(#) Copyright (C) Andy Rutter 1993",
39 si_copyright3[] = "@(#) Copyright (C) Peter Wemm 1995";
40#endif /* not lint */
41

--- 66 unchanged lines hidden (view full) ---

108
109enum si_mctl { GET, SET, BIS, BIC };
110
111static void si_command __P((struct si_port *, int, int));
112static int si_modem __P((struct si_port *, enum si_mctl, int));
113static void si_write_enable __P((struct si_port *, int));
114static int si_Sioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
115static void si_start __P((struct tty *));
116static void si_stop __P((struct tty *, int));
116static timeout_t si_lstart;
117static void si_disc_optim __P((struct tty *tp, struct termios *t,
118 struct si_port *pp));
119static void sihardclose __P((struct si_port *pp));
120static void sidtrwakeup __P((void *chan));
121
122static int siparam __P((struct tty *, struct termios *));
123

--- 42 unchanged lines hidden (view full) ---

166
167#endif
168
169static d_open_t siopen;
170static d_close_t siclose;
171static d_read_t siread;
172static d_write_t siwrite;
173static d_ioctl_t siioctl;
117static timeout_t si_lstart;
118static void si_disc_optim __P((struct tty *tp, struct termios *t,
119 struct si_port *pp));
120static void sihardclose __P((struct si_port *pp));
121static void sidtrwakeup __P((void *chan));
122
123static int siparam __P((struct tty *, struct termios *));
124

--- 42 unchanged lines hidden (view full) ---

167
168#endif
169
170static d_open_t siopen;
171static d_close_t siclose;
172static d_read_t siread;
173static d_write_t siwrite;
174static d_ioctl_t siioctl;
174static d_stop_t sistop;
175static d_devtotty_t sidevtotty;
176
177#define CDEV_MAJOR 68
178static struct cdevsw si_cdevsw = {
179 /* open */ siopen,
180 /* close */ siclose,
181 /* read */ siread,
182 /* write */ siwrite,
183 /* ioctl */ siioctl,
175
176#define CDEV_MAJOR 68
177static struct cdevsw si_cdevsw = {
178 /* open */ siopen,
179 /* close */ siclose,
180 /* read */ siread,
181 /* write */ siwrite,
182 /* ioctl */ siioctl,
184 /* stop */ sistop,
183 /* stop */ nostop,
185 /* reset */ noreset,
184 /* reset */ noreset,
186 /* devtotty */ sidevtotty,
187 /* poll */ ttpoll,
185 /* devtotty */ nodevtotty,
186 /* poll */ ttypoll,
188 /* mmap */ nommap,
189 /* strategy */ nostrategy,
190 /* name */ "si",
191 /* parms */ noparms,
192 /* maj */ CDEV_MAJOR,
193 /* dump */ nodump,
194 /* psize */ nopsize,
195 /* flags */ D_TTY,

--- 961 unchanged lines hidden (view full) ---

1157
1158 /* initial/lock device */
1159 if (IS_STATE(mynor)) {
1160 return(0);
1161 }
1162
1163 pp = sc->sc_ports + port;
1164 tp = pp->sp_tty; /* the "real" tty */
187 /* mmap */ nommap,
188 /* strategy */ nostrategy,
189 /* name */ "si",
190 /* parms */ noparms,
191 /* maj */ CDEV_MAJOR,
192 /* dump */ nodump,
193 /* psize */ nopsize,
194 /* flags */ D_TTY,

--- 961 unchanged lines hidden (view full) ---

1156
1157 /* initial/lock device */
1158 if (IS_STATE(mynor)) {
1159 return(0);
1160 }
1161
1162 pp = sc->sc_ports + port;
1163 tp = pp->sp_tty; /* the "real" tty */
1164 dev->si_tty = tp;
1165 ccbp = pp->sp_ccb; /* Find control block */
1166 DPRINT((pp, DBG_ENTRY|DBG_OPEN, "siopen(%s,%x,%x,%x)\n",
1167 devtoname(dev), flag, mode, p));
1168
1169 oldspl = spltty(); /* Keep others out */
1170 error = 0;
1171
1172open_top:

--- 35 unchanged lines hidden (view full) ---

1208 }
1209 } else {
1210 /*
1211 * The device isn't open, so there are no conflicts.
1212 * Initialize it. Avoid sleep... :-)
1213 */
1214 DPRINT((pp, DBG_OPEN, "first open\n"));
1215 tp->t_oproc = si_start;
1165 ccbp = pp->sp_ccb; /* Find control block */
1166 DPRINT((pp, DBG_ENTRY|DBG_OPEN, "siopen(%s,%x,%x,%x)\n",
1167 devtoname(dev), flag, mode, p));
1168
1169 oldspl = spltty(); /* Keep others out */
1170 error = 0;
1171
1172open_top:

--- 35 unchanged lines hidden (view full) ---

1208 }
1209 } else {
1210 /*
1211 * The device isn't open, so there are no conflicts.
1212 * Initialize it. Avoid sleep... :-)
1213 */
1214 DPRINT((pp, DBG_OPEN, "first open\n"));
1215 tp->t_oproc = si_start;
1216 tp->t_stop = si_stop;
1216 tp->t_param = siparam;
1217 tp->t_dev = dev;
1218 tp->t_termios = mynor & SI_CALLOUT_MASK
1219 ? pp->sp_iout : pp->sp_iin;
1220
1221 (void) si_modem(pp, SET, TIOCM_DTR|TIOCM_RTS);
1222
1223 ++pp->sp_wopeners; /* in case of sleep in siparam */

--- 98 unchanged lines hidden (view full) ---

1322 }
1323 /* ok. we are now still on the right track.. nuke the hardware */
1324
1325 if (pp->sp_state & SS_LSTART) {
1326 untimeout(si_lstart, (caddr_t)pp, pp->lstart_ch);
1327 pp->sp_state &= ~SS_LSTART;
1328 }
1329
1217 tp->t_param = siparam;
1218 tp->t_dev = dev;
1219 tp->t_termios = mynor & SI_CALLOUT_MASK
1220 ? pp->sp_iout : pp->sp_iin;
1221
1222 (void) si_modem(pp, SET, TIOCM_DTR|TIOCM_RTS);
1223
1224 ++pp->sp_wopeners; /* in case of sleep in siparam */

--- 98 unchanged lines hidden (view full) ---

1323 }
1324 /* ok. we are now still on the right track.. nuke the hardware */
1325
1326 if (pp->sp_state & SS_LSTART) {
1327 untimeout(si_lstart, (caddr_t)pp, pp->lstart_ch);
1328 pp->sp_state &= ~SS_LSTART;
1329 }
1330
1330 sistop(tp, FREAD | FWRITE);
1331 si_stop(tp, FREAD | FWRITE);
1331
1332 sihardclose(pp);
1333 ttyclose(tp);
1334 pp->sp_state &= ~SS_OPEN;
1335
1336out:
1337 DPRINT((pp, DBG_CLOSE|DBG_EXIT, "close done, returning\n"));
1338 splx(oldspl);

--- 114 unchanged lines hidden (view full) ---

1453
1454 error = (*linesw[tp->t_line].l_write)(tp, uio, flag);
1455out:
1456 splx(oldspl);
1457 return (error);
1458}
1459
1460
1332
1333 sihardclose(pp);
1334 ttyclose(tp);
1335 pp->sp_state &= ~SS_OPEN;
1336
1337out:
1338 DPRINT((pp, DBG_CLOSE|DBG_EXIT, "close done, returning\n"));
1339 splx(oldspl);

--- 114 unchanged lines hidden (view full) ---

1454
1455 error = (*linesw[tp->t_line].l_write)(tp, uio, flag);
1456out:
1457 splx(oldspl);
1458 return (error);
1459}
1460
1461
1461static struct tty *
1462sidevtotty(dev_t dev)
1463{
1464 struct si_port *pp;
1465 int mynor = minor(dev);
1466 struct si_softc *sc = &si_softc[SI_CARD(mynor)];
1467
1468 if (IS_SPECIAL(mynor))
1469 return(NULL);
1470 if (SI_PORT(mynor) >= sc->sc_nport)
1471 return(NULL);
1472 pp = MINOR2PP(mynor);
1473 return (pp->sp_tty);
1474}
1475
1476static int
1477siioctl(dev, cmd, data, flag, p)
1478 dev_t dev;
1479 u_long cmd;
1480 caddr_t data;
1481 int flag;
1482 struct proc *p;
1483{

--- 1093 unchanged lines hidden (view full) ---

2577 pp->sp_state &= ~SS_INLSTART;
2578 splx(oldspl);
2579}
2580
2581/*
2582 * Stop output on a line. called at spltty();
2583 */
2584void
1462static int
1463siioctl(dev, cmd, data, flag, p)
1464 dev_t dev;
1465 u_long cmd;
1466 caddr_t data;
1467 int flag;
1468 struct proc *p;
1469{

--- 1093 unchanged lines hidden (view full) ---

2563 pp->sp_state &= ~SS_INLSTART;
2564 splx(oldspl);
2565}
2566
2567/*
2568 * Stop output on a line. called at spltty();
2569 */
2570void
2585sistop(tp, rw)
2571si_stop(tp, rw)
2586 register struct tty *tp;
2587 int rw;
2588{
2589 volatile struct si_channel *ccbp;
2590 struct si_port *pp;
2591
2592 pp = TP2PP(tp);
2593 ccbp = pp->sp_ccb;
2594
2572 register struct tty *tp;
2573 int rw;
2574{
2575 volatile struct si_channel *ccbp;
2576 struct si_port *pp;
2577
2578 pp = TP2PP(tp);
2579 ccbp = pp->sp_ccb;
2580
2595 DPRINT((TP2PP(tp), DBG_ENTRY|DBG_STOP, "sistop(%x,%x)\n", tp, rw));
2581 DPRINT((TP2PP(tp), DBG_ENTRY|DBG_STOP, "si_stop(%x,%x)\n", tp, rw));
2596
2597 /* XXX: must check (rw & FWRITE | FREAD) etc flushing... */
2598 if (rw & FWRITE) {
2599 /* what level are we meant to be flushing anyway? */
2600 if (tp->t_state & TS_BUSY) {
2601 si_command(TP2PP(tp), WFLUSH, SI_NOWAIT);
2602 tp->t_state &= ~TS_BUSY;
2603 ttwwakeup(tp); /* Bruce???? */

--- 208 unchanged lines hidden ---
2582
2583 /* XXX: must check (rw & FWRITE | FREAD) etc flushing... */
2584 if (rw & FWRITE) {
2585 /* what level are we meant to be flushing anyway? */
2586 if (tp->t_state & TS_BUSY) {
2587 si_command(TP2PP(tp), WFLUSH, SI_NOWAIT);
2588 tp->t_state &= ~TS_BUSY;
2589 ttwwakeup(tp); /* Bruce???? */

--- 208 unchanged lines hidden ---