#ifdef XXX do_flags_thing:  if ( (cflag & CRTSCTS) ) { cflag |= 014000000000; } i2QueueCommands(PTYPE_BYPASS, pCh, 100, 1, CMD_UNIX_FLAGS(iflag,cflag,lflag)); #endif  
set_params( i2ChanStrPtr pCh, struct termios *o_tios ){	tcflag_t cflag, iflag, lflag;	char stop_char, start_char;	struct termios dummy;	lflag = pCh->pTTY->termios->c_lflag;	cflag = pCh->pTTY->termios->c_cflag;	iflag = pCh->pTTY->termios->c_iflag;	if (o_tios == NULL) {		dummy.c_lflag = ~lflag;		dummy.c_cflag = ~cflag;		dummy.c_iflag = ~iflag;		o_tios = &dummy;	}	{		switch ( cflag & CBAUD ) {		case B0:			i2QueueCommands( PTYPE_BYPASS, pCh, 100, 2, CMD_RTSDN, CMD_DTRDN);			pCh->dataSetOut &= ~(I2_DTR | I2_RTS);			i2QueueCommands( PTYPE_INLINE, pCh, 100, 1, CMD_PAUSE(25));			pCh->pTTY->termios->c_cflag |= (CBAUD & o_tios->c_cflag);			goto service_it;			break;		case B38400:			/*			 * This is the speed that is overloaded with all the other high			 * speeds, depending upon the flag settings.			 */			if ( ( pCh->flags & ASYNC_SPD_MASK ) == ASYNC_SPD_HI ) {				pCh->speed = CBR_57600;			} else if ( (pCh->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI ) {				pCh->speed = CBR_115200;			} else if ( (pCh->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST ) {				pCh->speed = CBR_C1;			} else {				pCh->speed = CBR_38400;			}			break;		case B50:      pCh->speed = CBR_50;      break;		case B75:      pCh->speed = CBR_75;      break;		case B110:     pCh->speed = CBR_110;     break;		case B134:     pCh->speed = CBR_134;     break;		case B150:     pCh->speed = CBR_150;     break;		case B200:     pCh->speed = CBR_200;     break;		case B300:     pCh->speed = CBR_300;     break;		case B600:     pCh->speed = CBR_600;     break;		case B1200:    pCh->speed = CBR_1200;    break;		case B1800:    pCh->speed = CBR_1800;    break;		case B2400:    pCh->speed = CBR_2400;    break;		case B4800:    pCh->speed = CBR_4800;    break;		case B9600:    pCh->speed = CBR_9600;    break;		case B19200:   pCh->speed = CBR_19200;   break;		case B57600:   pCh->speed = CBR_57600;   break;		case B115200:  pCh->speed = CBR_115200;  break;		case B153600:  pCh->speed = CBR_153600;  break;		case B230400:  pCh->speed = CBR_230400;  break;		case B307200:  pCh->speed = CBR_307200;  break;		case B460800:  pCh->speed = CBR_460800;  break;		case B921600:  pCh->speed = CBR_921600;  break;		default:       pCh->speed = CBR_9600;    break;		}		if ( pCh->speed == CBR_C1 ) {			// Process the custom speed parameters.			int bps = pCh->BaudBase / pCh->BaudDivisor;			if ( bps == 921600 ) {				pCh->speed = CBR_921600;			} else {				bps = bps/10;				i2QueueCommands( PTYPE_INLINE, pCh, 100, 1, CMD_BAUD_DEF1(bps) );			}		}		i2QueueCommands( PTYPE_INLINE, pCh, 100, 1, CMD_SETBAUD(pCh->speed));				i2QueueCommands ( PTYPE_INLINE, pCh, 100, 2, CMD_DTRUP, CMD_RTSUP);		pCh->dataSetOut |= (I2_DTR | I2_RTS);	}	if ( (CSTOPB & cflag) ^ (CSTOPB & o_tios->c_cflag)) 	{		i2QueueCommands ( PTYPE_INLINE, pCh, 100, 1, 			CMD_SETSTOP( ( cflag & CSTOPB ) ? CST_2 : CST_1));	}	if (((PARENB|PARODD) & cflag) ^ ((PARENB|PARODD) & o_tios->c_cflag)) 	{		i2QueueCommands ( PTYPE_INLINE, pCh, 100, 1,			CMD_SETPAR( 				(cflag & PARENB ?  (cflag & PARODD ? CSP_OD : CSP_EV) : CSP_NP)			)		);	}	/* byte size and parity */	if ( (CSIZE & cflag)^(CSIZE & o_tios->c_cflag)) 	{		int datasize;		switch ( cflag & CSIZE ) {		case CS5: datasize = CSZ_5; break;		case CS6: datasize = CSZ_6; break;		case CS7: datasize = CSZ_7; break;		case CS8: datasize = CSZ_8; break;		default:  datasize = CSZ_5; break;	/* as per serial.c */		}		i2QueueCommands ( PTYPE_INLINE, pCh, 100, 1, CMD_SETBITS(datasize) );	}	/* Process CTS flow control flag setting */	if ( (cflag & CRTSCTS) ) {		i2QueueCommands(PTYPE_INLINE, pCh, 100,						2, CMD_CTSFL_ENAB, CMD_RTSFL_ENAB);	} else {		i2QueueCommands(PTYPE_INLINE, pCh, 100,						2, CMD_CTSFL_DSAB, CMD_RTSFL_DSAB);	}	//	// Process XON/XOFF flow control flags settings	//	stop_char = STOP_CHAR(pCh->pTTY);	start_char = START_CHAR(pCh->pTTY);	//////////// can't be \000	if (stop_char == __DISABLED_CHAR ) 	{		stop_char = ~__DISABLED_CHAR; 	}	if (start_char == __DISABLED_CHAR ) 	{		start_char = ~__DISABLED_CHAR;	}	/////////////////////////////////	if ( o_tios->c_cc[VSTART] != start_char ) 	{		i2QueueCommands(PTYPE_BYPASS, pCh, 100, 1, CMD_DEF_IXON(start_char));		i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_DEF_OXON(start_char));	}	if ( o_tios->c_cc[VSTOP] != stop_char ) 	{		 i2QueueCommands(PTYPE_BYPASS, pCh, 100, 1, CMD_DEF_IXOFF(stop_char));		 i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_DEF_OXOFF(stop_char));	}	if (stop_char == __DISABLED_CHAR ) 	{		stop_char = ~__DISABLED_CHAR;  //TEST123		goto no_xoff;	}	if ((iflag & (IXOFF))^(o_tios->c_iflag & (IXOFF))) 	{		if ( iflag & IXOFF ) {	// Enable XOFF output flow control			i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_OXON_OPT(COX_XON));		} else {	// Disable XOFF output flow controlno_xoff:			i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_OXON_OPT(COX_NONE));		}	}	if (start_char == __DISABLED_CHAR ) 	{		goto no_xon;	}	if ((iflag & (IXON|IXANY)) ^ (o_tios->c_iflag & (IXON|IXANY))) 	{		if ( iflag & IXON ) {			if ( iflag & IXANY ) { // Enable XON/XANY output flow control				i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_IXON_OPT(CIX_XANY));			} else { // Enable XON output flow control				i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_IXON_OPT(CIX_XON));			}		} else { // Disable XON output flow controlno_xon:			i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_IXON_OPT(CIX_NONE));		}	}	if ( (iflag & ISTRIP) ^ ( o_tios->c_iflag & (ISTRIP)) ) 	{		i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, 				CMD_ISTRIP_OPT((iflag & ISTRIP ? 1 : 0)));	}	if ( (iflag & INPCK) ^ ( o_tios->c_iflag & (INPCK)) ) 	{		i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, 				CMD_PARCHK((iflag & INPCK) ? CPK_ENAB : CPK_DSAB));	}	if ( (iflag & (IGNBRK|PARMRK|BRKINT|IGNPAR)) 			^	( o_tios->c_iflag & (IGNBRK|PARMRK|BRKINT|IGNPAR)) ) 	{		char brkrpt = 0;		char parrpt = 0;		if ( iflag & IGNBRK ) { /* Ignore breaks altogether */			/* Ignore breaks altogether */			i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_BRK_NREP);		} else {			if ( iflag & BRKINT ) {				if ( iflag & PARMRK ) {					brkrpt = 0x0a;	// exception an inline triple				} else {					brkrpt = 0x1a;	// exception and NULL				}				brkrpt |= 0x04;	// flush input			} else {				if ( iflag & PARMRK ) {					brkrpt = 0x0b;	//POSIX triple \0377 \0 \0				} else {					brkrpt = 0x01;	// Null only				}			}			i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_BRK_REP(brkrpt));		} 		if (iflag & IGNPAR) {			parrpt = 0x20;													/* would be 2 for not cirrus bug */													/* would be 0x20 cept for cirrus bug */		} else {			if ( iflag & PARMRK ) {				/*				 * Replace error characters with 3-byte sequence (\0377,\0,char)				 */				parrpt = 0x04 ;				i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_ISTRIP_OPT((char)0));			} else {				parrpt = 0x03;			} 		}		i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_SET_ERROR(parrpt));	}	if (cflag & CLOCAL) {		// Status reporting fails for DCD if this is off		i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_DCD_NREP);		pCh->flags &= ~ASYNC_CHECK_CD;	} else {		i2QueueCommands(PTYPE_INLINE, pCh, 100, 1, CMD_DCD_REP);		pCh->flags	|= ASYNC_CHECK_CD;	}#ifdef XXXdo_flags_thing:	// This is a test, we don't do the flags thing		if ( (cflag & CRTSCTS) ) {		cflag |= 014000000000;	}	i2QueueCommands(PTYPE_BYPASS, pCh, 100, 1, 				CMD_UNIX_FLAGS(iflag,cflag,lflag));#endif		service_it:	i2DrainOutput( pCh, 100 );		}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/995c6ed2b1bb309eb45c3006779dc90fb3f4150d/ip2main.c/buggy/drivers/char/ip2main.c