1
0
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:
benpicco 2024-01-18 12:26:30 +00:00 committed by GitHub
commit d5f1fda70d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View File

@ -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) {

View File

@ -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
*/