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 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 *)); |
116static void si_stop __P((struct tty *, int)); |
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; |
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, |
183 /* stop */ nostop, |
184 /* reset */ noreset, |
185 /* devtotty */ nodevtotty, 186 /* poll */ ttypoll, |
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; |
1216 tp->t_stop = si_stop; |
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 |
1331 si_stop(tp, FREAD | FWRITE); |
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 |
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 |
2571si_stop(tp, rw) |
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 |
2581 DPRINT((TP2PP(tp), DBG_ENTRY|DBG_STOP, "si_stop(%x,%x)\n", tp, rw)); |
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 --- |