You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by je...@apache.org on 2020/05/13 11:11:18 UTC

[incubator-nuttx] branch master updated (21557ac -> ef169b7)

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

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


    from 21557ac  ea3131/scripts/pg-ld.script: Rename up_head.o to arm_head.o
     new 77f15c8  arch: cxd56xx: Apply the latest cxd56_dma.c and cxd56_spi from SDK
     new 65b3acc  boards: cxd56xx: Add SPI DMA support to cxd56_gs2200m.c
     new ef169b7  drivers: wireless: Handle multiple incoming packets in gs2200m.c

The 3 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/arm/src/cxd56xx/cxd56_dmac.c             | 35 +++++++++--
 arch/arm/src/cxd56xx/cxd56_spi.c              | 85 ++-------------------------
 boards/arm/cxd56xx/common/src/cxd56_gs2200m.c | 30 +++++++++-
 drivers/wireless/gs2200m.c                    | 20 +++++--
 4 files changed, 77 insertions(+), 93 deletions(-)


[incubator-nuttx] 03/03: drivers: wireless: Handle multiple incoming packets in gs2200m.c

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

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

commit ef169b7ebf8977ba60939064ddf782340aaeb233
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Tue May 5 11:24:09 2020 +0900

    drivers: wireless: Handle multiple incoming packets in gs2200m.c
    
    Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
 drivers/wireless/gs2200m.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/wireless/gs2200m.c b/drivers/wireless/gs2200m.c
index 5a016d3..d666c56 100644
--- a/drivers/wireless/gs2200m.c
+++ b/drivers/wireless/gs2200m.c
@@ -2754,6 +2754,8 @@ static void gs2200m_irq_worker(FAR void *arg)
     }
   while (ret < 0);
 
+repeat:
+
   n = dev->lower->dready(&ec);
   wlinfo("== start (dready=%d, ec=%d) \n", n, ec);
 
@@ -2844,21 +2846,27 @@ static void gs2200m_irq_worker(FAR void *arg)
 
 errout:
 
-  /* NOTE: Enable gs2200m irq which was disabled in gs2200m_irq() */
-
-  dev->lower->enable();
+  if (ignored)
+    {
+      _release_pkt_dat(pkt_dat);
+      kmm_free(pkt_dat);
+      ignored = false;
+    }
 
   n = dev->lower->dready(&ec);
 
   wlinfo("== end: cid=%c (dready=%d, ec=%d) type=%d \n",
          pkt_dat->cid, n, ec, t);
 
-  if (ignored)
+  if (1 == n)
     {
-      _release_pkt_dat(pkt_dat);
-      kmm_free(pkt_dat);
+      goto repeat;
     }
 
+  /* NOTE: Enable gs2200m irq which was disabled in gs2200m_irq() */
+
+  dev->lower->enable();
+
   gs2200m_unlock(dev);
 }
 


[incubator-nuttx] 02/03: boards: cxd56xx: Add SPI DMA support to cxd56_gs2200m.c

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

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

commit 65b3accc5170336e8a5df6ce47f3236f84445723
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Tue May 5 11:23:04 2020 +0900

    boards: cxd56xx: Add SPI DMA support to cxd56_gs2200m.c
    
    Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
 boards/arm/cxd56xx/common/src/cxd56_gs2200m.c | 30 ++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/boards/arm/cxd56xx/common/src/cxd56_gs2200m.c b/boards/arm/cxd56xx/common/src/cxd56_gs2200m.c
index 211a411..846f8a0 100644
--- a/boards/arm/cxd56xx/common/src/cxd56_gs2200m.c
+++ b/boards/arm/cxd56xx/common/src/cxd56_gs2200m.c
@@ -51,9 +51,17 @@
 
 #include "cxd56_pinconfig.h"
 #include "cxd56_spi.h"
+#include "cxd56_dmac.h"
 #include "cxd56_gpio.h"
 #include "cxd56_gpioint.h"
 
+#define DMA_TXCH       (CONFIG_CXD56_DMAC_SPI5_TX_CH)
+#define DMA_RXCH       (CONFIG_CXD56_DMAC_SPI5_RX_CH)
+#define DMA_TXCH_CFG   (CXD56_DMA_PERIPHERAL_SPI5_TX)
+#define DMA_RXCH_CFG   (CXD56_DMA_PERIPHERAL_SPI5_RX)
+#define SPI_TX_MAXSIZE (CONFIG_CXD56_DMAC_SPI5_TX_MAXSIZE)
+#define SPI_RX_MAXSIZE (CONFIG_CXD56_DMAC_SPI5_RX_MAXSIZE)
+
 /****************************************************************************
  * Private Function Prototypes
  ****************************************************************************/
@@ -224,6 +232,8 @@ static void spi_pincontrol(int bus, bool on)
 int board_gs2200m_initialize(FAR const char *devpath, int bus)
 {
   FAR struct spi_dev_s *spi;
+  DMA_HANDLE    hdl;
+  dma_config_t  conf;
 
   wlinfo("Initializing GS2200M..\n");
 
@@ -245,9 +255,27 @@ int board_gs2200m_initialize(FAR const char *devpath, int bus)
           return -ENODEV;
         }
 
+      hdl = cxd56_dmachannel(DMA_TXCH, SPI_TX_MAXSIZE);
+      if (hdl)
+        {
+          conf.channel_cfg = DMA_TXCH_CFG;
+          conf.dest_width  = CXD56_DMAC_WIDTH8;
+          conf.src_width   = CXD56_DMAC_WIDTH8;
+          cxd56_spi_dmaconfig(bus, CXD56_SPI_DMAC_CHTYPE_TX, hdl, &conf);
+        }
+
+      hdl = cxd56_dmachannel(DMA_RXCH, SPI_RX_MAXSIZE);
+      if (hdl)
+        {
+          conf.channel_cfg = DMA_RXCH_CFG;
+          conf.dest_width  = CXD56_DMAC_WIDTH8;
+          conf.src_width   = CXD56_DMAC_WIDTH8;
+          cxd56_spi_dmaconfig(bus, CXD56_SPI_DMAC_CHTYPE_RX, hdl, &conf);
+        }
+
       /* Enable SPI5 */
 
-      spi_pincontrol(5, true);
+      spi_pincontrol(bus, true);
 
       g_devhandle = gs2200m_register(devpath, spi, &g_wifi_lower);
 


[incubator-nuttx] 01/03: arch: cxd56xx: Apply the latest cxd56_dma.c and cxd56_spi from SDK

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

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

commit 77f15c8b17a83e9dc10d990e16cb414bd0dd617e
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Wed May 13 11:41:04 2020 +0900

    arch: cxd56xx: Apply the latest cxd56_dma.c and cxd56_spi from SDK
    
    See the following commit in SDK:
    
      commit 62a2fb4fd3001aefad9ec3b2e2e7c47e5b0f21e1
      Author: SPRESENSE <41...@users.noreply.github.com>
      Date:   Fri Jan 24 13:32:04 2020 +0900
    
          Enable dummy transfer by SPI using DMA
    
    Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
 arch/arm/src/cxd56xx/cxd56_dmac.c | 35 +++++++++++++---
 arch/arm/src/cxd56xx/cxd56_spi.c  | 85 +++------------------------------------
 2 files changed, 34 insertions(+), 86 deletions(-)

diff --git a/arch/arm/src/cxd56xx/cxd56_dmac.c b/arch/arm/src/cxd56xx/cxd56_dmac.c
index 7deb5a3..0035351 100644
--- a/arch/arm/src/cxd56xx/cxd56_dmac.c
+++ b/arch/arm/src/cxd56xx/cxd56_dmac.c
@@ -290,6 +290,7 @@ struct dma_channel_s
   dmac_lli_t * list;             /* Link list */
   dma_callback_t callback;       /* Callback invoked when the DMA completes */
   void *arg;                     /* Argument passed to callback function */
+  unsigned int dummy;            /* Dummy buffer */
 };
 
 /****************************************************************************
@@ -902,10 +903,21 @@ void cxd56_rxdmasetup(DMA_HANDLE handle, uintptr_t paddr, uintptr_t maddr,
   uintptr_t dst;
   size_t rest;
   int peri;
+  int di;
 
   DEBUGASSERT(dmach != NULL && dmach->inuse && dmach->list != NULL);
 
-  dst = maddr;
+  if (maddr)
+    {
+      dst = maddr;
+      di = 1;
+    }
+  else
+    {
+      dst = (uintptr_t)&dmach->dummy;
+      di = 0;
+    }
+
   rest = nbytes;
 
   list_num = (nbytes + CXD56_DMAC_MAX_SIZE - 1) / CXD56_DMAC_MAX_SIZE;
@@ -914,7 +926,7 @@ void cxd56_rxdmasetup(DMA_HANDLE handle, uintptr_t paddr, uintptr_t maddr,
       dmach->list[i].src_addr = paddr;
       dmach->list[i].dest_addr = dst;
       dmach->list[i].nextlli = (uint32_t)&dmach->list[i + 1];
-      dmach->list[i].control = DMAC_EX_CTRL_HELPER(0, 1, 0,            /* interrupt / Dest inc / Src inc */
+      dmach->list[i].control = DMAC_EX_CTRL_HELPER(0, di, 0,           /* interrupt / Dest inc / Src inc */
                                CXD56_DMAC_MASTER1, CXD56_DMAC_MASTER2, /* AHB dst master / AHB src master (fixed) */
                                config.dest_width, config.src_width,    /* Dest / Src transfer width */
                                CXD56_DMAC_BSIZE4, CXD56_DMAC_BSIZE4,   /* Dest / Src burst size (fixed) */
@@ -927,7 +939,7 @@ void cxd56_rxdmasetup(DMA_HANDLE handle, uintptr_t paddr, uintptr_t maddr,
   dmach->list[i].src_addr = paddr;
   dmach->list[i].dest_addr = dst;
   dmach->list[i].nextlli = 0;
-  dmach->list[i].control = DMAC_EX_CTRL_HELPER(1, 1, 0,                /* interrupt / Dest inc / Src inc */
+  dmach->list[i].control = DMAC_EX_CTRL_HELPER(1, di, 0,               /* interrupt / Dest inc / Src inc */
                                CXD56_DMAC_MASTER1, CXD56_DMAC_MASTER2, /* AHB dst master / AHB src master (fixed) */
                                config.dest_width, config.src_width,    /* Dest / Src transfer width */
                                CXD56_DMAC_BSIZE4, CXD56_DMAC_BSIZE4,   /* Dest / Src burst size (fixed) */
@@ -961,10 +973,21 @@ void cxd56_txdmasetup(DMA_HANDLE handle, uintptr_t paddr, uintptr_t maddr,
   uintptr_t src;
   size_t rest;
   int peri;
+  int si;
 
   DEBUGASSERT(dmach != NULL && dmach->inuse && dmach->list != NULL);
 
-  src = maddr;
+  if (maddr)
+    {
+      src = maddr;
+      si = 1;
+    }
+  else
+    {
+      src = (uintptr_t)&dmach->dummy;
+      si = 0;
+    }
+
   rest = nbytes;
 
   list_num = (nbytes + CXD56_DMAC_MAX_SIZE - 1) / CXD56_DMAC_MAX_SIZE;
@@ -973,7 +996,7 @@ void cxd56_txdmasetup(DMA_HANDLE handle, uintptr_t paddr, uintptr_t maddr,
       dmach->list[i].src_addr = src;
       dmach->list[i].dest_addr = paddr;
       dmach->list[i].nextlli = (uint32_t)&dmach->list[i + 1];
-      dmach->list[i].control = DMAC_EX_CTRL_HELPER(0, 0, 1,                /* interrupt / Dest inc / Src inc */
+      dmach->list[i].control = DMAC_EX_CTRL_HELPER(0, 0, si,               /* interrupt / Dest inc / Src inc */
                                    CXD56_DMAC_MASTER2, CXD56_DMAC_MASTER1, /* AHB dst master / AHB src master (fixed) */
                                    config.dest_width, config.src_width,    /* Dest / Src transfer width (fixed) */
                                    CXD56_DMAC_BSIZE1, CXD56_DMAC_BSIZE1,   /* Dest / Src burst size (fixed) */
@@ -986,7 +1009,7 @@ void cxd56_txdmasetup(DMA_HANDLE handle, uintptr_t paddr, uintptr_t maddr,
   dmach->list[i].src_addr = src;
   dmach->list[i].dest_addr = paddr;
   dmach->list[i].nextlli = 0;
-  dmach->list[i].control = DMAC_EX_CTRL_HELPER(1, 0, 1,                    /* interrupt / Dest inc / Src inc */
+  dmach->list[i].control = DMAC_EX_CTRL_HELPER(1, 0, si,                   /* interrupt / Dest inc / Src inc */
                                    CXD56_DMAC_MASTER2, CXD56_DMAC_MASTER1, /* AHB dst master / AHB src master (fixed) */
                                    config.dest_width, config.src_width,    /* Dest / Src transfer width (fixed) */
                                    CXD56_DMAC_BSIZE4, CXD56_DMAC_BSIZE4,   /* Dest / Src burst size (fixed) */
diff --git a/arch/arm/src/cxd56xx/cxd56_spi.c b/arch/arm/src/cxd56xx/cxd56_spi.c
index 72caec9..2f2bbfc 100644
--- a/arch/arm/src/cxd56xx/cxd56_spi.c
+++ b/arch/arm/src/cxd56xx/cxd56_spi.c
@@ -126,8 +126,6 @@ static inline void spi_putreg(FAR struct cxd56_spidev_s *priv,
 static void __unused spi_dmaexchange(FAR struct spi_dev_s *dev,
                                      FAR const void *txbuffer,
                                      FAR void *rxbuffer, size_t nwords);
-static void spi_dmatxwait(FAR struct cxd56_spidev_s *priv);
-static void spi_dmarxwait(FAR struct cxd56_spidev_s *priv);
 static void spi_dmatrxwait(FAR struct cxd56_spidev_s *priv);
 static void spi_dmatxcallback(DMA_HANDLE handle, uint8_t status, void *data);
 static void spi_dmarxcallback(DMA_HANDLE handle, uint8_t status, void *data);
@@ -1438,42 +1436,17 @@ static void spi_dmaexchange(FAR struct spi_dev_s *dev,
 
   /* Setup DMAs */
 
-  if (txbuffer)
-    {
-      spi_dmatxsetup(priv, txbuffer, nwords);
-    }
-
-  if (rxbuffer)
-    {
-      spi_dmarxsetup(priv, rxbuffer, nwords);
-    }
+  spi_dmatxsetup(priv, txbuffer, nwords);
+  spi_dmarxsetup(priv, rxbuffer, nwords);
 
   /* Start the DMAs */
 
-  if (rxbuffer)
-    {
-      cxd56_dmastart(priv->rxdmach, spi_dmarxcallback, priv);
-    }
-
-  if (txbuffer)
-    {
-      cxd56_dmastart(priv->txdmach, spi_dmatxcallback, priv);
-    }
+  cxd56_dmastart(priv->rxdmach, spi_dmarxcallback, priv);
+  cxd56_dmastart(priv->txdmach, spi_dmatxcallback, priv);
 
   /* Then wait for each to complete */
 
-  if (txbuffer && rxbuffer)
-    {
-      spi_dmatrxwait(priv);
-    }
-  else if (txbuffer)
-    {
-      spi_dmatxwait(priv);
-    }
-  else if (rxbuffer)
-    {
-      spi_dmarxwait(priv);
-    }
+  spi_dmatrxwait(priv);
 
   if (priv->port == 3)
     {
@@ -1609,54 +1582,6 @@ static void spi_dmarxsetup(FAR struct cxd56_spidev_s *priv,
 }
 
 /****************************************************************************
- * Name: spi_dmatxwait
- *
- * Description:
- *   Wait for TX DMA to complete.
- *
- ****************************************************************************/
-
-static void spi_dmatxwait(FAR struct cxd56_spidev_s *priv)
-{
-  uint32_t val;
-
-  if (nxsem_wait(&priv->dmasem) != OK)
-    {
-      spierr("dma error\n");
-    }
-
-  cxd56_dmastop(priv->txdmach);
-
-  val = spi_getreg(priv, CXD56_SPI_DMACR_OFFSET);
-  val &= ~SPI_DMACR_TXDMAE;
-  spi_putreg(priv, CXD56_SPI_DMACR_OFFSET, val);
-}
-
-/****************************************************************************
- * Name: spi_dmarxwait
- *
- * Description:
- *   Wait for RX DMA to complete.
- *
- ****************************************************************************/
-
-static void spi_dmarxwait(FAR struct cxd56_spidev_s *priv)
-{
-  uint32_t val;
-
-  if (nxsem_wait(&priv->dmasem) != OK)
-    {
-      spierr("dma error\n");
-    }
-
-  cxd56_dmastop(priv->rxdmach);
-
-  val = spi_getreg(priv, CXD56_SPI_DMACR_OFFSET);
-  val &= ~SPI_DMACR_RXDMAE;
-  spi_putreg(priv, CXD56_SPI_DMACR_OFFSET, val);
-}
-
-/****************************************************************************
  * Name: spi_dmatrxwait
  *
  * Description: