From 33905b7161123f75fae970bc5be4b8f2854dfbee Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 28 Sep 2011 18:24:00 +0000 Subject: Fix NXFFS compilation error git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3990 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/sim/src/up_initialize.c | 21 -------------------- nuttx/arch/sim/src/up_internal.h | 1 - nuttx/arch/sim/src/up_touchscreen.c | 38 ++++++++++++++++++++----------------- 3 files changed, 21 insertions(+), 39 deletions(-) (limited to 'nuttx/arch/sim') diff --git a/nuttx/arch/sim/src/up_initialize.c b/nuttx/arch/sim/src/up_initialize.c index 26207b624..4e07904e4 100644 --- a/nuttx/arch/sim/src/up_initialize.c +++ b/nuttx/arch/sim/src/up_initialize.c @@ -44,7 +44,6 @@ #include #include -#include "os_internal.h" #include "up_internal.h" /**************************************************************************** @@ -107,24 +106,4 @@ void up_initialize(void) #ifdef CONFIG_NET uipdriver_init(); /* Our "real" netwok driver */ #endif - - /* Start the X11 event loop and register the touchscreen driver */ - -#if defined(CONFIG_SIM_X11FB) && defined(CONFIG_SIM_TOUCHSCREEN) - { - int ret; - - /* Start the X11 event loop */ - - ret = KERNEL_THREAD("evloop", CONFIG_SIM_EVLOOPPRIORITY, - CONFIG_SIM_EVLOOPSTACKSIZE, - (main_t)up_x11eventloop, (const char **)NULL); - ASSERT(ret != ERROR); - - /* Register the touchscreen driver */ - - ret = up_tcregister(0); - ASSERT(ret == OK); - } -#endif } diff --git a/nuttx/arch/sim/src/up_internal.h b/nuttx/arch/sim/src/up_internal.h index 19e50986b..71a2380e2 100644 --- a/nuttx/arch/sim/src/up_internal.h +++ b/nuttx/arch/sim/src/up_internal.h @@ -182,7 +182,6 @@ extern int up_x11eventloop(int argc, char *argv[]); #ifdef CONFIG_SIM_X11FB #ifdef CONFIG_SIM_TOUCHSCREEN -extern int up_tcregister(int minor); extern int up_tcenter(int x, int y, int buttons); extern int up_tcleave(int x, int y, int buttons); #endif diff --git a/nuttx/arch/sim/src/up_touchscreen.c b/nuttx/arch/sim/src/up_touchscreen.c index 09e4e013e..38e893128 100644 --- a/nuttx/arch/sim/src/up_touchscreen.c +++ b/nuttx/arch/sim/src/up_touchscreen.c @@ -58,6 +58,7 @@ #include +#include "os_internal.h" #include "up_internal.h" /**************************************************************************** @@ -106,6 +107,7 @@ 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 */ @@ -604,15 +606,13 @@ errout: ****************************************************************************/ /**************************************************************************** - * Name: up_tcregister + * Name: up_simtouchscreen * * Description: - * Configure the touchscreen to use the provided I2C device instance. This - * will register the driver as /dev/inputN where N is the minor device - * number + * Configure the simulated touchscreen. This will register the driver as + * /dev/inputN where N is the minor device number * * Input Parameters: - * dev - An I2C driver instance * minor - The input device minor number * * Returned Value: @@ -621,9 +621,9 @@ errout: * ****************************************************************************/ -int up_tcregister(int minor) +int up_simtouchscreen(int minor) { - FAR struct up_dev_s *priv; + FAR struct up_dev_s *priv = ( FAR struct up_dev_s *)&g_simtouchscreen; char devname[DEV_NAMELEN]; int ret; @@ -631,11 +631,7 @@ int up_tcregister(int minor) /* Debug-only sanity checks */ - DEBUGASSERT(minor >= 0 && minor < 100); - - /* Create and initialize a touchscreen device driver instance */ - - priv = &g_simtouchscreen; + DEBUGASSERT(minor >= 0 && minor < 100 && priv->eventloop == 0); /* Initialize the touchscreen device driver instance */ @@ -643,6 +639,18 @@ int up_tcregister(int minor) sem_init(&priv->devsem, 0, 1); /* Initialize device structure semaphore */ sem_init(&priv->waitsem, 0, 0); /* Initialize pen event wait semaphore */ + /* Start the X11 event loop */ + + ret = KERNEL_THREAD("evloop", CONFIG_SIM_EVLOOPPRIORITY, + CONFIG_SIM_EVLOOPSTACKSIZE, + (main_t)up_x11eventloop, (const char **)NULL); + 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 */ (void)snprintf(devname, DEV_NAMELEN, DEV_FORMAT, minor); @@ -660,10 +668,8 @@ int up_tcregister(int minor) return OK; errout_with_priv: + sem_destroy(&priv->waitsem); sem_destroy(&priv->devsem); -#ifdef CONFIG_touchscreen_MULTIPLE - kfree(priv); -#endif return ret; } @@ -749,5 +755,3 @@ int up_tcleave(int x, int y, int buttons) } return OK; } - - -- cgit v1.2.3