SAMA5D3x-EK: Add support for app/examples/adc

This commit is contained in:
Gregory Nutt 2013-10-24 15:39:56 -06:00
parent 18e651b670
commit 28d50790f2
5 changed files with 38 additions and 24 deletions

View File

@ -5877,3 +5877,6 @@
* configs/freedom-kl25z/src/Makefile: Only build kl_wifi.c if
CONFIG_WL_CC3000 is selected. From Alan Carvalho de Assis
(2013-10-24).
* configs/sama5d3x-ek/src/sam_adc.c: Integrate support for the
apps/examples/adc into the SAMA5D3x-EK configuration (2013-10-24).

View File

@ -1671,6 +1671,7 @@ if SAMA5_ADC_HAVE_CHAN
config SAMA5_ADC_DMA
bool "DMA Support"
default n
depends on SAMA5_DMAC1
---help---
Enable DMA transfers of converted data. This option is only
useful if you have numerous DMA channels enabled. The end result
@ -1703,7 +1704,7 @@ menu "Channel gain"
config SAMA5_ADC_GAIN0
int "Channel 0 gain"
default 0
default 1
depends on SAMA5_ADC_CHAN0
range 0 3
---help---
@ -1714,7 +1715,7 @@ config SAMA5_ADC_GAIN0
config SAMA5_ADC_GAIN1
int "Channel 1 gain"
default 0
default 1
depends on SAMA5_ADC_CHAN1
range 0 3
---help---
@ -1725,7 +1726,7 @@ config SAMA5_ADC_GAIN1
config SAMA5_ADC_GAIN2
int "Channel 2 gain"
default 0
default 1
depends on SAMA5_ADC_CHAN2
range 0 3
---help---
@ -1736,7 +1737,7 @@ config SAMA5_ADC_GAIN2
config SAMA5_ADC_GAIN3
int "Channel 3 gain"
default 0
default 1
depends on SAMA5_ADC_CHAN3
range 0 3
---help---
@ -1747,7 +1748,7 @@ config SAMA5_ADC_GAIN3
config SAMA5_ADC_GAIN4
int "Channel 4 gain"
default 0
default 1
depends on SAMA5_ADC_CHAN4
range 0 3
---help---
@ -1758,7 +1759,7 @@ config SAMA5_ADC_GAIN4
config SAMA5_ADC_GAIN5
int "Channel 5 gain"
default 0
default 1
depends on SAMA5_ADC_CHAN5
range 0 3
---help---
@ -1769,7 +1770,7 @@ config SAMA5_ADC_GAIN5
config SAMA5_ADC_GAIN6
int "Channel 6 gain"
default 0
default 1
depends on SAMA5_ADC_CHAN6
range 0 3
---help---
@ -1780,7 +1781,7 @@ config SAMA5_ADC_GAIN6
config SAMA5_ADC_GAIN7
int "Channel 7 gain"
default 0
default 1
depends on SAMA5_ADC_CHAN7
range 0 3
---help---
@ -1791,7 +1792,7 @@ config SAMA5_ADC_GAIN7
config SAMA5_ADC_GAIN8
int "Channel 8 gain"
default 0
default 1
depends on SAMA5_ADC_CHAN8
range 0 3
---help---
@ -1802,7 +1803,7 @@ config SAMA5_ADC_GAIN8
config SAMA5_ADC_GAIN9
int "Channel 9 gain"
default 0
default 1
depends on SAMA5_ADC_CHAN9
range 0 3
---help---
@ -1813,7 +1814,7 @@ config SAMA5_ADC_GAIN9
config SAMA5_ADC_GAIN10
int "Channel 10 gain"
default 0
default 1
depends on SAMA5_ADC_CHAN10
range 0 3
---help---
@ -1824,7 +1825,7 @@ config SAMA5_ADC_GAIN10
config SAMA5_ADC_GAIN11
int "Channel 11 gain"
default 0
default 1
depends on SAMA5_ADC_CHAN11
range 0 3
---help---
@ -2028,6 +2029,7 @@ if !SAMA5_ADC_ANARCH
config SAMA5_ADC_GAIN
int "Analog gain"
default 1
depends on SAMA5_ADC_CHAN0
range 0 3
---help---
@ -2263,6 +2265,7 @@ menu "Touchscreen configuration"
config SAMA5_TSD
bool "Touchscreen support"
default n
depends on !SAMA5_ADC_HAVE_CHAN || EXPERIMENTAL
select INPUT
---help---
Configure the ADC to support a touchscreen

View File

@ -482,11 +482,7 @@ static struct sam_adc_s g_adcpriv;
#ifdef SAMA5_ADC_HAVE_CHANNELS
/* ADC device instance */
static struct adc_dev_s g_adcdev =
{
.ad_ops = &g_adcops,
.ad_priv = &g_adcpriv,
};
static struct adc_dev_s g_adcdev;
#endif
/****************************************************************************
@ -1432,9 +1428,9 @@ static void sam_adc_offset(struct sam_adc_s *priv)
static void sam_adc_gain(struct sam_adc_s *priv)
{
#ifdef CONFIG_SAMA5_ADC_ANARCH
uint32_t regval;
#ifdef CONFIG_SAMA5_ADC_ANARCH
/* Set the gain for each enabled channel */
regval = 0;
@ -1724,7 +1720,7 @@ static void sam_adc_channels(struct sam_adc_s *priv)
****************************************************************************/
/****************************************************************************
* Name: sam_adcinitialize
* Name: sam_adc_initialize
*
* Description:
* Initialize the adc
@ -1734,7 +1730,7 @@ static void sam_adc_channels(struct sam_adc_s *priv)
*
****************************************************************************/
struct sam_adc_s *sam_adc_initialize(void)
struct adc_dev_s *sam_adc_initialize(void)
{
struct sam_adc_s *priv = &g_adcpriv;
uint32_t regval;
@ -1793,7 +1789,12 @@ struct sam_adc_s *sam_adc_initialize(void)
sam_configpio(PIO_ADC_TRG);
#endif
/* Initialize the ADC device data structure */
/* Initialize the public ADC device data structure */
g_adcdev.ad_ops = &g_adcops;
g_adcdev.ad_priv = &priv;
/* Initialize the private ADC device data structure */
sem_init(&priv->exclsem, 0, 1);
priv->dev = &g_adcdev;
@ -1872,7 +1873,7 @@ struct sam_adc_s *sam_adc_initialize(void)
/* Return a pointer to the device structure */
return priv;
return &g_adcdev;
}
/****************************************************************************

View File

@ -41,6 +41,9 @@
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/analog/adc.h>
#include "chip/sam_adc.h"
#ifdef CONFIG_SAMA5_ADC
@ -120,8 +123,7 @@ extern "C"
*
****************************************************************************/
struct sam_adc_s;
FAR struct sam_adc_s *sam_adc_initialize(void);
FAR struct adc_dev_s *sam_adc_initialize(void);
/****************************************************************************
* Interfaces exported from the ADC to the touchscreen driver
@ -135,6 +137,7 @@ FAR struct sam_adc_s *sam_adc_initialize(void);
*
****************************************************************************/
struct sam_adc_s;
void sam_adc_lock(FAR struct sam_adc_s *priv);
/****************************************************************************

View File

@ -106,6 +106,10 @@ ifeq ($(CONFIG_NSH_ARCHINIT),y)
CSRCS += sam_nsh.c
endif
ifeq ($(CONFIG_ADC),y)
CSRCS += sam_adc.c
endif
ifeq ($(CONFIG_USBMSC),y)
CSRCS += sam_usbmsc.c
endif