rch_tcinitialize() and arch_tcunitinitialize() renamed to board_tsc_setup() and board_tsc_teardown(). These are not long called directly by applications but only indirectly throught the crappy boardctl() OS interface.

This commit is contained in:
Gregory Nutt 2015-03-31 13:21:25 -06:00
parent a1195b4528
commit 9ec66482b6
4 changed files with 24 additions and 30 deletions

View File

@ -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.

View File

@ -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
^^^^^^^^^^^^

View File

@ -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

View File

@ -40,6 +40,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <sys/boardctl.h>
#include <stdio.h>
#include <stdlib.h>
@ -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