diff --git a/NxWidgets/Kconfig b/NxWidgets/Kconfig index 89e7e222d..066cdb2da 100644 --- a/NxWidgets/Kconfig +++ b/NxWidgets/Kconfig @@ -782,12 +782,11 @@ config NXWM_TOUCHSCREEN_DEVINIT depends on !BUILD_PROTECTED && !BUILD_KERNEL ---help--- It this option is selected, then the NxWM:CTouchscreen listener - thread will call a function arch_tcinitialize(NXWM_TOUCHSCREEN_DEVNO) - in order to instantiate the touchscreen driver at path - NXWM_TOUCHSCREEN_DEVPATH. If NXWM_TOUCHSCREEN_DEVINIT is not - selected, then the NxWM:CTouchscreen listener thread will assume - that the driver has already been initialized at - NXWM_TOUCHSCREEN_DEVPATH. + thread will call a function boardctl() in order to instantiate the + touchscreen driver at path NXWM_TOUCHSCREEN_DEVPATH. If + NXWM_TOUCHSCREEN_DEVINIT is not selected, then the NxWM:CTouchscreen + listener thread will assume that the driver has already been + initialized at NXWM_TOUCHSCREEN_DEVPATH. NOTE that in the kernel build, all touchscreen initialize must be performed in kernel logic prior to the execution of NxWM. diff --git a/examples/README.txt b/examples/README.txt index 1a4047592..27ff6d1e2 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -1809,12 +1809,13 @@ examples/touchscreen CONFIG_EXAMPLES_TOUCHSREEN=y - The board-specific logic must provide the following interfaces that will - be called by the example in order to initialize and uninitialize the - touchscreen hardware: + This example code will call boardctl() to setup the touchscreen driver + for texting. The implementation of boardctl() will require that board- + specific logic provide the following interfaces that will be called by + the boardctl() in order to initialize and uninitialize the touchscreen hardware: - int arch_tcinitialize(int minor); - int arch_tcuninitialize(void); + int board_tsc_setup(int minor); + void board_tsc_teardown(void); examples/udp ^^^^^^^^^^^^ diff --git a/examples/touchscreen/Kconfig b/examples/touchscreen/Kconfig index e266972b6..2edad5915 100644 --- a/examples/touchscreen/Kconfig +++ b/examples/touchscreen/Kconfig @@ -46,12 +46,13 @@ config EXAMPLES_TOUCHSCREEN_MOUSE config EXAMPLES_TOUCHSCREEN_ARCHINIT bool "Architecture-specific initialization" default y - depends on !BUILD_PROTECTED && !BUILD_KERNEL + depends on LIB_BOARDCTL + select BOARDCTL_TSCTEST ---help--- - By default, the touchscreen example will call arch_tcinitialize() to + By default, the touchscreen example will call boardctl() to register the touchscreen device before it attempts to open it. - Similarly, it will call arch_tcuninitialize() to unregister the - touchscreen device when it is finished. + Similarly, it will call boardctl() to unregister the touchscreen + device when it is finished. This works well for the typical touchscreen controller but there are other devices that cannot be initialized and uninitialized in this @@ -60,17 +61,9 @@ config EXAMPLES_TOUCHSCREEN_ARCHINIT mouse is disconnected. So, in cases like this, there are two options: (1) provide dummy - arch_tcinitialize() and arch_tcuninitialize() just to satisfy the - linking requirements or, (2) select this option. if this option is - de-selected, then the arch_tcinitialize() and arch_tcuninitialize() will - never be called. - - NOTE also that the functions arch_tcinitialize() and - arch_tcuninitialize() are effective non-standard operating system - calls. This is cheap shortcut and a violation of the OS interface. - You can get away with this in the flat build (CONFIG_BUILD_FLAT), - but not in the protected or kernel builds (CONFIG_BUILD_PROTECTED - or CONFIG)BUILD_KERNEL). In those cases, you will need to perform - one-time touchscreen initialization in board_initialize(). + board_tsc_setup() and board_tsc_teardown() just to satisfy the + linking requirements of boardctl() or, (2) de-select this option. + If this option is de-selected, then the boardctl() will never be + called. endif diff --git a/examples/touchscreen/tc_main.c b/examples/touchscreen/tc_main.c index c2c451f2f..8e35630d2 100644 --- a/examples/touchscreen/tc_main.c +++ b/examples/touchscreen/tc_main.c @@ -40,6 +40,7 @@ #include #include +#include #include #include @@ -130,10 +131,10 @@ int tc_main(int argc, char *argv[]) */ printf("tc_main: Initializing external touchscreen device\n"); - ret = arch_tcinitialize(CONFIG_EXAMPLES_TOUCHSCREEN_MINOR); + ret = boardctl(BOARDIOC_TSCTEST_SETUP, CONFIG_EXAMPLES_TOUCHSCREEN_MINOR); if (ret != OK) { - printf("tc_main: arch_tcinitialize failed: %d\n", ret); + printf("tc_main: board_tsc_setup failed: %d\n", ret); errval = 1; goto errout; } @@ -260,7 +261,7 @@ errout_with_dev: errout_with_tc: #ifdef CONFIG_EXAMPLES_TOUCHSCREEN_ARCHINIT - arch_tcuninitialize(); + boardctl(BOARDIOC_TSCTEST_TEARDOWN, 0); errout: #endif