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:
commit
7fef2e4b6f
@ -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
|
||||
*/
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user