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

View File

@ -1014,7 +1014,6 @@ config STM32F7_ADC1
bool "ADC1"
default n
select STM32F7_ADC
select STM32F7_HAVE_ADC1_DMA if STM32F7_DMA1
select STM32F7_HAVE_ADC1_DMA if STM32F7_DMA2
config STM32F7_ADC2
@ -1027,8 +1026,7 @@ config STM32F7_ADC3
bool "ADC3"
default n
select STM32F7_ADC
select STM32F7_HAVE_ADC1_DMA if STM32F7_DMA1
select STM32F7_HAVE_ADC1_DMA if STM32F7_DMA2
select STM32F7_HAVE_ADC3_DMA if STM32F7_DMA2
config STM32F7_BKPSRAM
bool "Enable BKP RAM Domain"

View File

@ -41,10 +41,6 @@
* Included Files
****************************************************************************************************/
#include <nuttx/config.h>
#include "chip.h"
#include <nuttx/config.h>
#include "chip.h"

View File

@ -131,6 +131,12 @@
#define ADC_MAX_CHANNELS_DMA 16
#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
# define ADC_MAX_SAMPLES ADC_MAX_CHANNELS_DMA
#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++)
{
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++;
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
*
* Returned Value:
* Valid ADC device structure reference on succcess; a NULL on failure
* Valid ADC device structure reference on success; a NULL on failure
*
****************************************************************************/

View File

@ -750,14 +750,14 @@ extern "C"
* nchannels - Number of channels
*
* Returned Value:
* Valid can device structure reference on succcess; a NULL on failure
* Valid ADC device structure reference on success; a NULL on failure
*
****************************************************************************/
struct adc_dev_s;
struct adc_dev_s *stm32_adc_initialize(int intf,
FAR const uint8_t *chanlist,
int nchannels);
FAR const uint8_t *chanlist,
int nchannels);
#undef EXTERN
#ifdef __cplusplus
}

View File

@ -80,7 +80,7 @@
/* 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