if ((port = DART_PORT(dev)) > 1) {
port = DART_PORT(dev); if (dart_cd.cd_ndevs == 0 || port > NDARTPORTS)
dartparam(tp, t)	struct tty *tp;	struct termios *t;{	union dartreg *addr;	union dart_pt_io *ptaddr;	int flags;	int port;	int speeds;	unsigned char mr1, mr2;	struct dart_info *dart;	struct dartsoftc *sc;	dev_t dev;	dev = tp->t_dev;	dprintf(("dartparam: setting param for dev(%d, %d)\n", major(dev), minor(dev)));	if ((port = DART_PORT(dev)) > 1) {		return (ENODEV);	}	sc = (struct dartsoftc *) dart_cd.cd_devs[0];	dart = &sc->sc_dart[port];	addr = sc->dart_reg;	ptaddr = sc->port_reg[port];		tp->t_ispeed = t->c_ispeed;	tp->t_ospeed = t->c_ospeed;	tp->t_cflag = t->c_cflag;	flags = tp->t_flags;	/* Reset to make global changes*/	/* disable Tx and Rx */	dprintf(("dartparam: disabling Tx and Rx int\n"));	if (dart_cons == port) {		dprintf(("dartparam: skipping console init\n"));	} else {		if (port == A_PORT)			dart_sv_reg.sv_imr = dart_sv_reg.sv_imr & ~(ITXRDYA | IRXRDYA);		else			dart_sv_reg.sv_imr = dart_sv_reg.sv_imr & ~(ITXRDYB | IRXRDYB);		addr -> write.wr_imr = dart_sv_reg.sv_imr;		/* hang up on zero baud rate */		if (tp->t_ispeed == 0) {			dprintf(("dartparam: ispeed == 0 -> HUP\n"));			dartmctl(dev, HUPCL, DMSET);			return 0;		} else {			/* set baudrate */			speeds = dart_speed(tp->t_ispeed);			dprintf(("dartparam: speed 0x%x, baudrate %d\n", speeds, tp->t_ispeed));			if (speeds == NOBAUD)				speeds = dart_sv_reg.sv_csr[port];			ptaddr->write.wr_csr = speeds;			dart_sv_reg.sv_csr[port] = speeds;			dprintf(("dartparam: baudrate set param = %d\n", speeds));		}		/* get saved mode registers and clear set up parameters */		mr1 = dart_sv_reg.sv_mr1[port];		mr1 &= ~(CLMASK | PARTYPEMASK | PARMODEMASK);		mr2 = dart_sv_reg.sv_mr2[port];		mr2 &= ~SBMASK;		/* set up character size */		if (flags & CS8) {			mr1 |= CL8;			dprintf(("dartparam: PASS8\n"));		} else if (tp->t_ispeed == B134) {			mr1 |= CL6;			dprintf(("dartparam: CS6\n"));		} else {			mr1 |= CL7;			dprintf(("dartparam: CS7\n"));		}		/* set up stop bits */		if (tp->t_ospeed == B110) {			mr2 |= SB2;			dprintf(("dartparam: two stop bits\n"));		} else {			mr2 |= SB1;			dprintf(("dartparam: one stop bit\n"));		}		/* set up parity */		if (((flags & PARENB) != PARENB) &&		    (flags & PARENB)) {			mr1 |= PAREN;			if (flags & PARODD) {				mr1 |= ODDPAR;				dprintf(("dartparam: odd parity\n"));			} else {				mr1 |= EVENPAR;				dprintf(("dartparam: even parity\n"));			}		} else {			mr1 |= PARDIS;			dprintf(("dartparam: no parity\n"));		}		if ((dart_sv_reg.sv_mr1[port] != mr1)		    || (dart_sv_reg.sv_mr2[port] != mr2)) {			/* write mode registers to duart */			ptaddr->write.wr_cr = MRRESET;			ptaddr->write.wr_mr = mr1;			ptaddr->write.wr_mr = mr2;			/* save changed mode registers */			dart_sv_reg.sv_mr1[port] = mr1;			dart_sv_reg.sv_mr2[port] = mr2;		}	}	/* enable transmitter? */	if (tp->t_state & TS_BUSY) {		dprintf(("dartparam: reenabling Tx int\n"));		if (port == A_PORT)			dart_sv_reg.sv_imr = dart_sv_reg.sv_imr | ITXRDYA;		else			dart_sv_reg.sv_imr = dart_sv_reg.sv_imr | ITXRDYB;		addr -> write.wr_imr = dart_sv_reg.sv_imr;	} else {		dprintf(("dartparam: not enabling Tx\n"));	}	/* re-enable the receiver */	dprintf(("dartparam: reenabling Rx int\n"));	DELAY_CR;	if (port == A_PORT)		dart_sv_reg.sv_imr = dart_sv_reg.sv_imr | IRXRDYA;	else		dart_sv_reg.sv_imr = dart_sv_reg.sv_imr | IRXRDYB;	addr -> write.wr_imr = dart_sv_reg.sv_imr;	return 0;}