static void ir_set_termios (struct usb_serial_port *port, struct termios *old_termios) { unsigned char *transfer_buffer; unsigned int cflag; int result; u8 baud; dbg(__FUNCTION__ " - port %d", port->number); if ((!port->tty) || (!port->tty->termios)) { dbg(__FUNCTION__" - no tty structures"); return; } cflag = port->tty->termios->c_cflag; /* check that they really want us to change something */ if (old_termios) { if ((cflag == old_termios->c_cflag) && (RELEVANT_IFLAG(port->tty->termios->c_iflag) == RELEVANT_IFLAG(old_termios->c_iflag))) { dbg(__FUNCTION__ " - nothing to change..."); return; } } /* All we can change is the baud rate */ if (cflag & CBAUD) { dbg (__FUNCTION__ " - asking for baud %d", tty_get_baud_rate(port->tty)); /* * FIXME, we should compare the baud request against the * capability stated in the IR header that we got in the * startup funtion. */ switch (cflag & CBAUD) { case B2400: baud = SPEED_2400; break; case B9600: baud = SPEED_9600; break; case B19200: baud = SPEED_19200; break; case B38400: baud = SPEED_38400; break; case B57600: baud = SPEED_57600; break; case B115200: baud = SPEED_115200; break; case B576000: baud = SPEED_576000; break; case B1152000: baud = SPEED_1152000; break; case B4000000: baud = SPEED_4000000; break; default: err ("ir-usb driver does not support the baudrate (%d) requested", tty_get_baud_rate(port->tty)); return; } /* FIXME need to check to see if our write urb is busy right * now, or use a urb pool. */ /* send the baud change out on an "empty" data packet */ transfer_buffer = port->write_urb->transfer_buffer; transfer_buffer[0] = baud; port->write_urb->transfer_buffer_length = 1; port->write_urb->dev = port->serial->dev; result = usb_submit_urb (port->write_urb); if (result) err(__FUNCTION__ " - failed submitting write urb, error %d", result); } return; }
static void rs_set_termios(struct tty_struct *tty, struct termios *old_termios) { unsigned int cflag = tty->termios->c_cflag; if ( (cflag == old_termios->c_cflag) && ( RELEVANT_IFLAG(tty->termios->c_iflag) == RELEVANT_IFLAG(old_termios->c_iflag))) return; /* Handle turning off CRTSCTS */ if ((old_termios->c_cflag & CRTSCTS) && !(tty->termios->c_cflag & CRTSCTS)) { tty->hw_stopped = 0; rs_start(tty); } }
static void rs_set_termios(struct tty_struct *tty, struct termios *old_termios) { struct async_struct *info = (struct async_struct *)tty->driver_data; if ( (tty->termios->c_cflag == old_termios->c_cflag) && ( RELEVANT_IFLAG(tty->termios->c_iflag) == RELEVANT_IFLAG(old_termios->c_iflag))) return; change_speed(info); if ((old_termios->c_cflag & CRTSCTS) && !(tty->termios->c_cflag & CRTSCTS)) { tty->hw_stopped = 0; rs_start(tty); } }
void sab8253x_set_termiosS(struct tty_struct *tty, struct termios *old_termios) { struct sab_port *port = (struct sab_port *)tty->driver_data; if((tty->termios->c_cflag == old_termios->c_cflag) && (RELEVANT_IFLAG(tty->termios->c_iflag) == RELEVANT_IFLAG(old_termios->c_iflag))) { return; } if(!port) { return; } sab8253x_change_speedS(port); /* Handle transition to B0 status */ if ((old_termios->c_cflag & CBAUD) && !(tty->termios->c_cflag & CBAUD)) { LOWER(port,rts); LOWER(port,dtr); } /* Handle transition away from B0 status */ if (!(old_termios->c_cflag & CBAUD) && (tty->termios->c_cflag & CBAUD)) { RAISE(port,dtr); if (!tty->hw_stopped || !(tty->termios->c_cflag & CRTSCTS)) { RAISE(port,rts); } } /* Handle turning off CRTSCTS */ if ((old_termios->c_cflag & CRTSCTS) && !(tty->termios->c_cflag & CRTSCTS)) { tty->hw_stopped = 0; sab8253x_startS(tty); } }
/* * Function ircomm_tty_set_termios (tty, old_termios) * * This routine allows the tty driver to be notified when device's * termios settings have changed. Note that a well-designed tty driver * should be prepared to accept the case where old == NULL, and try to * do something rational. */ void ircomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; unsigned int cflag = tty->termios->c_cflag; IRDA_DEBUG(2, "%s()\n", __func__ ); if ((cflag == old_termios->c_cflag) && (RELEVANT_IFLAG(tty->termios->c_iflag) == RELEVANT_IFLAG(old_termios->c_iflag))) { return; } ircomm_tty_change_speed(self); /* Handle transition to B0 status */ if ((old_termios->c_cflag & CBAUD) && !(cflag & CBAUD)) { self->settings.dte &= ~(IRCOMM_DTR|IRCOMM_RTS); ircomm_param_request(self, IRCOMM_DTE, TRUE); } /* Handle transition away from B0 status */ if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) { self->settings.dte |= IRCOMM_DTR; if (!(tty->termios->c_cflag & CRTSCTS) || !test_bit(TTY_THROTTLED, &tty->flags)) { self->settings.dte |= IRCOMM_RTS; } ircomm_param_request(self, IRCOMM_DTE, TRUE); } /* Handle turning off CRTSCTS */ if ((old_termios->c_cflag & CRTSCTS) && !(tty->termios->c_cflag & CRTSCTS)) { tty->hw_stopped = 0; ircomm_tty_start(tty); } }
static void pdc_set_termios(struct tty_struct *tty, struct termios *old_termios) { #if 0 /* XXX CP, has to be checked, if there is stuff to do */ struct async_struct *info = (struct async_struct *) tty->driver_data; unsigned long flags; unsigned int cflag = tty->termios->c_cflag; if ((cflag == old_termios->c_cflag) && (RELEVANT_IFLAG(tty->termios->c_iflag) == RELEVANT_IFLAG(old_termios->c_iflag))) return; #if 0 change_speed(info, old_termios); #endif /* Handle turning off CRTSCTS */ if ((old_termios->c_cflag & CRTSCTS) && !(tty->termios->c_cflag & CRTSCTS)) { tty->hw_stopped = 0; pdc_start(tty); } #endif }
static void uart_set_termios(struct tty_struct *tty, struct ktermios *old_termios) { struct uart_state *state = tty->driver_data; unsigned long flags; unsigned int cflag = tty->termios->c_cflag; #define RELEVANT_IFLAG(iflag) ((iflag) & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) if ((cflag ^ old_termios->c_cflag) == 0 && tty->termios->c_ospeed == old_termios->c_ospeed && tty->termios->c_ispeed == old_termios->c_ispeed && RELEVANT_IFLAG(tty->termios->c_iflag ^ old_termios->c_iflag) == 0) { return; } uart_change_speed(tty, state, old_termios); if ((old_termios->c_cflag & CBAUD) && !(cflag & CBAUD)) uart_clear_mctrl(state->uart_port, TIOCM_RTS | TIOCM_DTR); else if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) { unsigned int mask = TIOCM_DTR; if (!(cflag & CRTSCTS) || !test_bit(TTY_THROTTLED, &tty->flags)) mask |= TIOCM_RTS; uart_set_mctrl(state->uart_port, mask); } if ((old_termios->c_cflag & CRTSCTS) && !(cflag & CRTSCTS)) { spin_lock_irqsave(&state->uart_port->lock, flags); tty->hw_stopped = 0; __uart_start(tty); spin_unlock_irqrestore(&state->uart_port->lock, flags); } else if (!(old_termios->c_cflag & CRTSCTS) && (cflag & CRTSCTS)) { spin_lock_irqsave(&state->uart_port->lock, flags); if (!(state->uart_port->ops->get_mctrl(state->uart_port) & TIOCM_CTS)) { tty->hw_stopped = 1; state->uart_port->ops->stop_tx(state->uart_port); } spin_unlock_irqrestore(&state->uart_port->lock, flags); } }
static void tiny_set_termios(struct tty_struct *tty, struct ktermios *old_termios) { unsigned int cflag; cflag = tty->termios.c_cflag; /* check that they really want us to change something */ if (old_termios) { if ((cflag == old_termios->c_cflag) && (RELEVANT_IFLAG(tty->termios.c_iflag) == RELEVANT_IFLAG(old_termios->c_iflag))) { printk(KERN_DEBUG " - nothing to change...\n"); return; } } /* get the byte size */ switch (cflag & CSIZE) { case CS5: printk(KERN_DEBUG " - data bits = 5\n"); break; case CS6: printk(KERN_DEBUG " - data bits = 6\n"); break; case CS7: printk(KERN_DEBUG " - data bits = 7\n"); break; default: case CS8: printk(KERN_DEBUG " - data bits = 8\n"); break; } /* determine the parity */ if (cflag & PARENB) if (cflag & PARODD) printk(KERN_DEBUG " - parity = odd\n"); else printk(KERN_DEBUG " - parity = even\n"); else printk(KERN_DEBUG " - parity = none\n"); /* figure out the stop bits requested */ if (cflag & CSTOPB) printk(KERN_DEBUG " - stop bits = 2\n"); else printk(KERN_DEBUG " - stop bits = 1\n"); /* figure out the hardware flow control settings */ if (cflag & CRTSCTS) printk(KERN_DEBUG " - RTS/CTS is enabled\n"); else printk(KERN_DEBUG " - RTS/CTS is disabled\n"); /* determine software flow control */ /* if we are implementing XON/XOFF, set the start and * stop character in the device */ if (I_IXOFF(tty) || I_IXON(tty)) { unsigned char stop_char = STOP_CHAR(tty); unsigned char start_char = START_CHAR(tty); /* if we are implementing INBOUND XON/XOFF */ if (I_IXOFF(tty)) printk(KERN_DEBUG " - INBOUND XON/XOFF is enabled, " "XON = %2x, XOFF = %2x", start_char, stop_char); else printk(KERN_DEBUG" - INBOUND XON/XOFF is disabled"); /* if we are implementing OUTBOUND XON/XOFF */ if (I_IXON(tty)) printk(KERN_DEBUG" - OUTBOUND XON/XOFF is enabled, " "XON = %2x, XOFF = %2x", start_char, stop_char); else printk(KERN_DEBUG" - OUTBOUND XON/XOFF is disabled"); } /* get the baud rate wanted */ printk(KERN_DEBUG " - baud rate = %d", tty_get_baud_rate(tty)); }
/* This function is all nice and good, but we don't change anything based on it :) */ static void visor_set_termios (struct usb_serial_port *port, struct termios *old_termios) { unsigned int cflag; dbg("%s - port %d", __FUNCTION__, port->number); if ((!port->tty) || (!port->tty->termios)) { dbg("%s - no tty structures", __FUNCTION__); return; } cflag = port->tty->termios->c_cflag; /* check that they really want us to change something */ if (old_termios) { if ((cflag == old_termios->c_cflag) && (RELEVANT_IFLAG(port->tty->termios->c_iflag) == RELEVANT_IFLAG(old_termios->c_iflag))) { dbg("%s - nothing to change...", __FUNCTION__); return; } } /* get the byte size */ switch (cflag & CSIZE) { case CS5: dbg("%s - data bits = 5", __FUNCTION__); break; case CS6: dbg("%s - data bits = 6", __FUNCTION__); break; case CS7: dbg("%s - data bits = 7", __FUNCTION__); break; default: case CS8: dbg("%s - data bits = 8", __FUNCTION__); break; } /* determine the parity */ if (cflag & PARENB) if (cflag & PARODD) dbg("%s - parity = odd", __FUNCTION__); else dbg("%s - parity = even", __FUNCTION__); else dbg("%s - parity = none", __FUNCTION__); /* figure out the stop bits requested */ if (cflag & CSTOPB) dbg("%s - stop bits = 2", __FUNCTION__); else dbg("%s - stop bits = 1", __FUNCTION__); /* figure out the flow control settings */ if (cflag & CRTSCTS) dbg("%s - RTS/CTS is enabled", __FUNCTION__); else dbg("%s - RTS/CTS is disabled", __FUNCTION__); /* determine software flow control */ if (I_IXOFF(port->tty)) dbg("%s - XON/XOFF is enabled, XON = %2x, XOFF = %2x", __FUNCTION__, START_CHAR(port->tty), STOP_CHAR(port->tty)); else dbg("%s - XON/XOFF is disabled", __FUNCTION__); /* get the baud rate wanted */ dbg("%s - baud rate = %d", __FUNCTION__, tty_get_baud_rate(port->tty)); return; }
static void belkin_sa_set_termios (struct usb_serial_port *port, struct termios *old_termios) { struct usb_serial *serial = port->serial; struct belkin_sa_private *priv = usb_get_serial_port_data(port); unsigned int iflag; unsigned int cflag; unsigned int old_iflag = 0; unsigned int old_cflag = 0; __u16 urb_value = 0; /* Will hold the new flags */ unsigned long flags; unsigned long control_state; int bad_flow_control; if ((!port->tty) || (!port->tty->termios)) { dbg ("%s - no tty or termios structure", __FUNCTION__); return; } iflag = port->tty->termios->c_iflag; cflag = port->tty->termios->c_cflag; /* get a local copy of the current port settings */ spin_lock_irqsave(&priv->lock, flags); control_state = priv->control_state; bad_flow_control = priv->bad_flow_control; spin_unlock_irqrestore(&priv->lock, flags); /* check that they really want us to change something */ if (old_termios) { if ((cflag == old_termios->c_cflag) && (RELEVANT_IFLAG(port->tty->termios->c_iflag) == RELEVANT_IFLAG(old_termios->c_iflag))) { dbg("%s - nothing to change...", __FUNCTION__); return; } old_iflag = old_termios->c_iflag; old_cflag = old_termios->c_cflag; } /* Set the baud rate */ if( (cflag&CBAUD) != (old_cflag&CBAUD) ) { /* reassert DTR and (maybe) RTS on transition from B0 */ if( (old_cflag&CBAUD) == B0 ) { control_state |= (TIOCM_DTR|TIOCM_RTS); if (BSA_USB_CMD(BELKIN_SA_SET_DTR_REQUEST, 1) < 0) err("Set DTR error"); /* don't set RTS if using hardware flow control */ if (!(old_cflag&CRTSCTS) ) if (BSA_USB_CMD(BELKIN_SA_SET_RTS_REQUEST, 1) < 0) err("Set RTS error"); } switch(cflag & CBAUD) { case B0: /* handled below */ break; case B300: urb_value = BELKIN_SA_BAUD(300); break; case B600: urb_value = BELKIN_SA_BAUD(600); break; case B1200: urb_value = BELKIN_SA_BAUD(1200); break; case B2400: urb_value = BELKIN_SA_BAUD(2400); break; case B4800: urb_value = BELKIN_SA_BAUD(4800); break; case B9600: urb_value = BELKIN_SA_BAUD(9600); break; case B19200: urb_value = BELKIN_SA_BAUD(19200); break; case B38400: urb_value = BELKIN_SA_BAUD(38400); break; case B57600: urb_value = BELKIN_SA_BAUD(57600); break; case B115200: urb_value = BELKIN_SA_BAUD(115200); break; case B230400: urb_value = BELKIN_SA_BAUD(230400); break; default: err("BELKIN USB Serial Adapter: unsupported baudrate request, using default of 9600"); urb_value = BELKIN_SA_BAUD(9600); break; } if ((cflag & CBAUD) != B0 ) { if (BSA_USB_CMD(BELKIN_SA_SET_BAUDRATE_REQUEST, urb_value) < 0) err("Set baudrate error"); } else { /* Disable flow control */ if (BSA_USB_CMD(BELKIN_SA_SET_FLOW_CTRL_REQUEST, BELKIN_SA_FLOW_NONE) < 0) err("Disable flowcontrol error"); /* Drop RTS and DTR */ control_state &= ~(TIOCM_DTR | TIOCM_RTS); if (BSA_USB_CMD(BELKIN_SA_SET_DTR_REQUEST, 0) < 0) err("DTR LOW error"); if (BSA_USB_CMD(BELKIN_SA_SET_RTS_REQUEST, 0) < 0) err("RTS LOW error"); } } /* set the parity */ if( (cflag&(PARENB|PARODD)) != (old_cflag&(PARENB|PARODD)) ) { if (cflag & PARENB) urb_value = (cflag & PARODD) ? BELKIN_SA_PARITY_ODD : BELKIN_SA_PARITY_EVEN; else urb_value = BELKIN_SA_PARITY_NONE; if (BSA_USB_CMD(BELKIN_SA_SET_PARITY_REQUEST, urb_value) < 0) err("Set parity error"); } /* set the number of data bits */ if( (cflag&CSIZE) != (old_cflag&CSIZE) ) { switch (cflag & CSIZE) { case CS5: urb_value = BELKIN_SA_DATA_BITS(5); break; case CS6: urb_value = BELKIN_SA_DATA_BITS(6); break; case CS7: urb_value = BELKIN_SA_DATA_BITS(7); break; case CS8: urb_value = BELKIN_SA_DATA_BITS(8); break; default: err("CSIZE was not CS5-CS8, using default of 8"); urb_value = BELKIN_SA_DATA_BITS(8); break; } if (BSA_USB_CMD(BELKIN_SA_SET_DATA_BITS_REQUEST, urb_value) < 0) err("Set data bits error"); } /* set the number of stop bits */ if( (cflag&CSTOPB) != (old_cflag&CSTOPB) ) { urb_value = (cflag & CSTOPB) ? BELKIN_SA_STOP_BITS(2) : BELKIN_SA_STOP_BITS(1); if (BSA_USB_CMD(BELKIN_SA_SET_STOP_BITS_REQUEST, urb_value) < 0) err("Set stop bits error"); } /* Set flow control */ if( (iflag&IXOFF) != (old_iflag&IXOFF) || (iflag&IXON) != (old_iflag&IXON) || (cflag&CRTSCTS) != (old_cflag&CRTSCTS) ) { urb_value = 0; if ((iflag & IXOFF) || (iflag & IXON)) urb_value |= (BELKIN_SA_FLOW_OXON | BELKIN_SA_FLOW_IXON); else urb_value &= ~(BELKIN_SA_FLOW_OXON | BELKIN_SA_FLOW_IXON); if (cflag & CRTSCTS) urb_value |= (BELKIN_SA_FLOW_OCTS | BELKIN_SA_FLOW_IRTS); else urb_value &= ~(BELKIN_SA_FLOW_OCTS | BELKIN_SA_FLOW_IRTS); if (bad_flow_control) urb_value &= ~(BELKIN_SA_FLOW_IRTS); if (BSA_USB_CMD(BELKIN_SA_SET_FLOW_CTRL_REQUEST, urb_value) < 0) err("Set flow control error"); } /* save off the modified port settings */ spin_lock_irqsave(&priv->lock, flags); priv->control_state = control_state; spin_unlock_irqrestore(&priv->lock, flags); } /* belkin_sa_set_termios */
static void ir_set_termios (struct usb_serial_port *port, struct termios *old_termios) { unsigned char *transfer_buffer; unsigned int cflag; int result; dbg("%s - port %d", __FUNCTION__, port->number); if ((!port->tty) || (!port->tty->termios)) { dbg("%s - no tty structures", __FUNCTION__); return; } cflag = port->tty->termios->c_cflag; /* check that they really want us to change something */ if (old_termios) { if ((cflag == old_termios->c_cflag) && (RELEVANT_IFLAG(port->tty->termios->c_iflag) == RELEVANT_IFLAG(old_termios->c_iflag))) { dbg("%s - nothing to change...", __FUNCTION__); return; } } /* All we can change is the baud rate */ if (cflag & CBAUD) { dbg ("%s - asking for baud %d", __FUNCTION__, tty_get_baud_rate(port->tty)); /* * FIXME, we should compare the baud request against the * capability stated in the IR header that we got in the * startup funtion. */ switch (cflag & CBAUD) { case B2400: ir_baud = SPEED_2400; break; default: case B9600: ir_baud = SPEED_9600; break; case B19200: ir_baud = SPEED_19200; break; case B38400: ir_baud = SPEED_38400; break; case B57600: ir_baud = SPEED_57600; break; case B115200: ir_baud = SPEED_115200; break; case B576000: ir_baud = SPEED_576000; break; case B1152000: ir_baud = SPEED_1152000; break; case B4000000: ir_baud = SPEED_4000000; break; } if (xbof == -1) { ir_xbof = ir_xbof_change(ir_add_bof); } else { ir_xbof = ir_xbof_change(xbof) ; } /* Notify the tty driver that the termios have changed. */ port->tty->ldisc.set_termios(port->tty, NULL); /* FIXME need to check to see if our write urb is busy right * now, or use a urb pool. * * send the baud change out on an "empty" data packet */ transfer_buffer = port->write_urb->transfer_buffer; *transfer_buffer = ir_xbof | ir_baud; usb_fill_bulk_urb ( port->write_urb, port->serial->dev, usb_sndbulkpipe(port->serial->dev, port->bulk_out_endpointAddress), port->write_urb->transfer_buffer, 1, ir_write_bulk_callback, port); port->write_urb->transfer_flags = USB_QUEUE_BULK | USB_ZERO_PACKET; result = usb_submit_urb (port->write_urb); if (result) err("%s - failed submitting write urb, error %d", __FUNCTION__, result); } return; }
void ipoctal_set_termios(struct tty_struct *tty, struct ktermios *old_termios) { unsigned int cflag; unsigned char mr1 = 0; unsigned char mr2 = 0; unsigned char csr = 0; unsigned char imr = 0; unsigned char imr_brk = 0; unsigned int channel = tty->index; int index = *(int *)tty->driver_data; struct ipoctal *ipoctal; int block = channel / 2; ipoctal = &ipoctal_installed[index]; cflag = tty->termios->c_cflag; if (old_termios) { if((cflag == old_termios->c_cflag) && (RELEVANT_IFLAG(tty->termios->c_iflag) == RELEVANT_IFLAG(old_termios->c_iflag))) return; } ipoctal_write_io_reg(ipoctal, &ipoctal->chan_regs[channel].u.w.cr, CR_DISABLE_RX | CR_DISABLE_TX); ipoctal_write_cr_cmd(ipoctal, &ipoctal->chan_regs[channel].u.w.cr, CR_CMD_RESET_RX); ipoctal_write_cr_cmd(ipoctal, &ipoctal->chan_regs[channel].u.w.cr, CR_CMD_RESET_TX); ipoctal_write_cr_cmd(ipoctal, &ipoctal->chan_regs[channel].u.w.cr, CR_CMD_RESET_ERR_STATUS); ipoctal_write_cr_cmd(ipoctal, &ipoctal->chan_regs[channel].u.w.cr, CR_CMD_RESET_MR); /* Set Bits per chars */ switch(cflag & CSIZE) { case CS6 : mr1 |= MR1_CHRL_6_BITS; break; case CS7 : mr1 |= MR1_CHRL_7_BITS; break; default: case CS8 : mr1 |= MR1_CHRL_8_BITS; break; break; } /* Set Parity */ if (cflag & PARENB) if(cflag & PARODD) mr1 |= MR1_PARITY_ON | MR1_PARITY_ODD; else mr1 |= MR1_PARITY_ON | MR1_PARITY_EVEN; else mr1 |= MR1_PARITY_OFF; /* Set stop bits */ if (cflag & CSTOPB) mr2 |= MR2_STOP_BITS_LENGTH_2; else mr2 |= MR2_STOP_BITS_LENGTH_1; /* Set the flow control */ switch(ipoctal->board_id) { case IP_OCTAL_232_ID : if (cflag & CRTSCTS) { mr1 |= MR1_RxRTS_CONTROL_ON; mr2 |= MR2_TxRTS_CONTROL_OFF | MR2_CTS_ENABLE_TX_ON; ipoctal->chan_config[channel].flow_control = 1; } else { mr1 |= MR1_RxRTS_CONTROL_OFF; mr2 |= MR2_TxRTS_CONTROL_OFF | MR2_CTS_ENABLE_TX_OFF; ipoctal->chan_config[channel].flow_control = 0; } break; case IP_OCTAL_422_ID : mr1 |= MR1_RxRTS_CONTROL_OFF; mr2 |= MR2_TxRTS_CONTROL_OFF | MR2_CTS_ENABLE_TX_OFF; ipoctal->chan_config[channel].flow_control = 0; break; case IP_OCTAL_485_ID : mr1 |= MR1_RxRTS_CONTROL_OFF; mr2 |= MR2_TxRTS_CONTROL_ON | MR2_CTS_ENABLE_TX_OFF; ipoctal->chan_config[channel].flow_control = 0; break; default: return; break; } /* Set baud rate */ switch(tty_get_baud_rate(tty)) { case 75: csr |= TX_CLK_75 | RX_CLK_75; break; case 110: csr |= TX_CLK_110 | RX_CLK_110; break; case 150: csr |= TX_CLK_150 | RX_CLK_150; break; case 300: csr |= TX_CLK_300 | RX_CLK_300; break; case 600: csr |= TX_CLK_600 | RX_CLK_600; break; case 1200: csr |= TX_CLK_1200 | RX_CLK_1200; break; case 1800: csr |= TX_CLK_1800 | RX_CLK_1800; break; case 2000: csr |= TX_CLK_2000 | RX_CLK_2000; break; case 2400: csr |= TX_CLK_2400 | RX_CLK_2400; break; case 4800: csr |= TX_CLK_4800 | RX_CLK_4800; break; case 9600: csr |= TX_CLK_9600 | RX_CLK_9600; break; case 19200: csr |= TX_CLK_19200 | RX_CLK_19200; break; case 38400: csr |= TX_CLK_38400 | RX_CLK_38400; break; default: printk(KERN_ERR PFX "Slot [%d:%d] Channel %c : Illegal baud rate value: %d !\n", ipoctal->slot_id->carrier_number, ipoctal->slot_id->slot_position, 'a'+channel, tty_get_baud_rate(tty)); return; } /* Set ignore break status */ imr = ipoctal_read_io_reg( ipoctal, &ipoctal->block_regs[block].u.w.imr); if((channel % 2) == 1) imr_brk = IMR_DELTA_BREAK_B; else imr_brk = IMR_DELTA_BREAK_A; if (I_IGNBRK(tty)) imr &= ~imr_brk; else imr |= imr_brk; ipoctal_write_io_reg( ipoctal, &ipoctal->block_regs[block].u.w.imr, imr); mr1 |= MR1_ERROR_CHAR; mr1 |= MR1_RxINT_RxRDY; ipoctal_write_io_reg(ipoctal, &ipoctal->chan_regs[channel].u.w.mr, mr1); ipoctal_write_io_reg(ipoctal, &ipoctal->chan_regs[channel].u.w.mr, mr2); ipoctal_write_io_reg(ipoctal, &ipoctal->chan_regs[channel].u.w.csr, csr); ipoctal->chan_config[channel].baud = tty_get_baud_rate(tty); ipoctal->chan_config[channel].bits_per_char = cflag & CSIZE; ipoctal->chan_config[channel].parity = cflag & PARENB; ipoctal->chan_config[channel].stop_bits = cflag & CSTOPB; }
static void cidatatty_set_termios(struct tty_struct *tty, struct ktermios *old_termios) { unsigned int cflag; F_ENTER(); cflag = tty->termios.c_cflag; /* check that they really want us to change something */ if (old_termios) { if ((cflag == old_termios->c_cflag) && (RELEVANT_IFLAG(tty->termios.c_iflag) == RELEVANT_IFLAG(old_termios->c_iflag))) { PDEBUG(" - nothing to change...\n"); return; } } /* get the byte size */ switch (cflag & CSIZE) { case CS5: PDEBUG(" - data bits = 5\n"); break; case CS6: PDEBUG(" - data bits = 6\n"); break; case CS7: PDEBUG(" - data bits = 7\n"); break; default: case CS8: PDEBUG(" - data bits = 8\n"); break; } /* determine the parity */ if (cflag & PARENB) if (cflag & PARODD) PDEBUG(" - parity = odd\n"); else PDEBUG(" - parity = even\n"); else PDEBUG(" - parity = none\n"); /* figure out the stop bits requested */ if (cflag & CSTOPB) PDEBUG(" - stop bits = 2\n"); else PDEBUG(" - stop bits = 1\n"); /* figure out the hardware flow control settings */ if (cflag & CRTSCTS) PDEBUG(" - RTS/CTS is enabled\n"); else PDEBUG(" - RTS/CTS is disabled\n"); /* determine software flow control */ /* if we are implementing XON/XOFF, set the start and * stop character in the device */ if (I_IXOFF(tty) || I_IXON(tty)) ;/* CHECKPOINT */ /* get the baud rate wanted */ PDEBUG(" - baud rate = %d", tty_get_baud_rate(tty)); F_LEAVE(); }
static void nullmodem_set_termios(struct tty_struct *tty, struct ktermios *old_termios) { struct nullmodem_end *end = tty->driver_data; unsigned long flags; unsigned int cflag; dprintf("%s - #%d\n", __FUNCTION__, tty->index); cflag = tty->termios.c_cflag; /* check that they really want us to change something */ if (old_termios) { if (cflag == old_termios->c_cflag && RELEVANT_IFLAG(tty->termios.c_iflag) == RELEVANT_IFLAG(old_termios->c_iflag)) { dprintf(" - nothing to change...\n"); return; } } spin_lock_irqsave(&end->pair->spin, flags); handle_termios(tty); spin_unlock_irqrestore(&end->pair->spin, flags); #ifdef SCULL_DEBUG speed_t speed = tty_get_baud_rate(tty); dprintf(" - baud = %u", speed); dprintf(" - ispeed = %u", tty->termios.c_ispeed); dprintf(" - ospeed = %u", tty->termios.c_ospeed); /* get the byte size */ switch (cflag & CSIZE) { case CS5: dprintf(" - data bits = 5\n"); break; case CS6: dprintf(" - data bits = 6\n"); break; case CS7: dprintf(" - data bits = 7\n"); break; default: case CS8: dprintf(" - data bits = 8\n"); break; } /* determine the parity */ if (cflag & PARENB) if (cflag & PARODD) dprintf(" - parity = odd\n"); else dprintf(" - parity = even\n"); else dprintf(" - parity = none\n"); /* figure out the stop bits requested */ if (cflag & CSTOPB) dprintf(" - stop bits = 2\n"); else dprintf(" - stop bits = 1\n"); /* figure out the hardware flow control settings */ if (cflag & CRTSCTS) dprintf(" - RTS/CTS is enabled\n"); else dprintf(" - RTS/CTS is disabled\n"); /* determine software flow control */ /* if we are implementing XON/XOFF, set the start and * stop character in the device */ /* if we are implementing INBOUND XON/XOFF */ if (I_IXOFF(tty)) dprintf(" - INBOUND XON/XOFF is enabled, " "XON = %2x, XOFF = %2x\n", START_CHAR(tty), STOP_CHAR(tty)); else dprintf(" - INBOUND XON/XOFF is disabled\n"); /* if we are implementing OUTBOUND XON/XOFF */ if (I_IXON(tty)) dprintf(" - OUTBOUND XON/XOFF is enabled, " "XON = %2x, XOFF = %2x\n", START_CHAR(tty), STOP_CHAR(tty)); else dprintf(" - OUTBOUND XON/XOFF is disabled\n"); #endif }