driver/syslog: add config SYSLOG_RPMSG_SERVER_NAME to

N/A

specified the name of remote proc(rpmsg server)

Change-Id: Ie270d651071e87a40a80ab489597ae18db9814f0
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
Jiuzhu Dong 2021-04-22 22:36:01 +08:00 committed by Alan Carvalho de Assis
parent beed26b6bf
commit ff567124d3
5 changed files with 15 additions and 9 deletions

View File

@ -63,7 +63,7 @@ static char g_logbuffer[4096];
int main(int argc, char **argv, char **envp)
{
#ifdef CONFIG_SYSLOG_RPMSG
syslog_rpmsg_init_early("server", g_logbuffer, sizeof(g_logbuffer));
syslog_rpmsg_init_early(g_logbuffer, sizeof(g_logbuffer));
#endif
/* Start NuttX */

View File

@ -59,6 +59,7 @@ CONFIG_SIM_M32=y
CONFIG_SYSLOG_PREFIX=y
CONFIG_SYSLOG_PREFIX_STRING="proxy: "
CONFIG_SYSLOG_RPMSG=y
CONFIG_SYSLOG_RPMSG_SERVER_NAME="server"
CONFIG_SYSLOG_TIMESTAMP=y
CONFIG_SYSTEM_CLE=y
CONFIG_SYSTEM_NSH=y

View File

@ -215,6 +215,13 @@ config SYSLOG_RPMSG
---help---
Use the rpmsg as a SYSLOG output device, send message to remote proc.
config SYSLOG_RPMSG_SERVER_NAME
string "The name of Syslog Rpmsg Server"
depends on SYSLOG_RPMSG
---help---
The proc name of rpmsg server. Client sends message to
specified name of remote proc.
config SYSLOG_DEFAULT
bool "Default SYSLOG device"
---help---

View File

@ -62,7 +62,6 @@ struct syslog_rpmsg_s
struct work_s work; /* Used for deferred callback work */
struct rpmsg_endpoint ept;
FAR const char *cpuname;
bool suspend;
bool transfer; /* The transfer flag */
ssize_t trans_len; /* The data length when transfer */
@ -210,7 +209,8 @@ static void syslog_rpmsg_device_created(FAR struct rpmsg_device *rdev,
FAR struct syslog_rpmsg_s *priv = priv_;
int ret;
if (priv->buffer && strcmp(priv->cpuname, rpmsg_get_cpuname(rdev)) == 0)
if (priv->buffer && strcmp(CONFIG_SYSLOG_RPMSG_SERVER_NAME,
rpmsg_get_cpuname(rdev)) == 0)
{
priv->ept.priv = priv;
@ -230,7 +230,8 @@ static void syslog_rpmsg_device_destroy(FAR struct rpmsg_device *rdev,
{
FAR struct syslog_rpmsg_s *priv = priv_;
if (priv->buffer && strcmp(priv->cpuname, rpmsg_get_cpuname(rdev)) == 0)
if (priv->buffer && strcmp(CONFIG_SYSLOG_RPMSG_SERVER_NAME,
rpmsg_get_cpuname(rdev)) == 0)
{
rpmsg_destroy_ept(&priv->ept);
}
@ -343,15 +344,13 @@ ssize_t syslog_rpmsg_write(FAR struct syslog_channel_s *channel,
return buflen;
}
void syslog_rpmsg_init_early(FAR const char *cpuname, FAR void *buffer,
size_t size)
void syslog_rpmsg_init_early(FAR void *buffer, size_t size)
{
FAR struct syslog_rpmsg_s *priv = &g_syslog_rpmsg;
char prev, cur;
size_t i;
size_t j;
priv->cpuname = cpuname;
priv->buffer = buffer;
priv->size = size;

View File

@ -40,8 +40,7 @@ extern "C"
#endif
#ifdef CONFIG_SYSLOG_RPMSG
void syslog_rpmsg_init_early(FAR const char *cpu_name, FAR void *buffer,
size_t size);
void syslog_rpmsg_init_early(FAR void *buffer, size_t size);
int syslog_rpmsg_init(void);
int syslog_rpmsg_putc(FAR struct syslog_channel_s *channel, int ch);