cp210x.c (94bd217e2d683719ab21a4ac117d8a1b91cbedc9) | cp210x.c (4b6181caa411ccb91ff4aad10b83d62d5a0464d3) |
---|---|
1/* 2 * Silicon Laboratories CP210x USB to RS232 serial adaptor driver 3 * 4 * Copyright (C) 2005 Craig Shelley (craig@microtron.org.uk) 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License version 8 * 2 as published by the Free Software Foundation. --- 506 unchanged lines hidden (view full) --- 515 cflag |= (PARENB|PARODD); 516 break; 517 case BITS_PARITY_EVEN: 518 dbg("%s - parity = EVEN", __func__); 519 cflag &= ~PARODD; 520 cflag |= PARENB; 521 break; 522 case BITS_PARITY_MARK: | 1/* 2 * Silicon Laboratories CP210x USB to RS232 serial adaptor driver 3 * 4 * Copyright (C) 2005 Craig Shelley (craig@microtron.org.uk) 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License version 8 * 2 as published by the Free Software Foundation. --- 506 unchanged lines hidden (view full) --- 515 cflag |= (PARENB|PARODD); 516 break; 517 case BITS_PARITY_EVEN: 518 dbg("%s - parity = EVEN", __func__); 519 cflag &= ~PARODD; 520 cflag |= PARENB; 521 break; 522 case BITS_PARITY_MARK: |
523 dbg("%s - parity = MARK (not supported, disabling parity)", 524 __func__); 525 cflag &= ~PARENB; 526 bits &= ~BITS_PARITY_MASK; 527 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); | 523 dbg("%s - parity = MARK", __func__); 524 cflag |= (PARENB|PARODD|CMSPAR); |
528 break; 529 case BITS_PARITY_SPACE: | 525 break; 526 case BITS_PARITY_SPACE: |
530 dbg("%s - parity = SPACE (not supported, disabling parity)", 531 __func__); 532 cflag &= ~PARENB; 533 bits &= ~BITS_PARITY_MASK; 534 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); | 527 dbg("%s - parity = SPACE", __func__); 528 cflag &= ~PARODD; 529 cflag |= (PARENB|CMSPAR); |
535 break; 536 default: 537 dbg("%s - Unknown parity mode, disabling parity", __func__); 538 cflag &= ~PARENB; 539 bits &= ~BITS_PARITY_MASK; 540 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); 541 break; 542 } --- 40 unchanged lines hidden (view full) --- 583 unsigned int baud = 0, bits; 584 unsigned int modem_ctl[4]; 585 586 dbg("%s - port %d", __func__, port->number); 587 588 if (!tty) 589 return; 590 | 530 break; 531 default: 532 dbg("%s - Unknown parity mode, disabling parity", __func__); 533 cflag &= ~PARENB; 534 bits &= ~BITS_PARITY_MASK; 535 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); 536 break; 537 } --- 40 unchanged lines hidden (view full) --- 578 unsigned int baud = 0, bits; 579 unsigned int modem_ctl[4]; 580 581 dbg("%s - port %d", __func__, port->number); 582 583 if (!tty) 584 return; 585 |
591 tty->termios->c_cflag &= ~CMSPAR; | |
592 cflag = tty->termios->c_cflag; 593 old_cflag = old_termios->c_cflag; 594 baud = cp210x_quantise_baudrate(tty_get_baud_rate(tty)); 595 596 /* If the baud rate is to be updated*/ 597 if (baud != tty_termios_baud_rate(old_termios) && baud != 0) { 598 dbg("%s - Setting baud rate to %d baud", __func__, 599 baud); --- 38 unchanged lines hidden (view full) --- 638 bits |= BITS_DATA_8; 639 break; 640 } 641 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) 642 dbg("Number of data bits requested " 643 "not supported by device\n"); 644 } 645 | 586 cflag = tty->termios->c_cflag; 587 old_cflag = old_termios->c_cflag; 588 baud = cp210x_quantise_baudrate(tty_get_baud_rate(tty)); 589 590 /* If the baud rate is to be updated*/ 591 if (baud != tty_termios_baud_rate(old_termios) && baud != 0) { 592 dbg("%s - Setting baud rate to %d baud", __func__, 593 baud); --- 38 unchanged lines hidden (view full) --- 632 bits |= BITS_DATA_8; 633 break; 634 } 635 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) 636 dbg("Number of data bits requested " 637 "not supported by device\n"); 638 } 639 |
646 if ((cflag & (PARENB|PARODD)) != (old_cflag & (PARENB|PARODD))) { | 640 if ((cflag & (PARENB|PARODD|CMSPAR)) != 641 (old_cflag & (PARENB|PARODD|CMSPAR))) { |
647 cp210x_get_config(port, CP210X_GET_LINE_CTL, &bits, 2); 648 bits &= ~BITS_PARITY_MASK; 649 if (cflag & PARENB) { | 642 cp210x_get_config(port, CP210X_GET_LINE_CTL, &bits, 2); 643 bits &= ~BITS_PARITY_MASK; 644 if (cflag & PARENB) { |
650 if (cflag & PARODD) { 651 bits |= BITS_PARITY_ODD; 652 dbg("%s - parity = ODD", __func__); | 645 if (cflag & CMSPAR) { 646 if (cflag & PARODD) { 647 bits |= BITS_PARITY_MARK; 648 dbg("%s - parity = MARK", __func__); 649 } else { 650 bits |= BITS_PARITY_SPACE; 651 dbg("%s - parity = SPACE", __func__); 652 } |
653 } else { | 653 } else { |
654 bits |= BITS_PARITY_EVEN; 655 dbg("%s - parity = EVEN", __func__); | 654 if (cflag & PARODD) { 655 bits |= BITS_PARITY_ODD; 656 dbg("%s - parity = ODD", __func__); 657 } else { 658 bits |= BITS_PARITY_EVEN; 659 dbg("%s - parity = EVEN", __func__); 660 } |
656 } 657 } 658 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) 659 dbg("Parity mode not supported " 660 "by device\n"); 661 } 662 663 if ((cflag & CSTOPB) != (old_cflag & CSTOPB)) { --- 164 unchanged lines hidden --- | 661 } 662 } 663 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) 664 dbg("Parity mode not supported " 665 "by device\n"); 666 } 667 668 if ((cflag & CSTOPB) != (old_cflag & CSTOPB)) { --- 164 unchanged lines hidden --- |