You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/07/27 12:36:59 UTC

[incubator-nuttx] 02/06: rptun_ping: add sleep param to rptun_ping

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/incubator-nuttx.git

commit a014a19f0e67f209bb162add6837387683911c3a
Author: ligd <li...@xiaomi.com>
AuthorDate: Wed May 11 12:20:54 2022 +0800

    rptun_ping: add sleep param to rptun_ping
    
    Signed-off-by: ligd <li...@xiaomi.com>
---
 drivers/rptun/rptun_ping.c  | 2 ++
 include/nuttx/rptun/rptun.h | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/rptun/rptun_ping.c b/drivers/rptun/rptun_ping.c
index 60055cef37..76ab8c59c0 100644
--- a/drivers/rptun/rptun_ping.c
+++ b/drivers/rptun/rptun_ping.c
@@ -161,6 +161,8 @@ int rptun_ping(FAR struct rpmsg_endpoint *ept,
       min    = MIN(min, tm);
       max    = MAX(max, tm);
       total += tm;
+
+      usleep(ping->sleep * USEC_PER_MSEC);
     }
 
   syslog(LOG_INFO, "current CPU freq: %" PRIu32 ", ping times: %d\n",
diff --git a/include/nuttx/rptun/rptun.h b/include/nuttx/rptun/rptun.h
index 2405ebe023..6d17377909 100644
--- a/include/nuttx/rptun/rptun.h
+++ b/include/nuttx/rptun/rptun.h
@@ -349,6 +349,7 @@ struct rptun_ping_s
   int  times;
   int  len;
   bool ack;
+  int  sleep; /* unit: ms */
 };
 
 /****************************************************************************