This is an automated email from the ASF dual-hosted git repository. pkarashchenko pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit aad5fbd2fb2bf6ce73c00cd36f00805731cc3cd5 Author: Xiang Xiao <[email protected]> AuthorDate: Thu Jul 14 11:22:50 2022 +0800 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 <[email protected]> --- arch/arm/src/common/Make.defs | 2 +- .../up_puts.c => arm/src/common/arm_nputs.c} | 10 ++-- arch/arm/src/common/arm_semi_syslog.c | 18 +++++-- arch/avr/src/at32uc3/Make.defs | 2 +- arch/avr/src/at90usb/Make.defs | 2 +- arch/avr/src/atmega/Make.defs | 2 +- .../common/up_puts.c => avr/src/common/up_nputs.c} | 10 ++-- .../arm_puts.c => ceva/src/common/up_nputs.c} | 10 ++-- .../common/up_puts.c => hc/src/common/up_nputs.c} | 10 ++-- arch/hc/src/m9s12/Make.defs | 2 +- arch/mips/src/common/{mips_puts.c => mips_nputs.c} | 10 ++-- arch/mips/src/pic32mx/Make.defs | 2 +- arch/mips/src/pic32mz/Make.defs | 2 +- .../xtensa_puts.c => or1k/src/common/up_nputs.c} | 10 ++-- arch/or1k/src/mor1kx/Make.defs | 2 +- .../up_puts.c => renesas/src/common/up_nputs.c} | 10 ++-- arch/renesas/src/m16c/Make.defs | 2 +- arch/renesas/src/rx65n/Make.defs | 2 +- arch/renesas/src/sh1/Make.defs | 2 +- arch/risc-v/src/common/Make.defs | 2 +- .../up_puts.c => risc-v/src/common/riscv_nputs.c} | 10 ++-- arch/sim/src/Makefile | 2 +- arch/sim/src/sim/{up_puts.c => up_nputs.c} | 10 ++-- arch/sparc/src/bm3803/Make.defs | 2 +- arch/sparc/src/bm3823/Make.defs | 2 +- .../up_puts.c => sparc/src/common/up_nputs.c} | 10 ++-- .../common/up_puts.c => x86/src/common/up_nputs.c} | 11 ++-- arch/x86/src/qemu/Make.defs | 2 +- .../up_puts.c => x86_64/src/common/up_nputs.c} | 10 ++-- arch/x86_64/src/common/up_puts.c | 60 ---------------------- arch/x86_64/src/intel64/Make.defs | 2 +- arch/xtensa/src/common/Make.defs | 2 +- .../src/common/xtensa_nputs.c} | 10 ++-- .../up_puts.c => z16/src/common/z16_nputs.c} | 8 +-- arch/z16/src/common/z16_puts.c | 46 ----------------- arch/z16/src/z16f/Make.defs | 2 +- .../up_puts.c => z80/src/common/z80_nputs.c} | 11 ++-- arch/z80/src/common/z80_puts.c | 60 ---------------------- arch/z80/src/ez80/Make.defs | 2 +- arch/z80/src/z180/Make.defs | 2 +- arch/z80/src/z8/Make.defs | 2 +- include/nuttx/arch.h | 3 +- 42 files changed, 97 insertions(+), 284 deletions(-) diff --git a/arch/arm/src/common/Make.defs b/arch/arm/src/common/Make.defs index ccf8dfb063..df5340234c 100644 --- a/arch/arm/src/common/Make.defs +++ b/arch/arm/src/common/Make.defs @@ -24,7 +24,7 @@ CMN_CSRCS += arm_allocateheap.c arm_assert.c arm_blocktask.c CMN_CSRCS += arm_createstack.c arm_exit.c arm_fullcontextrestore.c CMN_CSRCS += arm_initialize.c arm_lowputs.c CMN_CSRCS += arm_modifyreg16.c arm_modifyreg32.c -CMN_CSRCS += arm_modifyreg8.c arm_puts.c arm_releasepending.c +CMN_CSRCS += arm_modifyreg8.c arm_nputs.c arm_releasepending.c CMN_CSRCS += arm_releasestack.c arm_reprioritizertr.c arm_saveusercontext.c CMN_CSRCS += arm_stackframe.c arm_switchcontext.c CMN_CSRCS += arm_vfork.c arm_unblocktask.c arm_usestack.c diff --git a/arch/or1k/src/common/up_puts.c b/arch/arm/src/common/arm_nputs.c similarity index 92% copy from arch/or1k/src/common/up_puts.c copy to arch/arm/src/common/arm_nputs.c index 0b27632fb7..316ef260d3 100644 --- a/arch/or1k/src/common/up_puts.c +++ b/arch/arm/src/common/arm_nputs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/or1k/src/common/up_puts.c + * arch/arm/src/common/arm_nputs.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -25,23 +25,21 @@ #include <nuttx/config.h> #include <nuttx/arch.h> -#include "up_internal.h" - /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** - * 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++); } diff --git a/arch/arm/src/common/arm_semi_syslog.c b/arch/arm/src/common/arm_semi_syslog.c index 36f6477ec9..43562db01d 100644 --- a/arch/arm/src/common/arm_semi_syslog.c +++ b/arch/arm/src/common/arm_semi_syslog.c @@ -27,8 +27,6 @@ #include <syscall.h> -#include "arm_internal.h" - #ifdef CONFIG_ARM_SEMIHOSTING_SYSLOG /**************************************************************************** @@ -54,15 +52,25 @@ int up_putc(int ch) } /**************************************************************************** - * Name: up_puts + * Name: up_nputs * * Description: * Output a string on the console * ****************************************************************************/ -void up_puts(const char *str) +void up_nputs(const char *str, size_t len) { - smh_call(SEMI_SYSLOG_WRITE0, (char *)str); + if (len == ~((size_t)0)) + { + smh_call(SEMI_SYSLOG_WRITE0, (char *)str); + } + else + { + while (len-- > 0) + { + up_putc(*str++); + } + } } #endif diff --git a/arch/avr/src/at32uc3/Make.defs b/arch/avr/src/at32uc3/Make.defs index a353fc255d..f697097f30 100644 --- a/arch/avr/src/at32uc3/Make.defs +++ b/arch/avr/src/at32uc3/Make.defs @@ -31,7 +31,7 @@ CMN_CSRCS += up_initialize.c up_initialstate.c CMN_CSRCS += up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c CMN_CSRCS += up_releasepending.c up_releasestack.c up_reprioritizertr.c CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c up_stackframe.c -CMN_CSRCS += up_unblocktask.c up_usestack.c up_doirq.c up_puts.c +CMN_CSRCS += up_unblocktask.c up_usestack.c up_doirq.c up_nputs.c # Configuration-dependent common files diff --git a/arch/avr/src/at90usb/Make.defs b/arch/avr/src/at90usb/Make.defs index 5e903b4298..ecc0bfc7ad 100644 --- a/arch/avr/src/at90usb/Make.defs +++ b/arch/avr/src/at90usb/Make.defs @@ -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_udelay.c up_unblocktask.c up_usestack.c diff --git a/arch/avr/src/atmega/Make.defs b/arch/avr/src/atmega/Make.defs index 85c8ed1819..52e9c0b711 100644 --- a/arch/avr/src/atmega/Make.defs +++ b/arch/avr/src/atmega/Make.defs @@ -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_udelay.c up_unblocktask.c up_usestack.c diff --git a/arch/x86/src/common/up_puts.c b/arch/avr/src/common/up_nputs.c similarity index 94% rename from arch/x86/src/common/up_puts.c rename to arch/avr/src/common/up_nputs.c index cb21fed40a..2c1e0c7667 100644 --- a/arch/x86/src/common/up_puts.c +++ b/arch/avr/src/common/up_nputs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/x86/src/common/up_puts.c + * arch/avr/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,16 +42,16 @@ ****************************************************************************/ /**************************************************************************** - * 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++); } diff --git a/arch/arm/src/common/arm_puts.c b/arch/ceva/src/common/up_nputs.c similarity index 92% rename from arch/arm/src/common/arm_puts.c rename to arch/ceva/src/common/up_nputs.c index c7a79c0f3c..e2e18a5d78 100644 --- a/arch/arm/src/common/arm_puts.c +++ b/arch/ceva/src/common/up_nputs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/common/arm_puts.c + * arch/ceva/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,23 +25,21 @@ #include <nuttx/config.h> #include <nuttx/arch.h> -#include "arm_internal.h" - /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** - * 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++); } diff --git a/arch/avr/src/common/up_puts.c b/arch/hc/src/common/up_nputs.c similarity index 94% copy from arch/avr/src/common/up_puts.c copy to arch/hc/src/common/up_nputs.c index eb57132d53..564b3d2ff2 100644 --- a/arch/avr/src/common/up_puts.c +++ b/arch/hc/src/common/up_nputs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/avr/src/common/up_puts.c + * arch/hc/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,16 +42,16 @@ ****************************************************************************/ /**************************************************************************** - * 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++); } diff --git a/arch/hc/src/m9s12/Make.defs b/arch/hc/src/m9s12/Make.defs index 432e75e582..f9a6a79d99 100644 --- a/arch/hc/src/m9s12/Make.defs +++ b/arch/hc/src/m9s12/Make.defs @@ -23,7 +23,7 @@ HEAD_ASRC = m9s12_vectors.S CMN_CSRCS = up_allocateheap.c up_blocktask.c up_copystate.c up_createstack.c CMN_CSRCS += up_doirq.c up_exit.c up_idle.c up_initialize.c CMN_CSRCS += up_mdelay.c up_modifyreg16.c up_modifyreg32.c up_modifyreg8.c -CMN_CSRCS += up_puts.c up_releasepending.c up_releasestack.c up_reprioritizertr.c +CMN_CSRCS += up_nputs.c up_releasepending.c up_releasestack.c up_reprioritizertr.c CMN_CSRCS += up_stackframe.c up_udelay.c up_unblocktask.c up_usestack.c CHIP_ASRCS = m9s12_start.S m9s12_lowputc.S m9s12_saveusercontext.S diff --git a/arch/mips/src/common/mips_puts.c b/arch/mips/src/common/mips_nputs.c similarity index 94% rename from arch/mips/src/common/mips_puts.c rename to arch/mips/src/common/mips_nputs.c index 21c0d5f9be..c690ff7c67 100644 --- a/arch/mips/src/common/mips_puts.c +++ b/arch/mips/src/common/mips_nputs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/mips/src/common/mips_puts.c + * arch/mips/src/common/mips_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 "mips_internal.h" - /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -44,16 +42,16 @@ ****************************************************************************/ /**************************************************************************** - * 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++); } diff --git a/arch/mips/src/pic32mx/Make.defs b/arch/mips/src/pic32mx/Make.defs index fae17d42df..9e18bc4f7c 100644 --- a/arch/mips/src/pic32mx/Make.defs +++ b/arch/mips/src/pic32mx/Make.defs @@ -29,7 +29,7 @@ CMN_CSRCS = mips_allocateheap.c mips_assert.c mips_blocktask.c mips_copystate.c CMN_CSRCS += mips_createstack.c mips_doirq.c mips_exit.c mips_initialize.c CMN_CSRCS += mips_initialstate.c mips_irq.c mips_lowputs.c CMN_CSRCS += mips_mdelay.c mips_modifyreg8.c mips_modifyreg16.c mips_modifyreg32.c -CMN_CSRCS += mips_puts.c mips_releasepending.c mips_releasestack.c +CMN_CSRCS += mips_nputs.c mips_releasepending.c mips_releasestack.c CMN_CSRCS += mips_reprioritizertr.c mips_schedulesigaction.c mips_sigdeliver.c CMN_CSRCS += mips_stackframe.c mips_swint0.c mips_udelay.c mips_unblocktask.c CMN_CSRCS += mips_usestack.c mips_vfork.c diff --git a/arch/mips/src/pic32mz/Make.defs b/arch/mips/src/pic32mz/Make.defs index 252e4dd844..9af3182333 100644 --- a/arch/mips/src/pic32mz/Make.defs +++ b/arch/mips/src/pic32mz/Make.defs @@ -29,7 +29,7 @@ CMN_CSRCS = mips_allocateheap.c mips_assert.c mips_blocktask.c mips_copystate.c CMN_CSRCS += mips_createstack.c mips_doirq.c mips_exit.c mips_initialize.c CMN_CSRCS += mips_initialstate.c mips_irq.c mips_lowputs.c CMN_CSRCS += mips_mdelay.c mips_modifyreg8.c mips_modifyreg16.c mips_modifyreg32.c -CMN_CSRCS += mips_puts.c mips_releasepending.c mips_releasestack.c +CMN_CSRCS += mips_nputs.c mips_releasepending.c mips_releasestack.c CMN_CSRCS += mips_reprioritizertr.c mips_schedulesigaction.c mips_sigdeliver.c CMN_CSRCS += mips_stackframe.c mips_swint0.c mips_udelay.c mips_unblocktask.c CMN_CSRCS += mips_usestack.c mips_vfork.c diff --git a/arch/xtensa/src/common/xtensa_puts.c b/arch/or1k/src/common/up_nputs.c similarity index 92% rename from arch/xtensa/src/common/xtensa_puts.c rename to arch/or1k/src/common/up_nputs.c index 9aaa92b757..06287d703d 100644 --- a/arch/xtensa/src/common/xtensa_puts.c +++ b/arch/or1k/src/common/up_nputs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/xtensa/src/common/xtensa_puts.c + * arch/or1k/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,23 +25,21 @@ #include <nuttx/config.h> #include <nuttx/arch.h> -#include "xtensa.h" - /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** - * 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++); } diff --git a/arch/or1k/src/mor1kx/Make.defs b/arch/or1k/src/mor1kx/Make.defs index add82a2447..aa5a8a8796 100644 --- a/arch/or1k/src/mor1kx/Make.defs +++ b/arch/or1k/src/mor1kx/Make.defs @@ -41,7 +41,7 @@ CMN_CSRCS = up_initialize.c \ up_mdelay.c \ up_idle.c \ up_irq.c \ - up_puts.c \ + up_nputs.c \ up_uart.c \ up_timer.c \ up_doirq.c \ diff --git a/arch/avr/src/common/up_puts.c b/arch/renesas/src/common/up_nputs.c similarity index 94% copy from arch/avr/src/common/up_puts.c copy to arch/renesas/src/common/up_nputs.c index eb57132d53..45c84a386f 100644 --- a/arch/avr/src/common/up_puts.c +++ b/arch/renesas/src/common/up_nputs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/avr/src/common/up_puts.c + * arch/renesas/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,16 +42,16 @@ ****************************************************************************/ /**************************************************************************** - * 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++); } diff --git a/arch/renesas/src/m16c/Make.defs b/arch/renesas/src/m16c/Make.defs index dfa8949958..9c5326a2ac 100644 --- a/arch/renesas/src/m16c/Make.defs +++ b/arch/renesas/src/m16c/Make.defs @@ -22,7 +22,7 @@ HEAD_ASRC = m16c_head.S CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c CMN_CSRCS += up_createstack.c up_doirq.c up_exit.c up_idle.c up_initialize.c -CMN_CSRCS += up_lowputs.c up_mdelay.c up_puts.c +CMN_CSRCS += up_lowputs.c up_mdelay.c up_nputs.c CMN_CSRCS += up_releasepending.c up_releasestack.c up_reprioritizertr.c CMN_CSRCS += up_stackframe.c up_udelay.c up_unblocktask.c up_usestack.c diff --git a/arch/renesas/src/rx65n/Make.defs b/arch/renesas/src/rx65n/Make.defs index 0c5bb87445..2d77e89226 100644 --- a/arch/renesas/src/rx65n/Make.defs +++ b/arch/renesas/src/rx65n/Make.defs @@ -22,7 +22,7 @@ HEAD_ASRC = rx65n_head.S CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c CMN_CSRCS += up_createstack.c up_doirq.c up_exit.c up_idle.c up_initialize.c -CMN_CSRCS += up_lowputs.c up_mdelay.c up_puts.c +CMN_CSRCS += up_lowputs.c up_mdelay.c up_nputs.c CMN_CSRCS += up_releasepending.c up_releasestack.c up_reprioritizertr.c CMN_CSRCS += up_stackframe.c up_udelay.c up_unblocktask.c up_usestack.c diff --git a/arch/renesas/src/sh1/Make.defs b/arch/renesas/src/sh1/Make.defs index 042ee48a3a..4ff0cd13c2 100644 --- a/arch/renesas/src/sh1/Make.defs +++ b/arch/renesas/src/sh1/Make.defs @@ -23,7 +23,7 @@ HEAD_ASRC = sh1_head.S CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c CMN_CSRCS += up_createstack.c up_doirq.c up_exit.c up_idle.c up_initialize.c CMN_CSRCS += up_initialstate.c up_lowputs.c -CMN_CSRCS += up_mdelay.c up_puts.c up_releasepending.c up_releasestack.c +CMN_CSRCS += up_mdelay.c up_nputs.c up_releasepending.c up_releasestack.c CMN_CSRCS += up_reprioritizertr.c up_stackframe.c up_udelay.c CMN_CSRCS += sh1_schedulesigaction.c sh1_sigdeliver.c CMN_CSRCS += up_unblocktask.c up_usestack.c diff --git a/arch/risc-v/src/common/Make.defs b/arch/risc-v/src/common/Make.defs index 2c17173346..0662395a9a 100644 --- a/arch/risc-v/src/common/Make.defs +++ b/arch/risc-v/src/common/Make.defs @@ -29,7 +29,7 @@ CMN_ASRCS += riscv_vectors.S riscv_exception_common.S riscv_mhartid.S CMN_CSRCS += riscv_initialize.c riscv_swint.c riscv_mtimer.c CMN_CSRCS += riscv_allocateheap.c riscv_createstack.c riscv_exit.c CMN_CSRCS += riscv_assert.c riscv_blocktask.c riscv_copystate.c riscv_initialstate.c -CMN_CSRCS += riscv_modifyreg32.c riscv_puts.c +CMN_CSRCS += riscv_modifyreg32.c riscv_nputs.c CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c CMN_CSRCS += riscv_sigdeliver.c riscv_unblocktask.c riscv_usestack.c diff --git a/arch/or1k/src/common/up_puts.c b/arch/risc-v/src/common/riscv_nputs.c similarity index 92% rename from arch/or1k/src/common/up_puts.c rename to arch/risc-v/src/common/riscv_nputs.c index 0b27632fb7..b87a2d5d36 100644 --- a/arch/or1k/src/common/up_puts.c +++ b/arch/risc-v/src/common/riscv_nputs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/or1k/src/common/up_puts.c + * arch/risc-v/src/common/riscv_nputs.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -25,23 +25,21 @@ #include <nuttx/config.h> #include <nuttx/arch.h> -#include "up_internal.h" - /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** - * 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++); } diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile index cb9c2bfb5e..4f0ad875de 100644 --- a/arch/sim/src/Makefile +++ b/arch/sim/src/Makefile @@ -61,7 +61,7 @@ CSRCS = up_initialize.c up_idle.c up_interruptcontext.c up_initialstate.c CSRCS += up_createstack.c up_usestack.c up_releasestack.c up_stackframe.c CSRCS += up_unblocktask.c up_blocktask.c up_releasepending.c CSRCS += up_reprioritizertr.c up_exit.c up_schedulesigaction.c -CSRCS += up_heap.c up_uart.c up_assert.c up_puts.c +CSRCS += up_heap.c up_uart.c up_assert.c up_nputs.c CSRCS += up_copyfullstate.c CSRCS += up_sigdeliver.c diff --git a/arch/sim/src/sim/up_puts.c b/arch/sim/src/sim/up_nputs.c similarity index 94% rename from arch/sim/src/sim/up_puts.c rename to arch/sim/src/sim/up_nputs.c index 11471f9367..72e444996b 100644 --- a/arch/sim/src/sim/up_puts.c +++ b/arch/sim/src/sim/up_nputs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/sim/src/sim/up_puts.c + * arch/sim/src/sim/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,16 +42,16 @@ ****************************************************************************/ /**************************************************************************** - * 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++); } diff --git a/arch/sparc/src/bm3803/Make.defs b/arch/sparc/src/bm3803/Make.defs index b584b7d8ab..53dfcf2c85 100644 --- a/arch/sparc/src/bm3803/Make.defs +++ b/arch/sparc/src/bm3803/Make.defs @@ -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 diff --git a/arch/sparc/src/bm3823/Make.defs b/arch/sparc/src/bm3823/Make.defs index e716b96325..66efadc9f7 100644 --- a/arch/sparc/src/bm3823/Make.defs +++ b/arch/sparc/src/bm3823/Make.defs @@ -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 diff --git a/arch/renesas/src/common/up_puts.c b/arch/sparc/src/common/up_nputs.c similarity index 94% rename from arch/renesas/src/common/up_puts.c rename to arch/sparc/src/common/up_nputs.c index b607ee8c6c..106464b072 100644 --- a/arch/renesas/src/common/up_puts.c +++ b/arch/sparc/src/common/up_nputs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/renesas/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,16 +42,16 @@ ****************************************************************************/ /**************************************************************************** - * 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++); } diff --git a/arch/hc/src/common/up_puts.c b/arch/x86/src/common/up_nputs.c similarity index 94% rename from arch/hc/src/common/up_puts.c rename to arch/x86/src/common/up_nputs.c index 89de2d6361..6902cfba04 100644 --- a/arch/hc/src/common/up_puts.c +++ b/arch/x86/src/common/up_nputs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/hc/src/common/up_puts.c + * arch/x86/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 @@ -23,11 +23,8 @@ ****************************************************************************/ #include <nuttx/config.h> - #include <nuttx/arch.h> -#include "up_internal.h" - /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -45,16 +42,16 @@ ****************************************************************************/ /**************************************************************************** - * 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++); } diff --git a/arch/x86/src/qemu/Make.defs b/arch/x86/src/qemu/Make.defs index 9365134ea7..4cd986f79d 100644 --- a/arch/x86/src/qemu/Make.defs +++ b/arch/x86/src/qemu/Make.defs @@ -32,7 +32,7 @@ CMN_CSRCS += up_irq.c up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c CMN_CSRCS += up_regdump.c up_releasepending.c up_releasestack.c CMN_CSRCS += up_reprioritizertr.c up_savestate.c up_sigdeliver.c CMN_CSRCS += up_schedulesigaction.c up_stackframe.c up_unblocktask.c -CMN_CSRCS += up_usestack.c up_puts.c +CMN_CSRCS += up_usestack.c up_nputs.c # Required QEMU files diff --git a/arch/avr/src/common/up_puts.c b/arch/x86_64/src/common/up_nputs.c similarity index 94% rename from arch/avr/src/common/up_puts.c rename to arch/x86_64/src/common/up_nputs.c index eb57132d53..6c0935f7ff 100644 --- a/arch/avr/src/common/up_puts.c +++ b/arch/x86_64/src/common/up_nputs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/avr/src/common/up_puts.c + * arch/x86_64/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,16 +42,16 @@ ****************************************************************************/ /**************************************************************************** - * 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++); } diff --git a/arch/x86_64/src/common/up_puts.c b/arch/x86_64/src/common/up_puts.c deleted file mode 100644 index 350ed55aec..0000000000 --- a/arch/x86_64/src/common/up_puts.c +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** - * arch/x86_64/src/common/up_puts.c - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. The - * ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> -#include <nuttx/arch.h> - -#include "up_internal.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_puts - * - * Description: - * This is a low-level helper function used to support debug. - * - ****************************************************************************/ - -void up_puts(const char *str) -{ - while (*str) - { - up_putc(*str++); - } -} diff --git a/arch/x86_64/src/intel64/Make.defs b/arch/x86_64/src/intel64/Make.defs index 6d09dde282..503a27504a 100644 --- a/arch/x86_64/src/intel64/Make.defs +++ b/arch/x86_64/src/intel64/Make.defs @@ -27,7 +27,7 @@ CMN_CSRCS += up_irq.c up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c CMN_CSRCS += up_regdump.c up_releasepending.c up_releasestack.c CMN_CSRCS += up_reprioritizertr.c up_savestate.c up_sigdeliver.c CMN_CSRCS += up_schedulesigaction.c up_stackframe.c up_unblocktask.c -CMN_CSRCS += up_usestack.c up_puts.c +CMN_CSRCS += up_usestack.c up_nputs.c CMN_CSRCS += up_rtc.c CMN_CSRCS += up_map_region.c diff --git a/arch/xtensa/src/common/Make.defs b/arch/xtensa/src/common/Make.defs index 0d1c0162f5..1b15e05aa5 100644 --- a/arch/xtensa/src/common/Make.defs +++ b/arch/xtensa/src/common/Make.defs @@ -32,7 +32,7 @@ CMN_CSRCS += xtensa_cpenable.c xtensa_createstack.c xtensa_exit.c CMN_CSRCS += xtensa_initialize.c xtensa_initialstate.c CMN_CSRCS += xtensa_irqdispatch.c xtensa_lowputs.c xtensa_mdelay.c CMN_CSRCS += xtensa_modifyreg8.c xtensa_modifyreg16.c xtensa_modifyreg32.c -CMN_CSRCS += xtensa_puts.c xtensa_releasepending.c xtensa_releasestack.c +CMN_CSRCS += xtensa_nputs.c xtensa_releasepending.c xtensa_releasestack.c CMN_CSRCS += xtensa_reprioritizertr.c xtensa_schedsigaction.c CMN_CSRCS += xtensa_sigdeliver.c xtensa_stackframe.c xtensa_udelay.c CMN_CSRCS += xtensa_unblocktask.c xtensa_usestack.c xtensa_swint.c diff --git a/arch/risc-v/src/common/riscv_puts.c b/arch/xtensa/src/common/xtensa_nputs.c similarity index 92% rename from arch/risc-v/src/common/riscv_puts.c rename to arch/xtensa/src/common/xtensa_nputs.c index 788b8f9eb7..46764e3b40 100644 --- a/arch/risc-v/src/common/riscv_puts.c +++ b/arch/xtensa/src/common/xtensa_nputs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/risc-v/src/common/riscv_puts.c + * arch/xtensa/src/common/xtensa_nputs.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -25,23 +25,21 @@ #include <nuttx/config.h> #include <nuttx/arch.h> -#include "riscv_internal.h" - /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** - * 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++); } diff --git a/arch/ceva/src/common/up_puts.c b/arch/z16/src/common/z16_nputs.c similarity index 92% rename from arch/ceva/src/common/up_puts.c rename to arch/z16/src/common/z16_nputs.c index edb931c059..2915a60f80 100644 --- a/arch/ceva/src/common/up_puts.c +++ b/arch/z16/src/common/z16_nputs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/ceva/src/common/up_puts.c + * arch/z16/src/common/z16_nputs.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -30,16 +30,16 @@ ****************************************************************************/ /**************************************************************************** - * 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++); } diff --git a/arch/z16/src/common/z16_puts.c b/arch/z16/src/common/z16_puts.c deleted file mode 100644 index 26e14f5bb9..0000000000 --- a/arch/z16/src/common/z16_puts.c +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** - * arch/z16/src/common/z16_puts.c - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. The - * ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> -#include <nuttx/arch.h> - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_puts - * - * Description: - * This is a low-level helper function used to support debug. - * - ****************************************************************************/ - -void up_puts(const char *str) -{ - while (*str) - { - up_putc(*str++); - } -} diff --git a/arch/z16/src/z16f/Make.defs b/arch/z16/src/z16f/Make.defs index ab95c4473e..264be6b4b6 100644 --- a/arch/z16/src/z16f/Make.defs +++ b/arch/z16/src/z16f/Make.defs @@ -26,7 +26,7 @@ CMN_CSRCS += z16_stackdump.c z16_copystate.c CMN_CSRCS += z16_mdelay.c z16_udelay.c z16_createstack.c z16_registerdump.c CMN_CSRCS += z16_unblocktask.c z16_doirq.c z16_releasepending.c z16_usestack.c CMN_CSRCS += z16_exit.c z16_releasestack.c z16_stackframe.c z16_idle.c -CMN_CSRCS += z16_reprioritizertr.c z16_puts.c +CMN_CSRCS += z16_reprioritizertr.c z16_nputs.c CHIP_SSRCS = z16f_lowuart.S z16f_saveusercontext.S z16f_restoreusercontext.S CHIP_CSRCS = z16f_clkinit.c z16f_sysexec.c z16f_irq.c z16f_serial.c diff --git a/arch/sparc/src/common/up_puts.c b/arch/z80/src/common/z80_nputs.c similarity index 94% rename from arch/sparc/src/common/up_puts.c rename to arch/z80/src/common/z80_nputs.c index 7ab7bd07ff..839b8318a2 100644 --- a/arch/sparc/src/common/up_puts.c +++ b/arch/z80/src/common/z80_nputs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/sparc/src/common/up_puts.c + * arch/z80/src/common/z80_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++); } } - diff --git a/arch/z80/src/common/z80_puts.c b/arch/z80/src/common/z80_puts.c deleted file mode 100644 index 64b197f7f4..0000000000 --- a/arch/z80/src/common/z80_puts.c +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** - * arch/z80/src/common/z80_puts.c - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. The - * ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> -#include <nuttx/arch.h> - -#include "z80_internal.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_puts - * - * Description: - * This is a low-level helper function used to support debug. - * - ****************************************************************************/ - -void up_puts(const char *str) -{ - while (*str) - { - up_putc(*str++); - } -} diff --git a/arch/z80/src/ez80/Make.defs b/arch/z80/src/ez80/Make.defs index bb3034fdb4..b10df0800a 100644 --- a/arch/z80/src/ez80/Make.defs +++ b/arch/z80/src/ez80/Make.defs @@ -23,7 +23,7 @@ CMN_CSRCS += z80_releasestack.c z80_interruptcontext.c z80_blocktask.c CMN_CSRCS += z80_unblocktask.c z80_exit.c z80_releasepending.c CMN_CSRCS += z80_reprioritizertr.c z80_idle.c z80_assert.c z80_doirq.c CMN_CSRCS += z80_mdelay.c z80_stackframe.c z80_udelay.c z80_usestack.c -CMN_CSRCS += z80_puts.c +CMN_CSRCS += z80_nputs.c ifeq ($(CONFIG_ARCH_STACKDUMP),y) CMN_CSRCS += z80_stackdump.c diff --git a/arch/z80/src/z180/Make.defs b/arch/z80/src/z180/Make.defs index e7045734e4..c48c998073 100644 --- a/arch/z80/src/z180/Make.defs +++ b/arch/z80/src/z180/Make.defs @@ -30,7 +30,7 @@ CMN_CSRCS = z80_allocateheap.c z80_assert.c z80_blocktask.c z80_createstack.c CMN_CSRCS += z80_doirq.c z80_exit.c z80_idle.c z80_initialize.c CMN_CSRCS += z80_interruptcontext.c z80_mdelay.c z80_releasepending.c CMN_CSRCS += z80_releasestack.c z80_stackframe.c z80_reprioritizertr.c -CMN_CSRCS += z80_unblocktask.c z80_udelay.c z80_usestack.c z80_puts.c +CMN_CSRCS += z80_unblocktask.c z80_udelay.c z80_usestack.c z80_nputs.c CHIP_ASRCS = z180_restoreusercontext.asm z180_saveusercontext.asm CHIP_ASRCS += z180_vectcommon.asm diff --git a/arch/z80/src/z8/Make.defs b/arch/z80/src/z8/Make.defs index 7fa8e49f21..92798ecb08 100644 --- a/arch/z80/src/z8/Make.defs +++ b/arch/z80/src/z8/Make.defs @@ -25,7 +25,7 @@ CMN_CSRCS += z80_releasestack.c z80_interruptcontext.c z80_blocktask.c CMN_CSRCS += z80_unblocktask.c z80_exit.c z80_releasepending.c CMN_CSRCS += z80_reprioritizertr.c z80_idle.c z80_assert.c z80_doirq.c CMN_CSRCS += z80_mdelay.c z80_stackframe.c z80_udelay.c z80_usestack.c -CMN_CSRCS += z80_puts.c +CMN_CSRCS += z80_nputs.c CHIP_SSRCS = z8_vector.S z8_saveusercontext.S z8_restorecontext.S CHIP_CSRCS = z8_initialstate.c z8_irq.c z8_saveirqcontext.c diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h index 302767b5cd..a28e271cc5 100644 --- a/include/nuttx/arch.h +++ b/include/nuttx/arch.h @@ -2552,7 +2552,8 @@ int up_putc(int ch); * ****************************************************************************/ -void up_puts(FAR const char *str); +#define up_puts(str) up_nputs(str, ~((size_t)0)) +void up_nputs(FAR const char *str, size_t len); /**************************************************************************** * Name: arch_sporadic_*
