You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/12/17 17:43:13 UTC
[incubator-nuttx] branch master updated (9a53601 -> f35c6d7)
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.
from 9a53601 sched:add holder in sem_trywait Avoid priority rollover
new 5a22d33 up_putc: do up_putc when enable CONFIG_ARCH_LOWPUTC
new f35c6d7 syslog/rpmsg: using up_putc to force flush syslog_rpmsg buffer
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
arch/sim/src/sim/up_uart.c | 4 ++--
drivers/syslog/syslog_rpmsg.c | 43 ++++++++++++++++++++++++++++++++-----------
2 files changed, 34 insertions(+), 13 deletions(-)
[incubator-nuttx] 01/02: up_putc: do up_putc when enable CONFIG_ARCH_LOWPUTC
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 5a22d3347515c9c6b1164b5c199023c999cf7969
Author: Jiuzhu Dong <do...@xiaomi.com>
AuthorDate: Tue Dec 14 11:52:25 2021 +0800
up_putc: do up_putc when enable CONFIG_ARCH_LOWPUTC
Signed-off-by: Jiuzhu Dong <do...@xiaomi.com>
---
arch/sim/src/sim/up_uart.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/sim/src/sim/up_uart.c b/arch/sim/src/sim/up_uart.c
index ea13005..61f7ca7 100644
--- a/arch/sim/src/sim/up_uart.c
+++ b/arch/sim/src/sim/up_uart.c
@@ -573,10 +573,10 @@ void up_uartloop(void)
* Name: up_putc
****************************************************************************/
-#ifdef USE_DEVCONSOLE
int up_putc(int ch)
{
+#ifdef USE_DEVCONSOLE
tty_send(&g_console_dev, ch);
+#endif
return 0;
}
-#endif
[incubator-nuttx] 02/02: syslog/rpmsg: using up_putc to force flush syslog_rpmsg buffer
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit f35c6d7ef12a49fe168f41b44c8b450ed6eb6d9e
Author: Jiuzhu Dong <do...@xiaomi.com>
AuthorDate: Mon Dec 13 21:37:02 2021 +0800
syslog/rpmsg: using up_putc to force flush syslog_rpmsg buffer
Signed-off-by: Jiuzhu Dong <do...@xiaomi.com>
---
drivers/syslog/syslog_rpmsg.c | 43 ++++++++++++++++++++++++++++++++-----------
1 file changed, 32 insertions(+), 11 deletions(-)
diff --git a/drivers/syslog/syslog_rpmsg.c b/drivers/syslog/syslog_rpmsg.c
index a419f82..6399b47 100644
--- a/drivers/syslog/syslog_rpmsg.c
+++ b/drivers/syslog/syslog_rpmsg.c
@@ -28,6 +28,10 @@
#include <errno.h>
#include <string.h>
+#ifdef CONFIG_ARCH_LOWPUTC
+#include <nuttx/arch.h>
+#endif
+
#include <nuttx/irq.h>
#include <nuttx/rptun/openamp.h>
#include <nuttx/syslog/syslog.h>
@@ -53,16 +57,17 @@
struct syslog_rpmsg_s
{
- volatile size_t head; /* The head index (where data is added) */
- volatile size_t tail; /* The tail index (where data is removed) */
- size_t size; /* Size of the RAM buffer */
- FAR char *buffer; /* Circular RAM buffer */
- struct work_s work; /* Used for deferred callback work */
+ volatile size_t head; /* The head index (where data is added) */
+ volatile size_t tail; /* The tail index (where data is removed) */
+ volatile size_t flush; /* The tail index of flush (where data is removed) */
+ size_t size; /* Size of the RAM buffer */
+ FAR char *buffer; /* Circular RAM buffer */
+ struct work_s work; /* Used for deferred callback work */
struct rpmsg_endpoint ept;
bool suspend;
- bool transfer; /* The transfer flag */
- ssize_t trans_len; /* The data length when transfer */
+ bool transfer; /* The transfer flag */
+ ssize_t trans_len; /* The data length when transfer */
sem_t sem;
};
@@ -333,11 +338,27 @@ int syslog_rpmsg_putc(FAR struct syslog_channel_s *channel, int ch)
int syslog_rpmsg_flush(FAR struct syslog_channel_s *channel)
{
+#if defined(CONFIG_ARCH_LOWPUTC)
+ FAR struct syslog_rpmsg_s *priv = &g_syslog_rpmsg;
+ irqstate_t flags;
+
UNUSED(channel);
- FAR struct syslog_rpmsg_s *priv = &g_syslog_rpmsg;
+ flags = enter_critical_section();
+
+ if (priv->head - priv->flush > priv->size)
+ {
+ priv->flush = priv->tail;
+ }
+
+ while (priv->flush < priv->head)
+ {
+ up_putc(priv->buffer[priv->flush++ % priv->size]);
+ }
+
+ leave_critical_section(flags);
+#endif
- work_queue(HPWORK, &priv->work, syslog_rpmsg_work, priv, 0);
return OK;
}
@@ -371,8 +392,8 @@ void syslog_rpmsg_init_early(FAR void *buffer, size_t size)
nxsem_init(&priv->sem, 0, 0);
nxsem_set_protocol(&priv->sem, SEM_PRIO_NONE);
- priv->buffer = buffer;
- priv->size = size;
+ priv->buffer = buffer;
+ priv->size = size;
prev = priv->buffer[size - 1];