diff --git a/arch/sim/src/up_touchscreen.c b/arch/sim/src/up_touchscreen.c index 9ee99cbe92..a7f6d68fb4 100644 --- a/arch/sim/src/up_touchscreen.c +++ b/arch/sim/src/up_touchscreen.c @@ -52,6 +52,7 @@ #include #include +#include #include #include #include @@ -625,7 +626,7 @@ errout: ****************************************************************************/ /**************************************************************************** - * Name: arch_tcinitialize + * Name: board_tsc_setup * * Description: * Configure the simulated touchscreen. This will register the driver as @@ -640,7 +641,7 @@ errout: * ****************************************************************************/ -int arch_tcinitialize(int minor) +int board_tsc_setup(int minor) { FAR struct up_dev_s *priv = ( FAR struct up_dev_s *)&g_simtouchscreen; char devname[DEV_NAMELEN]; @@ -687,7 +688,7 @@ errout_with_priv: } /**************************************************************************** - * Name: arch_tcuninitialize + * Name: board_tsc_teardown * * Description: * Uninitialized the simulated touchscreen @@ -700,7 +701,7 @@ errout_with_priv: * ****************************************************************************/ -void arch_tcuninitialize(void) +void board_tsc_teardown(void) { FAR struct up_dev_s *priv = ( FAR struct up_dev_s *)&g_simtouchscreen; char devname[DEV_NAMELEN]; diff --git a/configs/Kconfig b/configs/Kconfig index 403002594b..c1dc72ca95 100644 --- a/configs/Kconfig +++ b/configs/Kconfig @@ -1585,3 +1585,8 @@ endif config LIB_BOARDCTL bool "Enabled boardctl() interface" default n + +config BOARDCTL_TSCTEST + bool "Enable touchscreen test interfaces" + default n + depends on LIB_BOARDCTL diff --git a/configs/arduino-due/src/sam_touchscreen.c b/configs/arduino-due/src/sam_touchscreen.c index 5e5a22a8d2..6a7c1cfed6 100644 --- a/configs/arduino-due/src/sam_touchscreen.c +++ b/configs/arduino-due/src/sam_touchscreen.c @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -335,7 +336,7 @@ static FAR struct spi_dev_s *sam_tsc_spiinitialize(void) ****************************************************************************/ /**************************************************************************** - * Name: arch_tcinitialize + * Name: board_tsc_setup * * Description: * Each board that supports a touchscreen device must provide this function. @@ -352,7 +353,7 @@ static FAR struct spi_dev_s *sam_tsc_spiinitialize(void) * ****************************************************************************/ -int arch_tcinitialize(int minor) +int board_tsc_setup(int minor) { FAR struct spi_dev_s *dev; static bool initialized = false; @@ -405,7 +406,7 @@ int arch_tcinitialize(int minor) } /**************************************************************************** - * Name: arch_tcuninitialize + * Name: board_tsc_teardown * * Description: * Each board that supports a touchscreen device must provide this function. @@ -420,7 +421,7 @@ int arch_tcinitialize(int minor) * ****************************************************************************/ -void arch_tcuninitialize(void) +void board_tsc_teardown(void) { /* No support for un-initializing the touchscreen XPT2046 device. It will * continue to run and process touch interrupts in the background. diff --git a/configs/boardctl.c b/configs/boardctl.c index a41c1d2e6b..d865fff685 100755 --- a/configs/boardctl.c +++ b/configs/boardctl.c @@ -98,24 +98,31 @@ int boardctl(unsigned int cmd, uintptr_t arg) break; #ifdef CONFIG_BOARDCTL_TSCTEST - /* CMD: BOARDIOC_TSCTEST + /* CMD: BOARDIOC_TSCTEST_SETUP * DESCRIPTION: Touchscreen controller test configuration - * ARG: 0: Setup touchscreen test, 1: Teardown touchscreen test - * CONFIGURATION: CONFIG_LIB_BOARDCTL && - * DEPENDENCIES: Board logic must provide board_tsc_setup() and - * board_tsc_teardown(). + * ARG: Touch controller device minor number + * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_TSCTEST + * DEPENDENCIES: Board logic must provide board_tsc_setup() */ - case BOARDIOC_TSCTEST: - if (arg) - { - ret = board_tsc_setup(); - } - else - { - ret = board_tsc_teardown(); - } + case BOARDIOC_TSCTEST_SETUP: + { + ret = board_tsc_setup((int)arg); + } + break; + /* CMD: BOARDIOC_TSCTEST_TEARDOWN + * DESCRIPTION: Touchscreen controller test configuration + * ARG: None + * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_TSCTEST + * DEPENDENCIES: Board logic must provide board_tsc_teardown() + */ + + case BOARDIOC_TSCTEST_TEARDOWN: + { + board_tsc_teardown(); + ret = OK; + } break; #endif diff --git a/configs/hymini-stm32v/nsh2/defconfig b/configs/hymini-stm32v/nsh2/defconfig index a588d93018..3c92af4041 100644 --- a/configs/hymini-stm32v/nsh2/defconfig +++ b/configs/hymini-stm32v/nsh2/defconfig @@ -714,6 +714,8 @@ CONFIG_EXAMPLES_NXIMAGE=y # CONFIG_EXAMPLES_THTTPD is not set # CONFIG_EXAMPLES_TIFF is not set CONFIG_EXAMPLES_TOUCHSCREEN=y +CONFIG_LIB_BOARDCTL=y +CONFIG_BOARDCTL_TSCTEST=y CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0" CONFIG_EXAMPLES_TOUCHSCREEN_ARCHINIT=y diff --git a/configs/hymini-stm32v/src/stm32_ts.c b/configs/hymini-stm32v/src/stm32_ts.c index 0c384048d1..6d156d860a 100644 --- a/configs/hymini-stm32v/src/stm32_ts.c +++ b/configs/hymini-stm32v/src/stm32_ts.c @@ -45,12 +45,13 @@ #include #include -#include "stm32.h" -#include "hymini_stm32v-internal.h" - +#include #include #include +#include "stm32.h" +#include "hymini_stm32v-internal.h" + /************************************************************************************ * Pre-processor Defintiions ************************************************************************************/ @@ -131,7 +132,7 @@ static bool hymini_ts_pendown(FAR struct ads7843e_config_s *state) } /**************************************************************************** - * Name: arch_tcinitialize + * Name: board_tsc_setup * * Description: * Each board that supports a touchscreen device must provide this function. @@ -148,7 +149,7 @@ static bool hymini_ts_pendown(FAR struct ads7843e_config_s *state) * ****************************************************************************/ -int arch_tcinitialize(int minor) +int board_tsc_setup(int minor) { FAR struct spi_dev_s *dev; @@ -169,7 +170,7 @@ int arch_tcinitialize(int minor) } /**************************************************************************** - * Name: arch_tcuninitialize + * Name: board_tsc_teardown * * Description: * Each board that supports a touchscreen device must provide this function. @@ -184,7 +185,7 @@ int arch_tcinitialize(int minor) * ****************************************************************************/ -void arch_tcuninitialize(void) +void board_tsc_teardown(void) { /* FIXME What can/should we do here ? */ } diff --git a/configs/mikroe-stm32f4/fulldemo/defconfig b/configs/mikroe-stm32f4/fulldemo/defconfig index 9e3dc090a2..ba66239b8d 100644 --- a/configs/mikroe-stm32f4/fulldemo/defconfig +++ b/configs/mikroe-stm32f4/fulldemo/defconfig @@ -1146,6 +1146,8 @@ CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4 # CONFIG_EXAMPLES_THTTPD is not set # CONFIG_EXAMPLES_TIFF is not set CONFIG_EXAMPLES_TOUCHSCREEN=y +CONFIG_LIB_BOARDCTL=y +CONFIG_BOARDCTL_TSCTEST=y CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0" # CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE is not set diff --git a/configs/mikroe-stm32f4/src/stm32_touchscreen.c b/configs/mikroe-stm32f4/src/stm32_touchscreen.c index 210c11d193..f15c688ed6 100644 --- a/configs/mikroe-stm32f4/src/stm32_touchscreen.c +++ b/configs/mikroe-stm32f4/src/stm32_touchscreen.c @@ -50,6 +50,7 @@ #include #include +#include #include #include #include @@ -1473,7 +1474,7 @@ errout: ************************************************************************************/ /**************************************************************************** - * Name: arch_tcinitialize + * Name: board_tsc_setup * * Description: * Each board that supports a touchscreen device must provide this function. @@ -1490,7 +1491,7 @@ errout: * ****************************************************************************/ -int arch_tcinitialize(int minor) +int board_tsc_setup(int minor) { FAR struct tc_dev_s *priv; char devname[DEV_NAMELEN]; @@ -1583,7 +1584,7 @@ errout_with_priv: } /**************************************************************************** - * Name: arch_tcuninitialize + * Name: board_tsc_teardown * * Description: * Each board that supports a touchscreen device must provide this function. @@ -1598,7 +1599,7 @@ errout_with_priv: * ****************************************************************************/ -void arch_tcuninitialize(void) +void board_tsc_teardown(void) { /* Need to unregister the /dev/inputN device here. */ } diff --git a/configs/olimex-lpc1766stk/hidmouse/defconfig b/configs/olimex-lpc1766stk/hidmouse/defconfig index 68f5381c57..da70dc4a22 100644 --- a/configs/olimex-lpc1766stk/hidmouse/defconfig +++ b/configs/olimex-lpc1766stk/hidmouse/defconfig @@ -703,6 +703,8 @@ CONFIG_EXAMPLES_NSH=y # CONFIG_EXAMPLES_THTTPD is not set # CONFIG_EXAMPLES_TIFF is not set CONFIG_EXAMPLES_TOUCHSCREEN=y +CONFIG_LIB_BOARDCTL=y +CONFIG_BOARDCTL_TSCTEST=y CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/mouse0" CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE=y diff --git a/configs/olimex-lpc1766stk/src/lpc17_hidmouse.c b/configs/olimex-lpc1766stk/src/lpc17_hidmouse.c index d78579245c..24fa5aa17d 100644 --- a/configs/olimex-lpc1766stk/src/lpc17_hidmouse.c +++ b/configs/olimex-lpc1766stk/src/lpc17_hidmouse.c @@ -45,6 +45,7 @@ #include #include +#include #include #include @@ -90,7 +91,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: arch_tcinitialize + * Name: board_tsc_setup * * Description: * Each board that supports a touchscreen device must provide this @@ -108,7 +109,7 @@ * ****************************************************************************/ -int arch_tcinitialize(int minor) +int board_tsc_setup(int minor) { static bool initialized = false; int ret; @@ -142,7 +143,7 @@ int arch_tcinitialize(int minor) } /**************************************************************************** - * Name: arch_tcuninitialize + * Name: board_tsc_teardown * * Description: * Each board that supports a touchscreen device must provide this function. @@ -157,7 +158,7 @@ int arch_tcinitialize(int minor) * ****************************************************************************/ -void arch_tcuninitialize(void) +void board_tsc_teardown(void) { /* No support for un-initializing the USB mouse driver. It will continue * to run and process touch interrupts in the background. diff --git a/configs/open1788/src/lpc17_touchscreen.c b/configs/open1788/src/lpc17_touchscreen.c index 09dcb0a338..2dfb69c550 100644 --- a/configs/open1788/src/lpc17_touchscreen.c +++ b/configs/open1788/src/lpc17_touchscreen.c @@ -254,7 +254,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: arch_tcinitialize + * Name: board_tsc_setup * * Description: * Each board that supports a touchscreen device must provide this @@ -271,7 +271,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) * ****************************************************************************/ -int arch_tcinitialize(int minor) +int board_tsc_setup(int minor) { static bool initialized = false; FAR struct spi_dev_s *dev; @@ -323,7 +323,7 @@ int arch_tcinitialize(int minor) } /**************************************************************************** - * Name: arch_tcuninitialize + * Name: board_tsc_teardown * * Description: * Each board that supports a touchscreen device must provide this function. @@ -338,7 +338,7 @@ int arch_tcinitialize(int minor) * ****************************************************************************/ -void arch_tcuninitialize(void) +void board_tsc_teardown(void) { /* No support for un-initializing the touchscreen XPT2046 device yet */ } diff --git a/configs/pic32mx7mmb/src/pic32_touchscreen.c b/configs/pic32mx7mmb/src/pic32_touchscreen.c index e4b8a2d64d..33434bd8e8 100644 --- a/configs/pic32mx7mmb/src/pic32_touchscreen.c +++ b/configs/pic32mx7mmb/src/pic32_touchscreen.c @@ -48,6 +48,7 @@ #include #include +#include #include #include #include @@ -1343,7 +1344,7 @@ errout: ************************************************************************************/ /**************************************************************************** - * Name: arch_tcinitialize + * Name: board_tsc_setup * * Description: * Each board that supports a touchscreen device must provide this function. @@ -1360,7 +1361,7 @@ errout: * ****************************************************************************/ -int arch_tcinitialize(int minor) +int board_tsc_setup(int minor) { FAR struct tc_dev_s *priv; char devname[DEV_NAMELEN]; @@ -1436,7 +1437,7 @@ errout_with_priv: } /**************************************************************************** - * Name: arch_tcuninitialize + * Name: board_tsc_teardown * * Description: * Each board that supports a touchscreen device must provide this function. @@ -1451,7 +1452,7 @@ errout_with_priv: * ****************************************************************************/ -void arch_tcuninitialize(void) +void board_tsc_teardown(void) { /* Need to unregister the /dev/inputN device here. */ } diff --git a/configs/sam3u-ek/src/sam_touchscreen.c b/configs/sam3u-ek/src/sam_touchscreen.c index 0becba7824..533b3b26b9 100644 --- a/configs/sam3u-ek/src/sam_touchscreen.c +++ b/configs/sam3u-ek/src/sam_touchscreen.c @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -213,7 +214,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: arch_tcinitialize + * Name: board_tsc_setup * * Description: * Each board that supports a touchscreen device must provide this function. @@ -230,7 +231,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) * ****************************************************************************/ -int arch_tcinitialize(int minor) +int board_tsc_setup(int minor) { FAR struct spi_dev_s *dev; int ret; @@ -270,7 +271,7 @@ int arch_tcinitialize(int minor) } /**************************************************************************** - * Name: arch_tcuninitialize + * Name: board_tsc_teardown * * Description: * Each board that supports a touchscreen device must provide this function. @@ -285,7 +286,7 @@ int arch_tcinitialize(int minor) * ****************************************************************************/ -void arch_tcuninitialize(void) +void board_tsc_teardown(void) { /* No support for un-initializing the touchscreen ADS7843E device yet */ } diff --git a/configs/sam4e-ek/src/sam_ads7843e.c b/configs/sam4e-ek/src/sam_ads7843e.c index 1f3265bcf9..1fe76919f1 100644 --- a/configs/sam4e-ek/src/sam_ads7843e.c +++ b/configs/sam4e-ek/src/sam_ads7843e.c @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -210,7 +211,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: arch_tcinitialize + * Name: board_tsc_setup * * Description: * Each board that supports a touchscreen device must provide this function. @@ -227,7 +228,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) * ****************************************************************************/ -int arch_tcinitialize(int minor) +int board_tsc_setup(int minor) { FAR struct spi_dev_s *dev; int ret; @@ -267,7 +268,7 @@ int arch_tcinitialize(int minor) } /**************************************************************************** - * Name: arch_tcuninitialize + * Name: board_tsc_teardown * * Description: * Each board that supports a touchscreen device must provide this function. @@ -282,7 +283,7 @@ int arch_tcinitialize(int minor) * ****************************************************************************/ -void arch_tcuninitialize(void) +void board_tsc_teardown(void) { /* No support for un-initializing the touchscreen ADS7843E device yet */ } diff --git a/configs/sama5d3x-ek/src/sam_touchscreen.c b/configs/sama5d3x-ek/src/sam_touchscreen.c index 51345ab667..3ab2572b2c 100644 --- a/configs/sama5d3x-ek/src/sam_touchscreen.c +++ b/configs/sama5d3x-ek/src/sam_touchscreen.c @@ -47,6 +47,8 @@ #include "sam_tsd.h" #include "sama5d3x-ek.h" +#include + #ifdef CONFIG_SAMA5_TSD /**************************************************************************** @@ -83,7 +85,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: arch_tcinitialize + * Name: board_tsc_setup * * Description: * Each board that supports a touchscreen device must provide this @@ -100,7 +102,7 @@ * ****************************************************************************/ -int arch_tcinitialize(int minor) +int board_tsc_setup(int minor) { struct sam_adc_s *adc; static bool initialized = false; @@ -141,7 +143,7 @@ int arch_tcinitialize(int minor) } /**************************************************************************** - * Name: arch_tcuninitialize + * Name: board_tsc_teardown * * Description: * Each board that supports a touchscreen device must provide this function. @@ -156,7 +158,7 @@ int arch_tcinitialize(int minor) * ****************************************************************************/ -void arch_tcuninitialize(void) +void board_tsc_teardown(void) { /* No support for un-initializing the touchscreen yet */ } diff --git a/configs/sama5d4-ek/ipv6/defconfig b/configs/sama5d4-ek/ipv6/defconfig index 77f44963ea..ca5ee10e7c 100644 --- a/configs/sama5d4-ek/ipv6/defconfig +++ b/configs/sama5d4-ek/ipv6/defconfig @@ -1220,6 +1220,8 @@ CONFIG_EXAMPLES_NX_TOOLBAR_HEIGHT=16 # CONFIG_EXAMPLES_THTTPD is not set # CONFIG_EXAMPLES_TIFF is not set CONFIG_EXAMPLES_TOUCHSCREEN=y +CONFIG_LIB_BOARDCTL=y +CONFIG_BOARDCTL_TSCTEST=y CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0" # CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE is not set diff --git a/configs/sama5d4-ek/nsh/defconfig b/configs/sama5d4-ek/nsh/defconfig index 49badb8f9e..82c1de8947 100644 --- a/configs/sama5d4-ek/nsh/defconfig +++ b/configs/sama5d4-ek/nsh/defconfig @@ -1222,6 +1222,8 @@ CONFIG_EXAMPLES_NX_TOOLBAR_HEIGHT=16 # CONFIG_EXAMPLES_THTTPD is not set # CONFIG_EXAMPLES_TIFF is not set CONFIG_EXAMPLES_TOUCHSCREEN=y +CONFIG_LIB_BOARDCTL=y +CONFIG_BOARDCTL_TSCTEST=y CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0" # CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE is not set diff --git a/configs/sama5d4-ek/src/sam_maxtouch.c b/configs/sama5d4-ek/src/sam_maxtouch.c index 6a73fb4cec..8de590332b 100644 --- a/configs/sama5d4-ek/src/sam_maxtouch.c +++ b/configs/sama5d4-ek/src/sam_maxtouch.c @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -218,7 +219,7 @@ static int mxt_interrupt(int irq, FAR void *context) ****************************************************************************/ /**************************************************************************** - * Name: arch_tcinitialize + * Name: board_tsc_setup * * Description: * Each board that supports a touchscreen device must provide this function. @@ -235,7 +236,7 @@ static int mxt_interrupt(int irq, FAR void *context) * ****************************************************************************/ -int arch_tcinitialize(int minor) +int board_tsc_setup(int minor) { FAR struct i2c_dev_s *i2c; static bool initialized = false; @@ -290,7 +291,7 @@ int arch_tcinitialize(int minor) } /**************************************************************************** - * Name: arch_tcuninitialize + * Name: board_tsc_teardown * * Description: * Each board that supports a touchscreen device must provide this function. @@ -305,7 +306,7 @@ int arch_tcinitialize(int minor) * ****************************************************************************/ -void arch_tcuninitialize(void) +void board_tsc_teardown(void) { /* No support for un-initializing the touchscreen maXTouch device. It will * continue to run and process touch interrupts in the background. diff --git a/configs/samv71-xult/mxtxplnd/defconfig b/configs/samv71-xult/mxtxplnd/defconfig index a514a3bd24..ff5f597dbc 100644 --- a/configs/samv71-xult/mxtxplnd/defconfig +++ b/configs/samv71-xult/mxtxplnd/defconfig @@ -792,6 +792,8 @@ CONFIG_EXAMPLES_NSH=y # CONFIG_EXAMPLES_THTTPD is not set # CONFIG_EXAMPLES_TIFF is not set CONFIG_EXAMPLES_TOUCHSCREEN=y +CONFIG_LIB_BOARDCTL=y +CONFIG_BOARDCTL_TSCTEST=y CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0" # CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE is not set diff --git a/configs/samv71-xult/src/sam_maxtouch.c b/configs/samv71-xult/src/sam_maxtouch.c index b0559b3253..14615cc220 100644 --- a/configs/samv71-xult/src/sam_maxtouch.c +++ b/configs/samv71-xult/src/sam_maxtouch.c @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -214,7 +215,7 @@ static int mxt_interrupt(int irq, FAR void *context) ****************************************************************************/ /**************************************************************************** - * Name: arch_tcinitialize + * Name: board_tsc_setup * * Description: * Each board that supports a touchscreen device must provide this function. @@ -231,7 +232,7 @@ static int mxt_interrupt(int irq, FAR void *context) * ****************************************************************************/ -int arch_tcinitialize(int minor) +int board_tsc_setup(int minor) { FAR struct i2c_dev_s *i2c; static bool initialized = false; @@ -286,7 +287,7 @@ int arch_tcinitialize(int minor) } /**************************************************************************** - * Name: arch_tcuninitialize + * Name: board_tsc_teardown * * Description: * Each board that supports a touchscreen device must provide this function. @@ -301,7 +302,7 @@ int arch_tcinitialize(int minor) * ****************************************************************************/ -void arch_tcuninitialize(void) +void board_tsc_teardown(void) { /* No support for un-initializing the touchscreen maXTouch device. It will * continue to run and process touch interrupts in the background. diff --git a/configs/shenzhou/src/stm32_touchscreen.c b/configs/shenzhou/src/stm32_touchscreen.c index 5128733ef7..e2c6ba0d0b 100644 --- a/configs/shenzhou/src/stm32_touchscreen.c +++ b/configs/shenzhou/src/stm32_touchscreen.c @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -228,7 +229,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: arch_tcinitialize + * Name: board_tsc_setup * * Description: * Each board that supports a touchscreen device must provide this function. @@ -245,7 +246,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) * ****************************************************************************/ -int arch_tcinitialize(int minor) +int board_tsc_setup(int minor) { FAR struct spi_dev_s *dev; int ret; @@ -280,7 +281,7 @@ int arch_tcinitialize(int minor) } /**************************************************************************** - * Name: arch_tcuninitialize + * Name: board_tsc_teardown * * Description: * Each board that supports a touchscreen device must provide this function. @@ -295,7 +296,7 @@ int arch_tcinitialize(int minor) * ****************************************************************************/ -void arch_tcuninitialize(void) +void board_tsc_teardown(void) { /* No support for un-initializing the touchscreen ADS7843E device yet */ } diff --git a/configs/sim/README.txt b/configs/sim/README.txt index 6d6192a33c..aaeba1c1da 100644 --- a/configs/sim/README.txt +++ b/configs/sim/README.txt @@ -490,7 +490,7 @@ nx11 CONFIG_SIM_TOUCHSCREEN=y Then you must also have some application logic that will call - arch_tcinitialize(0) to register the touchscreen driver. See + board_tsc_setup(0) to register the touchscreen driver. See also configuration "touchscreen" NOTES: diff --git a/configs/sim/nsh2/defconfig b/configs/sim/nsh2/defconfig index 067434c8e1..3bc73dad54 100644 --- a/configs/sim/nsh2/defconfig +++ b/configs/sim/nsh2/defconfig @@ -517,6 +517,8 @@ CONFIG_EXAMPLES_NXLINES_BPP=32 # CONFIG_EXAMPLES_THTTPD is not set # CONFIG_EXAMPLES_TIFF is not set CONFIG_EXAMPLES_TOUCHSCREEN=y +CONFIG_LIB_BOARDCTL=y +CONFIG_BOARDCTL_TSCTEST=y CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0" CONFIG_EXAMPLES_TOUCHSCREEN_ARCHINIT=y diff --git a/configs/sim/src/sim_touchscreen.c b/configs/sim/src/sim_touchscreen.c index f91674c443..57ec36c1ae 100644 --- a/configs/sim/src/sim_touchscreen.c +++ b/configs/sim/src/sim_touchscreen.c @@ -44,6 +44,7 @@ #include #include +#include #include #include #include @@ -83,7 +84,7 @@ static struct sim_touchscreen_s g_simtc; ****************************************************************************/ /**************************************************************************** - * Name: arch_tcinitialize() + * Name: board_tsc_setup() * * Description: * Perform architecuture-specific initialization of the touchscreen @@ -92,7 +93,7 @@ static struct sim_touchscreen_s g_simtc; * ****************************************************************************/ -int arch_tcinitialize(int minor) +int board_tsc_setup(int minor) { FAR NX_DRIVERTYPE *dev; nxgl_mxpixel_t color; @@ -143,10 +144,10 @@ int arch_tcinitialize(int minor) /* Finally, initialize the touchscreen simulation on the X window */ - ret = arch_tcinitialize(minor); + ret = board_tsc_setup(minor); if (ret < 0) { - idbg("arch_tcinitialize failed: %d\n", ret); + idbg("board_tsc_setup failed: %d\n", ret); goto errout_with_nx; } return OK; @@ -161,7 +162,7 @@ errout: } /**************************************************************************** - * Name: arch_tcuninitialize() + * Name: board_tsc_teardown() * * Description: * Perform architecuture-specific un-initialization of the touchscreen @@ -170,7 +171,7 @@ errout: * ****************************************************************************/ -void arch_tcuninitialize(void) +void board_tsc_teardown(void) { /* Shut down the touchscreen driver */ diff --git a/configs/sim/touchscreen/defconfig b/configs/sim/touchscreen/defconfig index 7b914fa5f7..399eab66d6 100644 --- a/configs/sim/touchscreen/defconfig +++ b/configs/sim/touchscreen/defconfig @@ -511,6 +511,8 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # CONFIG_EXAMPLES_THTTPD is not set # CONFIG_EXAMPLES_TIFF is not set CONFIG_EXAMPLES_TOUCHSCREEN=y +CONFIG_LIB_BOARDCTL=y +CONFIG_BOARDCTL_TSCTEST=y CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0" CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES=25 diff --git a/configs/stm3220g-eval/src/stm32_stmpe811.c b/configs/stm3220g-eval/src/stm32_stmpe811.c index a9e7886082..30f2ea3dee 100644 --- a/configs/stm3220g-eval/src/stm32_stmpe811.c +++ b/configs/stm3220g-eval/src/stm32_stmpe811.c @@ -44,6 +44,7 @@ #include #include +#include #include #include #include @@ -255,7 +256,7 @@ static void stmpe811_clear(FAR struct stmpe811_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: arch_tcinitialize + * Name: board_tsc_setup * * Description: * Each board that supports a touchscreen device must provide this function. @@ -272,7 +273,7 @@ static void stmpe811_clear(FAR struct stmpe811_config_s *state) * ****************************************************************************/ -int arch_tcinitialize(int minor) +int board_tsc_setup(int minor) { #ifndef CONFIG_STMPE811_TSC_DISABLE FAR struct i2c_dev_s *dev; @@ -328,7 +329,7 @@ int arch_tcinitialize(int minor) } /**************************************************************************** - * Name: arch_tcuninitialize + * Name: board_tsc_teardown * * Description: * Each board that supports a touchscreen device must provide this function. @@ -343,7 +344,7 @@ int arch_tcinitialize(int minor) * ****************************************************************************/ -void arch_tcuninitialize(void) +void board_tsc_teardown(void) { /* No support for un-initializing the touchscreen STMPE811 device yet */ } diff --git a/configs/stm3240g-eval/src/stm32_boot.c b/configs/stm3240g-eval/src/stm32_boot.c index d6d14e50a8..bbf5bc5331 100644 --- a/configs/stm3240g-eval/src/stm32_boot.c +++ b/configs/stm3240g-eval/src/stm32_boot.c @@ -181,10 +181,10 @@ static int board_initthread(int argc, char *argv[]) /* Initialize the touchscreen */ #ifdef HAVE_TCINIT - ret = arch_tcinitialize(CONFIG_NXWM_TOUCHSCREEN_DEVNO); + ret = board_tsc_setup(CONFIG_NXWM_TOUCHSCREEN_DEVNO); if (ret < 0) { - gdbg("ERROR: arch_tcinitialize failed: %d\n", ret); + gdbg("ERROR: board_tsc_setup failed: %d\n", ret); } #endif diff --git a/configs/stm3240g-eval/src/stm32_stmpe811.c b/configs/stm3240g-eval/src/stm32_stmpe811.c index 6ef8eb2690..0418283c26 100644 --- a/configs/stm3240g-eval/src/stm32_stmpe811.c +++ b/configs/stm3240g-eval/src/stm32_stmpe811.c @@ -44,6 +44,7 @@ #include #include +#include #include #include #include @@ -255,7 +256,7 @@ static void stmpe811_clear(FAR struct stmpe811_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: arch_tcinitialize + * Name: board_tsc_setup * * Description: * Each board that supports a touchscreen device must provide this function. @@ -272,7 +273,7 @@ static void stmpe811_clear(FAR struct stmpe811_config_s *state) * ****************************************************************************/ -int arch_tcinitialize(int minor) +int board_tsc_setup(int minor) { #ifndef CONFIG_STMPE811_TSC_DISABLE FAR struct i2c_dev_s *dev; @@ -328,7 +329,7 @@ int arch_tcinitialize(int minor) } /**************************************************************************** - * Name: arch_tcuninitialize + * Name: board_tsc_teardown * * Description: * Each board that supports a touchscreen device must provide this function. @@ -343,7 +344,7 @@ int arch_tcinitialize(int minor) * ****************************************************************************/ -void arch_tcuninitialize(void) +void board_tsc_teardown(void) { /* No support for un-initializing the touchscreen STMPE811 device yet */ } diff --git a/configs/viewtool-stm32f107/src/stm32_touchscreen.c b/configs/viewtool-stm32f107/src/stm32_touchscreen.c index e2061e4697..a0edfcabf4 100644 --- a/configs/viewtool-stm32f107/src/stm32_touchscreen.c +++ b/configs/viewtool-stm32f107/src/stm32_touchscreen.c @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -234,7 +235,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) ****************************************************************************/ /**************************************************************************** - * Name: arch_tcinitialize + * Name: board_tsc_setup * * Description: * Each board that supports a touchscreen device must provide this function. @@ -251,7 +252,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) * ****************************************************************************/ -int arch_tcinitialize(int minor) +int board_tsc_setup(int minor) { FAR struct spi_dev_s *dev; static bool initialized = false; @@ -300,7 +301,7 @@ int arch_tcinitialize(int minor) } /**************************************************************************** - * Name: arch_tcuninitialize + * Name: board_tsc_teardown * * Description: * Each board that supports a touchscreen device must provide this function. @@ -315,7 +316,7 @@ int arch_tcinitialize(int minor) * ****************************************************************************/ -void arch_tcuninitialize(void) +void board_tsc_teardown(void) { /* No support for un-initializing the touchscreen XPT2046 device. It will * continue to run and process touch interrupts in the background. diff --git a/include/nuttx/board.h b/include/nuttx/board.h index cfbbb83318..2942b02173 100644 --- a/include/nuttx/board.h +++ b/include/nuttx/board.h @@ -142,7 +142,59 @@ void board_initialize(void); #ifdef CONFIG_LIB_BOARDCTL int board_app_initialize(void); -#endif +#endif /* CONFIG_LIB_BOARDCTL */ + +/**************************************************************************** + * 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 commands + * 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_tsc_teardown + * + * Description: + * Each board that supports a touchscreen device must provide this function. + * This function is called by application-specific, setup logic to + * uninitialize the touchscreen device. + * + * 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 commands + * BOARDIOC_TSCTEST_TEARDOWN command. + * + * Input Parameters: + * None + * + * Returned Value: + * None. + * + ****************************************************************************/ + +void board_tsc_teardown(void); /**************************************************************************** * Name: board_led_initialize diff --git a/include/nuttx/input/touchscreen.h b/include/nuttx/input/touchscreen.h index d9e531d5ff..dcd91b4d59 100644 --- a/include/nuttx/input/touchscreen.h +++ b/include/nuttx/input/touchscreen.h @@ -134,44 +134,6 @@ extern "C" #define EXTERN extern #endif -/**************************************************************************** - * Name: arch_tcinitialize - * - * 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. - * - * 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 arch_tcinitialize(int minor); - -/**************************************************************************** - * Name: arch_tcuninitialize - * - * Description: - * Each board that supports a touchscreen device must provide this function. - * This function is called by application-specific, setup logic to - * uninitialize the touchscreen device. - * - * Input Parameters: - * None - * - * Returned Value: - * None. - * - ****************************************************************************/ - -void arch_tcuninitialize(void); - #undef EXTERN #ifdef __cplusplus } diff --git a/include/sys/boardctl.h b/include/sys/boardctl.h index 811953e084..675daa8025 100644 --- a/include/sys/boardctl.h +++ b/include/sys/boardctl.h @@ -58,16 +58,22 @@ * CONFIGURATION: CONFIG_LIB_BOARDCTL * DEPENDENCIES: Board logic must provide board_app_initialization * - * CMD: BOARDIOC_TSCTEST + * CMD: BOARDIOC_TSCTEST_SETUP * DESCRIPTION: Touchscreen controller test configuration - * ARG: 0: Setup touchscreen test, 1: Teardown touchscreen test + * ARG: Touch controller device minor number * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_TSCTEST - * DEPENDENCIES: Board logic must provide board_tsc_setup() and - * board_tsc_teardown(). + * DEPENDENCIES: Board logic must provide board_tsc_setup() + * + * CMD: BOARDIOC_TSCTEST_TEARDOWN + * DESCRIPTION: Touchscreen controller test configuration + * ARG: None + * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_TSCTEST + * DEPENDENCIES: Board logic must provide board_tsc_teardown() */ -#define BOARDIOC_INIT _BOARDIOC(0x0001) -#define BOARDIOC_TSCTEST _BOARDIOC(0x0002) +#define BOARDIOC_INIT _BOARDIOC(0x0001) +#define BOARDIOC_TSCTEST_SETUP _BOARDIOC(0x0002) +#define BOARDIOC_TSCTEST_TEARDOWN _BOARDIOC(0x0003) /**************************************************************************** * Public Type Definitions