diff --git a/drivers/rpmsg/rpmsg.c b/drivers/rpmsg/rpmsg.c index ae2f786019e..58bc6744e84 100644 --- a/drivers/rpmsg/rpmsg.c +++ b/drivers/rpmsg/rpmsg.c @@ -31,8 +31,8 @@ #include #include #include -#include +#include "rpmsg.h" #include "rpmsg_ping.h" #include "rpmsg_router.h" #include "rpmsg_test.h" diff --git a/drivers/rpmsg/rpmsg.h b/drivers/rpmsg/rpmsg.h new file mode 100644 index 00000000000..0fad854e42b --- /dev/null +++ b/drivers/rpmsg/rpmsg.h @@ -0,0 +1,63 @@ +/**************************************************************************** + * drivers/rpmsg/rpmsg.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __DRIVERS_RPMSG_RPMSG_H +#define __DRIVERS_RPMSG_RPMSG_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#ifdef CONFIG_RPMSG + +#include + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +static inline FAR struct rpmsg_device * +rpmsg_get_rdev_by_rpmsg(FAR struct rpmsg_s *rpmsg) +{ + if (!rpmsg) + { + return NULL; + } + + return (FAR struct rpmsg_device *)(rpmsg + 1); +} + +void rpmsg_modify_signals(FAR struct rpmsg_s *rpmsg, + int setflags, int clrflags); + +void rpmsg_ns_bind(FAR struct rpmsg_device *rdev, + FAR const char *name, uint32_t dest); +void rpmsg_ns_unbind(FAR struct rpmsg_device *rdev, + FAR const char *name, uint32_t dest); + +void rpmsg_device_created(FAR struct rpmsg_s *rpmsg); +void rpmsg_device_destory(FAR struct rpmsg_s *rpmsg); + +int rpmsg_register(FAR const char *path, FAR struct rpmsg_s *rpmsg, + FAR const struct rpmsg_ops_s *ops); +void rpmsg_unregister(FAR const char *path, FAR struct rpmsg_s *rpmsg); + +#endif /* CONFIG_RPMSG */ +#endif /* __DRIVERS_RPMSG_RPMSG_H */ diff --git a/drivers/rpmsg/rpmsg_port.h b/drivers/rpmsg/rpmsg_port.h index 94d514982ab..0245c2c1c1c 100644 --- a/drivers/rpmsg/rpmsg_port.h +++ b/drivers/rpmsg/rpmsg_port.h @@ -32,9 +32,10 @@ #include #include #include -#include #include +#include "rpmsg.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ diff --git a/drivers/rpmsg/rpmsg_router.h b/drivers/rpmsg/rpmsg_router.h index cb799cd253b..dc80617ab53 100644 --- a/drivers/rpmsg/rpmsg_router.h +++ b/drivers/rpmsg/rpmsg_router.h @@ -27,7 +27,7 @@ * Included Files ****************************************************************************/ -#include +#include "rpmsg.h" /**************************************************************************** * Pre-processor Definitions diff --git a/drivers/rpmsg/rpmsg_virtio.c b/drivers/rpmsg/rpmsg_virtio.c index 66a44fe0840..2983d624b1f 100644 --- a/drivers/rpmsg/rpmsg_virtio.c +++ b/drivers/rpmsg/rpmsg_virtio.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -40,6 +39,8 @@ #include #include +#include "rpmsg.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ diff --git a/drivers/rpmsg/rpmsg_virtio_lite.c b/drivers/rpmsg/rpmsg_virtio_lite.c index 65bf52a59e6..4f08432c46f 100644 --- a/drivers/rpmsg/rpmsg_virtio_lite.c +++ b/drivers/rpmsg/rpmsg_virtio_lite.c @@ -38,6 +38,8 @@ #include #include +#include "rpmsg.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ diff --git a/include/nuttx/rpmsg/rpmsg.h b/include/nuttx/rpmsg/rpmsg.h index 86d11f195b0..08ef10da8c6 100644 --- a/include/nuttx/rpmsg/rpmsg.h +++ b/include/nuttx/rpmsg/rpmsg.h @@ -107,25 +107,12 @@ extern "C" #define EXTERN extern #endif -static inline FAR struct rpmsg_device * -rpmsg_get_rdev_by_rpmsg(FAR struct rpmsg_s *rpmsg) -{ - if (!rpmsg) - { - return NULL; - } - - return (FAR struct rpmsg_device *)(rpmsg + 1); -} - int rpmsg_wait(FAR struct rpmsg_endpoint *ept, FAR sem_t *sem); int rpmsg_post(FAR struct rpmsg_endpoint *ept, FAR sem_t *sem); FAR const char *rpmsg_get_local_cpuname(FAR struct rpmsg_device *rdev); FAR const char *rpmsg_get_cpuname(FAR struct rpmsg_device *rdev); int rpmsg_get_signals(FAR struct rpmsg_device *rdev); -void rpmsg_modify_signals(FAR struct rpmsg_s *rpmsg, - int setflags, int clrflags); static inline_function bool rpmsg_is_running(FAR struct rpmsg_device *rdev) { @@ -143,18 +130,6 @@ void rpmsg_unregister_callback(FAR void *priv, rpmsg_match_cb_t ns_match, rpmsg_bind_cb_t ns_bind); -void rpmsg_ns_bind(FAR struct rpmsg_device *rdev, - FAR const char *name, uint32_t dest); -void rpmsg_ns_unbind(FAR struct rpmsg_device *rdev, - FAR const char *name, uint32_t dest); - -void rpmsg_device_created(FAR struct rpmsg_s *rpmsg); -void rpmsg_device_destory(FAR struct rpmsg_s *rpmsg); - -int rpmsg_register(FAR const char *path, FAR struct rpmsg_s *rpmsg, - FAR const struct rpmsg_ops_s *ops); -void rpmsg_unregister(FAR const char *path, FAR struct rpmsg_s *rpmsg); - int rpmsg_ioctl(FAR const char *cpuname, int cmd, unsigned long arg); int rpmsg_panic(FAR const char *cpuname); void rpmsg_dump_all(void);