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

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


The following commit(s) were added to refs/heads/master by this push:
     new 5bf3110777 arch/sim/sim_canchar.c: notify upper-half driver that tx 
done
5bf3110777 is described below

commit 5bf311077700d9297f832788f8ea66327d0460aa
Author: p-szafonimateusz <p-szafonimate...@xiaomi.com>
AuthorDate: Tue May 13 18:38:32 2025 +0200

    arch/sim/sim_canchar.c: notify upper-half driver that tx done
    
    add missing can_txdone() callback after message is send
    
    Signed-off-by: p-szafonimateusz <p-szafonimate...@xiaomi.com>
---
 arch/sim/src/sim/sim_canchar.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/sim/src/sim/sim_canchar.c b/arch/sim/src/sim/sim_canchar.c
index 7612aabd8e..ef30e49664 100644
--- a/arch/sim/src/sim/sim_canchar.c
+++ b/arch/sim/src/sim/sim_canchar.c
@@ -180,6 +180,7 @@ static int sim_can_remoterequest(struct can_dev_s *dev, 
uint16_t id)
 static int sim_can_send(struct can_dev_s *dev, struct can_msg_s *msg)
 {
   struct sim_canchar_s *priv = dev->cd_priv;
+  int ret;
 
   if (!msg->cm_hdr.ch_edl)
     {
@@ -204,7 +205,7 @@ static int sim_can_send(struct can_dev_s *dev, struct 
can_msg_s *msg)
 
       memcpy(frame.data, msg->cm_data, frame.can_dlc);
 
-      return host_can_send(&priv->host, &frame, sizeof(struct can_frame));
+      ret = host_can_send(&priv->host, &frame, sizeof(struct can_frame));
     }
   else
     {
@@ -240,8 +241,17 @@ static int sim_can_send(struct can_dev_s *dev, struct 
can_msg_s *msg)
 
       memcpy(frame.data, msg->cm_data, frame.len);
 
-      return host_can_send(&priv->host, &frame, sizeof(struct canfd_frame));
+      ret = host_can_send(&priv->host, &frame, sizeof(struct canfd_frame));
+    }
+
+  if (ret > 0)
+    {
+      /* Tell the upper half that the transfer is finished. */
+
+      can_txdone(dev);
     }
+
+  return ret;
 }
 
 /****************************************************************************

Reply via email to