nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gn...@apache.org
Subject [incubator-nuttx] 02/02: sama5d3x-ek/nxwm: Fix error: 'g_adcdev' undeclared
Date Wed, 29 Apr 2020 20:04:24 GMT
This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 5d12735f34ed20a40fe13f8f78b86ae75a566150
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
AuthorDate: Thu Apr 30 01:46:22 2020 +0800

    sama5d3x-ek/nxwm: Fix error: 'g_adcdev' undeclared
    
    Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
---
 arch/arm/src/sama5/sam_adc.c                       | 11 ++++++-----
 boards/arm/sama5/sama5d3x-ek/src/sam_touchscreen.c |  2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/arm/src/sama5/sam_adc.c b/arch/arm/src/sama5/sam_adc.c
index b95b96b..07a190e 100644
--- a/arch/arm/src/sama5/sam_adc.c
+++ b/arch/arm/src/sama5/sam_adc.c
@@ -500,11 +500,9 @@ static const struct adc_ops_s g_adcops =
 
 static struct sam_adc_s g_adcpriv;
 
-#ifdef SAMA5_ADC_HAVE_CHANNELS
 /* ADC device instance */
 
 static struct adc_dev_s g_adcdev;
-#endif
 
 /****************************************************************************
  * Private Functions
@@ -677,7 +675,7 @@ static void sam_adc_dmadone(void *arg)
                     ADC_LCDR_CHANB_SHIFT);
           sample = ((*buffer & ADC_LCDR_DATA_MASK) >> ADC_LCDR_DATA_SHIFT);
 
-          /* Verify that the upper-half driver has bound its callback functions */
+          /* Verify the upper-half driver has bound its callback functions */
 
           if (priv->cb != NULL)
             {
@@ -884,7 +882,7 @@ static void sam_adc_endconversion(void *arg)
 
           regval = sam_adc_getreg(priv, SAM_ADC_CDR(chan));
 
-          /* Verify that the upper-half driver has bound its callback functions */
+          /* Verify the upper-half driver has bound its callback functions */
 
           if (priv->cb != NULL)
             {
@@ -2033,14 +2031,17 @@ struct adc_dev_s *sam_adc_initialize(void)
 
       /* Initialize the public ADC device data structure */
 
+#ifdef SAMA5_ADC_HAVE_CHANNELS
       g_adcdev.ad_ops  = &g_adcops;
+      priv->dev = &g_adcdev;
+#endif
+
       g_adcdev.ad_priv = priv;
 
       /* Initialize the private ADC device data structure */
 
       nxsem_init(&priv->exclsem,  0, 1);
       priv->cb  = NULL;
-      priv->dev = &g_adcdev;
 
 #ifdef CONFIG_SAMA5_ADC_DMA
       /* Allocate a DMA channel from DMAC1 */
diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_touchscreen.c b/boards/arm/sama5/sama5d3x-ek/src/sam_touchscreen.c
index d2b4f6d..1f09227 100644
--- a/boards/arm/sama5/sama5d3x-ek/src/sam_touchscreen.c
+++ b/boards/arm/sama5/sama5d3x-ek/src/sam_touchscreen.c
@@ -96,7 +96,7 @@ int sam_tsc_setup(int minor)
 
   /* Initialize the ADC driver */
 
-  adc = sam_adc_initialize();
+  adc = (struct sam_adc_s *)sam_adc_initialize();
   if (!adc)
     {
       ierr("ERROR: Failed to initialize the ADC driver\n");


Mime
View raw message