driver/syslog: support syslog output when buffer remaining space over 75%

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
Jiuzhu Dong 2022-06-24 18:32:04 +08:00 committed by Xiang Xiao
parent 664fcb2698
commit 059114557f

View File

@ -44,7 +44,11 @@
* Pre-processor definitions * Pre-processor definitions
****************************************************************************/ ****************************************************************************/
#if CONFIG_SYSLOG_RPMSG_WORK_DELAY
# define SYSLOG_RPMSG_WORK_DELAY MSEC2TICK(CONFIG_SYSLOG_RPMSG_WORK_DELAY) # define SYSLOG_RPMSG_WORK_DELAY MSEC2TICK(CONFIG_SYSLOG_RPMSG_WORK_DELAY)
#else
# define SYSLOG_RPMSG_WORK_DELAY MSEC2TICK(100)
#endif
#define SYSLOG_RPMSG_COUNT(p) ((p)->head - (p)->tail) #define SYSLOG_RPMSG_COUNT(p) ((p)->head - (p)->tail)
#define SYSLOG_RPMSG_SPACE(p) ((p)->size - 1 - SYSLOG_RPMSG_COUNT(p)) #define SYSLOG_RPMSG_SPACE(p) ((p)->size - 1 - SYSLOG_RPMSG_COUNT(p))
@ -234,10 +238,16 @@ static void syslog_rpmsg_putchar(FAR struct syslog_rpmsg_s *priv, int ch,
/* Start work immediately when data more then 75% and meet '\n' */ /* Start work immediately when data more then 75% and meet '\n' */
if (space < priv->size / 4 && ch == '\n') if (space < priv->size / 4)
{ {
delay = 0; delay = 0;
} }
#if CONFIG_SYSLOG_RPMSG_WORK_DELAY == 0
else
{
return;
}
#endif
work_queue(HPWORK, &priv->work, syslog_rpmsg_work, priv, delay); work_queue(HPWORK, &priv->work, syslog_rpmsg_work, priv, delay);
} }
@ -259,8 +269,7 @@ static void syslog_rpmsg_device_created(FAR struct rpmsg_device *rdev,
syslog_rpmsg_ept_cb, NULL); syslog_rpmsg_ept_cb, NULL);
if (ret == 0) if (ret == 0)
{ {
work_queue(HPWORK, &priv->work, work_queue(HPWORK, &priv->work, syslog_rpmsg_work, priv, 0);
syslog_rpmsg_work, priv, SYSLOG_RPMSG_WORK_DELAY);
} }
} }
} }
@ -292,8 +301,7 @@ static int syslog_rpmsg_ept_cb(FAR struct rpmsg_endpoint *ept,
else if (header->command == SYSLOG_RPMSG_RESUME) else if (header->command == SYSLOG_RPMSG_RESUME)
{ {
priv->suspend = false; priv->suspend = false;
work_queue(HPWORK, &priv->work, work_queue(HPWORK, &priv->work, syslog_rpmsg_work, priv, 0);
syslog_rpmsg_work, priv, SYSLOG_RPMSG_WORK_DELAY);
} }
else if (header->command == SYSLOG_RPMSG_TRANSFER_DONE) else if (header->command == SYSLOG_RPMSG_TRANSFER_DONE)
{ {