diff options
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/ChangeLog | 4 | ||||
-rw-r--r-- | nuttx/arch/sim/src/up_touchscreen.c | 8 | ||||
-rw-r--r-- | nuttx/configs/hymini-stm32v/src/hymini_stm32v-internal.h | 13 | ||||
-rw-r--r-- | nuttx/configs/hymini-stm32v/src/up_ts.c | 33 | ||||
-rw-r--r-- | nuttx/configs/sam3u-ek/src/up_touchscreen.c | 30 | ||||
-rw-r--r-- | nuttx/configs/sim/README.txt | 2 | ||||
-rw-r--r-- | nuttx/configs/sim/src/up_touchscreen.c | 4 | ||||
-rw-r--r-- | nuttx/configs/stm3240g-eval/nxwm/appconfig | 5 | ||||
-rw-r--r-- | nuttx/configs/stm3240g-eval/src/up_stmpe11.c | 27 | ||||
-rw-r--r-- | nuttx/drivers/input/stmpe11_tsc.c | 7 | ||||
-rw-r--r-- | nuttx/include/nuttx/input/touchscreen.h | 24 |
11 files changed, 106 insertions, 51 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 3d1324759..0f7e5af3a 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -2726,5 +2726,9 @@ * include/cxx/cfcntl: Added std:: header file. * graphics/nxbe/nxbe_filltrapezoid.c and graphics/nxglib/fb/nxglib_filltrapezoid.c: Fix several errors in the trapezoid fill logic. + * include/nuttx/input/touchscreen.h, configs/hymini-stm32, configs/stm3240g-evel, + * configs/sam3u-ek, configs/sim, arch/sim/src/up_touchscreen.c, and + apps/examples/touchscreen: Standardize the board-specific, touchscreen + initialization interfaces. diff --git a/nuttx/arch/sim/src/up_touchscreen.c b/nuttx/arch/sim/src/up_touchscreen.c index 53e8e0d0d..a05b42c74 100644 --- a/nuttx/arch/sim/src/up_touchscreen.c +++ b/nuttx/arch/sim/src/up_touchscreen.c @@ -625,7 +625,7 @@ errout: ****************************************************************************/ /**************************************************************************** - * Name: sim_tcinitialize + * Name: arch_tcinitialize * * Description: * Configure the simulated touchscreen. This will register the driver as @@ -640,7 +640,7 @@ errout: * ****************************************************************************/ -int sim_tcinitialize(int minor) +int arch_tcinitialize(int minor) { FAR struct up_dev_s *priv = ( FAR struct up_dev_s *)&g_simtouchscreen; char devname[DEV_NAMELEN]; @@ -687,7 +687,7 @@ errout_with_priv: } /**************************************************************************** - * Name: sim_tcuninitialize + * Name: arch_tcuninitialize * * Description: * Uninitialized the simulated touchscreen @@ -700,7 +700,7 @@ errout_with_priv: * ****************************************************************************/ -void sim_tcuninitialize(void) +void arch_tcuninitialize(void) { FAR struct up_dev_s *priv = ( FAR struct up_dev_s *)&g_simtouchscreen; char devname[DEV_NAMELEN]; diff --git a/nuttx/configs/hymini-stm32v/src/hymini_stm32v-internal.h b/nuttx/configs/hymini-stm32v/src/hymini_stm32v-internal.h index 718220454..03dceea19 100644 --- a/nuttx/configs/hymini-stm32v/src/hymini_stm32v-internal.h +++ b/nuttx/configs/hymini-stm32v/src/hymini_stm32v-internal.h @@ -135,19 +135,6 @@ extern void weak_function stm32_spiinitialize(void); extern void weak_function stm32_usbinitialize(void); -#if defined(CONFIG_INPUT_ADS7843E) - -/************************************************************************************ - * Name: Touchscreen initialization - * - ************************************************************************************/ - -extern int arch_tcinitialize(int minor); - -extern void arch_tcuninitialize(void); - -#endif /* CONFIG_INPUT_ADS7843E */ - #endif /* __ASSEMBLY__ */ #endif /* __CONFIGS_HYMINI_STM32V_INTERNAL_H */ diff --git a/nuttx/configs/hymini-stm32v/src/up_ts.c b/nuttx/configs/hymini-stm32v/src/up_ts.c index 6c4decf7c..e5a779605 100644 --- a/nuttx/configs/hymini-stm32v/src/up_ts.c +++ b/nuttx/configs/hymini-stm32v/src/up_ts.c @@ -46,6 +46,7 @@ #include "stm32_internal.h" #include "hymini_stm32v-internal.h" +#include <nuttx/input/touchscreen.h> #include <nuttx/input/ads7843e.h> #if !defined(CONFIG_STM32_SPI1) @@ -120,11 +121,20 @@ static bool hymini_ts_pendown(FAR struct ads7843e_config_s *state) } /**************************************************************************** - * Name: arch_tcinitialize() + * Name: arch_tcinitialize * * Description: - * Perform architecture-specific initialization of the touchscreen. - * This function must be called directly from application. + * 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. * ****************************************************************************/ @@ -132,12 +142,12 @@ int arch_tcinitialize(int minor) { FAR struct spi_dev_s *dev; - idbg("arch_tcinitialize: minor %d\n", minor); + idbg("minor %d\n", minor); dev = up_spiinitialize(1); if (!dev) { - idbg("arch_tcinitialize: Failed to initialize SPI bus\n"); + idbg("Failed to initialize SPI bus\n"); return -ENODEV; } @@ -149,11 +159,18 @@ int arch_tcinitialize(int minor) } /**************************************************************************** - * Name: arch_tcuninitialize() + * Name: arch_tcuninitialize * * Description: - * Perform architecture-specific un-initialization of the touchscreen - * hardware. This function must be called directly from application. + * 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. * ****************************************************************************/ diff --git a/nuttx/configs/sam3u-ek/src/up_touchscreen.c b/nuttx/configs/sam3u-ek/src/up_touchscreen.c index 0de367ec9..35ab43859 100644 --- a/nuttx/configs/sam3u-ek/src/up_touchscreen.c +++ b/nuttx/configs/sam3u-ek/src/up_touchscreen.c @@ -2,7 +2,7 @@ * configs/sam3u-ek/src/up_touchscreen.c * arch/arm/src/board/up_touchscreen.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -43,6 +43,7 @@ #include <stdbool.h> #include <stdio.h> #include <debug.h> +#include <assert.h> #include <errno.h> #include <nuttx/spi.h> @@ -213,16 +214,27 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state) * Name: arch_tcinitialize * * Description: - * Initialize the touchscreen device + * 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(void) +int arch_tcinitialize(int minor) { FAR struct spi_dev_s *dev; int ret; - ivdbg("Initializing\n"); + idbg("minor %d\n", minor); + DEBUGASSERT(minor == 0); /* Configure and enable the ADS7843E interrupt pin as an input */ @@ -259,7 +271,15 @@ int arch_tcinitialize(void) * Name: arch_tcuninitialize * * Description: - * Un-initialize the touchscreen device + * 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. * ****************************************************************************/ diff --git a/nuttx/configs/sim/README.txt b/nuttx/configs/sim/README.txt index 3be43bf80..833ec58dc 100644 --- a/nuttx/configs/sim/README.txt +++ b/nuttx/configs/sim/README.txt @@ -342,7 +342,7 @@ nx11 CONFIG_SIM_TOUCHSCREEN=y Then you must also have some application logic that will call - sim_tcinitialize(0) to register the touchscreen driver. See + arch_tcinitialize(0) to register the touchscreen driver. See also configuration "touchscreen" NOTES: diff --git a/nuttx/configs/sim/src/up_touchscreen.c b/nuttx/configs/sim/src/up_touchscreen.c index 54d6d0cb3..ef3686288 100644 --- a/nuttx/configs/sim/src/up_touchscreen.c +++ b/nuttx/configs/sim/src/up_touchscreen.c @@ -143,10 +143,10 @@ int arch_tcinitialize(int minor) /* Finally, initialize the touchscreen simulation on the X window */ - ret = sim_tcinitialize(minor); + ret = arch_tcinitialize(minor); if (ret < 0) { - idbg("sim_tcinitialize failed: %d\n", ret); + idbg("arch_tcinitialize failed: %d\n", ret); goto errout_with_nx; } return OK; diff --git a/nuttx/configs/stm3240g-eval/nxwm/appconfig b/nuttx/configs/stm3240g-eval/nxwm/appconfig index 212e36680..6a5864fb1 100644 --- a/nuttx/configs/stm3240g-eval/nxwm/appconfig +++ b/nuttx/configs/stm3240g-eval/nxwm/appconfig @@ -33,8 +33,9 @@ # ############################################################################ -# The NSH Library -- NOTE: The NxWM unit must be installed in order -# to build this example. +# The NSH Library -- NOTE: The NxWM unit test must be installed at +# apps/external in order to build this example. See +# NxWidgets/UnitTests/README.txt for additional information CONFIGURED_APPS += system/readline CONFIGURED_APPS += nshlib diff --git a/nuttx/configs/stm3240g-eval/src/up_stmpe11.c b/nuttx/configs/stm3240g-eval/src/up_stmpe11.c index a9402eda7..e06e203e7 100644 --- a/nuttx/configs/stm3240g-eval/src/up_stmpe11.c +++ b/nuttx/configs/stm3240g-eval/src/up_stmpe11.c @@ -252,16 +252,29 @@ static void stmpe11_clear(FAR struct stmpe11_config_s *state) * Name: arch_tcinitialize * * Description: - * Initialize the touchscreen device + * 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(void) +int arch_tcinitialize(int minor) { #ifndef CONFIG_STMPE11_TSC_DISABLE FAR struct i2c_dev_s *dev; int ret; + idbg("minor %d\n", minor); + DEBUGASSERT(minor == 0); + /* Check if we are already initialized */ if (!g_stmpe11config.handle) @@ -312,7 +325,15 @@ int arch_tcinitialize(void) * Name: arch_tcuninitialize * * Description: - * Un-initialize the touchscreen device + * 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. * ****************************************************************************/ diff --git a/nuttx/drivers/input/stmpe11_tsc.c b/nuttx/drivers/input/stmpe11_tsc.c index a452d8798..29dc51d02 100644 --- a/nuttx/drivers/input/stmpe11_tsc.c +++ b/nuttx/drivers/input/stmpe11_tsc.c @@ -306,11 +306,16 @@ static inline int stmpe11_waitsample(FAR struct stmpe11_dev_s *priv, if (ret < 0) { + // Sample the errno (debug output could change it) + + int errval = errno; + /* If we are awakened by a signal, then we need to return * the failure now. */ - DEBUGASSERT(errno == EINTR); + idbg("sem_wait failed: %d\n", errval); + DEBUGASSERT(errval == EINTR); ret = -EINTR; goto errout; } diff --git a/nuttx/include/nuttx/input/touchscreen.h b/nuttx/include/nuttx/input/touchscreen.h index dce898fcc..04fc13dd7 100644 --- a/nuttx/include/nuttx/input/touchscreen.h +++ b/nuttx/include/nuttx/input/touchscreen.h @@ -1,7 +1,7 @@ /************************************************************************************ * include/nuttx/input/touchscreen.h * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -134,11 +134,13 @@ extern "C" { #endif /**************************************************************************** - * Name: sim_tcinitialize + * Name: arch_tcinitialize * * Description: - * Configure the simulated touchscreen. This will register the driver as - * /dev/inputN where N is the minor device number. + * 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 @@ -149,15 +151,15 @@ extern "C" { * ****************************************************************************/ -#if defined(CONFIG_SIM_X11FB) && defined(CONFIG_SIM_TOUCHSCREEN) -EXTERN int sim_tcinitialize(int minor); -#endif +EXTERN int arch_tcinitialize(int minor); /**************************************************************************** - * Name: sim_tcuninitialize + * Name: arch_tcuninitialize * * Description: - * Uninitialized the simulated touchscreen + * 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 @@ -167,9 +169,7 @@ EXTERN int sim_tcinitialize(int minor); * ****************************************************************************/ -#if defined(CONFIG_SIM_X11FB) && defined(CONFIG_SIM_TOUCHSCREEN) -EXTERN void sim_tcuninitialize(void); -#endif +EXTERN void arch_tcuninitialize(void); #undef EXTERN #ifdef __cplusplus |