mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #20230 from benpicco/CONFIG_UART_DMA_THRESHOLD_BYTES
cpu/stm32: uart: don't do DMA for small transfers
This commit is contained in:
commit
d5f1fda70d
@ -390,10 +390,8 @@ void uart_write(uart_t uart, const uint8_t *data, size_t len)
|
||||
}
|
||||
#endif
|
||||
#ifdef MODULE_PERIPH_DMA
|
||||
if (!len) {
|
||||
return;
|
||||
}
|
||||
if (uart_config[uart].dma != DMA_STREAM_UNDEF) {
|
||||
if (len > CONFIG_UART_DMA_THRESHOLD_BYTES &&
|
||||
uart_config[uart].dma != DMA_STREAM_UNDEF) {
|
||||
if (irq_is_in()) {
|
||||
uint16_t todo = 0;
|
||||
if (dev(uart)->CR3 & USART_CR3_DMAT) {
|
||||
|
@ -70,6 +70,14 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Threshold under which polling transfers are used instead of DMA
|
||||
* TODO: determine at run-time based on baudrate
|
||||
*/
|
||||
#ifndef CONFIG_UART_DMA_THRESHOLD_BYTES
|
||||
#define CONFIG_UART_DMA_THRESHOLD_BYTES 8
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Define default UART type identifier
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user