diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-09-28 19:09:38 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-09-28 19:09:38 +0000 |
commit | 1817773ede93ba7ad867c1309f5c23fd7043957a (patch) | |
tree | fa2e71076f5703b2dd2a1130e0a2da2212469c2b /nuttx/arch/sim | |
parent | 33905b7161123f75fae970bc5be4b8f2854dfbee (diff) | |
download | px4-nuttx-1817773ede93ba7ad867c1309f5c23fd7043957a.tar.gz px4-nuttx-1817773ede93ba7ad867c1309f5c23fd7043957a.tar.bz2 px4-nuttx-1817773ede93ba7ad867c1309f5c23fd7043957a.zip |
Change X11 event loop initialization
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3991 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/sim')
-rw-r--r-- | nuttx/arch/sim/src/Makefile | 17 | ||||
-rw-r--r-- | nuttx/arch/sim/src/up_internal.h | 14 | ||||
-rw-r--r-- | nuttx/arch/sim/src/up_touchscreen.c | 9 | ||||
-rw-r--r-- | nuttx/arch/sim/src/up_x11eventloop.c | 25 |
4 files changed, 34 insertions, 31 deletions
diff --git a/nuttx/arch/sim/src/Makefile b/nuttx/arch/sim/src/Makefile index 0213a69dc..b3ed39a2c 100644 --- a/nuttx/arch/sim/src/Makefile +++ b/nuttx/arch/sim/src/Makefile @@ -88,18 +88,25 @@ SRCS = $(ASRCS) $(CSRCS) $(HOSTSRCS) OBJS = $(AOBJS) $(COBJS) $(HOSTOBJS) LDFLAGS = $(ARCHSCRIPT) + +# Determine which standard libraries will need to be linked in + ifeq ($(CONFIG_SIM_X11FB),y) - STDLIBS = -lX11 -lXext -lc -else - STDLIBS = -lc + STDLIBS += -lX11 -lXext +ifeq ($(CONFIG_SIM_TOUCHSCREEN),y) + STDLIBS += -lpthread endif +endif + ifeq ($(CONFIG_FS_FAT),y) -STDLIBS += -lz +STDLIBS += -lz endif +STDLIBS += -lc + LINKOBJS = up_head$(OBJEXT) LINKLIBS = -LDPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS))) +LDPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS))) LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS)))) all: up_head$(OBJEXT) libarch$(LIBEXT) diff --git a/nuttx/arch/sim/src/up_internal.h b/nuttx/arch/sim/src/up_internal.h index 71a2380e2..2a1d9372a 100644 --- a/nuttx/arch/sim/src/up_internal.h +++ b/nuttx/arch/sim/src/up_internal.h @@ -63,18 +63,6 @@ # endif #endif -#ifdef CONFIG_SIM_TOUCHSCREEN -# ifndef CONFIG_SIM_EVLOOPPRIORITY -# define CONFIG_SIM_EVLOOPPRIORITY 50 -# endif -# ifndef CONFIG_SIM_EVLOOPSTACKSIZE -# define CONFIG_SIM_EVLOOPSTACKSIZE 4096 -# endif -#else -# undef CONFIG_SIM_EVLOOPPRIORITY -# undef CONFIG_SIM_EVLOOPSTACKSIZE -#endif - /* Context Switching Definitions ******************************************/ /* Storage order: %ebx, $esi, %edi, %ebp, sp, and return PC */ @@ -174,7 +162,7 @@ extern int up_x11cmap(unsigned short first, unsigned short len, #ifdef CONFIG_SIM_X11FB #ifdef CONFIG_SIM_TOUCHSCREEN -extern int up_x11eventloop(int argc, char *argv[]); +extern int up_x11eventloop(void); #endif #endif diff --git a/nuttx/arch/sim/src/up_touchscreen.c b/nuttx/arch/sim/src/up_touchscreen.c index 38e893128..a4c6be1cb 100644 --- a/nuttx/arch/sim/src/up_touchscreen.c +++ b/nuttx/arch/sim/src/up_touchscreen.c @@ -58,7 +58,6 @@ #include <nuttx/input/touchscreen.h> -#include "os_internal.h" #include "up_internal.h" /**************************************************************************** @@ -107,7 +106,6 @@ struct up_dev_s bool penchange; /* An unreported event is buffered */ sem_t devsem; /* Manages exclusive access to this structure */ sem_t waitsem; /* Used to wait for the availability of data */ - pid_t eventloop; /* PID of the eventloop */ struct up_sample_s sample; /* Last sampled touch point data */ @@ -631,7 +629,7 @@ int up_simtouchscreen(int minor) /* Debug-only sanity checks */ - DEBUGASSERT(minor >= 0 && minor < 100 && priv->eventloop == 0); + DEBUGASSERT(minor >= 0 && minor < 100); /* Initialize the touchscreen device driver instance */ @@ -641,15 +639,12 @@ int up_simtouchscreen(int minor) /* Start the X11 event loop */ - ret = KERNEL_THREAD("evloop", CONFIG_SIM_EVLOOPPRIORITY, - CONFIG_SIM_EVLOOPSTACKSIZE, - (main_t)up_x11eventloop, (const char **)NULL); + ret = up_x11eventloop(); if (ret < 0) { idbg("Failed to start event loop: %d\n", ret); goto errout_with_priv; } - priv->eventloop = ret; /* Register the device as an input device */ diff --git a/nuttx/arch/sim/src/up_x11eventloop.c b/nuttx/arch/sim/src/up_x11eventloop.c index d28a03ab9..a21f895c9 100644 --- a/nuttx/arch/sim/src/up_x11eventloop.c +++ b/nuttx/arch/sim/src/up_x11eventloop.c @@ -38,6 +38,8 @@ ****************************************************************************/ #include <stdio.h> +#include <pthread.h> + #include <X11/Xlib.h> /**************************************************************************** @@ -68,6 +70,8 @@ extern int up_tcleave(int x, int y, int buttons); extern Display *g_display; extern Window g_window; +pthread_t g_eventloop; + /**************************************************************************** * Private Variables ****************************************************************************/ @@ -109,14 +113,10 @@ static int up_buttonmap(int state) } /**************************************************************************** - * Public Functions - ***************************************************************************/ - -/**************************************************************************** * Name: up_x11eventloop ***************************************************************************/ -int up_x11eventloop(int argc, char *argv[]) +static void *up_x11eventthread(void *arg) { XEvent event; int ret; @@ -164,5 +164,18 @@ int up_x11eventloop(int argc, char *argv[]) break; } } - return 0; + return NULL; } + +/**************************************************************************** + * Name: up_x11eventloop + ***************************************************************************/ + +int up_x11eventloop(void) +{ + /* Start the X11 event loop */ + + return pthread_create(&g_eventloop, 0, up_x11eventthread, 0); +} + + |