This is an automated email from the ASF dual-hosted git repository.

gustavonihei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new f768e12  boards/sim: Remove sim_tsc_setup
f768e12 is described below

commit f768e1268b33f6aba2f21b76329edbbf38f3a75a
Author: Xiang Xiao <xiaoxi...@xiaomi.com>
AuthorDate: Wed Dec 29 02:23:57 2021 +0800

    boards/sim: Remove sim_tsc_setup
    
    since all NX and VNC initialization should be initiated from
    user space through BOARDIOC_NX_START and BOARDIOC_VNC_START
    
    Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com>
---
 boards/sim/sim/sim/src/Makefile          |   6 -
 boards/sim/sim/sim/src/sim.h             |  21 ---
 boards/sim/sim/sim/src/sim_bringup.c     |  22 +--
 boards/sim/sim/sim/src/sim_touchscreen.c | 266 -------------------------------
 4 files changed, 5 insertions(+), 310 deletions(-)

diff --git a/boards/sim/sim/sim/src/Makefile b/boards/sim/sim/sim/src/Makefile
index 80bad72..8fc2384 100644
--- a/boards/sim/sim/sim/src/Makefile
+++ b/boards/sim/sim/sim/src/Makefile
@@ -44,12 +44,6 @@ ifeq ($(CONFIG_LIBC_ZONEINFO_ROMFS),y)
 endif
 endif
 
-ifeq ($(CONFIG_SIM_X11FB),y)
-ifeq ($(CONFIG_SIM_TOUCHSCREEN),y)
-  CSRCS += sim_touchscreen.c
-endif
-endif
-
 ifeq ($(CONFIG_EXAMPLES_GPIO),y)
 ifeq ($(CONFIG_GPIO_LOWER_HALF),y)
   CSRCS += sim_ioexpander.c
diff --git a/boards/sim/sim/sim/src/sim.h b/boards/sim/sim/sim/src/sim.h
index 68f6554..5d5148b 100644
--- a/boards/sim/sim/sim/src/sim.h
+++ b/boards/sim/sim/sim/src/sim.h
@@ -110,27 +110,6 @@ int sim_gpio_initialize(void);
 #endif
 
 /****************************************************************************
- * Name: sim_tsc_setup
- *
- * Description:
- *   This function is called by board-bringup logic to configure the
- *   touchscreen device.  This function will register the driver as
- *   /dev/inputN where N is the minor device number.
- *
- * Input Parameters:
- *   minor   - The input device minor number
- *
- * Returned Value:
- *   Zero is returned on success.  Otherwise, a negated errno value is
- *   returned to indicate the nature of the failure.
- *
- ****************************************************************************/
-
-#if defined(CONFIG_SIM_X11FB) && defined(CONFIG_SIM_TOUCHSCREEN)
-int sim_tsc_setup(int minor);
-#endif
-
-/****************************************************************************
  * Name: sim_foc_setup
  *
  * Description:
diff --git a/boards/sim/sim/sim/src/sim_bringup.c 
b/boards/sim/sim/sim/src/sim_bringup.c
index 1044df9..86a0571 100644
--- a/boards/sim/sim/sim/src/sim_bringup.c
+++ b/boards/sim/sim/sim/src/sim_bringup.c
@@ -281,17 +281,7 @@ int sim_bringup(void)
   sim_ajoy_initialize();
 #endif
 
-#if defined(CONFIG_NX) && defined(CONFIG_SIM_TOUCHSCREEN)
-  /* Initialize the touchscreen */
-
-  ret = sim_tsc_setup(0);
-  if (ret < 0)
-    {
-      syslog(LOG_ERR, "ERROR: sim_tsc_setup failed: %d\n", ret);
-    }
-#else
-
-#  ifdef CONFIG_VIDEO_FB
+#ifdef CONFIG_VIDEO_FB
   /* Initialize and register the simulated framebuffer driver */
 
   ret = fb_register(0, 0);
@@ -299,9 +289,9 @@ int sim_bringup(void)
     {
       syslog(LOG_ERR, "ERROR: fb_register() failed: %d\n", ret);
     }
-#  endif
+#endif
 
-#  ifdef CONFIG_LCD
+#ifdef CONFIG_LCD
 
   ret = board_lcd_initialize();
   if (ret < 0)
@@ -319,9 +309,9 @@ int sim_bringup(void)
 
 #  endif
 
-#  endif
+#endif
 
-#  ifdef CONFIG_SIM_TOUCHSCREEN
+#ifdef CONFIG_SIM_TOUCHSCREEN
   /* Initialize the touchscreen */
 
   ret = sim_tsc_initialize(0);
@@ -329,8 +319,6 @@ int sim_bringup(void)
     {
       syslog(LOG_ERR, "ERROR: sim_tsc_initialize failed: %d\n", ret);
     }
-#  endif
-
 #endif
 
 #ifdef CONFIG_IEEE802154_LOOPBACK
diff --git a/boards/sim/sim/sim/src/sim_touchscreen.c 
b/boards/sim/sim/sim/src/sim_touchscreen.c
deleted file mode 100644
index 33aff53..0000000
--- a/boards/sim/sim/sim/src/sim_touchscreen.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/****************************************************************************
- * boards/sim/sim/sim/src/sim_touchscreen.c
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <sys/types.h>
-#include <sys/boardctl.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <sched.h>
-#include <errno.h>
-#include <debug.h>
-
-#include <nuttx/sched.h>
-#include <nuttx/board.h>
-#include <nuttx/video/fb.h>
-#include <nuttx/input/touchscreen.h>
-#include <nuttx/semaphore.h>
-#include <nuttx/nx/nx.h>
-#include <nuttx/nx/nxglib.h>
-
-#ifdef CONFIG_VNCSERVER
-#  include <nuttx/video/vnc.h>
-#endif
-
-#include "up_internal.h"
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* Configuration ************************************************************/
-
-/* Pick a background color */
-
-#ifndef CONFIG_EXAMPLES_TOUCHSCREEN_BGCOLOR
-#  define CONFIG_EXAMPLES_TOUCHSCREEN_BGCOLOR 0x007b68ee
-#endif
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-struct sim_touchscreen_s
-{
-  NXHANDLE hnx;
-  bool connected;
-  sem_t eventsem;
-};
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-static struct sim_touchscreen_s g_simtc =
-{
-  NULL,               /* hnx */
-  false,              /* connected */
-  SEM_INITIALIZER(0), /* eventsem */
-};
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: sim_listener
- ****************************************************************************/
-
-static FAR void *sim_listener(FAR void *arg)
-{
-  int ret;
-
-  /* Process events forever */
-
-  for (; ; )
-    {
-      /* Handle the next event.  If we were configured blocking, then
-       * we will stay right here until the next event is received.  Since
-       * we have dedicated a while thread to servicing events, it would
-       * be most natural to also select CONFIG_NX_BLOCKING -- if not, the
-       * following would be a tight infinite loop (unless we added addition
-       * logic with nx_eventnotify and sigwait to pace it).
-       */
-
-      ret = nx_eventhandler(g_simtc.hnx);
-      if (ret < 0)
-        {
-          /* An error occurred... assume that we have lost connection with
-           * the server.
-           */
-
-          fwarn("WARNING: Lost server connection: %d\n", ret);
-          break;
-        }
-
-      /* If we received a message, we must be connected */
-
-      if (!g_simtc.connected)
-        {
-          g_simtc.connected = true;
-          nxsem_post(&g_simtc.eventsem);
-          ginfo("Connected\n");
-        }
-    }
-
-  return NULL;
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: sim_tsc_setup
- *
- * Description:
- *   This function is called by board-bringup logic to configure the
- *   touchscreen device.  This function will register the driver as
- *   /dev/inputN where N is the minor device number.
- *
- * Input Parameters:
- *   minor   - The input device minor number
- *
- * Returned Value:
- *   Zero is returned on success.  Otherwise, a negated errno value is
- *   returned to indicate the nature of the failure.
- *
- ****************************************************************************/
-
-int sim_tsc_setup(int minor)
-{
-  struct sched_param param;
-  nxgl_mxpixel_t color;
-  pthread_t thread;
-  int ret;
-
-  /* Set the client task priority */
-
-  param.sched_priority = CONFIG_SIM_CLIENTPRIO;
-  ret = nxsched_set_param(0, &param);
-  if (ret < 0)
-    {
-      gerr("ERROR: nxsched_set_param failed: %d\n" , ret);
-      return ret;
-    }
-
-  /* Start the NX server kernel thread */
-
-  ret = boardctl(BOARDIOC_NX_START, 0);
-  if (ret < 0)
-    {
-      gerr("ERROR: Failed to start the NX server: %d\n", ret);
-      return ret;
-    }
-
-  /* Connect to the server */
-
-  g_simtc.hnx = nx_connect();
-  if (g_simtc.hnx)
-    {
-       pthread_attr_t attr;
-
-#ifdef CONFIG_VNCSERVER
-      /* Setup the VNC server to support keyboard/mouse inputs */
-
-      ret = vnc_default_fbinitialize(0, g_simtc.hnx);
-      if (ret < 0)
-        {
-          ginfo("ERROR: vnc_default_fbinitialize failed: %d\n", ret);
-          nx_disconnect(g_simtc.hnx);
-          return ret;
-        }
-#endif
-
-      /* Start a separate thread to listen for server events.
-       * This is probably the least efficient way to do this,
-       * but it makes this example flow more smoothly.
-       */
-
-      pthread_attr_init(&attr);
-      param.sched_priority = CONFIG_SIM_LISTENERPRIO;
-      pthread_attr_setschedparam(&attr, &param);
-      pthread_attr_setstacksize(&attr, CONFIG_SIM_LISTENER_STACKSIZE);
-
-      ret = pthread_create(&thread, &attr, sim_listener, NULL);
-      pthread_attr_destroy(&attr);
-      if (ret != 0)
-        {
-          gerr("ERROR: pthread_create failed: %d\n", ret);
-          nx_disconnect(g_simtc.hnx);
-          return -ret;
-        }
-
-      /* Don't return until we are connected to the server */
-
-      while (!g_simtc.connected)
-        {
-          /* Wait for the listener thread to wake us up when we really
-           * are connected.
-           */
-
-           nxsem_wait(&g_simtc.eventsem);
-        }
-    }
-  else
-    {
-      gerr("ERROR: nx_connect failed: %d\n", ret);
-      return ERROR;
-    }
-
-#ifdef CONFIG_NX
-  /* Set the background to the configured background color */
-
-  iinfo("Set background color=%d\n", CONFIG_EXAMPLES_TOUCHSCREEN_BGCOLOR);
-
-  color = CONFIG_EXAMPLES_TOUCHSCREEN_BGCOLOR;
-  ret = nx_setbgcolor(g_simtc.hnx, &color);
-  if (ret < 0)
-    {
-      ierr("ERROR: nx_setbgcolor failed: %d\n", ret);
-      goto errout_with_nx;
-    }
-#else
-  UNUSED(color);
-#endif
-
-  /* Finally, initialize the touchscreen simulation on the X window */
-
-  ret = sim_tsc_initialize(minor);
-  if (ret < 0)
-    {
-      ierr("ERROR: sim_tsc_initialize failed: %d\n", ret);
-      goto errout_with_nx;
-    }
-
-  return OK;
-
-errout_with_nx:
-  nx_disconnect(g_simtc.hnx);
-  goto errout;
-
-errout:
-  return ret;
-}

Reply via email to