From fd6cf9010b522019a4434ebd02fb447b567e7131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20D=C3=BCmpelmann?= Date: Thu, 3 Sep 2020 17:03:13 +0200 Subject: [PATCH] Turn transmit fifo overwritable in no DTR mode --- src/class/cdc/cdc_device.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/class/cdc/cdc_device.c b/src/class/cdc/cdc_device.c index 91799b2de..6c0f5fc7a 100644 --- a/src/class/cdc/cdc_device.c +++ b/src/class/cdc/cdc_device.c @@ -197,7 +197,7 @@ void cdcd_init(void) // config fifo tu_fifo_config(&p_cdc->rx_ff, p_cdc->rx_ff_buf, TU_ARRAY_SIZE(p_cdc->rx_ff_buf), 1, false); - tu_fifo_config(&p_cdc->tx_ff, p_cdc->tx_ff_buf, TU_ARRAY_SIZE(p_cdc->tx_ff_buf), 1, false); + tu_fifo_config(&p_cdc->tx_ff, p_cdc->tx_ff_buf, TU_ARRAY_SIZE(p_cdc->tx_ff_buf), 1, true); #if CFG_FIFO_MUTEX tu_fifo_config_mutex(&p_cdc->rx_ff, osal_mutex_create(&p_cdc->rx_ff_mutex)); @@ -355,6 +355,9 @@ bool cdcd_control_request(uint8_t rhport, tusb_control_request_t const * request p_cdc->line_state = (uint8_t) request->wValue; + // Disable fifo overwriting if DTR bit is set + p_cdc->tx_ff.overwritable = dtr ? false : true; + TU_LOG2(" Set Control Line State: DTR = %d, RTS = %d\r\n", dtr, rts); tud_control_status(rhport, request);