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:
parent
a1195b4528
commit
9ec66482b6
@ -782,12 +782,11 @@ config NXWM_TOUCHSCREEN_DEVINIT
|
|||||||
depends on !BUILD_PROTECTED && !BUILD_KERNEL
|
depends on !BUILD_PROTECTED && !BUILD_KERNEL
|
||||||
---help---
|
---help---
|
||||||
It this option is selected, then the NxWM:CTouchscreen listener
|
It this option is selected, then the NxWM:CTouchscreen listener
|
||||||
thread will call a function arch_tcinitialize(NXWM_TOUCHSCREEN_DEVNO)
|
thread will call a function boardctl() in order to instantiate the
|
||||||
in order to instantiate the touchscreen driver at path
|
touchscreen driver at path NXWM_TOUCHSCREEN_DEVPATH. If
|
||||||
NXWM_TOUCHSCREEN_DEVPATH. If NXWM_TOUCHSCREEN_DEVINIT is not
|
NXWM_TOUCHSCREEN_DEVINIT is not selected, then the NxWM:CTouchscreen
|
||||||
selected, then the NxWM:CTouchscreen listener thread will assume
|
listener thread will assume that the driver has already been
|
||||||
that the driver has already been initialized at
|
initialized at NXWM_TOUCHSCREEN_DEVPATH.
|
||||||
NXWM_TOUCHSCREEN_DEVPATH.
|
|
||||||
|
|
||||||
NOTE that in the kernel build, all touchscreen initialize must be
|
NOTE that in the kernel build, all touchscreen initialize must be
|
||||||
performed in kernel logic prior to the execution of NxWM.
|
performed in kernel logic prior to the execution of NxWM.
|
||||||
|
@ -1809,12 +1809,13 @@ examples/touchscreen
|
|||||||
|
|
||||||
CONFIG_EXAMPLES_TOUCHSREEN=y
|
CONFIG_EXAMPLES_TOUCHSREEN=y
|
||||||
|
|
||||||
The board-specific logic must provide the following interfaces that will
|
This example code will call boardctl() to setup the touchscreen driver
|
||||||
be called by the example in order to initialize and uninitialize the
|
for texting. The implementation of boardctl() will require that board-
|
||||||
touchscreen hardware:
|
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 board_tsc_setup(int minor);
|
||||||
int arch_tcuninitialize(void);
|
void board_tsc_teardown(void);
|
||||||
|
|
||||||
examples/udp
|
examples/udp
|
||||||
^^^^^^^^^^^^
|
^^^^^^^^^^^^
|
||||||
|
@ -46,12 +46,13 @@ config EXAMPLES_TOUCHSCREEN_MOUSE
|
|||||||
config EXAMPLES_TOUCHSCREEN_ARCHINIT
|
config EXAMPLES_TOUCHSCREEN_ARCHINIT
|
||||||
bool "Architecture-specific initialization"
|
bool "Architecture-specific initialization"
|
||||||
default y
|
default y
|
||||||
depends on !BUILD_PROTECTED && !BUILD_KERNEL
|
depends on LIB_BOARDCTL
|
||||||
|
select BOARDCTL_TSCTEST
|
||||||
---help---
|
---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.
|
register the touchscreen device before it attempts to open it.
|
||||||
Similarly, it will call arch_tcuninitialize() to unregister the
|
Similarly, it will call boardctl() to unregister the touchscreen
|
||||||
touchscreen device when it is finished.
|
device when it is finished.
|
||||||
|
|
||||||
This works well for the typical touchscreen controller but there are
|
This works well for the typical touchscreen controller but there are
|
||||||
other devices that cannot be initialized and uninitialized in this
|
other devices that cannot be initialized and uninitialized in this
|
||||||
@ -60,17 +61,9 @@ config EXAMPLES_TOUCHSCREEN_ARCHINIT
|
|||||||
mouse is disconnected.
|
mouse is disconnected.
|
||||||
|
|
||||||
So, in cases like this, there are two options: (1) provide dummy
|
So, in cases like this, there are two options: (1) provide dummy
|
||||||
arch_tcinitialize() and arch_tcuninitialize() just to satisfy the
|
board_tsc_setup() and board_tsc_teardown() just to satisfy the
|
||||||
linking requirements or, (2) select this option. if this option is
|
linking requirements of boardctl() or, (2) de-select this option.
|
||||||
de-selected, then the arch_tcinitialize() and arch_tcuninitialize() will
|
If this option is de-selected, then the boardctl() will never be
|
||||||
never be called.
|
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().
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/boardctl.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -130,10 +131,10 @@ int tc_main(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
printf("tc_main: Initializing external touchscreen device\n");
|
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)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
printf("tc_main: arch_tcinitialize failed: %d\n", ret);
|
printf("tc_main: board_tsc_setup failed: %d\n", ret);
|
||||||
errval = 1;
|
errval = 1;
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
@ -260,7 +261,7 @@ errout_with_dev:
|
|||||||
|
|
||||||
errout_with_tc:
|
errout_with_tc:
|
||||||
#ifdef CONFIG_EXAMPLES_TOUCHSCREEN_ARCHINIT
|
#ifdef CONFIG_EXAMPLES_TOUCHSCREEN_ARCHINIT
|
||||||
arch_tcuninitialize();
|
boardctl(BOARDIOC_TSCTEST_TEARDOWN, 0);
|
||||||
|
|
||||||
errout:
|
errout:
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user