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:28 UTC

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

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;
+                }
+            }
         }
     }