syslog/rpmsg: Don't overwrite up_putc

Hook into syslog subsystem like ramlog approach
This commit is contained in:
Xiang Xiao 2020-02-23 04:47:40 +08:00 committed by Gregory Nutt
parent b9b86fcc63
commit 46e22d7fd9
3 changed files with 12 additions and 3 deletions

View File

@ -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 =
{

View File

@ -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;

View File

@ -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