720da1df6b
Changes to make rtc/cts flow control work... This does not turn on the builtin hardware flow control on the SoC's usart device, because that doesn't work on uart1 due to a chip erratum (they forgot to wire up pin PA21 to RTS0 internally). Instead it uses the hardware flow control logic where the tty layer calls the driver to assert and de-assert the flow control lines as needed. This prevents overruns at the tty layer (app doesn't read fast enough), but does nothing for overruns at the driver layer (interrupts not serviced fast enough). To work around the wiring problem with RTS0, the driver reassigns that pin as a GPIO and controls it manually. It only does so if given permission via hint.uart.1.use_rts0_workaround=1, to prevent accidentally driving the pin if uart1 is used without flow control (because something not related to serial IO could be wired to that pin). In addition to the RTS0 workaround, driver changes were needed in the area of reading the current set of DCE signals. A priming read is now done at attach() time, and the interrupt routine now sets SER_INT_SIGCHG when any of the DCE signals change. Without these changes, nothing could ever be transmitted, because the tty layer thought CTS was de-asserted (when in fact we had just never read the status register, and the hwsig variable was init'd to CTS de-asserted). Changes to support bulk high-speed (230kbps and higher) data reception... Allow the receive fifo size to be tuned with hint.uart.<dev>.fifo_bytes. For high speed receive, a fifo size of 1024 works well. The default is still 128 bytes if no hint is provided. Using a value larger than 384 requires a change in dev/uart/uart_core.c to size the intermediate buffer as MAX(384, 3*sc->sc_rxfifosize). Recalculate the receive timeout whenever the baud rate changes. At low baud rates (19.2kbps and below) the timeout is the number of bits in 2 characters. At higher speed it's calculated to be 500 microseconds worth of bits. The idea is to compromise between being responsive in interactive situations and not timing out prematurely during a brief pause in bulk data flow. The old fixed timeout of 1.5 characters was just 32 microseconds at 460kbps. At interrupt time, check for receiver holding register overrun status and set the corresponding status bit in the return value. When handling a buffer overrun, get a single buffer emptied and handed back to the hardware as quickly as possible, then deal with the second buffer. This at least minimizes data loss compared to the old logic that fully processed both buffers before restarting the hardware. Rewrite the logic for handling buffers after a receive timeout. The original author speculated in a comment that there may be a race with high speed data. There was, although it was rare. The code now handles all three possible scenarios on receive timeout: two empty buffers, one empty and one partial buffer, or one full and one partial buffer. Reviewed by: imp |
||
---|---|---|
.. | ||
at91_aicreg.h | ||
at91_cfata.c | ||
at91_machdep.c | ||
at91_mci.c | ||
at91_mcireg.h | ||
at91_pdcreg.h | ||
at91_pio_sam9g20.h | ||
at91_pio_sam9g45.h | ||
at91_pio.c | ||
at91_pioreg.h | ||
at91_piovar.h | ||
at91_pit.c | ||
at91_pitreg.h | ||
at91_pmc.c | ||
at91_pmcreg.h | ||
at91_pmcvar.h | ||
at91_reset.S | ||
at91_rst.c | ||
at91_rstreg.h | ||
at91_rtc.c | ||
at91_rtcreg.h | ||
at91_spi.c | ||
at91_spireg.h | ||
at91_ssc.c | ||
at91_sscreg.h | ||
at91_st.c | ||
at91_streg.h | ||
at91_twi.c | ||
at91_twiio.h | ||
at91_twireg.h | ||
at91_usartreg.h | ||
at91_wdt.c | ||
at91_wdtreg.h | ||
at91.c | ||
at91board.h | ||
at91reg.h | ||
at91rm92reg.h | ||
at91rm9200_devices.c | ||
at91rm9200.c | ||
at91rm9200var.h | ||
at91sam9g20.c | ||
at91sam9g20reg.h | ||
at91sam9g45.c | ||
at91sam9g45reg.h | ||
at91sam9x5.c | ||
at91sam9x5reg.h | ||
at91sam9260.c | ||
at91sam9260reg.h | ||
at91soc.c | ||
at91soc.h | ||
at91var.h | ||
board_bwct.c | ||
board_eb9200.c | ||
board_ethernut5.c | ||
board_hl200.c | ||
board_hl201.c | ||
board_kb920x.c | ||
board_qila9g20.c | ||
board_sam9g20ek.c | ||
board_sam9x25ek.c | ||
board_sam9260ek.c | ||
board_sn9g45.c | ||
board_tsc4370.c | ||
files.at91 | ||
if_ate.c | ||
if_atereg.h | ||
if_macb.c | ||
if_macbreg.h | ||
if_macbvar.h | ||
std.at91 | ||
std.at91sam9 | ||
std.at91sam9g45 | ||
std.atmel | ||
std.bwct | ||
std.eb9200 | ||
std.ethernut5 | ||
std.hl200 | ||
std.hl201 | ||
std.kb920x | ||
std.qila9g20 | ||
std.sam9g20ek | ||
std.sam9x25ek | ||
std.sam9260ek | ||
std.sn9g45 | ||
std.tsc4370 | ||
uart_bus_at91usart.c | ||
uart_cpu_at91usart.c | ||
uart_dev_at91usart.c |