Add a simulated touchscreen driver

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3989 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2011-09-28 17:41:58 +00:00
parent 2d2ae68175
commit 1908b04f82
5 changed files with 298 additions and 33 deletions

View File

@ -68,7 +68,7 @@ X11 Issues
^^^^^^^^^^
There is an X11-based framebuffer driver that you can use exercise the NuttX graphics
subsystem on the simulator (see the sim/nx configuration below). This may require a
subsystem on the simulator (see the sim/nx11 configuration below). This may require a
lot of tinkering to get working, depending upon where your X11 installation stores
libraries and header files and how it names libraries.
@ -87,6 +87,9 @@ Configurations
^^^^^^^^^^^^^^
mount
Description
-----------
Configures to use examples/mount. This configuration may be
selected as follows:
@ -95,6 +98,8 @@ mount
nettest
Description
-----------
Configures to use examples/nettest. This configuration
enables networking using the network TAP device. It may
be selected via:
@ -118,6 +123,9 @@ nettest
select the IP address that you want to use.
nsh
Description
-----------
Configures to use the NuttShell at examples/nsh. This configuration
may be selected as follows:
@ -125,59 +133,112 @@ nsh
./configure.sh sim/nsh
nx
Description
-----------
Configures to use examples/nx. This configuration may be
selected as follows:
cd <nuttx-directory>/tools
./configure.sh sim/nx
Special Framebuffer Configuration
---------------------------------
Special simulated framebuffer configuration options:
CONFIG_SIM_X11FB - Use X11 window for framebuffer
CONFIG_SIM_FBHEIGHT - Height of the framebuffer in pixels
CONFIG_SIM_FBWIDTH - Width of the framebuffer in pixels.
CONFIG_SIM_FBBPP - Pixel depth in bits
CONFIG_SIM_FBHEIGHT - Height of the framebuffer in pixels
CONFIG_SIM_FBWIDTH - Width of the framebuffer in pixels.
CONFIG_SIM_FBBPP - Pixel depth in bits
NOTES:
- If CONFIG_SIM_X11FB is selected then the following are
needed
No Display!
-----------
This version has NO DISPLAY and is only useful for debugging NX
internals in environments where X11 is not supported. There is
and additonal configuration that may be added to include an X11-
based simulated framebuffer driver:
CONFIG_SIM_X11FB - Use X11 window for framebuffer
CONFIG_SIM_FBBPP (must match the resolution of the display).
CONFIG_FB_CMAP=y
See the nx11 configuration below for more information.
My system has 24-bit color, but packed into 32-bit words so
the correct seeting of CONFIG_SIM_FBBPP is 32.
Multi- and Single-User Modes
----------------------------
The default is the single-user NX implementation. To select
the multi-user NX implementation:
- For whatever value of CONFIG_SIM_FBBPP is selected, then
the corresponidng CONFIG_NX_DISABLE_*BPP setting must
not be disabled.
CONFG_NX_MULTIUSER=y
CONFIG_DISABLE_MQUEUE=n
- The default in defconfig is to use a generic memory buffer
for the framebuffer. defconfig-x11 is an example with X11
support enabled. To use this configuration you have to
configure as follows:
nx11
cd tools
./configure.sh sim/nx
cd ..
cp configs/sim/nx/defconfig-x11 .config
Description
-----------
Configures to use examples/nx. This configuration is similar
to the nx configuration except that it addes support for an X11-
based framebuffer driver. Of course, this configuration can only
be used in environments that support X11! (And it may not even
be usable in all of those environments without some "tweaking").
This configuration may be selected as follows:
- The default is the single-user NX implementation. To select
the multi-user NX implementation:
cd <nuttx-directory>/tools
./configure.sh sim/nx11
CONFG_NX_MULTIUSER=y
CONFIG_DISABLE_MQUEUE=n
Special Framebuffer Configuration
---------------------------------
This configuration uses the same special simulated framebuffer
configuration options as the nx configuration:
- To get the system to compile under various X11 installations
you may have to modify a few things. For example, in order
to find libXext, I had to make the following change under
Ubuntu 9.09:
CONFIG_SIM_X11FB - Use X11 window for framebuffer
CONFIG_SIM_FBHEIGHT - Height of the framebuffer in pixels
CONFIG_SIM_FBWIDTH - Width of the framebuffer in pixels.
CONFIG_SIM_FBBPP - Pixel depth in bits
X11 Configuration
-----------------
But now, since CONFIG_SIM_X11FB is also selected the following
definitions are needed
CONFIG_SIM_FBBPP (must match the resolution of the display).
CONFIG_FB_CMAP=y
My system has 24-bit color, but packed into 32-bit words so
the correct seeting of CONFIG_SIM_FBBPP is 32.
For whatever value of CONFIG_SIM_FBBPP is selected, the
corresponidng CONFIG_NX_DISABLE_*BPP setting must not be
disabled.
Touchscreen Support
-------------------
A X11 mouse-based touchscreen simulation can also be enabled
by setting:
CONFIG_INPUT=y
CONFIG_SIM_TOUCHSCREEN=y
X11 Build Issues
----------------
To get the system to compile under various X11 installations
you may have to modify a few things. For example, in order
to find libXext, I had to make the following change under
Ubuntu 9.09:
cd /usr/lib/
sudo ln -s libXext.so.6.4.0 libXext.so
Multi- and Single-User Modes
----------------------------
The default is the single-user NX implementation. To select
the multi-user NX implementation:
CONFG_NX_MULTIUSER=y
CONFIG_DISABLE_MQUEUE=n
ostest
Description
-----------
The "standard" NuttX examples/ostest configuration. This
configuration may be selected as follows:
@ -186,6 +247,8 @@ ostest
pashello
Description
-----------
Configures to use examples/pashello. This configuration may
by selected as follows:

110
configs/sim/nx11/Make.defs Normal file
View File

@ -0,0 +1,110 @@
############################################################################
# configs/sim/nx11/Make.defs
#
# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
include ${TOPDIR}/.config
HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = -g
else
ARCHOPTIMIZATION = -O2
endif
ARCHCPUFLAGS = -fno-builtin
ARCHPICFLAGS = -fpic
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHDEFINES =
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHSCRIPT =
CROSSDEV =
CC = $(CROSSDEV)gcc
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
NM = $(CROSSDEV)nm
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
OBJEXT = .o
LIBEXT = .a
ifeq ($(HOSTOS),Cygwin)
EXEEXT = .exe
else
EXEEXT =
endif
ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
LDFLAGS += -g
endif
define PREPROCESS
@echo "CPP: $1->$2"
@$(CPP) $(CPPFLAGS) $1 -o $2
endef
define COMPILE
@echo "CC: $1"
@$(CC) -c $(CFLAGS) $1 -o $2
endef
define ASSEMBLE
@echo "AS: $1"
@$(CC) -c $(AFLAGS) $1 -o $2
endef
define ARCHIVE
echo "AR: $2"; \
$(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
endef
define CLEAN
@rm -f *.o *.a
endef
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
HOSTLDFLAGS =

View File

@ -0,0 +1,39 @@
############################################################################
# configs/sim/nx11/appconfig
#
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
# Path to example in apps/examples containing the user_start entry point
CONFIGURED_APPS += examples/nx

View File

@ -1,7 +1,7 @@
############################################################################
# sim/nx/defconfig
# sim/nx11/defconfig
#
# Copyright (C) 2008, 2010 Gregory Nutt. All rights reserved.
# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
@ -51,11 +51,19 @@ CONFIG_ARCH_BOARD_SIM=y
#
# Simulated framebuffer configuration
#
CONFIG_SIM_X11FB=y
CONFIG_SIM_FBWIDTH=480
CONFIG_SIM_FBHEIGHT=240
CONFIG_SIM_FBBPP=32
#
# Simulated touchscreen configuration
# (Set both of the following to 'y' to enable)
#
CONFIG_INPUT=n
CONFIG_SIM_TOUCHSCREEN=n
#
# General OS setup
#

45
configs/sim/nx11/setenv.sh Executable file
View File

@ -0,0 +1,45 @@
#!/bin/bash
# sim/nx11/setenv.sh
#
# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
if [ "$(basename $0)" = "setenv.sh" ] ; then
echo "You must source this script, not run it!" 1>&2
exit 1
fi
if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
#export NUTTX_BIN=
#export PATH=${NUTTX_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
echo "PATH : ${PATH}"