FreeCalypso > hg > fc-magnetite
comparison src/cs/drivers/drv_app/uart/uartfax.c @ 682:17b7b92e7dba
uartfax.c: fix for old Openmoko bug with Auto-CTS
Openmoko made the change of enabling hardware assisted CTS flow control
in the UART when RTS/CTS flow control is used - it is a change which we
have retained in FreeCalypso - but they forgot to turn this hw mode off
if RTS/CTS flow control is deselected at the application level. We
(FreeCalypso) are now fixing the latter defect ourselves.
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Fri, 26 Jun 2020 02:53:02 +0000 |
| parents | 140a0d24a64c |
| children | 81394dcdf4d3 |
comparison
equal
deleted
inserted
replaced
| 681:140a0d24a64c | 682:17b7b92e7dba |
|---|---|
| 3621 /* | 3621 /* |
| 3622 WRITE_UART_REGISTER ( | 3622 WRITE_UART_REGISTER ( |
| 3623 uart, IER, READ_UART_REGISTER (uart, IER) | IER_SLEEP); | 3623 uart, IER, READ_UART_REGISTER (uart, IER) | IER_SLEEP); |
| 3624 */ | 3624 */ |
| 3625 #endif | 3625 #endif |
| 3626 | 3626 |
| 3627 /* | |
| 3628 * Openmoko made the change of enabling hardware assisted CTS | |
| 3629 * flow control in the UART when RTS/CTS flow control is used - | |
| 3630 * it is a change which we have retained in FreeCalypso - | |
| 3631 * but they forgot to turn this hw mode off if RTS/CTS flow control | |
| 3632 * is deselected at the application level. We (FreeCalypso) | |
| 3633 * are now fixing the latter defect ourselves. | |
| 3634 */ | |
| 3627 if (fcMode == fc_rts) { | 3635 if (fcMode == fc_rts) { |
| 3628 #if 1 // Dmitriy: enable hardware assisted CTS | 3636 /* begin Openmoko change */ |
| 3629 volatile SYS_UWORD8 oldValue; | 3637 SYS_UWORD8 oldValue; |
| 3630 | 3638 |
| 3631 oldValue = READ_UART_REGISTER (uart, LCR); | 3639 oldValue = READ_UART_REGISTER (uart, LCR); |
| 3632 | 3640 |
| 3633 // LCR value to allow acces to EFR | 3641 // LCR value to allow acces to EFR |
| 3634 | 3642 |
| 3635 WRITE_UART_REGISTER (uart, LCR, 0xBF); | 3643 WRITE_UART_REGISTER (uart, LCR, 0xBF); |
| 3636 | 3644 |
| 3637 // enable hardware assisted CTS | 3645 // enable hardware assisted CTS |
| 3638 | 3646 |
| 3639 SET_BIT (uart, EFR, AUTO_CTS_BIT); | 3647 SET_BIT (uart, EFR, AUTO_CTS_BIT); |
| 3640 | 3648 |
| 3641 WRITE_UART_REGISTER (uart, LCR, oldValue); | 3649 WRITE_UART_REGISTER (uart, LCR, oldValue); |
| 3642 #endif | 3650 /* end Openmoko change */ |
| 3651 | |
| 3643 if (uart->rts_level) | 3652 if (uart->rts_level) |
| 3644 uart->tx_stopped_by_driver = 1; | 3653 uart->tx_stopped_by_driver = 1; |
| 3654 } else { | |
| 3655 /* FreeCalypso addition: turn off OM-added Auto-CTS */ | |
| 3656 SYS_UWORD8 oldValue; | |
| 3657 | |
| 3658 oldValue = READ_UART_REGISTER (uart, LCR); | |
| 3659 | |
| 3660 // LCR value to allow acces to EFR | |
| 3661 | |
| 3662 WRITE_UART_REGISTER (uart, LCR, 0xBF); | |
| 3663 | |
| 3664 // disable hardware assisted CTS | |
| 3665 | |
| 3666 RESET_BIT (uart, EFR, AUTO_CTS_BIT); | |
| 3667 | |
| 3668 WRITE_UART_REGISTER (uart, LCR, oldValue); | |
| 3645 } | 3669 } |
| 3646 | 3670 |
| 3647 /* | 3671 /* |
| 3648 * If the high watermark is reached, RTS is activated or XOFF is sent | 3672 * If the high watermark is reached, RTS is activated or XOFF is sent |
| 3649 * according to the flow control mode. Else, RTS is deactivated or XON | 3673 * according to the flow control mode. Else, RTS is deactivated or XON |
