STM32F7: warn if no DMA2 configured when using ADC with DMA. Also correct ADC channel numbers that DMA callback passes to upper half driver.

This commit is contained in:
Juha Niskanen
2017-04-18 06:49:51 -06:00
committed by Gregory Nutt
parent de22d24f8e
commit 54eae7dcde
5 changed files with 13 additions and 13 deletions
+1 -3
View File
@@ -1014,7 +1014,6 @@ config STM32F7_ADC1
bool "ADC1" bool "ADC1"
default n default n
select STM32F7_ADC select STM32F7_ADC
select STM32F7_HAVE_ADC1_DMA if STM32F7_DMA1
select STM32F7_HAVE_ADC1_DMA if STM32F7_DMA2 select STM32F7_HAVE_ADC1_DMA if STM32F7_DMA2
config STM32F7_ADC2 config STM32F7_ADC2
@@ -1027,8 +1026,7 @@ config STM32F7_ADC3
bool "ADC3" bool "ADC3"
default n default n
select STM32F7_ADC select STM32F7_ADC
select STM32F7_HAVE_ADC1_DMA if STM32F7_DMA1 select STM32F7_HAVE_ADC3_DMA if STM32F7_DMA2
select STM32F7_HAVE_ADC1_DMA if STM32F7_DMA2
config STM32F7_BKPSRAM config STM32F7_BKPSRAM
bool "Enable BKP RAM Domain" bool "Enable BKP RAM Domain"
-4
View File
@@ -41,10 +41,6 @@
* Included Files * Included Files
****************************************************************************************************/ ****************************************************************************************************/
#include <nuttx/config.h>
#include "chip.h"
#include <nuttx/config.h> #include <nuttx/config.h>
#include "chip.h" #include "chip.h"
+8 -2
View File
@@ -131,6 +131,12 @@
#define ADC_MAX_CHANNELS_DMA 16 #define ADC_MAX_CHANNELS_DMA 16
#define ADC_MAX_CHANNELS_NODMA 1 #define ADC_MAX_CHANNELS_NODMA 1
#ifdef ADC_HAVE_DMA
# ifndef CONFIG_STM32F7_DMA2
# error "STM32F7 ADC DMA support requires CONFIG_STM32F7_DMA2"
# endif
#endif
#ifdef ADC_HAVE_DMA #ifdef ADC_HAVE_DMA
# define ADC_MAX_SAMPLES ADC_MAX_CHANNELS_DMA # define ADC_MAX_SAMPLES ADC_MAX_CHANNELS_DMA
#else #else
@@ -1133,7 +1139,7 @@ static void adc_dmaconvcallback(DMA_HANDLE handle, uint8_t isr, FAR void *arg)
for (i = 0; i < priv->nchannels; i++) for (i = 0; i < priv->nchannels; i++)
{ {
priv->cb->au_receive(dev, priv->current, priv->dmabuffer[priv->current]); priv->cb->au_receive(dev, priv->chanlist[priv->current], priv->dmabuffer[priv->current]);
priv->current++; priv->current++;
if (priv->current >= priv->nchannels) if (priv->current >= priv->nchannels)
{ {
@@ -1721,7 +1727,7 @@ static int adc123_interrupt(int irq, FAR void *context, FAR void *arg)
* cchannels - Number of channels * cchannels - Number of channels
* *
* Returned Value: * Returned Value:
* Valid ADC device structure reference on succcess; a NULL on failure * Valid ADC device structure reference on success; a NULL on failure
* *
****************************************************************************/ ****************************************************************************/
+1 -1
View File
@@ -750,7 +750,7 @@ extern "C"
* nchannels - Number of channels * nchannels - Number of channels
* *
* Returned Value: * Returned Value:
* Valid can device structure reference on succcess; a NULL on failure * Valid ADC device structure reference on success; a NULL on failure
* *
****************************************************************************/ ****************************************************************************/
+1 -1
View File
@@ -80,7 +80,7 @@
/* Convert the DMA stream base address to the DMA register block address */ /* Convert the DMA stream base address to the DMA register block address */
#define DMA_BASE(ch) (ch & 0xfffffc00) #define DMA_BASE(ch) ((ch) & 0xfffffc00)
/**************************************************************************** /****************************************************************************
* Private Types * Private Types