1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #20214 from benpicco/CONFIG_SPI_DMA_THRESHOLD_BYTES

cpu/stm32/periph_spi: only perform DMA transfer above threshold
This commit is contained in:
Kevin "Tristate Tom" Weiss 2024-01-04 17:32:02 +00:00 committed by GitHub
commit 7fef2e4b6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 9 deletions

View File

@ -38,14 +38,6 @@
#define ENABLE_DEBUG 0
#include "debug.h"
/**
* @brief Threshold under which polling transfers are used instead of DMA
* TODO: determine at run-time based on SPI clock
*/
#ifndef CONFIG_SPI_DMA_THRESHOLD_BYTES
#define CONFIG_SPI_DMA_THRESHOLD_BYTES 16
#endif
/**
* @brief Array holding one pre-initialized mutex for each SPI device
*/

View File

@ -390,7 +390,7 @@ void spi_transfer_bytes(spi_t bus, spi_cs_t cs, bool cont,
}
#ifdef MODULE_PERIPH_DMA
if (_use_dma(&spi_config[bus])) {
if (_use_dma(&spi_config[bus]) && len > CONFIG_SPI_DMA_THRESHOLD_BYTES) {
_transfer_dma(bus, out, in, len);
}
else {

View File

@ -80,6 +80,14 @@
extern "C" {
#endif
/**
* @brief Threshold under which polling transfers are used instead of DMA
* TODO: determine at run-time based on SPI clock
*/
#ifndef CONFIG_SPI_DMA_THRESHOLD_BYTES
#define CONFIG_SPI_DMA_THRESHOLD_BYTES 16
#endif
/**
* @brief Default SPI device access macro
*/