diff --git a/drivers/syslog/syslog_channel.c b/drivers/syslog/syslog_channel.c index 381c02b87e..c731aae951 100644 --- a/drivers/syslog/syslog_channel.c +++ b/drivers/syslog/syslog_channel.c @@ -90,7 +90,8 @@ static const struct syslog_channel_s g_default_channel = { syslog_rpmsg_putc, syslog_rpmsg_putc, - syslog_default_flush + syslog_rpmsg_flush, + syslog_rpmsg_write }; #elif defined(HAVE_LOWPUTC) static const struct syslog_channel_s g_default_channel = diff --git a/drivers/syslog/syslog_rpmsg.c b/drivers/syslog/syslog_rpmsg.c index cec7f30a4d..2d325f1b7d 100644 --- a/drivers/syslog/syslog_rpmsg.c +++ b/drivers/syslog/syslog_rpmsg.c @@ -90,8 +90,6 @@ struct syslog_rpmsg_s static void syslog_rpmsg_work(FAR void *priv_); static void syslog_rpmsg_putchar(FAR struct syslog_rpmsg_s *priv, int ch, bool last); -static int syslog_rpmsg_flush(void); -static ssize_t syslog_rpmsg_write(FAR const char *buffer, size_t buflen); static void syslog_rpmsg_device_created(FAR struct rpmsg_device *rdev, FAR void *priv_); static void syslog_rpmsg_device_destroy(FAR struct rpmsg_device *rdev, @@ -220,31 +218,6 @@ static void syslog_rpmsg_putchar(FAR struct syslog_rpmsg_s *priv, int ch, } } -static int syslog_rpmsg_flush(void) -{ - FAR struct syslog_rpmsg_s *priv = &g_syslog_rpmsg; - - work_queue(HPWORK, &priv->work, syslog_rpmsg_work, priv, 0); - return OK; -} - -static ssize_t syslog_rpmsg_write(FAR const char *buffer, size_t buflen) -{ - FAR struct syslog_rpmsg_s *priv = &g_syslog_rpmsg; - irqstate_t flags; - size_t nwritten; - - flags = enter_critical_section(); - for (nwritten = 1; nwritten <= buflen; nwritten++) - { - syslog_rpmsg_putchar(priv, *buffer++, nwritten == buflen); - } - - leave_critical_section(flags); - - return buflen; -} - static void syslog_rpmsg_device_created(FAR struct rpmsg_device *rdev, FAR void *priv_) { @@ -352,6 +325,31 @@ int syslog_rpmsg_putc(int ch) return ch; } +int syslog_rpmsg_flush(void) +{ + FAR struct syslog_rpmsg_s *priv = &g_syslog_rpmsg; + + work_queue(HPWORK, &priv->work, syslog_rpmsg_work, priv, 0); + return OK; +} + +ssize_t syslog_rpmsg_write(FAR const char *buffer, size_t buflen) +{ + FAR struct syslog_rpmsg_s *priv = &g_syslog_rpmsg; + irqstate_t flags; + size_t nwritten; + + flags = enter_critical_section(); + for (nwritten = 1; nwritten <= buflen; nwritten++) + { + syslog_rpmsg_putchar(priv, *buffer++, nwritten == buflen); + } + + leave_critical_section(flags); + + return buflen; +} + void syslog_rpmsg_init_early(FAR const char *cpuname, FAR void *buffer, size_t size) { diff --git a/include/nuttx/syslog/syslog_rpmsg.h b/include/nuttx/syslog/syslog_rpmsg.h index ac762f6985..7d0910c322 100644 --- a/include/nuttx/syslog/syslog_rpmsg.h +++ b/include/nuttx/syslog/syslog_rpmsg.h @@ -59,7 +59,10 @@ extern "C" void 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); +int syslog_rpmsg_flush(void); +ssize_t syslog_rpmsg_write(FAR const char *buffer, size_t buflen); #endif #ifdef CONFIG_SYSLOG_RPMSG_SERVER