summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2015-03-31 15:00:23 -0600
committerGregory Nutt <gnutt@nuttx.org>2015-03-31 15:00:23 -0600
commit494dfe2ae6157348956b941eb7a1f57b66181a56 (patch)
tree7201b16b309f34b73f46936ed1980c0ef0b8154a
parent49a7570f92a3ae31838f2eea2fa71354361f2881 (diff)
Rename adc_devinit() to board_adc_setup(). Add support to the boardctl() interface so that it can call board_adc_setup() on behalf of an application. Change apps/examples/adc to that is now calls boardctl() instead of adc_devinit() in order to initalize the ADC device.
-rw-r--r--apps/examples/adc/Kconfig2
-rw-r--r--apps/examples/adc/adc.h11
-rw-r--r--apps/examples/adc/adc_main.c7
-rw-r--r--nuttx/configs/Kconfig13
-rwxr-xr-xnuttx/configs/boardctl.c29
-rw-r--r--nuttx/configs/cloudctrl/src/stm32_adc.c5
-rw-r--r--nuttx/configs/lpcxpresso-lpc1768/src/lpc17_adc.c5
-rw-r--r--nuttx/configs/mbed/src/lpc17_adc.c5
-rw-r--r--nuttx/configs/nucleo-f4x1re/src/nucleo-f4x1re.h1
-rw-r--r--nuttx/configs/nucleo-f4x1re/src/stm32_adc.c5
-rw-r--r--nuttx/configs/olimex-stm32-h405/nshusb/defconfig2
-rw-r--r--nuttx/configs/olimex-stm32-h405/src/stm32_adc.c7
-rw-r--r--nuttx/configs/olimex-stm32-p207/nsh/defconfig2
-rw-r--r--nuttx/configs/olimex-stm32-p207/src/stm32_adc.c7
-rw-r--r--nuttx/configs/sama5d3-xplained/src/sam_adc.c5
-rw-r--r--nuttx/configs/sama5d3x-ek/src/sam_adc.c5
-rw-r--r--nuttx/configs/sama5d4-ek/src/sam_adc.c5
-rw-r--r--nuttx/configs/shenzhou/src/stm32_adc.c5
-rw-r--r--nuttx/configs/stm3210e-eval/src/stm32_adc.c5
-rw-r--r--nuttx/configs/stm3220g-eval/src/stm32_adc.c5
-rw-r--r--nuttx/configs/stm3240g-eval/src/stm32_adc.c5
-rw-r--r--nuttx/configs/tm4c123g-launchpad/src/tm4c123g-launchpad.h13
-rw-r--r--nuttx/configs/tm4c123g-launchpad/src/tm4c_adc.c10
-rw-r--r--nuttx/configs/zkit-arm-1769/src/lpc17_adc.c5
-rw-r--r--nuttx/include/nuttx/board.h26
-rw-r--r--nuttx/include/sys/boardctl.h17
26 files changed, 145 insertions, 62 deletions
diff --git a/apps/examples/adc/Kconfig b/apps/examples/adc/Kconfig
index 655427780f..8f20f1a02b 100644
--- a/apps/examples/adc/Kconfig
+++ b/apps/examples/adc/Kconfig
@@ -6,7 +6,7 @@
config EXAMPLES_ADC
bool "ADC example"
default n
- depends on ADC
+ depends on ADC && LIB_BOARDCTL
---help---
Enable the ADC example
diff --git a/apps/examples/adc/adc.h b/apps/examples/adc/adc.h
index 291d485faa..84583ca8fd 100644
--- a/apps/examples/adc/adc.h
+++ b/apps/examples/adc/adc.h
@@ -91,15 +91,4 @@ struct adc_state_s
* Public Function Prototypes
****************************************************************************/
-/****************************************************************************
- * Name: adc_devinit()
- *
- * Description:
- * Perform architecuture-specific initialization of the ADC hardware. This
- * interface must be provided by all configurations using apps/examples/adc
- *
- ****************************************************************************/
-
-int adc_devinit(void);
-
#endif /* __APPS_EXAMPLES_ADC_ADC_H */
diff --git a/apps/examples/adc/adc_main.c b/apps/examples/adc/adc_main.c
index 3478b5e0aa..16f1806965 100644
--- a/apps/examples/adc/adc_main.c
+++ b/apps/examples/adc/adc_main.c
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/adc/adc_main.c
*
- * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -41,6 +41,7 @@
#include <sys/types.h>
#include <sys/ioctl.h>
+#include <sys/boardctl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -250,10 +251,10 @@ int adc_main(int argc, char *argv[])
*/
printf("adc_main: Initializing external ADC device\n");
- ret = adc_devinit();
+ ret = boardctl(BOARDIOC_ADCTEST_SETUP, 0);
if (ret != OK)
{
- printf("adc_main: adc_devinit failed: %d\n", ret);
+ printf("adc_main: boardctl failed: %d\n", ret);
errval = 1;
goto errout;
}
diff --git a/nuttx/configs/Kconfig b/nuttx/configs/Kconfig
index c1dc72ca95..4fe6e0928b 100644
--- a/nuttx/configs/Kconfig
+++ b/nuttx/configs/Kconfig
@@ -1586,7 +1586,18 @@ config LIB_BOARDCTL
bool "Enabled boardctl() interface"
default n
+if LIB_BOARDCTL
+
config BOARDCTL_TSCTEST
bool "Enable touchscreen test interfaces"
default n
- depends on LIB_BOARDCTL
+
+config BOARDCTL_ADCTEST
+ bool "Enable ADC test interfaces"
+ default n
+
+config BOARDCTL_IOCTL
+ bool "Board-specific boardctl() commands"
+ default n
+
+endif # LIB_BOARDCTL
diff --git a/nuttx/configs/boardctl.c b/nuttx/configs/boardctl.c
index d865fff685..953b3e2d0e 100755
--- a/nuttx/configs/boardctl.c
+++ b/nuttx/configs/boardctl.c
@@ -126,8 +126,35 @@ int boardctl(unsigned int cmd, uintptr_t arg)
break;
#endif
+#ifdef CONFIG_BOARDCTL_ADCTEST
+ /* CMD: BOARDIOC_ADCTEST_SETUP
+ * DESCRIPTION: ADC controller test configuration
+ * ARG: None
+ * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_ADCTEST
+ * DEPENDENCIES: Board logic must provide board_adc_setup()
+ */
+
+ case BOARDIOC_ADCTEST_SETUP:
+ {
+ ret = board_adc_setup(();
+ }
+ break;
+#endif
+
default:
- ret = -ENOTTY;
+ {
+#ifdef CONFIG_BOARDCTL_IOCTL
+ /* Boards may also select CONFIG_BOARDCTL_IOCTL=y to enable board-
+ * specific commands. In this case, all commands not recognized
+ * by boardctl() will be forwarded to the board-provided board_ioctl()
+ * function.
+ */
+
+ ret = board_ioctl(cmd, arg);
+#else
+ ret = -ENOTTY;
+#endif
+ }
break;
}
diff --git a/nuttx/configs/cloudctrl/src/stm32_adc.c b/nuttx/configs/cloudctrl/src/stm32_adc.c
index d78497fecd..70e3578dd3 100644
--- a/nuttx/configs/cloudctrl/src/stm32_adc.c
+++ b/nuttx/configs/cloudctrl/src/stm32_adc.c
@@ -43,6 +43,7 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/analog/adc.h>
#include <arch/board/board.h>
@@ -113,7 +114,7 @@ static const uint32_t g_pinlist[ADC1_NCHANNELS] = {GPIO_ADC12_IN10}; //{GPIO_AD
************************************************************************************/
/************************************************************************************
- * Name: adc_devinit
+ * Name: board_adc_setup
*
* Description:
* All STM32 architectures must provide the following interface to work with
@@ -121,7 +122,7 @@ static const uint32_t g_pinlist[ADC1_NCHANNELS] = {GPIO_ADC12_IN10}; //{GPIO_AD
*
************************************************************************************/
-int adc_devinit(void)
+int board_adc_setup(void)
{
#ifdef CONFIG_STM32_ADC1
static bool initialized = false;
diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/lpc17_adc.c b/nuttx/configs/lpcxpresso-lpc1768/src/lpc17_adc.c
index 3b361d644b..898f746b0d 100644
--- a/nuttx/configs/lpcxpresso-lpc1768/src/lpc17_adc.c
+++ b/nuttx/configs/lpcxpresso-lpc1768/src/lpc17_adc.c
@@ -47,6 +47,7 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/analog/adc.h>
#include <arch/board/board.h>
@@ -75,7 +76,7 @@
************************************************************************************/
/************************************************************************************
- * Name: adc_devinit
+ * Name: board_adc_setup
*
* Description:
* All LPC17 architectures must provide the following interface to work with
@@ -83,7 +84,7 @@
*
************************************************************************************/
-int adc_devinit(void)
+int board_adc_setup(void)
{
static bool initialized = false;
struct adc_dev_s *adc;
diff --git a/nuttx/configs/mbed/src/lpc17_adc.c b/nuttx/configs/mbed/src/lpc17_adc.c
index 0ae4423b46..7b0fe48260 100644
--- a/nuttx/configs/mbed/src/lpc17_adc.c
+++ b/nuttx/configs/mbed/src/lpc17_adc.c
@@ -49,6 +49,7 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/analog/adc.h>
#include <arch/board/board.h>
@@ -77,7 +78,7 @@
************************************************************************************/
/************************************************************************************
- * Name: adc_devinit
+ * Name: board_adc_setup
*
* Description:
* All LPC17 architectures must provide the following interface to work with
@@ -85,7 +86,7 @@
*
************************************************************************************/
-int adc_devinit(void)
+int board_adc_setup(void)
{
static bool initialized = false;
struct adc_dev_s *adc;
diff --git a/nuttx/configs/nucleo-f4x1re/src/nucleo-f4x1re.h b/nuttx/configs/nucleo-f4x1re/src/nucleo-f4x1re.h
index 8c4b561f6f..9f231e8f48 100644
--- a/nuttx/configs/nucleo-f4x1re/src/nucleo-f4x1re.h
+++ b/nuttx/configs/nucleo-f4x1re/src/nucleo-f4x1re.h
@@ -43,6 +43,7 @@
#include <nuttx/config.h>
#include <nuttx/compiler.h>
+
#include <stdint.h>
/************************************************************************************
diff --git a/nuttx/configs/nucleo-f4x1re/src/stm32_adc.c b/nuttx/configs/nucleo-f4x1re/src/stm32_adc.c
index f1b1ffa7a6..e6aaf7cc4c 100644
--- a/nuttx/configs/nucleo-f4x1re/src/stm32_adc.c
+++ b/nuttx/configs/nucleo-f4x1re/src/stm32_adc.c
@@ -42,6 +42,7 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/analog/adc.h>
#include <arch/board/board.h>
@@ -158,7 +159,7 @@ int board_adc_initialize(void)
}
/************************************************************************************
- * Name: adc_devinit
+ * Name: board_adc_setup
*
* Description:
* All STM32 architectures must provide the following interface to work with
@@ -167,7 +168,7 @@ int board_adc_initialize(void)
************************************************************************************/
#ifdef CONFIG_EXAMPLES_ADC
-int adc_devinit(void)
+int board_adc_setup(void)
{
#ifdef CONFIG_SAMA5_ADC
return board_adc_initialize();
diff --git a/nuttx/configs/olimex-stm32-h405/nshusb/defconfig b/nuttx/configs/olimex-stm32-h405/nshusb/defconfig
index dd18ba95aa..37715abaa6 100644
--- a/nuttx/configs/olimex-stm32-h405/nshusb/defconfig
+++ b/nuttx/configs/olimex-stm32-h405/nshusb/defconfig
@@ -378,6 +378,8 @@ CONFIG_ARCH_BUTTONS=y
CONFIG_ARCH_HAVE_IRQBUTTONS=y
CONFIG_ARCH_IRQBUTTONS=y
CONFIG_NSH_MMCSDMINOR=0
+CONFIG_LIB_BOARDCTL=y
+CONFIG_BOARDCTL_ADCTEST=y
#
# Board-Specific Options
diff --git a/nuttx/configs/olimex-stm32-h405/src/stm32_adc.c b/nuttx/configs/olimex-stm32-h405/src/stm32_adc.c
index bff9debaca..3ba3b6549f 100644
--- a/nuttx/configs/olimex-stm32-h405/src/stm32_adc.c
+++ b/nuttx/configs/olimex-stm32-h405/src/stm32_adc.c
@@ -41,8 +41,11 @@
#include <errno.h>
#include <debug.h>
+
+#include <nuttx/board.h>
#include <nuttx/analog/adc.h>
#include <arch/board/board.h>
+
#include "chip.h"
#include "stm32_adc.h"
#include "olimex-stm32-h405.h"
@@ -111,7 +114,7 @@ static const uint32_t g_pinlist[ADC1_NCHANNELS] = {GPIO_ADC1_IN1};/*, GPIO_ADC
************************************************************************************/
/************************************************************************************
- * Name: adc_devinit
+ * Name: board_adc_setup
*
* Description:
* All STM32 architectures must provide the following interface to work with
@@ -119,7 +122,7 @@ static const uint32_t g_pinlist[ADC1_NCHANNELS] = {GPIO_ADC1_IN1};/*, GPIO_ADC
*
************************************************************************************/
-int adc_devinit(void)
+int board_adc_setup(void)
{
return stm32_adc_initialize();
}
diff --git a/nuttx/configs/olimex-stm32-p207/nsh/defconfig b/nuttx/configs/olimex-stm32-p207/nsh/defconfig
index f91cbe0ad0..b70e024f78 100644
--- a/nuttx/configs/olimex-stm32-p207/nsh/defconfig
+++ b/nuttx/configs/olimex-stm32-p207/nsh/defconfig
@@ -370,6 +370,8 @@ CONFIG_ARCH_BUTTONS=y
CONFIG_ARCH_HAVE_IRQBUTTONS=y
CONFIG_ARCH_IRQBUTTONS=y
CONFIG_NSH_MMCSDMINOR=0
+CONFIG_LIB_BOARDCTL=y
+CONFIG_BOARDCTL_ADCTEST=y
#
# Board-Specific Options
diff --git a/nuttx/configs/olimex-stm32-p207/src/stm32_adc.c b/nuttx/configs/olimex-stm32-p207/src/stm32_adc.c
index 0665c44c65..96fc837b97 100644
--- a/nuttx/configs/olimex-stm32-p207/src/stm32_adc.c
+++ b/nuttx/configs/olimex-stm32-p207/src/stm32_adc.c
@@ -41,8 +41,11 @@
#include <errno.h>
#include <debug.h>
+
+#include <nuttx/board.h>
#include <nuttx/analog/adc.h>
#include <arch/board/board.h>
+
#include "chip.h"
#include "stm32_adc.h"
#include "olimex-stm32-p207.h"
@@ -103,7 +106,7 @@ static const uint32_t g_pinlist[ADC1_NCHANNELS] = {GPIO_ADC1_IN10};
************************************************************************************/
/************************************************************************************
- * Name: adc_devinit
+ * Name: board_adc_setup
*
* Description:
* All STM32 architectures must provide the following interface to work with
@@ -111,7 +114,7 @@ static const uint32_t g_pinlist[ADC1_NCHANNELS] = {GPIO_ADC1_IN10};
*
************************************************************************************/
-int adc_devinit(void)
+int board_adc_setup(void)
{
return stm32_adc_initialize();
}
diff --git a/nuttx/configs/sama5d3-xplained/src/sam_adc.c b/nuttx/configs/sama5d3-xplained/src/sam_adc.c
index 2d091745b4..f770ba5d22 100644
--- a/nuttx/configs/sama5d3-xplained/src/sam_adc.c
+++ b/nuttx/configs/sama5d3-xplained/src/sam_adc.c
@@ -42,6 +42,7 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/analog/adc.h>
#include "sam_adc.h"
@@ -110,7 +111,7 @@ int board_adc_initialize(void)
#endif /* CONFIG_ADC */
/************************************************************************************
- * Name: adc_devinit
+ * Name: board_adc_setup
*
* Description:
* All SAMA5 architectures must provide the following interface to work with
@@ -119,7 +120,7 @@ int board_adc_initialize(void)
************************************************************************************/
#ifdef CONFIG_EXAMPLES_ADC
-int adc_devinit(void)
+int board_adc_setup(void)
{
#ifdef CONFIG_SAMA5_ADC
return board_adc_initialize();
diff --git a/nuttx/configs/sama5d3x-ek/src/sam_adc.c b/nuttx/configs/sama5d3x-ek/src/sam_adc.c
index cc5614bd4a..bb082fd085 100644
--- a/nuttx/configs/sama5d3x-ek/src/sam_adc.c
+++ b/nuttx/configs/sama5d3x-ek/src/sam_adc.c
@@ -42,6 +42,7 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/analog/adc.h>
#include "sam_adc.h"
@@ -67,7 +68,7 @@
************************************************************************************/
/************************************************************************************
- * Name: adc_devinit
+ * Name: board_adc_setup
*
* Description:
* All STM32 architectures must provide the following interface to work with
@@ -75,7 +76,7 @@
*
************************************************************************************/
-int adc_devinit(void)
+int board_adc_setup(void)
{
#ifdef CONFIG_SAMA5_ADC
static bool initialized = false;
diff --git a/nuttx/configs/sama5d4-ek/src/sam_adc.c b/nuttx/configs/sama5d4-ek/src/sam_adc.c
index f45cc47995..13346a91b9 100644
--- a/nuttx/configs/sama5d4-ek/src/sam_adc.c
+++ b/nuttx/configs/sama5d4-ek/src/sam_adc.c
@@ -42,6 +42,7 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/analog/adc.h>
#include "sam_adc.h"
@@ -66,7 +67,7 @@
************************************************************************************/
/************************************************************************************
- * Name: adc_devinit
+ * Name: board_adc_setup
*
* Description:
* All STM32 architectures must provide the following interface to work with
@@ -74,7 +75,7 @@
*
************************************************************************************/
-int adc_devinit(void)
+int board_adc_setup(void)
{
#ifdef CONFIG_SAMA5_ADC
static bool initialized = false;
diff --git a/nuttx/configs/shenzhou/src/stm32_adc.c b/nuttx/configs/shenzhou/src/stm32_adc.c
index ee806a993e..1219040423 100644
--- a/nuttx/configs/shenzhou/src/stm32_adc.c
+++ b/nuttx/configs/shenzhou/src/stm32_adc.c
@@ -42,6 +42,7 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/analog/adc.h>
#include <arch/board/board.h>
@@ -112,7 +113,7 @@ static const uint32_t g_pinlist[ADC1_NCHANNELS] = {GPIO_ADC12_IN10}; //{GPIO_AD
************************************************************************************/
/************************************************************************************
- * Name: adc_devinit
+ * Name: board_adc_setup
*
* Description:
* All STM32 architectures must provide the following interface to work with
@@ -120,7 +121,7 @@ static const uint32_t g_pinlist[ADC1_NCHANNELS] = {GPIO_ADC12_IN10}; //{GPIO_AD
*
************************************************************************************/
-int adc_devinit(void)
+int board_adc_setup(void)
{
#ifdef CONFIG_STM32_ADC1
static bool initialized = false;
diff --git a/nuttx/configs/stm3210e-eval/src/stm32_adc.c b/nuttx/configs/stm3210e-eval/src/stm32_adc.c
index 5bd4090237..7a563c00c7 100644
--- a/nuttx/configs/stm3210e-eval/src/stm32_adc.c
+++ b/nuttx/configs/stm3210e-eval/src/stm32_adc.c
@@ -42,6 +42,7 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/analog/adc.h>
#include <arch/board/board.h>
@@ -103,7 +104,7 @@ static const uint32_t g_pinlist[ADC1_NCHANNELS] = {GPIO_ADC1_IN14};
************************************************************************************/
/************************************************************************************
- * Name: adc_devinit
+ * Name: board_adc_setup
*
* Description:
* All STM32 architectures must provide the following interface to work with
@@ -111,7 +112,7 @@ static const uint32_t g_pinlist[ADC1_NCHANNELS] = {GPIO_ADC1_IN14};
*
************************************************************************************/
-int adc_devinit(void)
+int board_adc_setup(void)
{
#ifdef CONFIG_STM32_ADC1
static bool initialized = false;
diff --git a/nuttx/configs/stm3220g-eval/src/stm32_adc.c b/nuttx/configs/stm3220g-eval/src/stm32_adc.c
index 6347f1cfe4..94f3c2d428 100644
--- a/nuttx/configs/stm3220g-eval/src/stm32_adc.c
+++ b/nuttx/configs/stm3220g-eval/src/stm32_adc.c
@@ -42,6 +42,7 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/analog/adc.h>
#include <arch/board/board.h>
@@ -107,7 +108,7 @@ static const uint32_t g_pinlist[ADC3_NCHANNELS] = {GPIO_ADC3_IN7};
************************************************************************************/
/************************************************************************************
- * Name: adc_devinit
+ * Name: board_adc_setup
*
* Description:
* All STM32 architectures must provide the following interface to work with
@@ -115,7 +116,7 @@ static const uint32_t g_pinlist[ADC3_NCHANNELS] = {GPIO_ADC3_IN7};
*
************************************************************************************/
-int adc_devinit(void)
+int board_adc_setup(void)
{
#ifdef CONFIG_STM32_ADC3
static bool initialized = false;
diff --git a/nuttx/configs/stm3240g-eval/src/stm32_adc.c b/nuttx/configs/stm3240g-eval/src/stm32_adc.c
index 9fba540237..9c613e098b 100644
--- a/nuttx/configs/stm3240g-eval/src/stm32_adc.c
+++ b/nuttx/configs/stm3240g-eval/src/stm32_adc.c
@@ -42,6 +42,7 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/analog/adc.h>
#include <arch/board/board.h>
@@ -107,7 +108,7 @@ static const uint32_t g_pinlist[ADC3_NCHANNELS] = {GPIO_ADC3_IN7};
************************************************************************************/
/************************************************************************************
- * Name: adc_devinit
+ * Name: board_adc_setup
*
* Description:
* All STM32 architectures must provide the following interface to work with
@@ -115,7 +116,7 @@ static const uint32_t g_pinlist[ADC3_NCHANNELS] = {GPIO_ADC3_IN7};
*
************************************************************************************/
-int adc_devinit(void)
+int board_adc_setup(void)
{
#ifdef CONFIG_STM32_ADC3
static bool initialized = false;
diff --git a/nuttx/configs/tm4c123g-launchpad/src/tm4c123g-launchpad.h b/nuttx/configs/tm4c123g-launchpad/src/tm4c123g-launchpad.h
index 145127e603..2d1bab2fe2 100644
--- a/nuttx/configs/tm4c123g-launchpad/src/tm4c123g-launchpad.h
+++ b/nuttx/configs/tm4c123g-launchpad/src/tm4c123g-launchpad.h
@@ -249,18 +249,5 @@ int tiva_timer_initialize(void);
int board_adc_initialize(void);
#endif
-/************************************************************************************
- * Name: adc_devinit
- *
- * Description:
- * All Tiva architectures must provide the following interface to work with
- * examples/adc.
- *
- ************************************************************************************/
-
-#if defined(CONFIG_TIVA_ADC) && defined(CONFIG_EXAMPLES_ADC)
-int adc_devinit(void);
-#endif
-
#endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_TM4C123G_LAUNCHPAD_TM4C123G_LAUNCHPAD_H */
diff --git a/nuttx/configs/tm4c123g-launchpad/src/tm4c_adc.c b/nuttx/configs/tm4c123g-launchpad/src/tm4c_adc.c
index 2c727c3b6a..f452a433e9 100644
--- a/nuttx/configs/tm4c123g-launchpad/src/tm4c_adc.c
+++ b/nuttx/configs/tm4c123g-launchpad/src/tm4c_adc.c
@@ -42,6 +42,7 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/analog/adc.h>
#include "tiva_adc.h"
@@ -136,7 +137,7 @@ int board_adc_initialize(void)
#endif /* CONFIG_ADC */
/************************************************************************************
- * Name: adc_devinit
+ * Name: board_adc_setup
*
* Description:
* All Tiva architectures must provide the following interface to work with
@@ -145,7 +146,7 @@ int board_adc_initialize(void)
************************************************************************************/
#ifdef CONFIG_EXAMPLES_ADC
-int adc_devinit(void)
+int board_adc_setup(void)
{
#ifdef CONFIG_TIVA_ADC
return board_adc_initialize();
@@ -159,7 +160,7 @@ int adc_devinit(void)
/* Tiva timer interface does not currently support user configuration */
-# if 0
+#if 0
/************************************************************************************
* Name: adc_timer_init
*
@@ -188,5 +189,6 @@ TIMER_HANDLE adc_timer_init(void)
return tiva_gptm_configure((const struct tiva_gptmconfig_s *)&adctimer);
}
-# endif
+
+#endif
#endif /* defined (CONFIG_TIVA_ADC) && defined (CONFIG_TIVA_TIMER) */
diff --git a/nuttx/configs/zkit-arm-1769/src/lpc17_adc.c b/nuttx/configs/zkit-arm-1769/src/lpc17_adc.c
index 932f8214cc..2ba54b4b72 100644
--- a/nuttx/configs/zkit-arm-1769/src/lpc17_adc.c
+++ b/nuttx/configs/zkit-arm-1769/src/lpc17_adc.c
@@ -47,6 +47,7 @@
#include <errno.h>
#include <debug.h>
+#include <nuttx/board.h>
#include <nuttx/analog/adc.h>
#include <arch/board/board.h>
@@ -75,7 +76,7 @@
************************************************************************************/
/************************************************************************************
- * Name: adc_devinit
+ * Name: board_adc_setup
*
* Description:
* All LPC17 architectures must provide the following interface to work with
@@ -83,7 +84,7 @@
*
************************************************************************************/
-int adc_devinit(void)
+int board_adc_setup(void)
{
static bool initialized = false;
struct adc_dev_s *adc;
diff --git a/nuttx/include/nuttx/board.h b/nuttx/include/nuttx/board.h
index 2942b02173..80ec312c6f 100644
--- a/nuttx/include/nuttx/board.h
+++ b/nuttx/include/nuttx/board.h
@@ -197,6 +197,32 @@ int board_tsc_setup(int minor);
void board_tsc_teardown(void);
/****************************************************************************
+ * Name: board_adc_setup
+ *
+ * Description:
+ * All architectures must provide the following interface in order to
+ * work with examples/adc.
+ *
+ ****************************************************************************/
+
+int board_adc_setup(void);
+
+/****************************************************************************
+ * Name: board_ioctl
+ *
+ * Description:
+ * If CONFIG_LIB_BOARDCTL=y, boards may also select CONFIG_BOARDCTL_IOCTL=y
+ * enable board specific commands. In this case, all commands not
+ * recognized by boardctl() will be forwarded to the board-provided
+ * board_ioctl() function.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_BOARDCTL_IOCTL
+int board_ioctl(unsigned int cmd, uintptr_t arg);
+#endif
+
+/****************************************************************************
* Name: board_led_initialize
*
* Description:
diff --git a/nuttx/include/sys/boardctl.h b/nuttx/include/sys/boardctl.h
index 675daa8025..8da574ec34 100644
--- a/nuttx/include/sys/boardctl.h
+++ b/nuttx/include/sys/boardctl.h
@@ -69,11 +69,28 @@
* ARG: None
* CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_TSCTEST
* DEPENDENCIES: Board logic must provide board_tsc_teardown()
+ *
+ * CMD: BOARDIOC_ADCTEST_SETUP
+ * DESCRIPTION: ADC controller test configuration
+ * ARG: None
+ * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_ADCTEST
+ * DEPENDENCIES: Board logic must provide board_adc_setup()
+ *
*/
#define BOARDIOC_INIT _BOARDIOC(0x0001)
#define BOARDIOC_TSCTEST_SETUP _BOARDIOC(0x0002)
#define BOARDIOC_TSCTEST_TEARDOWN _BOARDIOC(0x0003)
+#define BOARDIOC_ADCTEST_SETUP _BOARDIOC(0x0004)
+
+/* If CONFIG_BOARDCTL_IOCTL=y, then boad-specific commands will be support.
+ * In this case, all commands not recognized by boardctl() will be forwarded
+ * to the board-provided board_ioctl() function.
+ *
+ * User defined board commands may begin with this value:
+ */
+
+#define BOARDIOC_USER _BOARDIOC(0x0005)
/****************************************************************************
* Public Type Definitions