You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2020/06/10 12:11:27 UTC

[incubator-nuttx] branch master updated (0317eae -> 8ae0a13)

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

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


    from 0317eae  libc: support CONFIG_ARCH_ROMGETC for scanf function series
     new 8a60cc0  drivers: audio: Send stop message when received the final buffer
     new 958ddc1  drivers: audio: Add a buffering feature to cxd56
     new 8ae0a13  boards: spresense: Change audio buffer size and mq size for wifi

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:
 .../arm/cxd56xx/spresense/configs/wifi/defconfig   |  2 +-
 drivers/audio/cxd56.c                              | 64 ++++++++++++++++++++--
 drivers/audio/cxd56.h                              |  1 +
 3 files changed, 61 insertions(+), 6 deletions(-)


[incubator-nuttx] 02/03: drivers: audio: Add a buffering feature to cxd56

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

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

commit 958ddc1926ebcdb991214bee68c762eed2bac8b9
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Wed Jun 10 16:31:09 2020 +0900

    drivers: audio: Add a buffering feature to cxd56
    
    Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
 drivers/audio/cxd56.c | 46 +++++++++++++++++++++++++++++++++++++++++-----
 drivers/audio/cxd56.h |  1 +
 2 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/drivers/audio/cxd56.c b/drivers/audio/cxd56.c
index 46dda98..6a3da21 100644
--- a/drivers/audio/cxd56.c
+++ b/drivers/audio/cxd56.c
@@ -2979,7 +2979,8 @@ static int cxd56_resume(FAR struct audio_lowerhalf_s *lower)
   int ret;
   FAR struct cxd56_dev_s *dev = (FAR struct cxd56_dev_s *)lower;
 
-  if (dev->state == CXD56_DEV_STATE_PAUSED)
+  if (dev->state == CXD56_DEV_STATE_PAUSED ||
+      dev->state == CXD56_DEV_STATE_BUFFERING)
     {
       dev->state = CXD56_DEV_STATE_STARTED;
       cxd56_power_on_analog_output(dev);
@@ -3062,17 +3063,17 @@ static int cxd56_start_dma(FAR struct cxd56_dev_s *dev)
   flags = spin_lock_irqsave();
   if (dq_count(&dev->pendingq) == 0)
     {
-      /* Pending queue empty, nothing to do */
+      /* Underrun occurred, send user message to start buffering */
 
+      audwarn("Underrun \n");
       struct audio_msg_s msg;
-
-      msg.msg_id = AUDIO_MSG_STOP;
+      msg.msg_id = AUDIO_MSG_USER;
       msg.u.data = 0;
       ret = nxmq_send(dev->mq, (FAR const char *)&msg,
                       sizeof(msg), CONFIG_CXD56_MSG_PRIO);
       if (ret != OK)
         {
-          auderr("ERROR: nxmq_send start DMA failed (%d)\n", ret);
+          auderr("ERROR: nxmq_send for buffering failed (%d)\n", ret);
           goto exit;
         }
     }
@@ -3396,6 +3397,18 @@ static void *cxd56_workerthread(pthread_addr_t pvarg)
 
       switch (msg.msg_id)
         {
+          case AUDIO_MSG_USER:
+            ret = cxd56_stop_dma(priv);
+            if (ret != CXD56_AUDIO_ECODE_OK)
+              {
+                auderr("ERROR: Could not stop DMA transfer (%d)\n", ret);
+                priv->running = false;
+              }
+
+            priv->state = CXD56_DEV_STATE_BUFFERING;
+            audinfo("Workerthread paused for buffering.\n");
+            break;
+
           case AUDIO_MSG_STOP:
             ret = cxd56_stop_dma(priv);
             if (ret != CXD56_AUDIO_ECODE_OK)
@@ -3417,6 +3430,29 @@ static void *cxd56_workerthread(pthread_addr_t pvarg)
             break;
 
           case AUDIO_MSG_ENQUEUE:
+            if (priv->state == CXD56_DEV_STATE_BUFFERING)
+              {
+                audwarn("Buffering pendingq=%d \n",
+                        dq_count(&priv->pendingq));
+
+                FAR struct ap_buffer_s *apb;
+                apb = (struct ap_buffer_s *)(&priv->pendingq)->tail;
+
+                bool final = (apb != NULL) &&
+                  ((apb->flags & AUDIO_APB_FINAL) != 0);
+
+                /* If pendingq exceeds the threshold or pendingq
+                 * contains the final buffer, then start dma.
+                 */
+
+                if (CONFIG_CXD56_AUDIO_NUM_BUFFERS <=
+                    dq_count(&priv->pendingq) || final)
+                  {
+                    cxd56_resume((FAR struct audio_lowerhalf_s *)priv);
+                  }
+              }
+            break;
+
           default:
             break;
         }
diff --git a/drivers/audio/cxd56.h b/drivers/audio/cxd56.h
index c43e0c6..685ed56 100644
--- a/drivers/audio/cxd56.h
+++ b/drivers/audio/cxd56.h
@@ -243,6 +243,7 @@ enum cxd56_devstate_e
 {
   CXD56_DEV_STATE_OFF,
   CXD56_DEV_STATE_PAUSED,
+  CXD56_DEV_STATE_BUFFERING,
   CXD56_DEV_STATE_STARTED,
   CXD56_DEV_STATE_STOPPED
 };


[incubator-nuttx] 01/03: drivers: audio: Send stop message when received the final buffer

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

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

commit 8a60cc01e21e0c729080c0428d5640c62fc22feb
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Wed Jun 10 16:01:21 2020 +0900

    drivers: audio: Send stop message when received the final buffer
    
    Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
 drivers/audio/cxd56.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/audio/cxd56.c b/drivers/audio/cxd56.c
index 602e4ea..46dda98 100644
--- a/drivers/audio/cxd56.c
+++ b/drivers/audio/cxd56.c
@@ -3224,6 +3224,24 @@ static int cxd56_start_dma(FAR struct cxd56_dev_s *dev)
           dq_get(&dev->pendingq);
           dq_put(&dev->runningq, &apb->dq_entry);
           dev->state = CXD56_DEV_STATE_STARTED;
+
+          if ((apb->flags & AUDIO_APB_FINAL) != 0)
+            {
+              /* If the apb is final, send stop message */
+
+              audinfo("Final apb \n");
+              struct audio_msg_s msg;
+              msg.msg_id = AUDIO_MSG_STOP;
+              msg.u.data = 0;
+              ret = nxmq_send(dev->mq, (FAR const char *)&msg,
+                              sizeof(msg), CONFIG_CXD56_MSG_PRIO);
+
+              if (ret != OK)
+                {
+                  auderr("ERROR: nxmq_send for stop failed (%d)\n", ret);
+                  goto exit;
+                }
+            }
         }
     }
 


[incubator-nuttx] 03/03: boards: spresense: Change audio buffer size and mq size for wifi

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

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

commit 8ae0a13b361a11021b0d65833674f1ab97ef1fc1
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Wed Jun 10 16:38:27 2020 +0900

    boards: spresense: Change audio buffer size and mq size for wifi
    
    Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
 boards/arm/cxd56xx/spresense/configs/wifi/defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/boards/arm/cxd56xx/spresense/configs/wifi/defconfig b/boards/arm/cxd56xx/spresense/configs/wifi/defconfig
index 856f1c6..44eba94 100644
--- a/boards/arm/cxd56xx/spresense/configs/wifi/defconfig
+++ b/boards/arm/cxd56xx/spresense/configs/wifi/defconfig
@@ -23,6 +23,7 @@ CONFIG_BOOT_RUNFROMISRAM=y
 CONFIG_BUILTIN=y
 CONFIG_CLOCK_MONOTONIC=y
 CONFIG_CODECS_HASH_MD5=y
+CONFIG_CXD56_AUDIO_BUFFER_SIZE=2048
 CONFIG_CXD56_AUDIO_NUM_BUFFERS=32
 CONFIG_CXD56_BINARY=y
 CONFIG_CXD56_DMAC_SPI5_RX=y
@@ -107,7 +108,6 @@ CONFIG_NSH_WGET_USERAGENT="NuttX/7.2x.x (; http://www.nuttx.org/)"
 CONFIG_NXPLAYER_HTTP_STREAMING_SUPPORT=y
 CONFIG_NXPLAYER_MAINTHREAD_STACKSIZE=3072
 CONFIG_PATH_INITIAL="/mnt/sd0/bin"
-CONFIG_PREALLOC_MQ_MSGS=4
 CONFIG_PREALLOC_TIMERS=4
 CONFIG_PREALLOC_WDOGS=16
 CONFIG_RAM_SIZE=1572864