You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/02/10 14:57:38 UTC

[incubator-nuttx] branch master updated (bbd1028 -> d09af3b)

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

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


    from bbd1028  drivers/net/telnet.c: correct typo error to fix build break
     new 856b62c  arch/sim: Fix X11 segmentation fault when CONFIG_SIM_X11NOSHM isn't enabled
     new 978575d  arch/sim: Pass X11 related config to host environment
     new 7fd3a3b  xarch/sim: Call pm_initialize from up_initialize directly
     new f2f3859  arch/sim: Remove the unnecessary file guard
     new d09af3b  Run .c and .h files modified by PR241 through nxstyle.

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 arch/sim/Kconfig                     |  2 +-
 arch/sim/src/Makefile                |  9 +++--
 arch/sim/src/sim/up_ajoystick.c      | 28 ++++++-------
 arch/sim/src/sim/up_checkstack.c     |  4 --
 arch/sim/src/sim/up_cpuidlestack.c   |  4 --
 arch/sim/src/sim/up_initialize.c     |  2 +-
 arch/sim/src/sim/up_internal.h       |  6 ---
 arch/sim/src/sim/up_ioexpander.c     | 56 +++++++++++++-------------
 arch/sim/src/sim/up_netdriver.c      |  8 +---
 arch/sim/src/sim/up_pminitialize.c   | 77 ------------------------------------
 arch/sim/src/sim/up_qspiflash.c      | 22 ++++++-----
 arch/sim/src/sim/up_romgetc.c        |  3 --
 arch/sim/src/sim/up_schednote.c      |  5 ---
 arch/sim/src/sim/up_smpsignal.c      |  4 --
 arch/sim/src/sim/up_spiflash.c       | 46 +++++++++++++--------
 arch/sim/src/sim/up_tapdev.c         | 31 ++++++++-------
 arch/sim/src/sim/up_wpcap.c          | 21 +++++-----
 arch/sim/src/sim/up_x11framebuffer.c |  4 +-
 drivers/net/telnet.c                 |  1 +
 19 files changed, 120 insertions(+), 213 deletions(-)
 delete mode 100644 arch/sim/src/sim/up_pminitialize.c


[incubator-nuttx] 01/05: arch/sim: Fix X11 segmentation fault when CONFIG_SIM_X11NOSHM isn't enabled

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 856b62ca097621da204b6970ca5a91988b86e1a9
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Feb 10 18:01:31 2020 +0800

    arch/sim: Fix X11 segmentation fault when CONFIG_SIM_X11NOSHM isn't enabled
    
    up_x11mapsharedmem should assign the share memory to g_framebuffer
---
 arch/sim/src/sim/up_x11framebuffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sim/src/sim/up_x11framebuffer.c b/arch/sim/src/sim/up_x11framebuffer.c
index 94cd922..7065a94 100644
--- a/arch/sim/src/sim/up_x11framebuffer.c
+++ b/arch/sim/src/sim/up_x11framebuffer.c
@@ -317,8 +317,8 @@ static inline int up_x11mapsharedmem(int depth, unsigned int fblen)
           goto shmerror;
         }
 
+      g_framebuffer = (unsigned char *)g_image->data;
       g_shmcheckpoint++;
-
     }
   else
 #endif


[incubator-nuttx] 03/05: xarch/sim: Call pm_initialize from up_initialize directly

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7fd3a3bccacfbbca85e4e1ba3b8ae586a086504f
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Feb 10 12:57:25 2020 +0800

    xarch/sim: Call pm_initialize from up_initialize directly
    
    We don't need the additional flexibility since sim just has one chip.
---
 arch/sim/Kconfig                   |  2 +-
 arch/sim/src/Makefile              |  4 --
 arch/sim/src/sim/up_initialize.c   |  2 +-
 arch/sim/src/sim/up_internal.h     |  6 ---
 arch/sim/src/sim/up_pminitialize.c | 77 --------------------------------------
 5 files changed, 2 insertions(+), 89 deletions(-)

diff --git a/arch/sim/Kconfig b/arch/sim/Kconfig
index 7ceeb90..62c977a 100644
--- a/arch/sim/Kconfig
+++ b/arch/sim/Kconfig
@@ -26,7 +26,7 @@ endchoice # Host CPU Type
 
 config ARCH_CHIP
 	string
-	default "sim" if ARCH_SIM
+	default "sim"
 
 config SIM_M32
 	bool "Build 32-bit simulation on 64-bit machine"
diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile
index 8cc91ff..2841b35 100644
--- a/arch/sim/src/Makefile
+++ b/arch/sim/src/Makefile
@@ -113,10 +113,6 @@ ifeq ($(CONFIG_ONESHOT),y)
   CSRCS += up_oneshot.c
 endif
 
-ifeq ($(CONFIG_PM),y)
-  CSRCS += up_pminitialize.c
-endif
-
 ifeq ($(CONFIG_SCHED_CRITMONITOR),y)
   HOSTSRCS += up_critmon.c
 endif
diff --git a/arch/sim/src/sim/up_initialize.c b/arch/sim/src/sim/up_initialize.c
index 6a52c2a..681bedc 100644
--- a/arch/sim/src/sim/up_initialize.c
+++ b/arch/sim/src/sim/up_initialize.c
@@ -189,7 +189,7 @@ void up_initialize(void)
    * with the power management subsystem).
    */
 
-  up_pminitialize();
+  pm_initialize();
 #endif
 
 #ifdef CONFIG_MM_IOB
diff --git a/arch/sim/src/sim/up_internal.h b/arch/sim/src/sim/up_internal.h
index 6f90e2d..67b906a 100644
--- a/arch/sim/src/sim/up_internal.h
+++ b/arch/sim/src/sim/up_internal.h
@@ -303,12 +303,6 @@ int up_x11cmap(unsigned short first, unsigned short len,
 int  sim_tsc_initialize(int minor);
 void sim_tsc_uninitialize(void);
 
-/* up_pminitialize.c ********************************************************/
-
-#ifdef CONFIG_PM
-void up_pminitialize(void);
-#endif
-
 /* up_eventloop.c ***********************************************************/
 
 #if defined(CONFIG_SIM_X11FB) && \
diff --git a/arch/sim/src/sim/up_pminitialize.c b/arch/sim/src/sim/up_pminitialize.c
deleted file mode 100644
index 4b44d81..0000000
--- a/arch/sim/src/sim/up_pminitialize.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
- * arch/arm/src/stm32l4/stm32l4_pminitialize.c
- *
- *   Copyright (C) 2019 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
- *
- * 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <nuttx/power/pm.h>
-
-#include "up_internal.h"
-
-#ifdef CONFIG_PM
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_pminitialize
- *
- * Description:
- *   This function is called by MCU-specific logic at power-on reset in
- *   order to provide one-time initialization the power management subsystem.
- *   This function must be called *very* early in the initialization sequence
- *   *before* any other device drivers are initialized (since they may
- *   attempt to register with the power management subsystem).
- *
- * Input Parameters:
- *   None.
- *
- * Returned Value:
- *   None.
- *
- ****************************************************************************/
-
-void up_pminitialize(void)
-{
-  /* Then initialize the NuttX power management subsystem proper */
-
-  pm_initialize();
-}
-
-#endif /* CONFIG_PM */


[incubator-nuttx] 02/05: arch/sim: Pass X11 related config to host environment

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 978575d79add1c8947c17c4e2800bf3d4f037446
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Feb 10 12:55:10 2020 +0800

    arch/sim: Pass X11 related config to host environment
    
    Remove the hard code CONFIG_SIM_X11NOSHM value from up_x11framebuffer.c
---
 arch/sim/src/Makefile                | 5 +++++
 arch/sim/src/sim/up_x11framebuffer.c | 2 --
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile
index 3ea0c70..8cc91ff 100644
--- a/arch/sim/src/Makefile
+++ b/arch/sim/src/Makefile
@@ -126,15 +126,20 @@ ifeq ($(CONFIG_NX_LCDDRIVER),y)
 else
   CSRCS += up_framebuffer.c
 ifeq ($(CONFIG_SIM_X11FB),y)
+ifeq ($(CONFIG_SIM_X11NOSHM),y)
+  HOSTCFLAGS += -DCONFIG_SIM_X11NOSHM=1
+endif
   HOSTSRCS += up_x11framebuffer.c
   STDLIBS += -lX11 -lXext
 ifeq ($(CONFIG_SIM_TOUCHSCREEN),y)
   CSRCS += up_touchscreen.c
   REQUIREDOBJS += up_touchscreen$(OBJEXT)
+  HOSTCFLAGS += -DCONFIG_SIM_TOUCHSCREEN=1
   HOSTSRCS += up_x11eventloop.c
 else
 ifeq ($(CONFIG_SIM_AJOYSTICK),y)
   CSRCS += up_ajoystick.c
+  HOSTCFLAGS += -DCONFIG_SIM_AJOYSTICK=1
   HOSTSRCS += up_x11eventloop.c
 endif
 endif
diff --git a/arch/sim/src/sim/up_x11framebuffer.c b/arch/sim/src/sim/up_x11framebuffer.c
index 7065a94..8704a85 100644
--- a/arch/sim/src/sim/up_x11framebuffer.c
+++ b/arch/sim/src/sim/up_x11framebuffer.c
@@ -37,8 +37,6 @@
  * Included Files
  ****************************************************************************/
 
-#define CONFIG_SIM_X11NOSHM 1
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>


[incubator-nuttx] 05/05: Run .c and .h files modified by PR241 through nxstyle.

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit d09af3b7f329619f4865cff9deea6df8fb996c34
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Mon Feb 10 08:49:00 2020 -0600

    Run .c and .h files modified by PR241 through nxstyle.
---
 arch/sim/src/sim/up_ajoystick.c  | 24 +++++++++----------
 arch/sim/src/sim/up_ioexpander.c | 52 +++++++++++++++++++++-------------------
 arch/sim/src/sim/up_netdriver.c  |  4 ++--
 arch/sim/src/sim/up_qspiflash.c  | 18 +++++++++-----
 arch/sim/src/sim/up_spiflash.c   | 42 ++++++++++++++++++++++----------
 arch/sim/src/sim/up_tapdev.c     | 27 ++++++++++++---------
 arch/sim/src/sim/up_wpcap.c      | 17 ++++++++-----
 drivers/net/telnet.c             |  1 +
 8 files changed, 112 insertions(+), 73 deletions(-)

diff --git a/arch/sim/src/sim/up_ajoystick.c b/arch/sim/src/sim/up_ajoystick.c
index 1e17438..cbbe74b 100644
--- a/arch/sim/src/sim/up_ajoystick.c
+++ b/arch/sim/src/sim/up_ajoystick.c
@@ -235,18 +235,18 @@ int up_buttonevent(int x, int y, int buttons)
     {
       /* Check button presses */
 
-       changed  = g_ajoy_buttons ^ g_ajoy_sample.as_buttons;
-       if (changed != 0)
-         {
-           pressed  = changed & (AJOY_SUPPORTED & g_ajoy_pset);
-           released = changed & (AJOY_SUPPORTED & ~g_ajoy_rset);
-           if ((pressed & g_ajoy_pset) != 0 || (released & g_ajoy_rset) != 0)
-             {
-               /* Call the interrupt handler */
-
-               g_ajoy_handler(&g_ajoylower, g_ajoy_arg);
-             }
-         }
+      changed  = g_ajoy_buttons ^ g_ajoy_sample.as_buttons;
+      if (changed != 0)
+        {
+          pressed  = changed & (AJOY_SUPPORTED & g_ajoy_pset);
+          released = changed & (AJOY_SUPPORTED & ~g_ajoy_rset);
+          if ((pressed & g_ajoy_pset) != 0 || (released & g_ajoy_rset) != 0)
+            {
+              /* Call the interrupt handler */
+
+              g_ajoy_handler(&g_ajoylower, g_ajoy_arg);
+            }
+        }
     }
 
   return OK;
diff --git a/arch/sim/src/sim/up_ioexpander.c b/arch/sim/src/sim/up_ioexpander.c
index 36e1d4a..e7fd40b 100644
--- a/arch/sim/src/sim/up_ioexpander.c
+++ b/arch/sim/src/sim/up_ioexpander.c
@@ -85,29 +85,33 @@
 
 struct sim_callback_s
 {
-   ioe_pinset_t pinset;              /* Set of pin interrupts that will generate
-                                      * the callback. */
-   ioe_callback_t cbfunc;            /* The saved callback function pointer */
-   FAR void *cbarg;                  /* Callback argument */
+  ioe_pinset_t pinset;              /* Set of pin interrupts that will generate
+                                     * the callback. */
+  ioe_callback_t cbfunc;            /* The saved callback function pointer */
+  FAR void *cbarg;                  /* Callback argument */
 };
 
 /* This structure represents the state of the I/O Expander driver */
 
 struct sim_dev_s
 {
-  struct ioexpander_dev_s dev;       /* Nested structure to allow casting as public gpio
-                                      * expander. */
+  struct ioexpander_dev_s dev;       /* Nested structure to allow casting as
+                                      * public GPIO expander. */
   ioe_pinset_t inpins;               /* Pins select as inputs */
   ioe_pinset_t invert;               /* Pin value inversion */
   ioe_pinset_t outval;               /* Value of output pins */
   ioe_pinset_t inval;                /* Simulated input register */
   ioe_pinset_t intenab;              /* Interrupt enable */
-  ioe_pinset_t last;                 /* Last pin inputs (for detection of changes) */
+  ioe_pinset_t last;                 /* Last pin inputs (for detection of
+                                      * changes) */
   ioe_pinset_t trigger;              /* Bit encoded: 0=level 1=edge */
-  ioe_pinset_t level[2];             /* Bit encoded: 01=high/rising, 10 low/falling, 11 both */
+  ioe_pinset_t level[2];             /* Bit encoded: 01=high/rising,
+                                      * 10 low/falling, 11 both */
 
-  WDOG_ID wdog;                      /* Timer used to poll for interrupt simulation */
-  struct work_s work;                /* Supports the interrupt handling "bottom half" */
+  WDOG_ID wdog;                      /* Timer used to poll for interrupt
+                                      * simulation */
+  struct work_s work;                /* Supports the interrupt handling
+                                      * "bottom half" */
 
   /* Saved callback information for each I/O expander client */
 
@@ -562,18 +566,18 @@ static FAR void *sim_attach(FAR struct ioexpander_dev_s *dev,
 
   for (i = 0; i < CONFIG_SIM_INT_NCALLBACKS; i++)
     {
-       /* Is this entry available (i.e., no callback attached) */
-
-       if (priv->cb[i].cbfunc == NULL)
-         {
-           /* Yes.. use this entry */
-
-           priv->cb[i].pinset = pinset;
-           priv->cb[i].cbfunc = callback;
-           priv->cb[i].cbarg  = arg;
-           handle             = &priv->cb[i];
-           break;
-         }
+      /* Is this entry available (i.e., no callback attached) */
+
+      if (priv->cb[i].cbfunc == NULL)
+        {
+          /* Yes.. use this entry */
+
+          priv->cb[i].pinset = pinset;
+          priv->cb[i].cbfunc = callback;
+          priv->cb[i].cbarg  = arg;
+          handle             = &priv->cb[i];
+          break;
+        }
     }
 
   return handle;
@@ -603,7 +607,7 @@ static int sim_detach(FAR struct ioexpander_dev_s *dev, FAR void *handle)
 
   DEBUGASSERT(priv != NULL && cb != NULL);
   DEBUGASSERT((uintptr_t)cb >= (uintptr_t)&priv->cb[0] &&
-              (uintptr_t)cb <= (uintptr_t)&priv->cb[CONFIG_SIM_INT_NCALLBACKS-1]);
+              (uintptr_t)cb <= (uintptr_t)&priv->cb[CONFIG_SIM_INT_NCALLBACKS - 1]);
   UNUSED(priv);
 
   cb->pinset = 0;
@@ -690,7 +694,7 @@ static ioe_pinset_t sim_int_update(FAR struct sim_dev_s *priv)
               /* Set interrupt as a function of edge type */
 
               if ((!pinval && SIM_EDGE_FALLING(priv, pin)) ||
-                  ( pinval && SIM_EDGE_RISING(priv, pin)))
+                  (pinval && SIM_EDGE_RISING(priv, pin)))
                 {
                   intstat |= 1 << pin;
                 }
diff --git a/arch/sim/src/sim/up_netdriver.c b/arch/sim/src/sim/up_netdriver.c
index 488f56b..88e4f73 100644
--- a/arch/sim/src/sim/up_netdriver.c
+++ b/arch/sim/src/sim/up_netdriver.c
@@ -187,8 +187,8 @@ static void netdriver_work(FAR void *arg)
     {
       NETDEV_RXPACKETS(&g_sim_dev);
 
-      /* Data received event.  Check for valid Ethernet header with destination == our
-       * MAC address
+      /* Data received event.  Check for valid Ethernet header with
+       * destination == our MAC address
        */
 
       eth = BUF;
diff --git a/arch/sim/src/sim/up_qspiflash.c b/arch/sim/src/sim/up_qspiflash.c
index 359e3c1..2d1c180 100644
--- a/arch/sim/src/sim/up_qspiflash.c
+++ b/arch/sim/src/sim/up_qspiflash.c
@@ -56,6 +56,7 @@
 /************************************************************************************
  * Pre-processor Definitions
  ************************************************************************************/
+
 /* Configuration ********************************************************************/
 
 /* Define the FLASH SIZE in bytes */
@@ -144,7 +145,9 @@
 #define QSPIFLASH_STATE_FREAD_WAIT   17
 
 /* Instructions */
+
 /*      Command            Value      N Description             Addr Dummy Data   */
+
 #define QSPIFLASH_WREN      0x06    /* 1 Write Enable              0   0     0     */
 #define QSPIFLASH_WRDI      0x04    /* 1 Write Disable             0   0     0     */
 #define QSPIFLASH_RDID      0x9f    /* 1 Read Identification       0   0     1-3   */
@@ -222,7 +225,10 @@ static const struct qspi_ops_s g_qspiops =
 
 struct sim_qspiflashdev_s g_qspidev =
 {
-  .spidev   = { &g_qspiops },
+  .spidev =
+  {
+    &g_qspiops
+  }
 };
 
 /************************************************************************************
@@ -428,7 +434,7 @@ static void qspiflash_sectorerase(FAR struct sim_qspiflashdev_s *priv)
 
       /* Now perform the erase */
 
-      memset(&priv->data[address], 0xFF, len);
+      memset(&priv->data[address], 0xff, len);
     }
 }
 
@@ -495,7 +501,7 @@ static void qspiflash_writeword(FAR struct sim_qspiflashdev_s *priv, uint16_t da
 
       default:
         priv->state = QSPIFLASH_STATE_IDLE;
-        priv->read_data = 0xFF;
+        priv->read_data = 0xff;
         break;
     }
 }
@@ -593,9 +599,9 @@ FAR struct qspi_dev_s *up_qspiflashinitialize()
   priv->wren = 0;
   priv->address = 0;
   priv->state = QSPIFLASH_STATE_IDLE;
-  priv->read_data = 0xFF;
-  priv->last_cmd = 0xFF;
-  memset(&priv->data[0], 0xFF, sizeof(priv->data));
+  priv->read_data = 0xff;
+  priv->last_cmd = 0xff;
+  memset(&priv->data[0], 0xff, sizeof(priv->data));
 
   leave_critical_section(flags);
   return (FAR struct qspi_dev_s *)priv;
diff --git a/arch/sim/src/sim/up_spiflash.c b/arch/sim/src/sim/up_spiflash.c
index 1308bc7..02dc4d3 100644
--- a/arch/sim/src/sim/up_spiflash.c
+++ b/arch/sim/src/sim/up_spiflash.c
@@ -55,6 +55,7 @@
 /************************************************************************************
  * Pre-processor Definitions
  ************************************************************************************/
+
 /* Configuration ********************************************************************/
 
 /* Define the FLASH SIZE in bytes */
@@ -71,7 +72,7 @@
 
 #ifdef CONFIG_SIM_SPIFLASH_8M
 #  define CONFIG_SPIFLASH_SIZE            (1024 * 1024)
-#  define CONFIG_SPIFLASH_CAPACITY_SST26  0x3F
+#  define CONFIG_SPIFLASH_CAPACITY_SST26  0x3f
 #  define CONFIG_SPIFLASH_CAPACITY        0x14
 #endif
 
@@ -147,7 +148,9 @@
 #define SPIFLASH_STATE_FREAD_WAIT   17
 
 /* Instructions */
+
 /*      Command            Value      N Description             Addr Dummy Data   */
+
 #define SPIFLASH_WREN      0x06    /* 1 Write Enable              0   0     0     */
 #define SPIFLASH_WRDI      0x04    /* 1 Write Disable             0   0     0     */
 #define SPIFLASH_RDID      0x9f    /* 1 Read Identification       0   0     1-3   */
@@ -244,7 +247,10 @@ static const struct spi_ops_s g_spiops =
 #ifdef CONFIG_SIM_SPIFLASH_M25P
 struct sim_spiflashdev_s g_spidev_m25p =
 {
-  .spidev   = { &g_spiops },
+  .spidev   =
+  {
+    &g_spiops
+  },
   .name     = "m25p",
   .manuf    = 0x20,
   .type     = 0x20,
@@ -255,9 +261,12 @@ struct sim_spiflashdev_s g_spidev_m25p =
 #ifdef CONFIG_SIM_SPIFLASH_SST26
 struct sim_spiflashdev_s g_spidev_sst26 =
 {
-  .spidev   = { &g_spiops },
+  .spidev   =
+  {
+    &g_spiops
+  },
   .name     = "sst26",
-  .manuf    = 0xBF,
+  .manuf    = 0xbf,
 #ifdef CONFIG_SST26_MEMORY_TYPE
   .type     = CONFIG_SST26_MEMORY_TYPE,
 #else
@@ -270,7 +279,10 @@ struct sim_spiflashdev_s g_spidev_sst26 =
 #ifdef CONFIG_SIM_SPIFLASH_W25
 struct sim_spiflashdev_s g_spidev_w25 =
 {
-  .spidev   = { &g_spiops },
+  .spidev   =
+  {
+    &g_spiops
+  },
   .name     = "w25",
   .manuf    = 0xef,
   .type     = 0x30,
@@ -281,7 +293,10 @@ struct sim_spiflashdev_s g_spidev_w25 =
 #ifdef CONFIG_SIM_SPIFLASH_CUSTOM
 struct sim_spiflashdev_s g_spidev_custom =
 {
-  .spidev   = { &g_spiops },
+  .spidev   =
+  {
+    &g_spiops
+  },
   .name     = "custom",
   .manuf    = CONFIG_SIM_SPIFLASH_MANUFACTURER,
   .type     = CONFIG_SIM_SPIFLASH_MEMORY_TYPE,
@@ -582,7 +597,8 @@ static void spiflash_exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffe
  ************************************************************************************/
 
 #ifndef CONFIG_SPI_EXCHANGE
-static void spiflash_sndblock(FAR struct spi_dev_s *dev, FAR const void *txbuffer, size_t nwords)
+static void spiflash_sndblock(FAR struct spi_dev_s *dev, FAR const void *txbuffer,
+                              size_t nwords)
 {
   spiinfo("txbuffer=%p nwords=%d\n", txbuffer, nwords);
   return spiflash_exchange(dev, txbuffer, NULL, nwords);
@@ -655,7 +671,7 @@ static void spiflash_sectorerase(FAR struct sim_spiflashdev_s *priv)
 
       /* Now perform the erase */
 
-      memset(&priv->data[address], 0xFF, len);
+      memset(&priv->data[address], 0xff, len);
     }
 }
 
@@ -797,6 +813,7 @@ static void spiflash_writeword(FAR struct sim_spiflashdev_s *priv, uint16_t data
         break;
 
       case SPIFLASH_STATE_PP4:
+
         /* In this state we actually write data (if WREN enabled) */
 
         if (priv->wren)
@@ -849,6 +866,7 @@ static void spiflash_writeword(FAR struct sim_spiflashdev_s *priv, uint16_t data
         break;
 
       case SPIFLASH_STATE_READ4:
+
         /* In this state perform data reads until de-selected. */
 
         priv->read_data = priv->data[priv->address++];
@@ -860,7 +878,7 @@ static void spiflash_writeword(FAR struct sim_spiflashdev_s *priv, uint16_t data
 
       default:
         priv->state = SPIFLASH_STATE_IDLE;
-        priv->read_data = 0xFF;
+        priv->read_data = 0xff;
         break;
     }
 }
@@ -944,9 +962,9 @@ FAR struct spi_dev_s *up_spiflashinitialize(FAR const char *name)
   priv->wren = 0;
   priv->address = 0;
   priv->state = SPIFLASH_STATE_IDLE;
-  priv->read_data = 0xFF;
-  priv->last_cmd = 0xFF;
-  memset(&priv->data[0], 0xFF, sizeof(priv->data));
+  priv->read_data = 0xff;
+  priv->last_cmd = 0xff;
+  memset(&priv->data[0], 0xff, sizeof(priv->data));
 
   leave_critical_section(flags);
   return (FAR struct spi_dev_s *)priv;
diff --git a/arch/sim/src/sim/up_tapdev.c b/arch/sim/src/sim/up_tapdev.c
index aa9c4a4..7c96a32 100644
--- a/arch/sim/src/sim/up_tapdev.c
+++ b/arch/sim/src/sim/up_tapdev.c
@@ -70,8 +70,6 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-//#define TAPDEV_DEBUG  1
-
 #define DEVTAP        "/dev/net/tun"
 
 /* Syslog priority (must match definitions in nuttx/include/syslog.h) */
@@ -120,18 +118,21 @@ static struct rtentry ghostroute;
  ****************************************************************************/
 
 #ifdef TAPDEV_DEBUG
-static inline void dump_ethhdr(const char *msg, unsigned char *buf, int buflen)
+static inline void dump_ethhdr(const char *msg, unsigned char *buf,
+                               int buflen)
 {
   syslog(LOG_INFO, "TAPDEV: %s %d bytes\n", msg, buflen);
   syslog(LOG_INFO,
-         "        %02x:%02x:%02x:%02x:%02x:%02x %02x:%02x:%02x:%02x:%02x:%02x %02x%02x\n",
+         "        %02x:%02x:%02x:%02x:%02x:%02x "
+         "%02x:%02x:%02x:%02x:%02x:%02x %02x%02x\n",
          buf[0], buf[1], buf[2], buf[3], buf[4],  buf[5],
          buf[6], buf[7], buf[8], buf[9], buf[10], buf[11],
 #ifdef CONFIG_ENDIAN_BIG
-         buf[13], buf[12]);
+         buf[13], buf[12]
 #else
-         buf[12], buf[13]);
+         buf[12], buf[13]
 #endif
+        );
 }
 #else
 #  define dump_ethhdr(m,b,l)
@@ -199,7 +200,7 @@ void tapdev_init(void)
     {
       syslog(LOG_ERR, "TAPDEV: ioctl failed: %d\n", -ret);
       return;
-   }
+    }
 
   /* Save the tap device name */
 
@@ -226,7 +227,8 @@ void tapdev_init(void)
   ret = ioctl(sockfd, SIOCBRADDIF, &ifr);
   if (ret < 0)
     {
-      syslog(LOG_ERR, "TAPDEV: ioctl failed (can't add interface %s to bridge %s): %d\n",
+      syslog(LOG_ERR, "TAPDEV: ioctl failed (can't add interface %s to "
+                      "bridge %s): %d\n",
              gdevname, CONFIG_SIM_NET_BRIDGE_DEVICE, -ret);
     }
 
@@ -326,7 +328,8 @@ void tapdev_ifup(in_addr_t ifaddr)
   ret = ioctl(sockfd, SIOCGIFFLAGS, (unsigned long)&ifr);
   if (ret < 0)
     {
-      syslog(LOG_ERR, "TAPDEV: ioctl failed (can't get interface flags): %d\n", -ret);
+      syslog(LOG_ERR, "TAPDEV: ioctl failed (can't get interface flags): %d\n",
+             -ret);
       close(sockfd);
       return;
     }
@@ -335,7 +338,8 @@ void tapdev_ifup(in_addr_t ifaddr)
   ret = ioctl(sockfd, SIOCSIFFLAGS, (unsigned long)&ifr);
   if (ret < 0)
     {
-      syslog(LOG_ERR, "TAPDEV: ioctl failed (can't set interface flags): %d\n", -ret);
+      syslog(LOG_ERR, "TAPDEV: ioctl failed (can't set interface flags): %d\n",
+             -ret);
       close(sockfd);
       return;
     }
@@ -385,7 +389,8 @@ void tapdev_ifdown(void)
       ret = ioctl(sockfd, SIOCDELRT, (unsigned long)&ghostroute);
       if (ret < 0)
         {
-          syslog(LOG_ERR, "TAPDEV: ioctl failed (can't delete host route): %d\n", -ret);
+          syslog(LOG_ERR, "TAPDEV: ioctl failed (can't delete host route): %d\n",
+                 -ret);
         }
 
       close(sockfd);
diff --git a/arch/sim/src/sim/up_wpcap.c b/arch/sim/src/sim/up_wpcap.c
index d430526..8bc4526 100644
--- a/arch/sim/src/sim/up_wpcap.c
+++ b/arch/sim/src/sim/up_wpcap.c
@@ -55,9 +55,6 @@
 
 #include <netinet/in.h>
 
-
-extern int netdriver_setmacaddr(unsigned char *macaddr);
-
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
@@ -115,6 +112,12 @@ HMODULE wpcap;
 static struct pcap *pcap;
 
 /****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+extern int netdriver_setmacaddr(unsigned char *macaddr);
+
+/****************************************************************************
  * Private Function Prototypes
  ****************************************************************************/
 
@@ -151,7 +154,6 @@ static void init_pcap(struct in_addr addr)
           interfaces->addresses->addr != NULL &&
           interfaces->addresses->addr->sa_family == AF_INET)
         {
-
           struct in_addr interface_addr;
           interface_addr =
             ((struct sockaddr_in *)interfaces->addresses->addr)->sin_addr;
@@ -162,6 +164,7 @@ static void init_pcap(struct in_addr addr)
               break;
             }
         }
+
       interfaces = interfaces->next;
     }
 
@@ -189,7 +192,9 @@ static void set_ethaddr(struct in_addr addr)
     {
       error_exit("error on access to adapter list size\n");
     }
+
   adapters = alloca(size);
+
   if (GetAdaptersAddresses(AF_INET, GAA_FLAG_SKIP_ANYCAST |
                            GAA_FLAG_SKIP_MULTICAST |
                            GAA_FLAG_SKIP_DNS_SERVER,
@@ -200,7 +205,6 @@ static void set_ethaddr(struct in_addr addr)
 
   while (adapters != NULL)
     {
-
       char buffer[256];
       WideCharToMultiByte(CP_ACP, 0, adapters->Description, -1,
                           buffer, sizeof(buffer), NULL, NULL);
@@ -211,7 +215,6 @@ static void set_ethaddr(struct in_addr addr)
           adapters->FirstUnicastAddress->Address.lpSockaddr->sa_family ==
           AF_INET)
         {
-
           struct in_addr adapter_addr;
           adapter_addr =
             ((struct sockaddr_in *)adapters->FirstUnicastAddress->Address.
@@ -225,6 +228,7 @@ static void set_ethaddr(struct in_addr addr)
                   error_exit
                     ("ip addr specified does not belong to an ethernet card\n");
                 }
+
               printf
                 ("set_ethaddr:  ethernetaddr: %02X-%02X-%02X-%02X-%02X-%02X\n",
                  adapters->PhysicalAddress[0], adapters->PhysicalAddress[1],
@@ -235,6 +239,7 @@ static void set_ethaddr(struct in_addr addr)
               break;
             }
         }
+
       adapters = adapters->Next;
     }
 
diff --git a/drivers/net/telnet.c b/drivers/net/telnet.c
index 7821972..29ce4cd 100644
--- a/drivers/net/telnet.c
+++ b/drivers/net/telnet.c
@@ -307,6 +307,7 @@ static void telnet_check_ctrlchar(FAR struct telnet_dev_s *priv,
           break;
         }
 #endif
+
 #ifdef CONFIG_TTY_SIGSTP
       /* Is this the special character that will generate the SIGSTP signal? */
 


[incubator-nuttx] 04/05: arch/sim: Remove the unnecessary file guard

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit f2f385902b3419f5667c97cf57ae6c255d4ffe0b
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Feb 10 13:02:39 2020 +0800

    arch/sim: Remove the unnecessary file guard
    
    since the same protection is already done in Makefile
---
 arch/sim/src/sim/up_ajoystick.c    | 4 ----
 arch/sim/src/sim/up_checkstack.c   | 4 ----
 arch/sim/src/sim/up_cpuidlestack.c | 4 ----
 arch/sim/src/sim/up_ioexpander.c   | 4 ----
 arch/sim/src/sim/up_netdriver.c    | 4 ----
 arch/sim/src/sim/up_qspiflash.c    | 4 ----
 arch/sim/src/sim/up_romgetc.c      | 3 ---
 arch/sim/src/sim/up_schednote.c    | 5 -----
 arch/sim/src/sim/up_smpsignal.c    | 4 ----
 arch/sim/src/sim/up_spiflash.c     | 4 ----
 arch/sim/src/sim/up_tapdev.c       | 4 ----
 arch/sim/src/sim/up_wpcap.c        | 4 ----
 12 files changed, 48 deletions(-)

diff --git a/arch/sim/src/sim/up_ajoystick.c b/arch/sim/src/sim/up_ajoystick.c
index 017c98c..1e17438 100644
--- a/arch/sim/src/sim/up_ajoystick.c
+++ b/arch/sim/src/sim/up_ajoystick.c
@@ -50,8 +50,6 @@
 
 #include "up_internal.h"
 
-#ifdef CONFIG_AJOYSTICK
-
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
@@ -253,5 +251,3 @@ int up_buttonevent(int x, int y, int buttons)
 
   return OK;
 }
-
-#endif /* CONFIG_AJOYSTICK */
diff --git a/arch/sim/src/sim/up_checkstack.c b/arch/sim/src/sim/up_checkstack.c
index 160d0a4..f8be93f 100644
--- a/arch/sim/src/sim/up_checkstack.c
+++ b/arch/sim/src/sim/up_checkstack.c
@@ -52,8 +52,6 @@
 #include "sched/sched.h"
 #include "up_internal.h"
 
-#ifdef CONFIG_STACK_COLORATION
-
 /****************************************************************************
  * Private Function Prototypes
  ****************************************************************************/
@@ -207,5 +205,3 @@ ssize_t up_check_stack_remain(void)
 {
   return up_check_tcbstack_remain(this_task());
 }
-
-#endif /* CONFIG_STACK_COLORATION */
diff --git a/arch/sim/src/sim/up_cpuidlestack.c b/arch/sim/src/sim/up_cpuidlestack.c
index d7e3746..7179808 100644
--- a/arch/sim/src/sim/up_cpuidlestack.c
+++ b/arch/sim/src/sim/up_cpuidlestack.c
@@ -46,8 +46,6 @@
 
 #include "up_internal.h"
 
-#ifdef CONFIG_SMP
-
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
@@ -104,5 +102,3 @@ int up_cpu_idlestack(int cpu, FAR struct tcb_s *tcb, size_t stack_size)
   tcb->adj_stack_ptr   = NULL;
   return OK;
 }
-
-#endif /* CONFIG_SMP */
diff --git a/arch/sim/src/sim/up_ioexpander.c b/arch/sim/src/sim/up_ioexpander.c
index 7f9180b..36e1d4a 100644
--- a/arch/sim/src/sim/up_ioexpander.c
+++ b/arch/sim/src/sim/up_ioexpander.c
@@ -50,8 +50,6 @@
 
 #include "up_internal.h"
 
-#ifdef CONFIG_SIM_IOEXPANDER
-
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
@@ -861,5 +859,3 @@ FAR struct ioexpander_dev_s *sim_ioexpander_initialize(void)
 
   return &priv->dev;
 }
-
-#endif /* CONFIG_SIM_IOEXPANDER */
diff --git a/arch/sim/src/sim/up_netdriver.c b/arch/sim/src/sim/up_netdriver.c
index b7b9b8d..488f56b 100644
--- a/arch/sim/src/sim/up_netdriver.c
+++ b/arch/sim/src/sim/up_netdriver.c
@@ -44,8 +44,6 @@
 
 #include <nuttx/config.h>
 
-#ifdef CONFIG_NET_ETHERNET
-
 #include <stdint.h>
 #include <stdbool.h>
 #include <string.h>
@@ -377,5 +375,3 @@ int netdriver_setmacaddr(unsigned char *macaddr)
   memcpy(g_sim_dev.d_mac.ether.ether_addr_octet, macaddr, IFHWADDRLEN);
   return 0;
 }
-
-#endif /* CONFIG_NET_ETHERNET */
diff --git a/arch/sim/src/sim/up_qspiflash.c b/arch/sim/src/sim/up_qspiflash.c
index bffc36e..359e3c1 100644
--- a/arch/sim/src/sim/up_qspiflash.c
+++ b/arch/sim/src/sim/up_qspiflash.c
@@ -53,8 +53,6 @@
 
 #include "up_internal.h"
 
-#if defined(CONFIG_SIM_QSPIFLASH)
-
 /************************************************************************************
  * Pre-processor Definitions
  ************************************************************************************/
@@ -602,5 +600,3 @@ FAR struct qspi_dev_s *up_qspiflashinitialize()
   leave_critical_section(flags);
   return (FAR struct qspi_dev_s *)priv;
 }
-
-#endif /* CONFIG_SIM_QSPIFLASH */
diff --git a/arch/sim/src/sim/up_romgetc.c b/arch/sim/src/sim/up_romgetc.c
index 955674d..3e0a759 100644
--- a/arch/sim/src/sim/up_romgetc.c
+++ b/arch/sim/src/sim/up_romgetc.c
@@ -41,8 +41,6 @@
 
 #include <nuttx/arch.h>
 
-#ifdef CONFIG_ARCH_ROMGETC
-
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
@@ -86,4 +84,3 @@ char up_romgetc(FAR const char *ptr)
 
   return *ptr;
 }
-#endif
diff --git a/arch/sim/src/sim/up_schednote.c b/arch/sim/src/sim/up_schednote.c
index ece96e9..225eaf9 100644
--- a/arch/sim/src/sim/up_schednote.c
+++ b/arch/sim/src/sim/up_schednote.c
@@ -42,9 +42,6 @@
 #include <syslog.h>
 #include <nuttx/sched.h>
 
-#if defined(CONFIG_SCHED_INSTRUMENTATION) && \
-   !defined(CONFIG_SCHED_INSTRUMENTATION_BUFFER)
-
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
@@ -207,5 +204,3 @@ void sched_note_csection(FAR struct tcb_s *tcb, bool enter)
 #endif
 }
 #endif
-
-#endif /* CONFIG_SCHED_INSTRUMENTATION && !CONFIG_SCHED_INSTRUMENTATION_BUFFER */
diff --git a/arch/sim/src/sim/up_smpsignal.c b/arch/sim/src/sim/up_smpsignal.c
index 126269c..a2d953d 100644
--- a/arch/sim/src/sim/up_smpsignal.c
+++ b/arch/sim/src/sim/up_smpsignal.c
@@ -46,8 +46,6 @@
 #include "sched/sched.h"
 #include "up_internal.h"
 
-#ifdef CONFIG_SMP
-
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
@@ -177,5 +175,3 @@ void up_cpu_started(void)
   sched_note_start(tcb);
 #endif
 }
-
-#endif /* CONFIG_SMP */
diff --git a/arch/sim/src/sim/up_spiflash.c b/arch/sim/src/sim/up_spiflash.c
index e97e088..1308bc7 100644
--- a/arch/sim/src/sim/up_spiflash.c
+++ b/arch/sim/src/sim/up_spiflash.c
@@ -52,8 +52,6 @@
 
 #include "up_internal.h"
 
-#if defined(CONFIG_SIM_SPIFLASH)
-
 /************************************************************************************
  * Pre-processor Definitions
  ************************************************************************************/
@@ -953,5 +951,3 @@ FAR struct spi_dev_s *up_spiflashinitialize(FAR const char *name)
   leave_critical_section(flags);
   return (FAR struct spi_dev_s *)priv;
 }
-
-#endif /* CONFIG_SIM_SPIFLASH */
diff --git a/arch/sim/src/sim/up_tapdev.c b/arch/sim/src/sim/up_tapdev.c
index fc38d4c..aa9c4a4 100644
--- a/arch/sim/src/sim/up_tapdev.c
+++ b/arch/sim/src/sim/up_tapdev.c
@@ -38,8 +38,6 @@
  *
  ****************************************************************************/
 
-#ifndef __CYGWIN__
-
 /****************************************************************************
  * Included Files
  ****************************************************************************/
@@ -394,5 +392,3 @@ void tapdev_ifdown(void)
     }
 #endif
 }
-
-#endif /* !__CYGWIN__ */
diff --git a/arch/sim/src/sim/up_wpcap.c b/arch/sim/src/sim/up_wpcap.c
index 5c754f4..d430526 100644
--- a/arch/sim/src/sim/up_wpcap.c
+++ b/arch/sim/src/sim/up_wpcap.c
@@ -38,8 +38,6 @@
  *
  ****************************************************************************/
 
-#ifdef __CYGWIN__
-
 /****************************************************************************
  * Included Files
  ****************************************************************************/
@@ -310,5 +308,3 @@ void wpcap_send(unsigned char *buf, unsigned int buflen)
       error_exit("error on send\n");
     }
 }
-
-#endif /* __CYGWIN__ */