File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -189,12 +189,18 @@ static int uart_litex_fifo_fill(const struct device *dev,
189
189
const struct uart_litex_device_config * config = dev -> config ;
190
190
int i ;
191
191
192
- litex_write8 (UART_EV_TX , config -> ev_pending_addr );
193
192
for (i = 0 ; i < size && !litex_read8 (config -> txfull_addr ); i ++ ) {
194
193
litex_write8 (tx_data [i ], config -> rxtx_addr );
195
194
}
196
- while (!litex_read8 (config -> txfull_addr )) {
197
- litex_write8 (0 , config -> rxtx_addr );
195
+
196
+ if (litex_read8 (config -> txfull_addr )) {
197
+ /* only flush TX event if TX is really full */
198
+ litex_write8 (UART_EV_TX , config -> ev_pending_addr );
199
+
200
+ /* fallback if we maybe missed the TX interrupt */
201
+ while (!litex_read8 (config -> txfull_addr )) {
202
+ litex_write8 (0 , config -> rxtx_addr );
203
+ }
198
204
}
199
205
200
206
return i ;
You can’t perform that action at this time.
0 commit comments