You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/02/24 14:45:34 UTC

[incubator-nuttx] 01/04: syslog/rpmsg: Don't overwrite up_putc

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

gnutt pushed a commit to branch pr366
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 34a4434fe68621e1119ae4860121125994bb304b
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sun Feb 23 04:47:40 2020 +0800

    syslog/rpmsg: Don't overwrite up_putc
    
    hook into syslog subsystem like ramlog approach
    
    Change-Id: I300e1f6524e89820e970edc84e12ea92c3d2ebc2
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 drivers/syslog/syslog_channel.c     | 11 ++++++++++-
 drivers/syslog/syslog_rpmsg.c       |  3 +--
 include/nuttx/syslog/syslog_rpmsg.h |  1 +
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/syslog/syslog_channel.c b/drivers/syslog/syslog_channel.c
index ea3606b..ebe2990 100644
--- a/drivers/syslog/syslog_channel.c
+++ b/drivers/syslog/syslog_channel.c
@@ -47,6 +47,8 @@
 
 #ifdef CONFIG_RAMLOG_SYSLOG
 #  include <nuttx/syslog/ramlog.h>
+#elif defined(CONFIG_SYSLOG_RPMSG)
+#  include <nuttx/syslog/syslog_rpmsg.h>
 #elif defined(CONFIG_ARCH_LOWPUTC)
 #  include <nuttx/arch.h>
 #endif
@@ -59,7 +61,7 @@
 
 #if defined(CONFIG_ARCH_LOWPUTC)
 #  define HAVE_LOWPUTC
-#elif !defined(CONFIG_RAMLOG_SYSLOG)
+#elif !defined(CONFIG_RAMLOG_SYSLOG) && !defined(CONFIG_SYSLOG_RPMSG)
 #  define NEED_LOWPUTC
 #endif
 
@@ -83,6 +85,13 @@ const struct syslog_channel_s g_default_channel =
   ramlog_putc,
   syslog_default_flush
 };
+#elif defined(CONFIG_SYSLOG_RPMSG)
+const struct syslog_channel_s g_default_channel =
+{
+  syslog_rpmsg_putc,
+  syslog_rpmsg_putc,
+  syslog_default_flush
+};
 #elif defined(HAVE_LOWPUTC)
 const struct syslog_channel_s g_default_channel =
 {
diff --git a/drivers/syslog/syslog_rpmsg.c b/drivers/syslog/syslog_rpmsg.c
index 6f6a157..7ac43d2 100644
--- a/drivers/syslog/syslog_rpmsg.c
+++ b/drivers/syslog/syslog_rpmsg.c
@@ -44,7 +44,6 @@
 #include <errno.h>
 #include <string.h>
 
-#include <nuttx/arch.h>
 #include <nuttx/irq.h>
 #include <nuttx/rptun/openamp.h>
 #include <nuttx/syslog/syslog.h>
@@ -347,7 +346,7 @@ static int syslog_rpmsg_ept_cb(FAR struct rpmsg_endpoint *ept, FAR void *data,
  * Public Functions
  ****************************************************************************/
 
-int up_putc(int ch)
+int syslog_rpmsg_putc(int ch)
 {
   FAR struct syslog_rpmsg_s *priv = &g_syslog_rpmsg;
   irqstate_t flags;
diff --git a/include/nuttx/syslog/syslog_rpmsg.h b/include/nuttx/syslog/syslog_rpmsg.h
index 8d8f2c4..33ec670 100644
--- a/include/nuttx/syslog/syslog_rpmsg.h
+++ b/include/nuttx/syslog/syslog_rpmsg.h
@@ -59,6 +59,7 @@ extern "C"
 int syslog_rpmsg_init_early(FAR const char *cpu_name, FAR void *buffer,
                             size_t size);
 int syslog_rpmsg_init(void);
+int syslog_rpmsg_putc(int ch);
 #endif
 
 #ifdef CONFIG_SYSLOG_RPMSG_SERVER