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
commit df147406db4011267c57d86f029bcfa89fdd369d Author: wangyongrong <[email protected]> AuthorDate: Thu Nov 30 18:21:21 2023 +0800 rptun_ping: decoupling rptun ping and rptun. ping is not only rptun support, so move it to public part. Signed-off-by: wangyongrong <[email protected]> --- drivers/rptun/Kconfig | 14 +++++------ drivers/rptun/rptun.h | 8 ++---- drivers/rptun/rptun_ping.c | 3 +-- drivers/rptun/{rptun.h => rptun_ping.h} | 16 ++++++------ include/nuttx/rptun/rptun.h | 11 +------- .../rptun.h => include/nuttx/rptun/rptun_ping.h | 29 ++++++++++++---------- 6 files changed, 35 insertions(+), 46 deletions(-) diff --git a/drivers/rptun/Kconfig b/drivers/rptun/Kconfig index 6124408762..10e4834389 100644 --- a/drivers/rptun/Kconfig +++ b/drivers/rptun/Kconfig @@ -10,6 +10,13 @@ menuconfig RPTUN ---help--- RPTUN driver is used for multi-cores' communication. +config RPTUN_PING + bool "rptun ping support" + default n + ---help--- + This is for debugging & profiling, create ping rpmsg + channel, user can use it to get send/recv speed & latency. + if RPTUN config RPTUN_PRIORITY @@ -38,11 +45,4 @@ config RPTUN_PM goto RAM-retention mode, can't access from another CPU. So, we provide this method to resolve this. -config RPTUN_PING - bool "rptun ping support" - default n - ---help--- - This is for rptun debugging & profiling, create ping RPMSG - channel, user can use it to get send/recv speed & latency. - endif # RPTUN diff --git a/drivers/rptun/rptun.h b/drivers/rptun/rptun.h index e890a05679..b937fabb2c 100644 --- a/drivers/rptun/rptun.h +++ b/drivers/rptun/rptun.h @@ -28,6 +28,8 @@ #include <nuttx/rptun/rptun.h> #include <openamp/open_amp.h> +#include "rptun_ping.h" + /**************************************************************************** * Public Function Prototypes ****************************************************************************/ @@ -35,10 +37,4 @@ int rptun_buffer_nused(FAR struct rpmsg_virtio_device *rvdev, bool rx); void rptun_dump(FAR struct rpmsg_virtio_device *rvdev); -int rptun_ping_init(FAR struct rpmsg_device *rvdev, - FAR struct rpmsg_endpoint *ept); -void rptun_ping_deinit(FAR struct rpmsg_endpoint *ept); -int rptun_ping(FAR struct rpmsg_endpoint *ept, - FAR const struct rptun_ping_s *ping); - #endif /* __DRIVERS_RPTUN_RPTUN_H */ diff --git a/drivers/rptun/rptun_ping.c b/drivers/rptun/rptun_ping.c index 83bfcf4260..5534e2957f 100644 --- a/drivers/rptun/rptun_ping.c +++ b/drivers/rptun/rptun_ping.c @@ -31,8 +31,7 @@ #include <time.h> #include <nuttx/signal.h> -#include "rptun.h" - +#include "rptun_ping.h" /**************************************************************************** * Pre-processor definitions ****************************************************************************/ diff --git a/drivers/rptun/rptun.h b/drivers/rptun/rptun_ping.h similarity index 85% copy from drivers/rptun/rptun.h copy to drivers/rptun/rptun_ping.h index e890a05679..9e17ee3dd3 100644 --- a/drivers/rptun/rptun.h +++ b/drivers/rptun/rptun_ping.h @@ -1,5 +1,5 @@ /**************************************************************************** - * drivers/rptun/rptun.h + * drivers/rptun/rptun_ping.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -18,27 +18,27 @@ * ****************************************************************************/ -#ifndef __DRIVERS_RPTUN_RPTUN_H -#define __DRIVERS_RPTUN_RPTUN_H +#ifndef __DRIVERS_RPTUN_RPTUN_PING_H +#define __DRIVERS_RPTUN_RPTUN_PING_H /**************************************************************************** * Included Files ****************************************************************************/ -#include <nuttx/rptun/rptun.h> +#include <nuttx/rptun/rptun_ping.h> #include <openamp/open_amp.h> +#ifdef CONFIG_RPTUN_PING + /**************************************************************************** * Public Function Prototypes ****************************************************************************/ -int rptun_buffer_nused(FAR struct rpmsg_virtio_device *rvdev, bool rx); -void rptun_dump(FAR struct rpmsg_virtio_device *rvdev); - int rptun_ping_init(FAR struct rpmsg_device *rvdev, FAR struct rpmsg_endpoint *ept); void rptun_ping_deinit(FAR struct rpmsg_endpoint *ept); int rptun_ping(FAR struct rpmsg_endpoint *ept, FAR const struct rptun_ping_s *ping); -#endif /* __DRIVERS_RPTUN_RPTUN_H */ +#endif /* CONFIG_RPTUN_PING */ +#endif /* __DRIVERS_RPTUN_RPTUN_PING_H */ diff --git a/include/nuttx/rptun/rptun.h b/include/nuttx/rptun/rptun.h index 94050e550a..e887d9b2df 100644 --- a/include/nuttx/rptun/rptun.h +++ b/include/nuttx/rptun/rptun.h @@ -30,6 +30,7 @@ #ifdef CONFIG_RPTUN #include <nuttx/fs/ioctl.h> +#include <nuttx/rptun/rptun_ping.h> #include <openamp/open_amp.h> /**************************************************************************** @@ -342,16 +343,6 @@ struct rptun_dev_s FAR const struct rptun_ops_s *ops; }; -/* used for ioctl RPTUNIOC_PING */ - -struct rptun_ping_s -{ - int times; - int len; - int ack; - int sleep; /* unit: ms */ -}; - /**************************************************************************** * Public Function Prototypes ****************************************************************************/ diff --git a/drivers/rptun/rptun.h b/include/nuttx/rptun/rptun_ping.h similarity index 69% copy from drivers/rptun/rptun.h copy to include/nuttx/rptun/rptun_ping.h index e890a05679..a47440bde3 100644 --- a/drivers/rptun/rptun.h +++ b/include/nuttx/rptun/rptun_ping.h @@ -1,5 +1,5 @@ /**************************************************************************** - * drivers/rptun/rptun.h + * include/nuttx/rptun/rptun_ping.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -18,27 +18,30 @@ * ****************************************************************************/ -#ifndef __DRIVERS_RPTUN_RPTUN_H -#define __DRIVERS_RPTUN_RPTUN_H +#ifndef __INCLUDE_NUTTX_RPTUN_RPTUN_PING_H +#define __INCLUDE_NUTTX_RPTUN_RPTUN_PING_H /**************************************************************************** * Included Files ****************************************************************************/ -#include <nuttx/rptun/rptun.h> -#include <openamp/open_amp.h> +#include <nuttx/config.h> + +#ifdef CONFIG_RPTUN_PING /**************************************************************************** * Public Function Prototypes ****************************************************************************/ -int rptun_buffer_nused(FAR struct rpmsg_virtio_device *rvdev, bool rx); -void rptun_dump(FAR struct rpmsg_virtio_device *rvdev); +/* used for ioctl RPTUNIOC_PING */ -int rptun_ping_init(FAR struct rpmsg_device *rvdev, - FAR struct rpmsg_endpoint *ept); -void rptun_ping_deinit(FAR struct rpmsg_endpoint *ept); -int rptun_ping(FAR struct rpmsg_endpoint *ept, - FAR const struct rptun_ping_s *ping); +struct rptun_ping_s +{ + int times; + int len; + int ack; + int sleep; /* unit: ms */ +}; -#endif /* __DRIVERS_RPTUN_RPTUN_H */ +#endif /* CONFIG_RPTUN_PING */ +#endif /* __INCLUDE_NUTTX_RPTUN_RPTUN_PING_H */
