diff --git a/configs/Kconfig b/configs/Kconfig index bc45349949..bf770edd1d 100644 --- a/configs/Kconfig +++ b/configs/Kconfig @@ -2351,14 +2351,6 @@ config BOARDCTL_USBDEVCTRL ---help--- Enables support for the BOARDIOC_USBDEV_CONTROL boardctl() command. -config BOARDCTL_TSCTEST - bool "Enable touchscreen test interfaces" - default n - ---help--- - Enables support for the BOARDIOC_TSCTEST_SETUP and - BOARDIOC_TSCTEST_TEARDOWN boardctl() commands. Architecture - specific logic must provide the board_tsc_setup() interface. - config BOARDCTL_IOCTL bool "Board-specific boardctl() commands" default n diff --git a/configs/arduino-due/src/arduino-due.h b/configs/arduino-due/src/arduino-due.h index 0e2b6736b3..01768855d7 100644 --- a/configs/arduino-due/src/arduino-due.h +++ b/configs/arduino-due/src/arduino-due.h @@ -166,7 +166,7 @@ * and the SD card. * 2. UART0 cannot be used. USARTs on the COMM connector should be available. * 3. Parallel data is not contiguous in the PIO register - * 4. Touchcontroller /CS pin is connected to ground (always selected). + * 4. Touch controller /CS pin is connected to ground (always selected). * 5. Either PA28 or PC29 may drive PWM10 */ @@ -308,7 +308,7 @@ * Public Functions ************************************************************************************/ -/**************************************************************************** +/************************************************************************************ * Name: sam_bringup * * Description: @@ -320,23 +320,44 @@ * CONFIG_BOARD_INITIALIZE=y && CONFIG_LIB_BOARDCTL=y : * Called from the NSH library * - ****************************************************************************/ + ************************************************************************************/ int sam_bringup(void); -/**************************************************************************** +/************************************************************************************ * Name: sam_sdinitialize * * Description: * Initialize the SPI-based SD card. * - ****************************************************************************/ + ************************************************************************************/ #if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \ defined(CONFIG_MMCSD_SPI) int sam_sdinitialize(int minor); #endif +/************************************************************************************ + * Name: sam_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen + * device. This function will register the driver as /dev/inputN where N is the + * minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to + * indicate the nature of the failure. + * + ************************************************************************************/ + +#if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \ + defined(CONFIG_INPUT_ADS7843E) +int sam_tsc_setup(int minor); +#endif #endif /* __ASSEMBLY__ */ #endif /* __CONFIGS_ARDUINO_DUE_SRC_ARDUNO_DUE_H */ diff --git a/configs/arduino-due/src/sam_bringup.c b/configs/arduino-due/src/sam_bringup.c index 298a5b0dbb..50dc141500 100644 --- a/configs/arduino-due/src/sam_bringup.c +++ b/configs/arduino-due/src/sam_bringup.c @@ -118,6 +118,17 @@ int sam_bringup(void) } #endif +#if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \ + defined(CONFIG_INPUT_ADS7843E) + /* Initialize the touchscreen */ + + ret = sam_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_tsc_setup failed: %d\n", ret); + } +#endif + UNUSED(ret); return OK; } diff --git a/configs/arduino-due/src/sam_touchscreen.c b/configs/arduino-due/src/sam_touchscreen.c index 2c20c0f2b2..b03ba31fb8 100644 --- a/configs/arduino-due/src/sam_touchscreen.c +++ b/configs/arduino-due/src/sam_touchscreen.c @@ -336,13 +336,12 @@ static FAR struct spi_dev_s *sam_tsc_spiinitialize(void) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: sam_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -353,7 +352,7 @@ static FAR struct spi_dev_s *sam_tsc_spiinitialize(void) * ****************************************************************************/ -int board_tsc_setup(int minor) +int sam_tsc_setup(int minor) { FAR struct spi_dev_s *dev; static bool initialized = false; diff --git a/configs/boardctl.c b/configs/boardctl.c index a1f4f6ebc6..d7e6d3c4ee 100644 --- a/configs/boardctl.c +++ b/configs/boardctl.c @@ -401,21 +401,6 @@ int boardctl(unsigned int cmd, uintptr_t arg) break; #endif -#ifdef CONFIG_BOARDCTL_TSCTEST - /* CMD: BOARDIOC_TSCTEST_SETUP - * DESCRIPTION: Touchscreen controller test configuration - * ARG: Touch controller device minor number - * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_TSCTEST - * DEPENDENCIES: Board logic must provide board_tsc_setup() - */ - - case BOARDIOC_TSCTEST_SETUP: - { - ret = board_tsc_setup((int)arg); - } - break; -#endif - default: { #ifdef CONFIG_BOARDCTL_IOCTL diff --git a/configs/hymini-stm32v/src/hymini-stm32v.h b/configs/hymini-stm32v/src/hymini-stm32v.h index f821d03465..cdfd96704a 100644 --- a/configs/hymini-stm32v/src/hymini-stm32v.h +++ b/configs/hymini-stm32v/src/hymini-stm32v.h @@ -1,7 +1,7 @@ /************************************************************************************ * configs/hymini-stm32v/src/hymini-stm32v.h * - * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * Laurent Latil * @@ -122,7 +122,7 @@ * ************************************************************************************/ -extern void weak_function stm32_spidev_initialize(void); +void weak_function stm32_spidev_initialize(void); /************************************************************************************ * Name: stm32_usbinitialize @@ -132,7 +132,28 @@ extern void weak_function stm32_spidev_initialize(void); * ************************************************************************************/ -extern void weak_function stm32_usbinitialize(void); +void weak_function stm32_usbinitialize(void); + +/************************************************************************************ + * Name: stm32_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen + * device. This function will register the driver as /dev/inputN where N is the + * minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to + * indicate the nature of the failure. + * + ************************************************************************************/ + +#ifdef CONFIG_INPUT +int stm32_tsc_setup(int minor); +#endif #endif /* __ASSEMBLY__ */ #endif /* __CONFIGS_HYMINI_STM32V_H */ diff --git a/configs/hymini-stm32v/src/stm32_appinit.c b/configs/hymini-stm32v/src/stm32_appinit.c index 5b99c4445b..85be09ecb7 100644 --- a/configs/hymini-stm32v/src/stm32_appinit.c +++ b/configs/hymini-stm32v/src/stm32_appinit.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/hymini-stm32v/src/stm32_appinit.c * - * Copyright (C) 2009, 2011, 2016-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011, 2016-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -170,10 +170,11 @@ static int nsh_cdinterrupt(int irq, FAR void *context, FAR void *arg) int board_app_initialize(uintptr_t arg) { -#ifdef NSH_HAVEMMCSD int ret; +#ifdef NSH_HAVEMMCSD /* Card detect */ + bool cd_status; /* Configure the card detect GPIO */ @@ -220,5 +221,17 @@ int board_app_initialize(uintptr_t arg) sdio_mediachange(g_sdiodev, cd_status); #endif + +#ifdef CONFIG_INPUT + /* Initialize the touchscreen */ + + ret = stm32_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); + } +#endif + + UNUSED(ret); return OK; } diff --git a/configs/hymini-stm32v/src/stm32_ts.c b/configs/hymini-stm32v/src/stm32_ts.c index 529a3fc1a6..59f7caa050 100644 --- a/configs/hymini-stm32v/src/stm32_ts.c +++ b/configs/hymini-stm32v/src/stm32_ts.c @@ -53,7 +53,7 @@ #include "hymini-stm32v.h" /************************************************************************************ - * Pre-processor Defintiions + * Pre-processor Definitions ************************************************************************************/ #if !defined(CONFIG_STM32_SPI1) @@ -136,13 +136,12 @@ static bool hymini_ts_pendown(FAR struct ads7843e_config_s *state) } /**************************************************************************** - * Name: board_tsc_setup + * Name: stm32_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -153,7 +152,7 @@ static bool hymini_ts_pendown(FAR struct ads7843e_config_s *state) * ****************************************************************************/ -int board_tsc_setup(int minor) +int stm32_tsc_setup(int minor) { FAR struct spi_dev_s *dev; diff --git a/configs/lpcxpresso-lpc54628/fb/defconfig b/configs/lpcxpresso-lpc54628/fb/defconfig index 2dc326a079..afc8562724 100644 --- a/configs/lpcxpresso-lpc54628/fb/defconfig +++ b/configs/lpcxpresso-lpc54628/fb/defconfig @@ -1,5 +1,4 @@ # CONFIG_ARCH_FPU is not set -# CONFIG_EXAMPLES_TOUCHSCREEN_ARCHINIT is not set CONFIG_ARCH_BOARD_LPCXPRESSO_LPC54628=y CONFIG_ARCH_BOARD="lpcxpresso-lpc54628" CONFIG_ARCH_CHIP_LPC54628=y diff --git a/configs/lpcxpresso-lpc54628/nxwm/defconfig b/configs/lpcxpresso-lpc54628/nxwm/defconfig index 5bc987dbb5..47cda398c4 100644 --- a/configs/lpcxpresso-lpc54628/nxwm/defconfig +++ b/configs/lpcxpresso-lpc54628/nxwm/defconfig @@ -2,7 +2,6 @@ # CONFIG_NX_DISABLE_16BPP is not set # CONFIG_NXFONTS_DISABLE_16BPP is not set # CONFIG_NXTK_DEFAULT_BORDERCOLORS is not set -# CONFIG_NXWM_TOUCHSCREEN_DEVINIT is not set CONFIG_ARCH_BOARD_LPCXPRESSO_LPC54628=y CONFIG_ARCH_BOARD="lpcxpresso-lpc54628" CONFIG_ARCH_CHIP_LPC54628=y diff --git a/configs/lpcxpresso-lpc54628/src/lpc54_ft5x06.c b/configs/lpcxpresso-lpc54628/src/lpc54_ft5x06.c index 84b4ede70b..8893f08ff6 100644 --- a/configs/lpcxpresso-lpc54628/src/lpc54_ft5x06.c +++ b/configs/lpcxpresso-lpc54628/src/lpc54_ft5x06.c @@ -245,20 +245,4 @@ int lpc54_ft5x06_register(void) return OK; } -/**************************************************************************** - * Name: board_tsc_setup - * - * Description: - * Stubs for expected interfaces. This implementation does not permit the - * application to mange the touch screen controller. - * - ****************************************************************************/ - -#ifdef CONFIG_BOARDCTL_TSCTEST -int board_tsc_setup(int minor) -{ - DEBUGASSERT(minor == 0); - return OK; -} - #endif /* HAVE_FT5x06*/ diff --git a/configs/mikroe-stm32f4/src/mikroe-stm32f4.h b/configs/mikroe-stm32f4/src/mikroe-stm32f4.h index 4b8bcc3daf..0df889c424 100644 --- a/configs/mikroe-stm32f4/src/mikroe-stm32f4.h +++ b/configs/mikroe-stm32f4/src/mikroe-stm32f4.h @@ -1,7 +1,7 @@ /**************************************************************************************************** * configs/mikroe-stm32f4/src/mikroe-stm32f4.h * - * Copyright (C) 2011-2013, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2013, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -218,7 +218,7 @@ void weak_function stm32_spidev_initialize(void); * Name: stm32_usbinitialize * * Description: - * Called from stm32_usbinitialize very early in inialization to setup USB-related + * Called from stm32_usbinitialize very early in initialization to setup USB-related * GPIO pins for the Mikroe-stm32f4 board. * ****************************************************************************************************/ @@ -227,13 +227,13 @@ void weak_function stm32_spidev_initialize(void); void weak_function stm32_usbinitialize(void); #endif -/************************************************************************************ +/**************************************************************************************************** * Name: stm32_pwm_setup * * Description: * Initialize PWM and register the PWM device. * - ************************************************************************************/ + ****************************************************************************************************/ #ifdef CONFIG_PWM int stm32_pwm_setup(void); @@ -252,13 +252,13 @@ int stm32_pwm_setup(void); # error "The Mikroe-STM32F4 board does not support HOST OTG, only device!" #endif -/**************************************************************************** +/**************************************************************************************************** * Name: stm32_qencoder_initialize * * Description: * Initialize and register a qencoder * - ****************************************************************************/ + ****************************************************************************************************/ #ifdef CONFIG_SENSORS_QENCODER int stm32_qencoder_initialize(FAR const char *devpath, int timer); @@ -277,6 +277,26 @@ int stm32_qencoder_initialize(FAR const char *devpath, int timer); void stm32_lcdinitialize(void); #endif +/**************************************************************************************************** + * Name: stm32_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen device. This + * function will register the driver as /dev/inputN where N is the minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to indicate the + * nature of the failure. + * + ****************************************************************************************************/ + +#ifdef CONFIG_INPUT +int stm32_tsc_setup(int minor); +#endif + /**************************************************************************************************** * Name: up_vs1053initialize * diff --git a/configs/mikroe-stm32f4/src/stm32_appinit.c b/configs/mikroe-stm32f4/src/stm32_appinit.c index 134f819fc4..18028def31 100644 --- a/configs/mikroe-stm32f4/src/stm32_appinit.c +++ b/configs/mikroe-stm32f4/src/stm32_appinit.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/mikroe_stm32f4/src/stm32_appinit.c * - * Copyright (C) 2012-2013, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -350,6 +350,16 @@ int board_app_initialize(uintptr_t arg) } #endif +#ifdef CONFIG_INPUT + /* Initialize the touchscreen */ + + ret = stm32_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef CONFIG_PWM /* Initialize PWM and register the PWM device. */ diff --git a/configs/mikroe-stm32f4/src/stm32_touchscreen.c b/configs/mikroe-stm32f4/src/stm32_touchscreen.c index ec1cb2e00e..efdb46d9a2 100644 --- a/configs/mikroe-stm32f4/src/stm32_touchscreen.c +++ b/configs/mikroe-stm32f4/src/stm32_touchscreen.c @@ -1474,13 +1474,12 @@ errout: ************************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: stm32_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -1491,7 +1490,7 @@ errout: * ****************************************************************************/ -int board_tsc_setup(int minor) +int stm32_tsc_setup(int minor) { FAR struct tc_dev_s *priv; char devname[DEV_NAMELEN]; diff --git a/configs/olimex-lpc1766stk/src/lpc1766stk.h b/configs/olimex-lpc1766stk/src/lpc1766stk.h index e591862819..bb67e6b7ef 100644 --- a/configs/olimex-lpc1766stk/src/lpc1766stk.h +++ b/configs/olimex-lpc1766stk/src/lpc1766stk.h @@ -1,7 +1,7 @@ /************************************************************************************ * configs/olimex-lpc1766stk/src/lpc1766stk.h * - * Copyright (C) 2010-2011, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2010-2011, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -272,6 +272,27 @@ void weak_function lpc1766stk_sspdev_initialize(void); int lpc1766stk_can_setup(void); #endif +/************************************************************************************ + * Name: lpc1766stk_hidmouse_setup + * + * Description: + * This function is called by board-bringup logic to configure the HID mouse + * device. This function will register the driver as /dev/inputN where N is the + * minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to + * indicate the nature of the failure. + * + ************************************************************************************/ + +#ifdef CONFIG_USBHOST_HIDMOUSE +int lpc1766stk_hidmouse_setup(int minor); +#endif + #endif /* __ASSEMBLY__ */ #endif /* _CONFIGS_OLIMEX_LPC1766STK_SRC_LPC1766STK_H */ diff --git a/configs/olimex-lpc1766stk/src/lpc17_appinit.c b/configs/olimex-lpc1766stk/src/lpc17_appinit.c index 22e4858fc3..8c3d455e9a 100644 --- a/configs/olimex-lpc1766stk/src/lpc17_appinit.c +++ b/configs/olimex-lpc1766stk/src/lpc17_appinit.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/olimex-lpc1766stk/src/lpc17_appinit.c * - * Copyright (C) 2010, 2013-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013-2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -362,6 +362,16 @@ int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); } +#ifdef CONFIG_USBHOST_HIDMOUSE + /* Initialize the HID Mouse class */ + + ret = lpc1766stk_hidmouse_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: lpc1766stk_hidmouse_setup failed: %d\n", ret); + } +#endif + #ifdef CONFIG_CAN /* Initialize CAN and register the CAN driver. */ diff --git a/configs/olimex-lpc1766stk/src/lpc17_hidmouse.c b/configs/olimex-lpc1766stk/src/lpc17_hidmouse.c index a44d62cbab..c4b6792d12 100644 --- a/configs/olimex-lpc1766stk/src/lpc17_hidmouse.c +++ b/configs/olimex-lpc1766stk/src/lpc17_hidmouse.c @@ -71,17 +71,15 @@ ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: lpc1766stk_hidmouse_setup * * Description: - * Each board that supports a touchscreen device must provide this - * function. This function is called by application-specific, setup logic - * to configure the USB HID mouse driver that emulates a touchscreen - * device. This function will register the driver as /dev/mouseN where N - * is the minor device number. + * This function is called by board-bringup logic to configure the HID + * mouse device. This function will register the driver as /dev/inputN + * where N is the minor device number. * * Input Parameters: - * minor - The mouse device minor number + * minor - The mouse device minor number * * Returned Value: * Zero is returned on success. Otherwise, a negated errno value is @@ -89,7 +87,7 @@ * ****************************************************************************/ -int board_tsc_setup(int minor) +int lpc1766stk_hidmouse_setup(int minor) { static bool initialized = false; int ret; diff --git a/configs/open1788/src/lpc17_appinit.c b/configs/open1788/src/lpc17_appinit.c index 19cc0ee0ac..ee557911a5 100644 --- a/configs/open1788/src/lpc17_appinit.c +++ b/configs/open1788/src/lpc17_appinit.c @@ -89,6 +89,6 @@ int board_app_initialize(uintptr_t arg) #else /* Perform board-specific initialization */ - return lpc17_bringup(); + return open1788_bringup(); #endif } diff --git a/configs/open1788/src/lpc17_boardinitialize.c b/configs/open1788/src/lpc17_boardinitialize.c index 12109ea14e..1058f6cc7e 100644 --- a/configs/open1788/src/lpc17_boardinitialize.c +++ b/configs/open1788/src/lpc17_boardinitialize.c @@ -137,6 +137,6 @@ void board_initialize(void) { /* Perform board-specific initialization */ - (void)lpc17_bringup(); + (void)open1788_bringup(); } #endif diff --git a/configs/open1788/src/lpc17_bringup.c b/configs/open1788/src/lpc17_bringup.c index 98a79fcf4e..047c31df84 100644 --- a/configs/open1788/src/lpc17_bringup.c +++ b/configs/open1788/src/lpc17_bringup.c @@ -245,12 +245,11 @@ static int nsh_sdinitialize(void) lpc17_configgpio(GPIO_SD_CD); +#ifdef NSH_HAVE_MMCSD_CDINT /* Attach an interrupt handler to get notifications when a card is * inserted or deleted. */ -#ifdef NSH_HAVE_MMCSD_CDINT - (void)irq_attach(LPC17_IRQ_P0p13, nsh_cdinterrupt, NULL); up_enable_irq(LPC17_IRQ_P0p13); @@ -361,7 +360,7 @@ static int nsh_usbhostinitialize(void) ****************************************************************************/ /**************************************************************************** - * Name: lpc17_bringup + * Name: open1788_bringup * * Description: * Perform architecture-specific initialization @@ -374,7 +373,7 @@ static int nsh_usbhostinitialize(void) * ****************************************************************************/ -int lpc17_bringup(void) +int open1788_bringup(void) { int ret; @@ -398,6 +397,16 @@ int lpc17_bringup(void) } #endif +#ifdef CONFIG_INPUT_ADS7843E + /* Initialize the touchscreen */ + + ret = open1788_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: open1788_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef CONFIG_OPEN1788_DJOYSTICK /* Initialize and register the joystick driver */ diff --git a/configs/open1788/src/lpc17_touchscreen.c b/configs/open1788/src/lpc17_touchscreen.c index 03416505ff..6c72a9205e 100644 --- a/configs/open1788/src/lpc17_touchscreen.c +++ b/configs/open1788/src/lpc17_touchscreen.c @@ -1,6 +1,5 @@ /************************************************************************************ * configs/open1788/src/lpc17_touchscreen.c - * arch/arm/src/board/lpc17_touchscreen.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -255,13 +254,12 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: open1788_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this - * function. This function is called by application-specific, setup logic - * to configure the touchscreen device. This function will register the - * driver as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -272,7 +270,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) * ****************************************************************************/ -int board_tsc_setup(int minor) +int open1788_tsc_setup(int minor) { static bool initialized = false; FAR struct spi_dev_s *dev; diff --git a/configs/open1788/src/open1788.h b/configs/open1788/src/open1788.h index 589d78b261..4a8254348b 100644 --- a/configs/open1788/src/open1788.h +++ b/configs/open1788/src/open1788.h @@ -2,7 +2,7 @@ * configs/open1788/src/open1788.h * arch/arm/src/board/open1788.n * - * Copyright (C) 2013, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -162,7 +162,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: lpc17_bringup + * Name: open1788_bringup * * Description: * Perform architecture-specific initialization @@ -175,7 +175,7 @@ * ************************************************************************************/ -int lpc17_bringup(void); +int open1788_bringup(void); /************************************************************************************ * Name: open1788_sspdev_initialize @@ -237,13 +237,34 @@ void open1788_nand_initialize(void); void open1788_lcd_initialize(void); #endif -/**************************************************************************** +/************************************************************************************ + * Name: open1788_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen + * device. This function will register the driver as /dev/inputN where N is the + * minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to + * indicate the nature of the failure. + * + ************************************************************************************/ + +#ifdef CONFIG_INPUT_ADS7843E +int open1788_tsc_setup(int minor); +#endif + +/************************************************************************************ * Name: lpc17_djoy_initialization * * Description: * Initialize and register the discrete joystick driver * - ****************************************************************************/ + ************************************************************************************/ #ifdef CONFIG_OPEN1788_DJOYSTICK int lpc17_djoy_initialization(void); diff --git a/configs/pic32mx7mmb/src/pic32_bringup.c b/configs/pic32mx7mmb/src/pic32_bringup.c index c082621356..81fc7e98e7 100644 --- a/configs/pic32mx7mmb/src/pic32_bringup.c +++ b/configs/pic32mx7mmb/src/pic32_bringup.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/pic32mx7mmb/src/pic32_bringup.c * - * Copyright (C) 2012, 2016-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2016-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -407,5 +407,15 @@ int pic32mx_bringup(void) ret = nsh_usbdevinitialize(); } +#ifdef CONFIG_INPUT + /* Initialize the touchscreen */ + + ret = pic32mx_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: pic32mx_tsc_setup failed: %d\n", ret); + } +#endif + return ret; } diff --git a/configs/pic32mx7mmb/src/pic32_touchscreen.c b/configs/pic32mx7mmb/src/pic32_touchscreen.c index f0ed889a2f..3974d6a358 100644 --- a/configs/pic32mx7mmb/src/pic32_touchscreen.c +++ b/configs/pic32mx7mmb/src/pic32_touchscreen.c @@ -1343,13 +1343,12 @@ errout: ************************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: pic32mx_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -1360,7 +1359,7 @@ errout: * ****************************************************************************/ -int board_tsc_setup(int minor) +int pic32mx_tsc_setup(int minor) { FAR struct tc_dev_s *priv; char devname[DEV_NAMELEN]; diff --git a/configs/pic32mx7mmb/src/pic32mx7mmb.h b/configs/pic32mx7mmb/src/pic32mx7mmb.h index da60ef9b6f..f28e0cb901 100644 --- a/configs/pic32mx7mmb/src/pic32mx7mmb.h +++ b/configs/pic32mx7mmb/src/pic32mx7mmb.h @@ -1,7 +1,7 @@ /**************************************************************************** * configs/pic32mx7mmb/src/pic32mx7mmb.h * - * Copyright (C) 2012, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -119,33 +119,33 @@ extern "C" { #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_spidev_initialize * * Description: - * Called to configure SPI chip select GPIO pins for the Mikroelektronika PIC32MX7 - * MMB board. + * Called to configure SPI chip select GPIO pins for the Mikroelektronika + * PIC32MX7 MMB board. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_PIC32MX_SPI1) || defined(CONFIG_PIC32MX_SPI2) || \ defined(CONFIG_PIC32MX_SPI3) || defined(CONFIG_PIC32MX_SPI4) void weak_function pic32mx_spidev_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_led_initialize * * Description: * Configure on-board LEDs if LED support has been selected. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_LEDS void pic32mx_led_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: pic32mx_bringup * * Description: @@ -157,7 +157,7 @@ void pic32mx_led_initialize(void); * CONFIG_BOARD_INITIALIZE=y && CONFIG_LIB_BOARDCTL=y : * Called from the NSH library * - ************************************************************************************/ + ****************************************************************************/ int pic32mx_bringup(void); @@ -173,6 +173,27 @@ int pic32mx_bringup(void); void pic32mx_lcdinitialize(void); +/**************************************************************************** + * Name: pic32mx_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is + * returned to indicate the nature of the failure. + * + ****************************************************************************/ + +#ifdef CONFIG_INPUT +int pic32mx_tsc_setup(int minor); +#endif + #undef EXTERN #ifdef __cplusplus } diff --git a/configs/sam3u-ek/nxwm/defconfig b/configs/sam3u-ek/nxwm/defconfig index 3e21c6bd89..feb067d7a5 100644 --- a/configs/sam3u-ek/nxwm/defconfig +++ b/configs/sam3u-ek/nxwm/defconfig @@ -19,7 +19,6 @@ CONFIG_ARCH="arm" CONFIG_ARMV7M_OABI_TOOLCHAIN=y CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y CONFIG_BOARD_LOOPSPERMSEC=8720 -CONFIG_BOARDCTL_TSCTEST=y CONFIG_CXX_NEWLONG=y CONFIG_DISABLE_POLL=y CONFIG_HAVE_CXX=y diff --git a/configs/sam3u-ek/src/sam3u-ek.h b/configs/sam3u-ek/src/sam3u-ek.h index 714ff54c2a..87119e417d 100644 --- a/configs/sam3u-ek/src/sam3u-ek.h +++ b/configs/sam3u-ek/src/sam3u-ek.h @@ -1,7 +1,7 @@ /************************************************************************************ * configs/sam3u-ek/src/sam3u-ek.h * - * Copyright (C) 2009-2011, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2011, 2013, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -263,5 +263,26 @@ bool sam_writeprotected(unsigned char slot); # define sam_writeprotected(slot) (false) #endif +/************************************************************************************ + * Name: sam_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen + * device. This function will register the driver as /dev/inputN where N is the + * minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to + * indicate the nature of the failure. + * + ***********************************************************************************/ + +#ifdef CONFIG_INPUT_ADS7843E +int sam_tsc_setup(int minor); +#endif + #endif /* __ASSEMBLY__ */ #endif /* __CONFIGS_SAM3U_EK_SRC_SAM3U_EK_H */ diff --git a/configs/sam3u-ek/src/sam_appinit.c b/configs/sam3u-ek/src/sam_appinit.c index 00f2cd2e21..3de2d64e61 100644 --- a/configs/sam3u-ek/src/sam_appinit.c +++ b/configs/sam3u-ek/src/sam_appinit.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/sam3u-ek/src/sam_appinit.c * - * Copyright (C) 2010, 2013, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -128,9 +128,10 @@ int board_app_initialize(uintptr_t arg) { + int ret; + #ifdef NSH_HAVE_MMCSD FAR struct sdio_dev_s *sdio; - int ret; /* Mount the SDIO-based MMC/SD block driver */ /* First, get an instance of the SDIO interface */ @@ -164,5 +165,17 @@ int board_app_initialize(uintptr_t arg) sdio_mediachange(sdio, sam_cardinserted(0)); #endif + +#ifdef CONFIG_INPUT + /* Initialize the touchscreen */ + + ret = sam_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_tsc_setup failed: %d\n", ret); + } +#endif + + UNUSED(ret); return OK; } diff --git a/configs/sam3u-ek/src/sam_touchscreen.c b/configs/sam3u-ek/src/sam_touchscreen.c index 398838710f..da529f2d87 100644 --- a/configs/sam3u-ek/src/sam_touchscreen.c +++ b/configs/sam3u-ek/src/sam_touchscreen.c @@ -216,13 +216,12 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: sam_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -233,7 +232,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) * ****************************************************************************/ -int board_tsc_setup(int minor) +int sam_tsc_setup(int minor) { FAR struct spi_dev_s *dev; int ret; @@ -273,4 +272,3 @@ int board_tsc_setup(int minor) } #endif /* CONFIG_INPUT_ADS7843E */ - diff --git a/configs/sam4e-ek/src/sam4e-ek.h b/configs/sam4e-ek/src/sam4e-ek.h index 591b90be1f..dacbe51098 100644 --- a/configs/sam4e-ek/src/sam4e-ek.h +++ b/configs/sam4e-ek/src/sam4e-ek.h @@ -1,7 +1,7 @@ /************************************************************************************ * configs/sam4e-ek/src/sam4e-ek.h * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2014, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -440,14 +440,14 @@ bool sam_writeprotected(int slotno); # define sam_writeprotected(slotno) (false) #endif -/**************************************************************************** +/************************************************************************************ * Name: sam_at25_automount * * Description: * Initialize, configure, and mount the AT25 serial FLASH. The FLASH will * be mounted at /dev/at25. * - ****************************************************************************/ + ************************************************************************************/ #ifdef HAVE_AT25 int sam_at25_automount(int minor); @@ -455,5 +455,26 @@ int sam_at25_automount(int minor); # define sam_at25_automount(minor) (-ENOSYS) #endif +/************************************************************************************ + * Name: sam_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen + * device. This function will register the driver as /dev/inputN where N is the + * minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to + * indicate the nature of the failure. + * + ***********************************************************************************/ + +#ifdef CONFIG_INPUT_ADS7843E +int sam_tsc_setup(int minor); +#endif + #endif /* __ASSEMBLY__ */ #endif /* __CONFIGS_SAM4E_EK_SRC_SAM4E_EK_H */ diff --git a/configs/sam4e-ek/src/sam_ads7843e.c b/configs/sam4e-ek/src/sam_ads7843e.c index aeeddceb27..b925125a51 100644 --- a/configs/sam4e-ek/src/sam_ads7843e.c +++ b/configs/sam4e-ek/src/sam_ads7843e.c @@ -213,13 +213,12 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: sam_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -230,7 +229,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) * ****************************************************************************/ -int board_tsc_setup(int minor) +int sam_tsc_setup(int minor) { FAR struct spi_dev_s *dev; int ret; diff --git a/configs/sam4e-ek/src/sam_appinit.c b/configs/sam4e-ek/src/sam_appinit.c index b9ec0bcf11..38c239602f 100644 --- a/configs/sam4e-ek/src/sam_appinit.c +++ b/configs/sam4e-ek/src/sam_appinit.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/sam4e-ek/src/sam_appinit.c * - * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2014, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -89,9 +89,7 @@ int board_app_initialize(uintptr_t arg) { -#if defined(HAVE_AT25) || defined(HAVE_HSMCI) || defined(HAVE_USBMONITOR) int ret; -#endif #ifdef HAVE_AT25 /* Initialize the AT25 driver */ @@ -115,6 +113,16 @@ int board_app_initialize(uintptr_t arg) } #endif +#ifdef CONFIG_INPUT_ADS7843E + /* Initialize the touchscreen */ + + ret = sam_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef HAVE_USBMONITOR /* Start the USB Monitor */ @@ -126,5 +134,6 @@ int board_app_initialize(uintptr_t arg) } #endif + UNUSED(ret); return OK; } diff --git a/configs/sama5d3x-ek/nxwm/defconfig b/configs/sama5d3x-ek/nxwm/defconfig index 998bd7c252..005230b47f 100644 --- a/configs/sama5d3x-ek/nxwm/defconfig +++ b/configs/sama5d3x-ek/nxwm/defconfig @@ -12,7 +12,6 @@ CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH="arm" CONFIG_ARMV7A_TOOLCHAIN_CODESOURCERYW=y CONFIG_BOARD_LOOPSPERMSEC=49341 -CONFIG_BOARDCTL_TSCTEST=y CONFIG_BUILTIN=y CONFIG_DISABLE_POLL=y CONFIG_FLASH_SIZE=134217728 diff --git a/configs/sama5d3x-ek/src/sam_appinit.c b/configs/sama5d3x-ek/src/sam_appinit.c index 0d3083ad2b..5da376d042 100644 --- a/configs/sama5d3x-ek/src/sam_appinit.c +++ b/configs/sama5d3x-ek/src/sam_appinit.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/sama5d3x-ek/src/sam_appinit.c * - * Copyright (C) 2013-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -173,6 +173,16 @@ int board_app_initialize(uintptr_t arg) } #endif +#ifdef CONFIG_SAMA5_TSD + /* Initialize the touchscreen */ + + ret = sam_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef HAVE_WM8904 /* Configure WM8904 audio */ diff --git a/configs/sama5d3x-ek/src/sam_touchscreen.c b/configs/sama5d3x-ek/src/sam_touchscreen.c index ced5853522..cbeba1ec02 100644 --- a/configs/sama5d3x-ek/src/sam_touchscreen.c +++ b/configs/sama5d3x-ek/src/sam_touchscreen.c @@ -64,34 +64,17 @@ # define CONFIG_SAMA5D3xEK_TSD_DEVMINOR 0 #endif -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: sam_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this - * function. This function is called by application-specific, setup logic - * to configure the touchscreen device. This function will register the - * driver as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -102,7 +85,7 @@ * ****************************************************************************/ -int board_tsc_setup(int minor) +int sam_tsc_setup(int minor) { struct sam_adc_s *adc; static bool initialized = false; diff --git a/configs/sama5d3x-ek/src/sama5d3x-ek.h b/configs/sama5d3x-ek/src/sama5d3x-ek.h index fcdfa53b3e..c6dd625998 100644 --- a/configs/sama5d3x-ek/src/sama5d3x-ek.h +++ b/configs/sama5d3x-ek/src/sama5d3x-ek.h @@ -1,7 +1,7 @@ /************************************************************************************ * configs/sama5d3x-ek/src/sama5d3x-ek.h * - * Copyright (C) 2013-2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -833,6 +833,27 @@ int sam_usbhost_initialize(void); void weak_function sam_netinitialize(void); #endif +/************************************************************************************ + * Name: sam_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen + * device. This function will register the driver as /dev/inputN where N is the + * minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to + * indicate the nature of the failure. + * + ***********************************************************************************/ + +#ifdef CONFIG_SAMA5_TSD +int sam_tsc_setup(int minor); +#endif + /************************************************************************************ * Name: sam_pwm_setup * diff --git a/configs/sama5d4-ek/README.txt b/configs/sama5d4-ek/README.txt index 40a703e402..fa063560b7 100644 --- a/configs/sama5d4-ek/README.txt +++ b/configs/sama5d4-ek/README.txt @@ -3268,7 +3268,6 @@ TM7000 LCD/Touchscreen build in a touchscreen test: CONFIG_EXAMPLES_TOUCHSCREEN=y - CONFIG_EXAMPLES_TOUCHSCREEN_ARCHINIT=y CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0" CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 diff --git a/configs/sama5d4-ek/src/sam_bringup.c b/configs/sama5d4-ek/src/sam_bringup.c index 5669b17fc7..d5a01c2fe6 100644 --- a/configs/sama5d4-ek/src/sam_bringup.c +++ b/configs/sama5d4-ek/src/sam_bringup.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/sama5d4-ek/src/sam_bringup.c * - * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2014, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -288,6 +288,16 @@ int sam_bringup(void) } #endif +#ifdef HAVE_MAXTOUCH + /* Initialize the touchscreen */ + + ret = sam_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef CONFIG_PWM /* Initialize PWM and register the PWM device. */ diff --git a/configs/sama5d4-ek/src/sam_maxtouch.c b/configs/sama5d4-ek/src/sam_maxtouch.c index f64f661836..3a2e3f5f37 100644 --- a/configs/sama5d4-ek/src/sam_maxtouch.c +++ b/configs/sama5d4-ek/src/sam_maxtouch.c @@ -219,13 +219,12 @@ static int mxt_interrupt(int irq, FAR void *context, FAR void *arg) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: sam_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -236,7 +235,7 @@ static int mxt_interrupt(int irq, FAR void *context, FAR void *arg) * ****************************************************************************/ -int board_tsc_setup(int minor) +int sam_tsc_setup(int minor) { FAR struct i2c_master_s *i2c; static bool initialized = false; diff --git a/configs/sama5d4-ek/src/sama5d4-ek.h b/configs/sama5d4-ek/src/sama5d4-ek.h index 1a364f64c2..50e956b08d 100644 --- a/configs/sama5d4-ek/src/sama5d4-ek.h +++ b/configs/sama5d4-ek/src/sama5d4-ek.h @@ -1,7 +1,7 @@ /************************************************************************************ * configs/sama5d4-ek/src/sama5d4-ek.h * - * Copyright (C) 2014-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2014-2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -1060,19 +1060,41 @@ bool sam_writeprotected(int slotno); void weak_function sam_usbinitialize(void); #endif -/**************************************************************************************************** +/************************************************************************************ * Name: stm32_usbhost_initialize * * Description: - * Called at application startup time to initialize the USB host functionality. This function will - * start a thread that will monitor for device connection/disconnection events. + * Called at application startup time to initialize the USB host functionality. + * This function will start a thread that will monitor for device connection/ + * disconnection events. * - ****************************************************************************************************/ + ************************************************************************************/ #ifdef HAVE_USBHOST int sam_usbhost_initialize(void); #endif +/************************************************************************************ + * Name: sam_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen + * device. This function will register the driver as /dev/inputN where N is the + * minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to + * indicate the nature of the failure. + * + ***********************************************************************************/ + +#ifdef HAVE_MAXTOUCH +int sam_tsc_setup(int minor); +#endif + /************************************************************************************ * Name: sam_pwm_setup * diff --git a/configs/samv71-xult/README.txt b/configs/samv71-xult/README.txt index c290d05bad..782bdaf632 100644 --- a/configs/samv71-xult/README.txt +++ b/configs/samv71-xult/README.txt @@ -1231,7 +1231,6 @@ MXT Configuration Options Application Configuration -> Examples -> Touchscreen example CONFIG_EXAMPLES_TOUCHSCREEN=y : Enables the example - CONFIG_EXAMPLES_TOUCHSCREEN_ARCHINIT=y : Have board-specific intialization CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0" CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 diff --git a/configs/samv71-xult/nxwm/defconfig b/configs/samv71-xult/nxwm/defconfig index 80cc25bf5c..9a5d3cb7e9 100644 --- a/configs/samv71-xult/nxwm/defconfig +++ b/configs/samv71-xult/nxwm/defconfig @@ -27,7 +27,6 @@ CONFIG_AT24XX_EXTENDED=y CONFIG_AT24XX_EXTSIZE=160 CONFIG_AT24XX_SIZE=2 CONFIG_BOARD_LOOPSPERMSEC=51262 -CONFIG_BOARDCTL_TSCTEST=y CONFIG_BUILTIN=y CONFIG_DISABLE_POLL=y CONFIG_FAT_LCNAMES=y diff --git a/configs/samv71-xult/src/sam_bringup.c b/configs/samv71-xult/src/sam_bringup.c index 5d6e288e21..4326c2b8ee 100644 --- a/configs/samv71-xult/src/sam_bringup.c +++ b/configs/samv71-xult/src/sam_bringup.c @@ -507,6 +507,16 @@ int sam_bringup(void) } #endif +#ifdef HAVE_MAXTOUCH + /* Initialize the touchscreen */ + + ret = sam_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef HAVE_WM8904 /* Configure WM8904 audio */ diff --git a/configs/samv71-xult/src/sam_maxtouch.c b/configs/samv71-xult/src/sam_maxtouch.c index 42cd74a16e..7db38fd551 100644 --- a/configs/samv71-xult/src/sam_maxtouch.c +++ b/configs/samv71-xult/src/sam_maxtouch.c @@ -218,13 +218,12 @@ static int mxt_interrupt(int irq, FAR void *context, FAR void *arg) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: sam_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -235,7 +234,7 @@ static int mxt_interrupt(int irq, FAR void *context, FAR void *arg) * ****************************************************************************/ -int board_tsc_setup(int minor) +int sam_tsc_setup(int minor) { FAR struct i2c_master_s *i2c; static bool initialized = false; diff --git a/configs/samv71-xult/src/samv71-xult.h b/configs/samv71-xult/src/samv71-xult.h index c9b3718b2c..cb273a819f 100644 --- a/configs/samv71-xult/src/samv71-xult.h +++ b/configs/samv71-xult/src/samv71-xult.h @@ -1,7 +1,7 @@ /************************************************************************************ * configs/samv71-xult/src/samv71-xult.h * - * Copyright (C) 2015-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2015-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -846,28 +846,49 @@ bool sam_writeprotected(int slotno); int sam_at24config(void); #endif -/**************************************************************************** +/************************************************************************************ + * Name: sam_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen + * device. This function will register the driver as /dev/inputN where N is the + * minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to + * indicate the nature of the failure. + * + ************************************************************************************/ + +#ifdef HAVE_MAXTOUCH +int sam_tsc_setup(int minor); +#endif + +/************************************************************************************ * Name: sam_wm8904_initialize * * Description: - * This function is called by platform-specific, setup logic to configure - * and register the WM8904 device. This function will register the driver - * as /dev/wm8904[x] where x is determined by the minor device number. + * This function is called by platform-specific, setup logic to configure and + * register the WM8904 device. This function will register the driver as + * /dev/wm8904[x] where x is determined by the minor device number. * * Input Parameters: * minor - The input device minor number * * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is - * returned to indicate the nature of the failure. + * Zero is returned on success. Otherwise, a negated errno value is returned + * to indicate the nature of the failure. * - ****************************************************************************/ + ************************************************************************************/ #ifdef HAVE_WM8904 int sam_wm8904_initialize(int minor); #endif /* HAVE_WM8904 */ -/**************************************************************************** +/************************************************************************************ * Name: sam_audio_null_initialize * * Description: @@ -877,26 +898,26 @@ int sam_wm8904_initialize(int minor); * minor - The input device minor number * * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is - * returned to indicate the nature of the failure. + * Zero is returned on success. Otherwise, a negated errno value is returned + * to indicate the nature of the failure. * - ****************************************************************************/ + ************************************************************************************/ #ifdef HAVE_AUDIO_NULL int sam_audio_null_initialize(int minor); #endif /* HAVE_AUDIO_NULL */ -/**************************************************************************** +/************************************************************************************ * Name: stm32_mrf24j40_initialize * * Description: * Initialize the MRF24J40 device. * * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is - * returned to indicate the nature of the failure. + * Zero is returned on success. Otherwise, a negated errno value is returned + * to indicate the nature of the failure. * - ****************************************************************************/ + ************************************************************************************/ #ifdef HAVE_MRF24J40 int sam_mrf24j40_initialize(void); diff --git a/configs/shenzhou/nxwm/defconfig b/configs/shenzhou/nxwm/defconfig index 33241b13dc..3c0273cff3 100644 --- a/configs/shenzhou/nxwm/defconfig +++ b/configs/shenzhou/nxwm/defconfig @@ -17,7 +17,6 @@ CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH="arm" CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y CONFIG_BOARD_LOOPSPERMSEC=5483 -CONFIG_BOARDCTL_TSCTEST=y CONFIG_ETH0_PHY_DM9161=y CONFIG_HAVE_CXX=y CONFIG_HAVE_CXXINITIALIZE=y diff --git a/configs/shenzhou/src/shenzhou.h b/configs/shenzhou/src/shenzhou.h index 68fb63d102..a841307dfb 100644 --- a/configs/shenzhou/src/shenzhou.h +++ b/configs/shenzhou/src/shenzhou.h @@ -1,7 +1,7 @@ /**************************************************************************************************** * configs/shenzhou/src/shenzhou.h * - * Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -426,7 +426,7 @@ void weak_function stm32_spidev_initialize(void); * Name: stm32_usbinitialize * * Description: - * Called from stm32_usbinitialize very early in inialization to setup USB-related GPIO pins for + * Called from stm32_usbinitialize very early in initialization to setup USB-related GPIO pins for * the STM3240G-EVAL board. * ****************************************************************************************************/ @@ -448,13 +448,34 @@ void weak_function stm32_usbinitialize(void); int stm32_usbhost_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** + * Name: stm32_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is + * returned to indicate the nature of the failure. + * + ****************************************************************************/ + +#ifdef CONFIG_INPUT_ADS7843E +int stm32_tsc_setup(int minor); +#endif + +/**************************************************************************** * Name: stm32_adc_setup * * Description: * Initialize ADC and register the ADC driver. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ADC int stm32_adc_setup(void); diff --git a/configs/shenzhou/src/stm32_appinit.c b/configs/shenzhou/src/stm32_appinit.c index a260c4ec1e..18de2f1660 100644 --- a/configs/shenzhou/src/stm32_appinit.c +++ b/configs/shenzhou/src/stm32_appinit.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/shenzhou/src/stm32_appinit.c * - * Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -204,6 +204,16 @@ int board_app_initialize(uintptr_t arg) } #endif +#ifdef CONFIG_INPUT_ADS7843E + /* Initialize the touchscreen */ + + ret = stm32_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef CONFIG_ADC /* Initialize ADC and register the ADC driver. */ diff --git a/configs/shenzhou/src/stm32_touchscreen.c b/configs/shenzhou/src/stm32_touchscreen.c index c499f33a27..1e0fe2e12c 100644 --- a/configs/shenzhou/src/stm32_touchscreen.c +++ b/configs/shenzhou/src/stm32_touchscreen.c @@ -230,13 +230,12 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: stm32_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -247,7 +246,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) * ****************************************************************************/ -int board_tsc_setup(int minor) +int stm32_tsc_setup(int minor) { FAR struct spi_dev_s *dev; int ret; diff --git a/configs/sim/README.txt b/configs/sim/README.txt index 226ddd3ffd..b463f412af 100644 --- a/configs/sim/README.txt +++ b/configs/sim/README.txt @@ -729,10 +729,6 @@ nx11 CONFIG_INPUT=y CONFIG_SIM_TOUCHSCREEN=y - Then you must also have some application logic that will call - board_tsc_setup(0) to register the touchscreen driver. See - also configuration "touchscreen" - NOTES: a. If you do not have the call to sim_tcinitialize(0), the build diff --git a/configs/sim/src/sim.h b/configs/sim/src/sim.h index f851b339cc..808818da1a 100644 --- a/configs/sim/src/sim.h +++ b/configs/sim/src/sim.h @@ -1,7 +1,7 @@ /**************************************************************************** * config/sim/src/sim.h * - * Copyright (C) 2015-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2015-2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -123,4 +123,25 @@ int sim_zoneinfo(int minor); int sim_gpio_initialize(void); #endif +/**************************************************************************** + * Name: sim_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is + * returned to indicate the nature of the failure. + * + ****************************************************************************/ + +#if defined(CONFIG_SIM_X11FB) && defined(CONFIG_SIM_TOUCHSCREEN) +int sim_tsc_setup(int minor); +#endif + #endif /* __CONFIGS_SIM_SRC_SIM_H */ \ No newline at end of file diff --git a/configs/sim/src/sim_bringup.c b/configs/sim/src/sim_bringup.c index 22351f6270..a2233a5fd8 100644 --- a/configs/sim/src/sim_bringup.c +++ b/configs/sim/src/sim_bringup.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/sim/src/sam_bringup.c * - * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -68,8 +68,7 @@ int trv_mount_world(int minor, FAR const char *mountpoint); #define NEED_FRAMEBUFFER 1 /* If we are using the X11 touchscreen simulation, then the frame buffer - * initialization happens in board_tsc_setup. Otherwise, we will need to - * do that here. + * initialization will need to be done here. */ #if defined(CONFIG_SIM_X11FB) && defined(CONFIG_SIM_TOUCHSCREEN) @@ -200,6 +199,16 @@ int sim_bringup(void) sim_ajoy_initialize(); #endif +#if defined(CONFIG_SIM_X11FB) && defined(CONFIG_SIM_TOUCHSCREEN) + /* Initialize the touchscreen */ + + ret = sim_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sim_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef CONFIG_GRAPHICS_TRAVELER_ROMFSDEMO /* Special initialization for the Traveler game simulation */ diff --git a/configs/sim/src/sim_touchscreen.c b/configs/sim/src/sim_touchscreen.c index 229b5a79d6..c3b15a8e5d 100644 --- a/configs/sim/src/sim_touchscreen.c +++ b/configs/sim/src/sim_touchscreen.c @@ -145,16 +145,23 @@ static FAR void *sim_listener(FAR void *arg) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup() + * Name: sim_tsc_setup * * Description: - * Perform architecuture-specific initialization of the touchscreen - * hardware. This interface must be provided by all configurations - * using apps/examples/touchscreen + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is + * returned to indicate the nature of the failure. * ****************************************************************************/ -int board_tsc_setup(int minor) +int sim_tsc_setup(int minor) { struct sched_param param; nxgl_mxpixel_t color; @@ -262,4 +269,3 @@ errout_with_nx: errout: return ret; } - diff --git a/configs/stm3220g-eval/nxwm/defconfig b/configs/stm3220g-eval/nxwm/defconfig index 1bfe7f8541..25a868d872 100644 --- a/configs/stm3220g-eval/nxwm/defconfig +++ b/configs/stm3220g-eval/nxwm/defconfig @@ -15,7 +15,6 @@ CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH="arm" CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y CONFIG_BOARD_LOOPSPERMSEC=10926 -CONFIG_BOARDCTL_TSCTEST=y CONFIG_ETH0_PHY_DP83848C=y CONFIG_FAT_LCNAMES=y CONFIG_FAT_LFN=y diff --git a/configs/stm3220g-eval/src/stm3220g-eval.h b/configs/stm3220g-eval/src/stm3220g-eval.h index 1e3087109f..95e603fd17 100644 --- a/configs/stm3220g-eval/src/stm3220g-eval.h +++ b/configs/stm3220g-eval/src/stm3220g-eval.h @@ -1,7 +1,7 @@ /**************************************************************************************************** * configs/stm3220g_eval/src/stm3220g.h * - * Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -249,6 +249,26 @@ void weak_function stm32_usbinitialize(void); int stm32_usbhost_initialize(void); #endif +/**************************************************************************************************** + * Name: stm32_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen device. This + * function will register the driver as /dev/inputN where N is the minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to indicate the + * nature of the failure. + * + ****************************************************************************************************/ + +#ifdef CONFIG_INPUT_STMPE811 +int stm32_tsc_setup(int minor); +#endif + /**************************************************************************************************** * Name: stm32_pwm_setup * @@ -321,7 +341,7 @@ void stm32_extmemaddr(int naddrs); void stm32_extmemdata(int ndata); #endif -/************************************************************************************ +/**************************************************************************************************** * Name: stm32_enablefsmc * * Description: @@ -333,7 +353,7 @@ void stm32_extmemdata(int ndata); void stm32_enablefsmc(void); #endif -/************************************************************************************ +/**************************************************************************************************** * Name: stm32_disablefsmc * * Description: @@ -345,7 +365,7 @@ void stm32_enablefsmc(void); void stm32_disablefsmc(void); #endif -/************************************************************************************ +/**************************************************************************************************** * Name: stm32_selectsram * * Description: @@ -375,7 +395,7 @@ void stm32_disablefsmc(void); void stm32_selectsram(void); #endif -/************************************************************************************ +/**************************************************************************************************** * Name: stm32_deselectsram * * Description: @@ -387,7 +407,7 @@ void stm32_selectsram(void); void stm32_deselectsram(void); #endif -/************************************************************************************ +/**************************************************************************************************** * Name: stm32_selectlcd * * Description: @@ -399,7 +419,7 @@ void stm32_deselectsram(void); void stm32_selectlcd(void); #endif -/************************************************************************************ +/**************************************************************************************************** * Name: stm32_deselectlcd * * Description: @@ -413,4 +433,3 @@ void stm32_deselectlcd(void); #endif /* __ASSEMBLY__ */ #endif /* __CONFIGS_STM3220G_EVAL_SRC_STM3220G_H */ - diff --git a/configs/stm3220g-eval/src/stm32_appinit.c b/configs/stm3220g-eval/src/stm32_appinit.c index 447bb24f3d..4800fca070 100644 --- a/configs/stm3220g-eval/src/stm32_appinit.c +++ b/configs/stm3220g-eval/src/stm32_appinit.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/stm3220g_eval/src/stm32_appinit.c * - * Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -292,6 +292,16 @@ int board_app_initialize(uintptr_t arg) } #endif +#ifdef CONFIG_INPUT_STMPE811 + /* Initialize the touchscreen */ + + ret = stm32_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef CONFIG_PWM /* Initialize PWM and register the PWM device. */ diff --git a/configs/stm3220g-eval/src/stm32_stmpe811.c b/configs/stm3220g-eval/src/stm32_stmpe811.c index 716761235c..d0346d5cf2 100644 --- a/configs/stm3220g-eval/src/stm32_stmpe811.c +++ b/configs/stm3220g-eval/src/stm32_stmpe811.c @@ -146,7 +146,8 @@ struct stm32_stmpe811config_s /* IRQ/GPIO access callbacks. These operations all hidden behind callbacks * to isolate the STMPE811 driver from differences in GPIO - * interrupt handling by varying boards and MCUs.* so that contact and loss-of-contact events can be detected. + * interrupt handling by varying boards and MCUs.* so that contact and loss- + * of-contact events can be detected. * * attach - Attach the STMPE811 interrupt handler to the GPIO interrupt * enable - Enable or disable the GPIO interrupt @@ -264,16 +265,15 @@ static void stmpe811_clear(FAR struct stmpe811_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: stm32_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: - * minor - The input device minor number + * minor - The input device minor number * * Returned Value: * Zero is returned on success. Otherwise, a negated errno value is @@ -281,7 +281,7 @@ static void stmpe811_clear(FAR struct stmpe811_config_s *state) * ****************************************************************************/ -int board_tsc_setup(int minor) +int stm32_tsc_setup(int minor) { #ifndef CONFIG_STMPE811_TSC_DISABLE FAR struct i2c_master_s *dev; diff --git a/configs/stm3240g-eval/knxwm/defconfig b/configs/stm3240g-eval/knxwm/defconfig index 8a33d10f56..916720ff0a 100644 --- a/configs/stm3240g-eval/knxwm/defconfig +++ b/configs/stm3240g-eval/knxwm/defconfig @@ -15,7 +15,6 @@ CONFIG_ARM_MPU=y CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y CONFIG_BOARD_INITIALIZE=y CONFIG_BOARD_LOOPSPERMSEC=16717 -CONFIG_BOARDCTL_TSCTEST=y CONFIG_BUILD_PROTECTED=y CONFIG_CXX_NEWLONG=y CONFIG_DISABLE_POLL=y diff --git a/configs/stm3240g-eval/nxwm/defconfig b/configs/stm3240g-eval/nxwm/defconfig index a72b8984d4..6a277c9bd8 100644 --- a/configs/stm3240g-eval/nxwm/defconfig +++ b/configs/stm3240g-eval/nxwm/defconfig @@ -15,7 +15,6 @@ CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH="arm" CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y CONFIG_BOARD_LOOPSPERMSEC=16717 -CONFIG_BOARDCTL_TSCTEST=y CONFIG_FAT_LCNAMES=y CONFIG_FAT_LFN=y CONFIG_FS_FAT=y diff --git a/configs/stm3240g-eval/src/stm3240g-eval.h b/configs/stm3240g-eval/src/stm3240g-eval.h index 8b98bf85d5..71d997bbd3 100644 --- a/configs/stm3240g-eval/src/stm3240g-eval.h +++ b/configs/stm3240g-eval/src/stm3240g-eval.h @@ -1,7 +1,7 @@ /**************************************************************************************************** * configs/stm3240g_eval/src/stm3240g_eval.h * - * Copyright (C) 2011-2013, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2013, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -266,6 +266,26 @@ void weak_function stm32_usbinitialize(void); int stm32_usbhost_initialize(void); #endif +/**************************************************************************************************** + * Name: stm32_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the touchscreen device. This + * function will register the driver as /dev/inputN where N is the minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is returned to indicate the + * nature of the failure. + * + ****************************************************************************************************/ + +#ifdef CONFIG_INPUT_STMPE811 +int stm32_tsc_setup(int minor); +#endif + /**************************************************************************************************** * Name: stm32_led_initialize * diff --git a/configs/stm3240g-eval/src/stm32_appinit.c b/configs/stm3240g-eval/src/stm32_appinit.c index f3362bf012..1ae1aa76ba 100644 --- a/configs/stm3240g-eval/src/stm32_appinit.c +++ b/configs/stm3240g-eval/src/stm32_appinit.c @@ -67,7 +67,7 @@ * arg - The boardctl() argument is passed to the board_app_initialize() * implementation without modification. The argument has no * meaning to NuttX; the meaning of the argument is a contract - * between the board-specific initalization logic and the + * between the board-specific initialization logic and the * matching application logic. The value cold be such things as a * mode enumeration value, a set of DIP switch switch settings, a * pointer to configuration data read from a file or serial FLASH, diff --git a/configs/stm3240g-eval/src/stm32_boot.c b/configs/stm3240g-eval/src/stm32_boot.c index 13f7591a40..2309fc50bb 100644 --- a/configs/stm3240g-eval/src/stm32_boot.c +++ b/configs/stm3240g-eval/src/stm32_boot.c @@ -64,12 +64,8 @@ #endif /* Should we initialize the touchscreen for the NxWM (CONFIG_NXWM=y)? This - * is done if we have a touchscreen (CONFIG_INPUT_STMPE811=y), NxWM uses the - * touchscreen (CONFIG_NXWM_TOUCHSCREEN=y), and if we were asked to - * initialize the touchscreen for NxWM (NXWM_TOUCHSCREEN_DEVINIT=n). This - * combination of settings is normally only used in the kernel build mode - * (CONFIG_BUILD_PROTECTED) when NxWidgets is unable to initialize NX from - * user-space. + * is done if we have a touchscreen (CONFIG_INPUT_STMPE811=y) and NxWM uses the + * touchscreen (CONFIG_NXWM_TOUCHSCREEN=y). */ #undef HAVE_TCINIT @@ -78,14 +74,10 @@ # if !defined(CONFIG_NXWM_TOUCHSCREEN_DEVNO) # error CONFIG_NXWM_TOUCHSCREEN_DEVNO is not defined # elif defined(CONFIG_INPUT_STMPE811) -# if !defined(CONFIG_NXWM_TOUCHSCREEN_DEVINIT) -# define HAVE_TCINIT -# include -# endif +# define HAVE_TCINIT 1 +# include # else -# if !defined(CONFIG_NXWM_TOUCHSCREEN_DEVINIT) && defined(CONFIG_BUILD_PROTECTED) -# error CONFIG_INPUT_STMPE811=y is needed -# endif +# error CONFIG_INPUT_STMPE811=y is needed # endif #endif @@ -143,10 +135,7 @@ static int board_initthread(int argc, char *argv[]) { int ret; - /* Perform NSH initialization here instead of from the NSH. This - * alternative NSH initialization is necessary when NSH is ran in user-space - * but the initialization function must run in kernel space. - */ + /* Perform the board initialization on an initialization thread */ ret = stm32_bringup(); if (ret < 0) @@ -154,26 +143,6 @@ static int board_initthread(int argc, char *argv[]) gerr("ERROR: stm32_bringup failed: %d\n", ret); } -#ifdef HAVE_NXSTART - /* Initialize the NX server */ - - ret = nx_start(); - if (ret < 0) - { - gerr("ERROR: nx_start failed: %d\n", ret); - } -#endif - -#ifdef HAVE_TCINIT - /* Initialize the touchscreen */ - - ret = board_tsc_setup(CONFIG_NXWM_TOUCHSCREEN_DEVNO); - if (ret < 0) - { - gerr("ERROR: board_tsc_setup failed: %d\n", ret); - } -#endif - return EXIT_SUCCESS; } #endif @@ -257,6 +226,11 @@ void board_initialize(void) NULL); ASSERT(server > 0); #else + /* Perform the board initialization on the start-up thread. Some + * initializations may fail in this case due to the limited capability of + * the start-up thread. + */ + (void)stm32_bringup(); #endif } diff --git a/configs/stm3240g-eval/src/stm32_bringup.c b/configs/stm3240g-eval/src/stm32_bringup.c index 3fcc402b22..61d3f4a69c 100644 --- a/configs/stm3240g-eval/src/stm32_bringup.c +++ b/configs/stm3240g-eval/src/stm32_bringup.c @@ -354,6 +354,26 @@ int stm32_bringup(void) } #endif +#ifdef HAVE_NXSTART + /* Initialize the NX server */ + + ret = nx_start(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: nx_start failed: %d\n", ret); + } +#endif + +#ifdef HAVE_TCINIT + /* Initialize the touchscreen */ + + ret = stm32_tsc_setup(CONFIG_NXWM_TOUCHSCREEN_DEVNO); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef CONFIG_PWM /* Initialize PWM and register the PWM device. */ diff --git a/configs/stm3240g-eval/src/stm32_stmpe811.c b/configs/stm3240g-eval/src/stm32_stmpe811.c index 1a03197263..876b91d0d5 100644 --- a/configs/stm3240g-eval/src/stm32_stmpe811.c +++ b/configs/stm3240g-eval/src/stm32_stmpe811.c @@ -264,13 +264,12 @@ static void stmpe811_clear(FAR struct stmpe811_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: stm32_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -281,7 +280,7 @@ static void stmpe811_clear(FAR struct stmpe811_config_s *state) * ****************************************************************************/ -int board_tsc_setup(int minor) +int stm32_tsc_setup(int minor) { #ifndef CONFIG_STMPE811_TSC_DISABLE FAR struct i2c_master_s *dev; diff --git a/configs/stm32f429i-disco/nxwm/defconfig b/configs/stm32f429i-disco/nxwm/defconfig index c1bda648f9..4485aa414b 100644 --- a/configs/stm32f429i-disco/nxwm/defconfig +++ b/configs/stm32f429i-disco/nxwm/defconfig @@ -13,7 +13,6 @@ CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH="arm" CONFIG_BOARD_INITIALIZE=y CONFIG_BOARD_LOOPSPERMSEC=16717 -CONFIG_BOARDCTL_TSCTEST=y CONFIG_BUILTIN=y CONFIG_DEBUG_CUSTOMOPT=y CONFIG_DEBUG_SYMBOLS=y diff --git a/configs/stm32f429i-disco/src/stm32_boot.c b/configs/stm32f429i-disco/src/stm32_boot.c index 8af811400a..9dda08d1de 100644 --- a/configs/stm32f429i-disco/src/stm32_boot.c +++ b/configs/stm32f429i-disco/src/stm32_boot.c @@ -68,12 +68,8 @@ #endif /* Should we initialize the touchscreen for the NxWM (CONFIG_NXWM=y)? This - * is done if we have a touchscreen (CONFIG_INPUT_STMPE811=y), NxWM uses the - * touchscreen (CONFIG_NXWM_TOUCHSCREEN=y), and if we were asked to - * initialize the touchscreen for NxWM (NXWM_TOUCHSCREEN_DEVINIT=n). This - * combination of settings is normally only used in the kernel build mode - * (CONFIG_BUILD_PROTECTED) when NxWidgets is unable to initialize NX from - * user-space. + * is done if we have a touchscreen (CONFIG_INPUT_STMPE811=y) and NxWM uses the + * touchscreen (CONFIG_NXWM_TOUCHSCREEN=y). */ #undef HAVE_TCINIT @@ -82,14 +78,10 @@ # if !defined(CONFIG_NXWM_TOUCHSCREEN_DEVNO) # error CONFIG_NXWM_TOUCHSCREEN_DEVNO is not defined # elif defined(CONFIG_INPUT_STMPE811) -# if !defined(CONFIG_NXWM_TOUCHSCREEN_DEVINIT) -# define HAVE_TCINIT -# include -# endif +# define HAVE_TCINIT +# include # else -# if !defined(CONFIG_NXWM_TOUCHSCREEN_DEVINIT) && defined(CONFIG_BUILD_PROTECTED) -# error CONFIG_INPUT_STMPE811=y is needed -# endif +# error CONFIG_INPUT_STMPE811=y is needed # endif #endif diff --git a/configs/stm32f429i-disco/src/stm32_bringup.c b/configs/stm32f429i-disco/src/stm32_bringup.c index 3ba8a5c213..821ddeb199 100644 --- a/configs/stm32f429i-disco/src/stm32_bringup.c +++ b/configs/stm32f429i-disco/src/stm32_bringup.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/stm32f429i-disco/src/stm32_bringup.c * - * Copyright (C) 2012, 2015-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2015-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -345,6 +345,16 @@ int stm32_bringup(void) } #endif +#ifdef CONFIG_INPUT_STMPE811 + /* Initialize the touchscreen */ + + ret = stm32_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef CONFIG_SENSORS_L3GD20 ret = stm32_l3gd20initialize("/dev/gyr0"); if (ret != OK) diff --git a/configs/stm32f429i-disco/src/stm32_stmpe811.c b/configs/stm32f429i-disco/src/stm32_stmpe811.c index c089990ee7..71bc9830d9 100644 --- a/configs/stm32f429i-disco/src/stm32_stmpe811.c +++ b/configs/stm32f429i-disco/src/stm32_stmpe811.c @@ -267,13 +267,12 @@ static void stmpe811_clear(FAR struct stmpe811_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: stm32_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -284,7 +283,7 @@ static void stmpe811_clear(FAR struct stmpe811_config_s *state) * ****************************************************************************/ -int board_tsc_setup(int minor) +int stm32_tsc_setup(int minor) { #ifndef CONFIG_STMPE811_TSC_DISABLE FAR struct i2c_master_s *dev; diff --git a/configs/stm32f429i-disco/src/stm32f429i-disco.h b/configs/stm32f429i-disco/src/stm32f429i-disco.h index 46355dcdc1..d324060876 100644 --- a/configs/stm32f429i-disco/src/stm32f429i-disco.h +++ b/configs/stm32f429i-disco/src/stm32f429i-disco.h @@ -1,7 +1,7 @@ /**************************************************************************** * configs/stm32f429i-disco/src/stm32f429i-disco.h * - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2012, 2018 Gregory Nutt. All rights reserved. * Authors: Gregory Nutt * Marco Krahl * @@ -230,8 +230,8 @@ void weak_function stm32_spidev_initialize(void); * Name: stm32_usbinitialize * * Description: - * Called from stm32_usbinitialize very early in inialization to setup USB-related - * GPIO pins for the STM32F429Discovery board. + * Called from stm32_usbinitialize very early in inialization to setup USB- + * related GPIO pins for the STM32F429Discovery board. * ****************************************************************************/ @@ -253,6 +253,27 @@ void weak_function stm32_usbinitialize(void); int stm32_usbhost_initialize(void); #endif +/**************************************************************************** + * Name: stm32_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is + * returned to indicate the nature of the failure. + * + ****************************************************************************/ + +#ifdef CONFIG_INPUT_STMPE811 +int stm32_tsc_setup(int minor); +#endif + /**************************************************************************** * Name: stm32_enablefsmc @@ -352,7 +373,6 @@ FAR struct ili9341_lcd_s *stm32_ili93414ws_initialize(void); FAR struct spi_dev_s *stm32_spi5initialize(void); #endif - /**************************************************************************** * Name: stm32_l3gd20initialize() * diff --git a/configs/viewtool-stm32f107/src/stm32_bringup.c b/configs/viewtool-stm32f107/src/stm32_bringup.c index cba3798e88..97ca12b986 100644 --- a/configs/viewtool-stm32f107/src/stm32_bringup.c +++ b/configs/viewtool-stm32f107/src/stm32_bringup.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/viewtool-stm32f107/src/stm32_bringup.c * - * Copyright (C) 2013, 2016-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2016-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -165,6 +165,16 @@ int stm32_bringup(void) } #endif +#ifdef CONFIG_INPUT_ADS7843E + /* Initialize the touchscreen */ + + ret = stm32_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); + } +#endif + #ifdef CONFIG_CAN /* Initialize CAN and register the CAN driver. */ diff --git a/configs/viewtool-stm32f107/src/stm32_touchscreen.c b/configs/viewtool-stm32f107/src/stm32_touchscreen.c index 17539fc9b5..afac08aa2b 100644 --- a/configs/viewtool-stm32f107/src/stm32_touchscreen.c +++ b/configs/viewtool-stm32f107/src/stm32_touchscreen.c @@ -239,13 +239,12 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: board_tsc_setup + * Name: stm32_tsc_setup * * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. * * Input Parameters: * minor - The input device minor number @@ -256,7 +255,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) * ****************************************************************************/ -int board_tsc_setup(int minor) +int stm32_tsc_setup(int minor) { FAR struct spi_dev_s *dev; static bool initialized = false; diff --git a/configs/viewtool-stm32f107/src/viewtool_stm32f107.h b/configs/viewtool-stm32f107/src/viewtool_stm32f107.h index 8ec579e140..8a196108c5 100644 --- a/configs/viewtool-stm32f107/src/viewtool_stm32f107.h +++ b/configs/viewtool-stm32f107/src/viewtool_stm32f107.h @@ -1,7 +1,7 @@ /**************************************************************************** * configs/viewtool-stm32f107/src/viewtool_stm32f107.h * - * Copyright (C) 2013-2014, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2014, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -348,8 +348,8 @@ void stm32_led_initialize(void); * Name: stm32_usbdev_initialize * * Description: - * Called from stm32_usbdev_initialize very early in initialization to setup USB-related - * GPIO pins for the Viewtool STM32F107 board. + * Called from stm32_usbdev_initialize very early in initialization to + * setup USB-related GPIO pins for the Viewtool STM32F107 board. * ****************************************************************************/ @@ -357,6 +357,27 @@ void stm32_led_initialize(void); void weak_function stm32_usbdev_initialize(void); #endif +/**************************************************************************** + * Name: stm32_tsc_setup + * + * Description: + * This function is called by board-bringup logic to configure the + * touchscreen device. This function will register the driver as + * /dev/inputN where N is the minor device number. + * + * Input Parameters: + * minor - The input device minor number + * + * Returned Value: + * Zero is returned on success. Otherwise, a negated errno value is + * returned to indicate the nature of the failure. + * + ****************************************************************************/ + +#ifdef CONFIG_INPUT_ADS7843E +int stm32_tsc_setup(int minor); +#endif + /**************************************************************************** * Name: stm32_sdinitialize * diff --git a/include/nuttx/board.h b/include/nuttx/board.h index b2b39d5c88..5c646a48a9 100644 --- a/include/nuttx/board.h +++ b/include/nuttx/board.h @@ -285,33 +285,6 @@ int board_composite_initialize(int port); FAR void *board_composite_connect(int port, int configid); #endif -/**************************************************************************** - * Name: board_tsc_setup - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * configure the touchscreen device. This function will register the driver - * as /dev/inputN where N is the minor device number. - * - * This is an internal OS interface but may be invoked indirectly from - * application-level touchscreen testing logic (perhaps by - * apps/examples/touchscreen). If CONFIG_LIB_BOARDCTL=y and - * CONFIG_BOARDCTL_TSCTEST=y, then this functions will be invoked via the - * (non-standard) boardctl() interface using the BOARDIOC_TSCTEST_SETUP - * command. - * - * Input Parameters: - * minor - The input device minor number - * - * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is - * returned to indicate the nature of the failure. - * - ****************************************************************************/ - -int board_tsc_setup(int minor); - /**************************************************************************** * Name: board_graphics_setup * diff --git a/include/sys/boardctl.h b/include/sys/boardctl.h index 84d828f8a2..907fbd6606 100644 --- a/include/sys/boardctl.h +++ b/include/sys/boardctl.h @@ -114,12 +114,6 @@ * ARG: None * CONFIGURATION: CONFIG_NX * DEPENDENCIES: Base graphics logic provides nx_start() - * - * CMD: BOARDIOC_TSCTEST_SETUP - * DESCRIPTION: Touchscreen controller test configuration - * ARG: Touch controller device minor number - * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_TSCTEST - * DEPENDENCIES: Board logic must provide board_tsc_setup() */ #define BOARDIOC_INIT _BOARDIOC(0x0001) @@ -130,7 +124,6 @@ #define BOARDIOC_OS_SYMTAB _BOARDIOC(0x0006) #define BOARDIOC_USBDEV_CONTROL _BOARDIOC(0x0007) #define BOARDIOC_NX_START _BOARDIOC(0x0008) -#define BOARDIOC_TSCTEST_SETUP _BOARDIOC(0x0009) /* If CONFIG_BOARDCTL_IOCTL=y, then board-specific commands will be support. * In this case, all commands not recognized by boardctl() will be forwarded @@ -139,7 +132,7 @@ * User defined board commands may begin with this value: */ -#define BOARDIOC_USER _BOARDIOC(0x000a) +#define BOARDIOC_USER _BOARDIOC(0x0009) /**************************************************************************** * Public Type Definitions