diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2015-03-31 15:00:23 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2015-03-31 15:00:23 -0600 |
commit | 494dfe2ae6157348956b941eb7a1f57b66181a56 (patch) | |
tree | 7201b16b309f34b73f46936ed1980c0ef0b8154a /nuttx/configs | |
parent | 49a7570f92a3ae31838f2eea2fa71354361f2881 (diff) | |
download | px4-nuttx-494dfe2ae6157348956b941eb7a1f57b66181a56.tar.gz px4-nuttx-494dfe2ae6157348956b941eb7a1f57b66181a56.tar.bz2 px4-nuttx-494dfe2ae6157348956b941eb7a1f57b66181a56.zip |
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.
Diffstat (limited to 'nuttx/configs')
21 files changed, 97 insertions, 47 deletions
diff --git a/nuttx/configs/Kconfig b/nuttx/configs/Kconfig index c1dc72ca9..4fe6e0928 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 d865fff68..953b3e2d0 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 d78497fec..70e3578dd 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 3b361d644..898f746b0 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 0ae4423b4..7b0fe4826 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 8c4b561f6..9f231e8f4 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 f1b1ffa7a..e6aaf7cc4 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 dd18ba95a..37715abaa 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 bff9debac..3ba3b6549 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 f91cbe0ad..b70e024f7 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 0665c44c6..96fc837b9 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 2d091745b..f770ba5d2 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 cc5614bd4..bb082fd08 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 f45cc4799..13346a91b 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 ee806a993..121904042 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 5bd409023..7a563c00c 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 6347f1cfe..94f3c2d42 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 9fba54023..9c613e098 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 145127e60..2d1bab2fe 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 2c727c3b6..f452a433e 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 932f8214c..2ba54b4b7 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; |