arch: Add up_nputs function to handle the non '\0' string correctly

and change up_puts as a simple macro

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2022-07-14 11:22:50 +08:00
committed by Petro Karashchenko
parent 02ea79365a
commit aad5fbd2fb
42 changed files with 247 additions and 266 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c up_syst
CMN_CSRCS += up_createstack.c up_doirq.c up_exit.c up_idle.c up_initialize.c
CMN_CSRCS += up_initialstate.c up_irq.c up_lowputs.c
CMN_CSRCS += up_mdelay.c up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c
CMN_CSRCS += up_puts.c up_releasepending.c up_releasestack.c
CMN_CSRCS += up_nputs.c up_releasepending.c up_releasestack.c
CMN_CSRCS += up_reprioritizertr.c up_schedulesigaction.c up_sigdeliver.c
CMN_CSRCS += up_stackframe.c up_swint1.c up_udelay.c up_unblocktask.c up_usestack.c
+1 -1
View File
@@ -29,7 +29,7 @@ CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c
CMN_CSRCS += up_createstack.c up_doirq.c up_exit.c up_idle.c up_initialize.c
CMN_CSRCS += up_initialstate.c up_irq.c up_lowputs.c
CMN_CSRCS += up_mdelay.c up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c
CMN_CSRCS += up_puts.c up_releasepending.c up_releasestack.c
CMN_CSRCS += up_nputs.c up_releasepending.c up_releasestack.c
CMN_CSRCS += up_reprioritizertr.c up_schedulesigaction.c up_sigdeliver.c
CMN_CSRCS += up_stackframe.c up_swint1.c up_udelay.c up_unblocktask.c up_usestack.c
@@ -1,5 +1,5 @@
/****************************************************************************
* arch/sparc/src/common/up_puts.c
* arch/sparc/src/common/up_nputs.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -25,8 +25,6 @@
#include <nuttx/config.h>
#include <nuttx/arch.h>
#include "up_internal.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -44,18 +42,17 @@
****************************************************************************/
/****************************************************************************
* Name: up_puts
* Name: up_nputs
*
* Description:
* This is a low-level helper function used to support debug.
*
****************************************************************************/
void up_puts(const char *str)
void up_nputs(const char *str, size_t len)
{
while (*str)
while (*str && len-- > 0)
{
up_putc(*str++);
}
}