FreeCalypso > hg > fc-magnetite
changeset 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 |
files | src/cs/drivers/drv_app/uart/uartfax.c |
diffstat | 1 files changed, 34 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/cs/drivers/drv_app/uart/uartfax.c Thu Jun 25 05:36:24 2020 +0000 +++ b/src/cs/drivers/drv_app/uart/uartfax.c Fri Jun 26 02:53:02 2020 +0000 @@ -3623,25 +3623,49 @@ uart, IER, READ_UART_REGISTER (uart, IER) | IER_SLEEP); */ #endif - + + /* + * 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. + */ if (fcMode == fc_rts) { -#if 1 // Dmitriy: enable hardware assisted CTS - volatile SYS_UWORD8 oldValue; + /* begin Openmoko change */ + SYS_UWORD8 oldValue; oldValue = READ_UART_REGISTER (uart, LCR); - + // LCR value to allow acces to EFR - + WRITE_UART_REGISTER (uart, LCR, 0xBF); - + // enable hardware assisted CTS - + SET_BIT (uart, EFR, AUTO_CTS_BIT); - - WRITE_UART_REGISTER (uart, LCR, oldValue); -#endif + + WRITE_UART_REGISTER (uart, LCR, oldValue); + /* end Openmoko change */ + if (uart->rts_level) uart->tx_stopped_by_driver = 1; + } else { + /* FreeCalypso addition: turn off OM-added Auto-CTS */ + SYS_UWORD8 oldValue; + + oldValue = READ_UART_REGISTER (uart, LCR); + + // LCR value to allow acces to EFR + + WRITE_UART_REGISTER (uart, LCR, 0xBF); + + // disable hardware assisted CTS + + RESET_BIT (uart, EFR, AUTO_CTS_BIT); + + WRITE_UART_REGISTER (uart, LCR, oldValue); } /*