From db9901e2f93d963cbba9ff6fa994de6f4042e347 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 8 Oct 2014 12:48:47 -0600 Subject: [PATCH] Update everything under nuttx/arch to use the corrected syslog interfaces --- arch/arm/src/arm/up_assert.c | 39 +++++++++++++++++------- arch/arm/src/arm/up_dataabort.c | 20 ++++++------ arch/arm/src/arm/up_prefetchabort.c | 22 ++++++------- arch/arm/src/arm/up_syscall.c | 20 ++++++------ arch/arm/src/arm/up_undefinedinsn.c | 20 ++++++------ arch/arm/src/armv6-m/up_assert.c | 38 ++++++++++++++++------- arch/arm/src/armv7-a/arm_assert.c | 37 +++++++++++++++------- arch/arm/src/armv7-a/arm_dataabort.c | 20 ++++++------ arch/arm/src/armv7-a/arm_prefetchabort.c | 22 ++++++------- arch/arm/src/armv7-a/arm_syscall.c | 20 ++++++------ arch/arm/src/armv7-a/arm_undefinedinsn.c | 20 ++++++------ arch/arm/src/armv7-m/up_assert.c | 37 +++++++++++++++------- arch/arm/src/dm320/dm320_decodeirq.c | 2 +- arch/arm/src/imx/imx_decodeirq.c | 2 +- arch/arm/src/lpc214x/lpc214x_decodeirq.c | 4 +-- arch/arm/src/lpc2378/lpc23xx_decodeirq.c | 6 ++-- arch/arm/src/lpc31xx/lpc31_decodeirq.c | 2 +- arch/arm/src/stm32/stm32_i2c.c | 7 +++-- arch/arm/src/stm32/stm32_i2c_alt.c | 7 +++-- arch/arm/src/stm32/stm32f30xxx_i2c.c | 11 ++++--- arch/arm/src/str71x/str71x_decodeirq.c | 4 +-- arch/avr/src/avr/up_dumpstate.c | 17 ++++++----- arch/avr/src/avr32/up_dumpstate.c | 14 ++++----- arch/avr/src/common/up_assert.c | 37 +++++++++++++++------- arch/hc/src/m9s12/m9s12_assert.c | 37 +++++++++++++++------- arch/mips/src/mips32/up_assert.c | 37 +++++++++++++++------- arch/mips/src/mips32/up_dumpstate.c | 14 ++++----- arch/sh/src/common/up_assert.c | 38 ++++++++++++++++------- arch/sh/src/m16c/m16c_dumpstate.c | 18 +++++------ arch/sh/src/sh1/sh1_dumpstate.c | 18 +++++------ arch/sim/src/up_initialize.c | 2 +- arch/sim/src/up_tapdev.c | 32 ++++++++++++------- arch/x86/src/common/up_assert.c | 37 +++++++++++++++------- arch/x86/src/i486/up_regdump.c | 12 +++++--- arch/z16/src/common/up_assert.c | 38 ++++++++++++++++------- arch/z16/src/common/up_registerdump.c | 30 ++++++++++-------- arch/z16/src/common/up_stackdump.c | 26 ++++++++-------- arch/z16/src/z16f/z16f_sysexec.c | 24 ++++++--------- arch/z80/src/common/up_assert.c | 36 ++++++++++++++++------ arch/z80/src/common/up_doirq.c | 2 +- arch/z80/src/common/up_stackdump.c | 26 ++++++++-------- arch/z80/src/ez80/ez80_registerdump.c | 26 ++++++++-------- arch/z80/src/z180/z180_registerdump.c | 22 ++++++------- arch/z80/src/z8/z8_registerdump.c | 29 ++++++++---------- arch/z80/src/z80/z80_registerdump.c | 26 ++++++++-------- 45 files changed, 577 insertions(+), 381 deletions(-) diff --git a/arch/arm/src/arm/up_assert.c b/arch/arm/src/arm/up_assert.c index c594a58de4..4c54e099b3 100644 --- a/arch/arm/src/arm/up_assert.c +++ b/arch/arm/src/arm/up_assert.c @@ -39,6 +39,18 @@ #include +/* Output debug info if stack dump is selected -- even if debug is not + * selected. + */ + +#ifdef CONFIG_ARCH_STACKDUMP +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +#endif + +#include #include #include #include @@ -57,6 +69,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* USB trace dumping */ #ifndef CONFIG_USBDEV_TRACE @@ -69,15 +82,6 @@ # undef CONFIG_DEBUG_STACK #endif -/* Output debug info if stack dump is selected -- even if debug is not - * selected. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /* The following is just intended to keep some ugliness out of the mainline * code. We are going to print the task name if: * @@ -172,9 +176,22 @@ static inline void up_registerdump(void) ****************************************************************************/ #ifdef CONFIG_ARCH_USBDUMP -static int assert_tracecallback(struct usbtrace_s *trace, void *arg) +static int usbtrace_syslog(FAR const char *fmt, ...) { - usbtrace_trprintf((trprintf_t)lowsyslog, trace->event, trace->value); + va_list ap; + int ret; + + /* Let vsyslog do the real work */ + + va_start(ap, fmt); + ret = lowvsyslog(LOG_INFO, fmt, ap); + va_end(ap); + return ret; +} + +static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg) +{ + usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value); return 0; } #endif diff --git a/arch/arm/src/arm/up_dataabort.c b/arch/arm/src/arm/up_dataabort.c index dc2a08a479..2dbf898e17 100644 --- a/arch/arm/src/arm/up_dataabort.c +++ b/arch/arm/src/arm/up_dataabort.c @@ -39,6 +39,17 @@ #include +/* Output debug info if stack dump is selected -- even if debug is not + * selected. + */ + +#ifdef CONFIG_ARCH_STACKDUMP +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +#endif + #include #include @@ -56,15 +67,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* Output debug info if stack dump is selected -- even if - * debug is not selected. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /**************************************************************************** * Private Data ****************************************************************************/ diff --git a/arch/arm/src/arm/up_prefetchabort.c b/arch/arm/src/arm/up_prefetchabort.c index 577bc1b8ba..69fba8be59 100644 --- a/arch/arm/src/arm/up_prefetchabort.c +++ b/arch/arm/src/arm/up_prefetchabort.c @@ -39,6 +39,17 @@ #include +/* Output debug info if stack dump is selected -- even if debug is not + * selected. + */ + +#ifdef CONFIG_ARCH_STACKDUMP +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +#endif + #include #include @@ -54,17 +65,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* Debug ********************************************************************/ - -/* Output debug info if stack dump is selected -- even if - * debug is not selected. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /**************************************************************************** * Private Data ****************************************************************************/ diff --git a/arch/arm/src/arm/up_syscall.c b/arch/arm/src/arm/up_syscall.c index 4d4110b129..990baed253 100644 --- a/arch/arm/src/arm/up_syscall.c +++ b/arch/arm/src/arm/up_syscall.c @@ -39,6 +39,17 @@ #include +/* Output debug info if stack dump is selected -- even if debug is not + * selected. + */ + +#ifdef CONFIG_ARCH_STACKDUMP +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +#endif + #include #include @@ -51,15 +62,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* Output debug info if stack dump is selected -- even if - * debug is not selected. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /**************************************************************************** * Private Data ****************************************************************************/ diff --git a/arch/arm/src/arm/up_undefinedinsn.c b/arch/arm/src/arm/up_undefinedinsn.c index bb80be9b24..fc57427212 100644 --- a/arch/arm/src/arm/up_undefinedinsn.c +++ b/arch/arm/src/arm/up_undefinedinsn.c @@ -39,6 +39,17 @@ #include +/* Output debug info if stack dump is selected -- even if debug is not + * selected. + */ + +#ifdef CONFIG_ARCH_STACKDUMP +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +#endif + #include #include #include @@ -51,15 +62,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* Output debug info if stack dump is selected -- even if - * debug is not selected. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /**************************************************************************** * Private Data ****************************************************************************/ diff --git a/arch/arm/src/armv6-m/up_assert.c b/arch/arm/src/armv6-m/up_assert.c index 492ee730ee..69af23fa0a 100644 --- a/arch/arm/src/armv6-m/up_assert.c +++ b/arch/arm/src/armv6-m/up_assert.c @@ -39,6 +39,17 @@ #include +/* Output debug info if stack dump is selected -- even if debug is not + * selected. + */ + +#ifdef CONFIG_ARCH_STACKDUMP +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +#endif + #include #include #include @@ -57,6 +68,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* USB trace dumping */ #ifndef CONFIG_USBDEV_TRACE @@ -69,15 +81,6 @@ # undef CONFIG_DEBUG_STACK #endif -/* Output debug info if stack dump is selected -- even if debug is not - * selected. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /* The following is just intended to keep some ugliness out of the mainline * code. We are going to print the task name if: * @@ -179,9 +182,22 @@ static inline void up_registerdump(void) ****************************************************************************/ #ifdef CONFIG_ARCH_USBDUMP -static int assert_tracecallback(struct usbtrace_s *trace, void *arg) +static int usbtrace_syslog(FAR const char *fmt, ...) { - usbtrace_trprintf((trprintf_t)lowsyslog, trace->event, trace->value); + va_list ap; + int ret; + + /* Let vsyslog do the real work */ + + va_start(ap, fmt); + ret = lowvsyslog(LOG_INFO, fmt, ap); + va_end(ap); + return ret; +} + +static int assert_tracecallback(FAR struct usbtrace_s *trace,FAR void *arg) +{ + usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value); return 0; } #endif diff --git a/arch/arm/src/armv7-a/arm_assert.c b/arch/arm/src/armv7-a/arm_assert.c index a97f091973..c08da07b4a 100644 --- a/arch/arm/src/armv7-a/arm_assert.c +++ b/arch/arm/src/armv7-a/arm_assert.c @@ -39,6 +39,17 @@ #include +/* Output debug info if stack dump is selected -- even if debug is not + * selected. + */ + +#ifdef CONFIG_ARCH_STACKDUMP +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +#endif + #include #include #include @@ -69,15 +80,6 @@ # undef CONFIG_DEBUG_STACK #endif -/* Output debug info if stack dump is selected -- even if debug is not - * selected. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /* The following is just intended to keep some ugliness out of the mainline * code. We are going to print the task name if: * @@ -172,9 +174,22 @@ static inline void up_registerdump(void) ****************************************************************************/ #ifdef CONFIG_ARCH_USBDUMP -static int assert_tracecallback(struct usbtrace_s *trace, void *arg) +static int usbtrace_syslog(FAR const char *fmt, ...) { - usbtrace_trprintf((trprintf_t)lowsyslog, trace->event, trace->value); + va_list ap; + int ret; + + /* Let vsyslog do the real work */ + + va_start(ap, fmt); + ret = lowvsyslog(LOG_INFO, fmt, ap); + va_end(ap); + return ret; +} + +static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg) +{ + usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value); return 0; } #endif diff --git a/arch/arm/src/armv7-a/arm_dataabort.c b/arch/arm/src/armv7-a/arm_dataabort.c index 073afe210f..1066a8d214 100644 --- a/arch/arm/src/armv7-a/arm_dataabort.c +++ b/arch/arm/src/armv7-a/arm_dataabort.c @@ -39,6 +39,17 @@ #include +/* Output debug info if stack dump is selected -- even if debug is not + * selected. + */ + +#ifdef CONFIG_ARCH_STACKDUMP +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +#endif + #include #include @@ -56,15 +67,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* Output debug info if stack dump is selected -- even if - * debug is not selected. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /**************************************************************************** * Private Data ****************************************************************************/ diff --git a/arch/arm/src/armv7-a/arm_prefetchabort.c b/arch/arm/src/armv7-a/arm_prefetchabort.c index 089e6105c2..1b4bd6dcf2 100644 --- a/arch/arm/src/armv7-a/arm_prefetchabort.c +++ b/arch/arm/src/armv7-a/arm_prefetchabort.c @@ -39,6 +39,17 @@ #include +/* Output debug info if stack dump is selected -- even if debug is not + * selected. + */ + +#ifdef CONFIG_ARCH_STACKDUMP +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +#endif + #include #include @@ -54,17 +65,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* Debug ********************************************************************/ - -/* Output debug info if stack dump is selected -- even if - * debug is not selected. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /**************************************************************************** * Private Data ****************************************************************************/ diff --git a/arch/arm/src/armv7-a/arm_syscall.c b/arch/arm/src/armv7-a/arm_syscall.c index 343226a86d..9814b7e8ea 100644 --- a/arch/arm/src/armv7-a/arm_syscall.c +++ b/arch/arm/src/armv7-a/arm_syscall.c @@ -39,6 +39,17 @@ #include +/* Output debug info if stack dump is selected -- even if debug is not + * selected. + */ + +#ifdef CONFIG_ARCH_STACKDUMP +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +#endif + #include #include #include @@ -65,15 +76,6 @@ # define svcdbg(x...) #endif -/* Output debug info if stack dump is selected -- even if debug is not - * selected. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /**************************************************************************** * Private Data ****************************************************************************/ diff --git a/arch/arm/src/armv7-a/arm_undefinedinsn.c b/arch/arm/src/armv7-a/arm_undefinedinsn.c index a1af60a4c6..392cfb9740 100644 --- a/arch/arm/src/armv7-a/arm_undefinedinsn.c +++ b/arch/arm/src/armv7-a/arm_undefinedinsn.c @@ -39,6 +39,17 @@ #include +/* Output debug info if stack dump is selected -- even if debug is not + * selected. + */ + +#ifdef CONFIG_ARCH_STACKDUMP +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +#endif + #include #include #include @@ -51,15 +62,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* Output debug info if stack dump is selected -- even if - * debug is not selected. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /**************************************************************************** * Private Data ****************************************************************************/ diff --git a/arch/arm/src/armv7-m/up_assert.c b/arch/arm/src/armv7-m/up_assert.c index a01cc0b487..7be0d02cbd 100644 --- a/arch/arm/src/armv7-m/up_assert.c +++ b/arch/arm/src/armv7-m/up_assert.c @@ -39,6 +39,17 @@ #include +/* Output debug info if stack dump is selected -- even if debug is not + * selected. + */ + +#ifdef CONFIG_ARCH_STACKDUMP +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +#endif + #include #include #include @@ -69,15 +80,6 @@ # undef CONFIG_DEBUG_STACK #endif -/* Output debug info if stack dump is selected -- even if debug is not - * selected. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /* The following is just intended to keep some ugliness out of the mainline * code. We are going to print the task name if: * @@ -185,9 +187,22 @@ static inline void up_registerdump(void) ****************************************************************************/ #ifdef CONFIG_ARCH_USBDUMP -static int assert_tracecallback(struct usbtrace_s *trace, void *arg) +static int usbtrace_syslog(FAR const char *fmt, ...) { - usbtrace_trprintf((trprintf_t)lowsyslog, trace->event, trace->value); + va_list ap; + int ret; + + /* Let vsyslog do the real work */ + + va_start(ap, fmt); + ret = lowvsyslog(LOG_INFO, fmt, ap); + va_end(ap); + return ret; +} + +static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg) +{ + usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value); return 0; } #endif diff --git a/arch/arm/src/dm320/dm320_decodeirq.c b/arch/arm/src/dm320/dm320_decodeirq.c index 7616fe9188..efdade56a9 100644 --- a/arch/arm/src/dm320/dm320_decodeirq.c +++ b/arch/arm/src/dm320/dm320_decodeirq.c @@ -74,7 +74,7 @@ void up_decodeirq(uint32_t* regs) { #ifdef CONFIG_SUPPRESS_INTERRUPTS - lowsyslog("Unexpected IRQ\n"); + lowsyslog(LOG_ERR, "Unexpected IRQ\n"); current_regs = regs; PANIC(); #else diff --git a/arch/arm/src/imx/imx_decodeirq.c b/arch/arm/src/imx/imx_decodeirq.c index e241ae3932..4e7c4e653c 100644 --- a/arch/arm/src/imx/imx_decodeirq.c +++ b/arch/arm/src/imx/imx_decodeirq.c @@ -74,7 +74,7 @@ void up_decodeirq(uint32_t* regs) { #ifdef CONFIG_SUPPRESS_INTERRUPTS - lowsyslog("Unexpected IRQ\n"); + lowsyslog(LOG_ERR, "Unexpected IRQ\n"); current_regs = regs; PANIC(); #else diff --git a/arch/arm/src/lpc214x/lpc214x_decodeirq.c b/arch/arm/src/lpc214x/lpc214x_decodeirq.c index ea0eb5683a..f5e4673586 100644 --- a/arch/arm/src/lpc214x/lpc214x_decodeirq.c +++ b/arch/arm/src/lpc214x/lpc214x_decodeirq.c @@ -52,7 +52,7 @@ #include "lpc214x_vic.h" /******************************************************************************** - * Definitions + * Pre-processor Definitions ********************************************************************************/ /******************************************************************************** @@ -111,7 +111,7 @@ static void lpc214x_decodeirq( uint32_t *regs) #endif { #ifdef CONFIG_SUPPRESS_INTERRUPTS - lowsyslog("Unexpected IRQ\n"); + lowsyslog(LOG_ERR, "Unexpected IRQ\n"); current_regs = regs; PANIC(); #else diff --git a/arch/arm/src/lpc2378/lpc23xx_decodeirq.c b/arch/arm/src/lpc2378/lpc23xx_decodeirq.c index 85e0d3a1ad..009414e921 100644 --- a/arch/arm/src/lpc2378/lpc23xx_decodeirq.c +++ b/arch/arm/src/lpc2378/lpc23xx_decodeirq.c @@ -58,7 +58,7 @@ #include "lpc23xx_vic.h" /******************************************************************************** - * Definitions + * Pre-processor Definitions ********************************************************************************/ /******************************************************************************** @@ -78,7 +78,7 @@ ********************************************************************************/ /******************************************************************************** - * Public Funstions + * Public Functions ********************************************************************************/ /******************************************************************************** @@ -110,7 +110,7 @@ static void lpc23xx_decodeirq(uint32_t *regs) #endif { #ifdef CONFIG_SUPPRESS_INTERRUPTS - lowsyslog("Unexpected IRQ\n"); + lowsyslog(LOG_ERR, "Unexpected IRQ\n"); current_regs = regs; PANIC(); #else diff --git a/arch/arm/src/lpc31xx/lpc31_decodeirq.c b/arch/arm/src/lpc31xx/lpc31_decodeirq.c index 355f13af3f..1a29da8188 100644 --- a/arch/arm/src/lpc31xx/lpc31_decodeirq.c +++ b/arch/arm/src/lpc31xx/lpc31_decodeirq.c @@ -76,7 +76,7 @@ void up_decodeirq(uint32_t *regs) { #ifdef CONFIG_SUPPRESS_INTERRUPTS - lowsyslog("Unexpected IRQ\n"); + lowsyslog(LOG_ERR, "Unexpected IRQ\n"); current_regs = regs; PANIC(); #else diff --git a/arch/arm/src/stm32/stm32_i2c.c b/arch/arm/src/stm32/stm32_i2c.c index cd4714fd45..b8bbd58206 100644 --- a/arch/arm/src/stm32/stm32_i2c.c +++ b/arch/arm/src/stm32/stm32_i2c.c @@ -921,11 +921,14 @@ static void stm32_i2c_tracedump(FAR struct stm32_i2c_priv_s *priv) struct stm32_trace_s *trace; int i; - syslog("Elapsed time: %d\n", clock_systimer() - priv->start_time); + syslog(LOG_DEBUG, "Elapsed time: %d\n", + clock_systimer() - priv->start_time); + for (i = 0; i <= priv->tndx; i++) { trace = &priv->trace[i]; - syslog("%2d. STATUS: %08x COUNT: %3d EVENT: %2d PARM: %08x TIME: %d\n", + syslog(LOG_DEBUG, + "%2d. STATUS: %08x COUNT: %3d EVENT: %2d PARM: %08x TIME: %d\n", i+1, trace->status, trace->count, trace->event, trace->parm, trace->time - priv->start_time); } diff --git a/arch/arm/src/stm32/stm32_i2c_alt.c b/arch/arm/src/stm32/stm32_i2c_alt.c index 9a6e90999a..51f0238dde 100755 --- a/arch/arm/src/stm32/stm32_i2c_alt.c +++ b/arch/arm/src/stm32/stm32_i2c_alt.c @@ -949,11 +949,14 @@ static void stm32_i2c_tracedump(FAR struct stm32_i2c_priv_s *priv) struct stm32_trace_s *trace; int i; - syslog("Elapsed time: %d\n", clock_systimer() - priv->start_time); + syslog(LOG_DEBUG, "Elapsed time: %d\n", + clock_systimer() - priv->start_time); + for (i = 0; i <= priv->tndx; i++) { trace = &priv->trace[i]; - syslog("%2d. STATUS: %08x COUNT: %4d EVENT: %4d PARM: %08x TIME: %d\n", + syslog(LOG_DEBUG, + "%2d. STATUS: %08x COUNT: %4d EVENT: %4d PARM: %08x TIME: %d\n", i+1, trace->status, trace->count, trace->event, trace->parm, trace->time - priv->start_time); } diff --git a/arch/arm/src/stm32/stm32f30xxx_i2c.c b/arch/arm/src/stm32/stm32f30xxx_i2c.c index f816bad306..8118133c01 100644 --- a/arch/arm/src/stm32/stm32f30xxx_i2c.c +++ b/arch/arm/src/stm32/stm32f30xxx_i2c.c @@ -1060,13 +1060,16 @@ static void stm32_i2c_tracedump(FAR struct stm32_i2c_priv_s *priv) struct stm32_trace_s *trace; int i; - syslog("Elapsed time: %d\n", clock_systimer() - priv->start_time); + syslog(LOG_DEBUG, "Elapsed time: %d\n", + clock_systimer() - priv->start_time); + for (i = 0; i <= priv->tndx; i++) { trace = &priv->trace[i]; - syslog("%2d. STATUS: %08x COUNT: %3d EVENT: %2d PARM: %08x TIME: %d\n", - i+1, trace->status, trace->count, trace->event, trace->parm, - trace->time - priv->start_time); + syslog(LOG_DEBUG, + "%2d. STATUS: %08x COUNT: %3d EVENT: %2d PARM: %08x TIME: %d\n", + i+1, trace->status, trace->count, trace->event, trace->parm, + trace->time - priv->start_time); } } #endif /* CONFIG_I2C_TRACE */ diff --git a/arch/arm/src/str71x/str71x_decodeirq.c b/arch/arm/src/str71x/str71x_decodeirq.c index 0eacccf9cf..6e9c9f7388 100644 --- a/arch/arm/src/str71x/str71x_decodeirq.c +++ b/arch/arm/src/str71x/str71x_decodeirq.c @@ -52,7 +52,7 @@ #include "up_internal.h" /******************************************************************************** - * Pre-procesor Definitions + * Pre-processor Definitions ********************************************************************************/ /******************************************************************************** @@ -90,7 +90,7 @@ void up_decodeirq(uint32_t *regs) { #ifdef CONFIG_SUPPRESS_INTERRUPTS board_led_on(LED_INIRQ); - lowsyslog("Unexpected IRQ\n"); + lowsyslog(LOG_ERR, "Unexpected IRQ\n"); current_regs = regs; PANIC(); #else diff --git a/arch/avr/src/avr/up_dumpstate.c b/arch/avr/src/avr/up_dumpstate.c index 8802dd80c5..78a8c50bfa 100644 --- a/arch/avr/src/avr/up_dumpstate.c +++ b/arch/avr/src/avr/up_dumpstate.c @@ -39,6 +39,13 @@ #include +/* Output debug info -- even if debug is not selected. */ + +#undef CONFIG_DEBUG +#undef CONFIG_DEBUG_VERBOSE +#define CONFIG_DEBUG 1 +#define CONFIG_DEBUG_VERBOSE 1 + #include #include #include @@ -64,13 +71,6 @@ # undef CONFIG_DEBUG_STACK #endif -/* Output debug info if stack dump is selected -- even if debug is not - * selected. - */ - -#undef lldbg -#define lldbg lowsyslog - /**************************************************************************** * Private Data ****************************************************************************/ @@ -275,4 +275,5 @@ void up_dumpstate(void) up_registerdump(); } -#endif + +#endif /* CONFIG_ARCH_STACKDUMP */ diff --git a/arch/avr/src/avr32/up_dumpstate.c b/arch/avr/src/avr32/up_dumpstate.c index 345eb34863..55c4a7cbac 100644 --- a/arch/avr/src/avr32/up_dumpstate.c +++ b/arch/avr/src/avr32/up_dumpstate.c @@ -39,6 +39,13 @@ #include +/* Output debug info -- even if debug is not selected. */ + +#undef CONFIG_DEBUG +#undef CONFIG_DEBUG_VERBOSE +#define CONFIG_DEBUG 1 +#define CONFIG_DEBUG_VERBOSE 1 + #include #include #include @@ -64,13 +71,6 @@ # undef CONFIG_DEBUG_STACK #endif -/* Output debug info if stack dump is selected -- even if debug is not - * selected. - */ - -#undef lldbg -#define lldbg lowsyslog - /**************************************************************************** * Private Data ****************************************************************************/ diff --git a/arch/avr/src/common/up_assert.c b/arch/avr/src/common/up_assert.c index ee180f17fd..411f7d68be 100644 --- a/arch/avr/src/common/up_assert.c +++ b/arch/avr/src/common/up_assert.c @@ -39,6 +39,17 @@ #include +/* Output debug info if stack dump is selected -- even if debug is not + * selected. + */ + +#ifdef CONFIG_ARCH_STACKDUMP +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +#endif + #include #include #include @@ -76,15 +87,6 @@ # define CONFIG_PRINT_TASKNAME 1 #endif -/* If there is going to be stackdump output, then we should turn on output - * here unconditionally as well. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /**************************************************************************** * Private Data ****************************************************************************/ @@ -126,9 +128,22 @@ static void _up_assert(int errorcode) ****************************************************************************/ #ifdef CONFIG_ARCH_USBDUMP -static int assert_tracecallback(struct usbtrace_s *trace, void *arg) +static int usbtrace_syslog(FAR const char *fmt, ...) { - usbtrace_trprintf((trprintf_t)lowsyslog, trace->event, trace->value); + va_list ap; + int ret; + + /* Let vsyslog do the real work */ + + va_start(ap, fmt); + ret = lowvsyslog(LOG_INFO, fmt, ap); + va_end(ap); + return ret; +} + +static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg) +{ + usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value); return 0; } #endif diff --git a/arch/hc/src/m9s12/m9s12_assert.c b/arch/hc/src/m9s12/m9s12_assert.c index 89c4c953f9..9ab95d3a97 100644 --- a/arch/hc/src/m9s12/m9s12_assert.c +++ b/arch/hc/src/m9s12/m9s12_assert.c @@ -39,6 +39,17 @@ #include +/* Output debug info if stack dump is selected -- even if debug is not + * selected. + */ + +#ifdef CONFIG_ARCH_STACKDUMP +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +#endif + #include #include #include @@ -63,15 +74,6 @@ # undef CONFIG_ARCH_USBDUMP #endif -/* Output debug info if stack dump is selected -- even if - * debug is not selected. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /* The following is just intended to keep some ugliness out of the mainline * code. We are going to print the task name if: * @@ -161,9 +163,22 @@ static inline void up_registerdump(void) ****************************************************************************/ #ifdef CONFIG_ARCH_USBDUMP -static int assert_tracecallback(struct usbtrace_s *trace, void *arg) +static int usbtrace_syslog(FAR const char *fmt, ...) { - usbtrace_trprintf((trprintf_t)lowsyslog, trace->event, trace->value); + va_list ap; + int ret; + + /* Let vsyslog do the real work */ + + va_start(ap, fmt); + ret = lowvsyslog(LOG_INFO, fmt, ap); + va_end(ap); + return ret; +} + +static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg) +{ + usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value); return 0; } #endif diff --git a/arch/mips/src/mips32/up_assert.c b/arch/mips/src/mips32/up_assert.c index a5af9dabcc..80e95203b8 100644 --- a/arch/mips/src/mips32/up_assert.c +++ b/arch/mips/src/mips32/up_assert.c @@ -39,6 +39,17 @@ #include +/* Output debug info if stack dump is selected -- even if debug is not + * selected. + */ + +#ifdef CONFIG_ARCH_STACKDUMP +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +#endif + #include #include #include @@ -63,15 +74,6 @@ # undef CONFIG_ARCH_USBDUMP #endif -/* Output debug info if stack dump is selected -- even if debug is not - * selected. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /* The following is just intended to keep some ugliness out of the mainline * code. We are going to print the task name if: * @@ -126,9 +128,22 @@ static void _up_assert(int errorcode) ****************************************************************************/ #ifdef CONFIG_ARCH_USBDUMP -static int assert_tracecallback(struct usbtrace_s *trace, void *arg) +static int usbtrace_syslog(FAR const char *fmt, ...) { - usbtrace_trprintf((trprintf_t)lowsyslog, trace->event, trace->value); + va_list ap; + int ret; + + /* Let vsyslog do the real work */ + + va_start(ap, fmt); + ret = lowvsyslog(LOG_INFO, fmt, ap); + va_end(ap); + return ret; +} + +static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg) +{ + usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value); return 0; } #endif diff --git a/arch/mips/src/mips32/up_dumpstate.c b/arch/mips/src/mips32/up_dumpstate.c index f4b35e54d5..714e9a882b 100644 --- a/arch/mips/src/mips32/up_dumpstate.c +++ b/arch/mips/src/mips32/up_dumpstate.c @@ -39,6 +39,13 @@ #include +/* Output debug info -- even if debug is not selected. */ + +#undef CONFIG_DEBUG +#undef CONFIG_DEBUG_VERBOSE +#define CONFIG_DEBUG 1 +#define CONFIG_DEBUG_VERBOSE 1 + #include #include #include @@ -58,13 +65,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* Output debug info if stack dump is selected -- even if debug is not - * selected. - */ - -#undef lldbg -#define lldbg lowsyslog - /**************************************************************************** * Private Data ****************************************************************************/ diff --git a/arch/sh/src/common/up_assert.c b/arch/sh/src/common/up_assert.c index 1aab5b7eec..f53cc38dd2 100644 --- a/arch/sh/src/common/up_assert.c +++ b/arch/sh/src/common/up_assert.c @@ -39,6 +39,17 @@ #include +/* Output debug info if stack dump is selected -- even if debug is not + * selected. + */ + +#ifdef CONFIG_ARCH_STACKDUMP +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +#endif + #include #include #include @@ -57,21 +68,13 @@ /**************************************************************************** * Definitions ****************************************************************************/ + /* USB trace dumping */ #ifndef CONFIG_USBDEV_TRACE # undef CONFIG_ARCH_USBDUMP #endif -/* Output debug info if stack dump is selected -- even if - * debug is not selected. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /**************************************************************************** * Private Data ****************************************************************************/ @@ -113,9 +116,22 @@ static void _up_assert(int errorcode) ****************************************************************************/ #ifdef CONFIG_ARCH_USBDUMP -static int assert_tracecallback(struct usbtrace_s *trace, void *arg) +static int usbtrace_syslog(FAR const char *fmt, ...) { - usbtrace_trprintf((trprintf_t)lowsyslog, trace->event, trace->value); + va_list ap; + int ret; + + /* Let vsyslog do the real work */ + + va_start(ap, fmt); + ret = lowvsyslog(LOG_INFO, fmt, ap); + va_end(ap); + return ret; +} + +static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg) +{ + usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value); return 0; } #endif diff --git a/arch/sh/src/m16c/m16c_dumpstate.c b/arch/sh/src/m16c/m16c_dumpstate.c index 41363322e7..8da3c79777 100644 --- a/arch/sh/src/m16c/m16c_dumpstate.c +++ b/arch/sh/src/m16c/m16c_dumpstate.c @@ -39,6 +39,13 @@ #include +/* Output debug info -- even if debug is not selected. */ + +#undef CONFIG_DEBUG +#undef CONFIG_DEBUG_VERBOSE +#define CONFIG_DEBUG 1 +#define CONFIG_DEBUG_VERBOSE 1 + #include #include @@ -53,18 +60,9 @@ #ifdef CONFIG_ARCH_STACKDUMP /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ -/* Output debug info if stack dump is selected -- even if debug is not - * selected. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /**************************************************************************** * Private Data ****************************************************************************/ diff --git a/arch/sh/src/sh1/sh1_dumpstate.c b/arch/sh/src/sh1/sh1_dumpstate.c index 5472261b3f..a6e714d8c7 100644 --- a/arch/sh/src/sh1/sh1_dumpstate.c +++ b/arch/sh/src/sh1/sh1_dumpstate.c @@ -39,6 +39,13 @@ #include +/* Output debug info -- even if debug is not selected. */ + +#undef CONFIG_DEBUG +#undef CONFIG_DEBUG_VERBOSE +#define CONFIG_DEBUG 1 +#define CONFIG_DEBUG_VERBOSE 1 + #include #include @@ -52,18 +59,9 @@ #ifdef CONFIG_ARCH_STACKDUMP /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ -/* Output debug info if stack dump is selected -- even if - * debug is not selected. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /**************************************************************************** * Private Data ****************************************************************************/ diff --git a/arch/sim/src/up_initialize.c b/arch/sim/src/up_initialize.c index 0ab1add7ff..6ae39f94ae 100644 --- a/arch/sim/src/up_initialize.c +++ b/arch/sim/src/up_initialize.c @@ -119,7 +119,7 @@ void up_initialize(void) */ #ifdef CONFIG_NET - syslog("SIM: Initializing"); + syslog(LOG_INFO, "SIM: Initializing"); #endif #if CONFIG_NFILE_DESCRIPTORS > 0 diff --git a/arch/sim/src/up_tapdev.c b/arch/sim/src/up_tapdev.c index 32ddade602..11459e15e0 100644 --- a/arch/sim/src/up_tapdev.c +++ b/arch/sim/src/up_tapdev.c @@ -61,9 +61,6 @@ #include #include -extern int syslog(const char *format, ...); -extern int netdriver_setmacaddr(unsigned char *macaddr); - /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -84,6 +81,11 @@ extern int netdriver_setmacaddr(unsigned char *macaddr); # define TAP_IPADDR3 0 #endif +/* Syslog priority (must match definitions in nuttx/include/syslog.h) */ + +#define LOG_INFO 1 /* Informational message */ +#define LOG_ERR 4 /* Error conditions */ + /**************************************************************************** * Private Types ****************************************************************************/ @@ -103,6 +105,13 @@ struct sel_arg_struct * Private Function Prototypes ****************************************************************************/ +/**************************************************************************** + * NuttX Domain Public Function Prototypes + ****************************************************************************/ + +int syslog(int priority, const char *format, ...); +int netdriver_setmacaddr(unsigned char *macaddr); + /**************************************************************************** * Private Data ****************************************************************************/ @@ -119,8 +128,9 @@ static int gtapdevfd; #ifdef TAPDEV_DEBUG static inline void dump_ethhdr(const char *msg, unsigned char *buf, int buflen) { - syslog("TAPDEV: %s %d bytes\n", msg, buflen); - syslog(" %02x:%02x:%02x:%02x:%02x:%02x %02x:%02x:%02x:%02x:%02x:%02x %02x%02x\n", + syslog(LOG_INFO, "TAPDEV: %s %d bytes\n", msg, buflen); + syslog(LOG_INFO, + " %02x:%02x:%02x:%02x:%02x:%02x %02x:%02x:%02x:%02x:%02x:%02x %02x%02x\n", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7], buf[8], buf[9], buf[10], buf[11], #ifdef CONFIG_ENDIAN_BIG @@ -179,7 +189,7 @@ void tapdev_init(void) gtapdevfd = open(DEVTAP, O_RDWR, 0644); if (gtapdevfd < 0) { - syslog("TAPDEV: open failed: %d\n", -gtapdevfd ); + syslog(LOG_ERR, "TAPDEV: open failed: %d\n", -gtapdevfd ); return; } @@ -190,7 +200,7 @@ void tapdev_init(void) ret = ioctl(gtapdevfd, TUNSETIFF, (unsigned long) &ifr); if (ret < 0) { - syslog("TAPDEV: ioctl failed: %d\n", -ret ); + syslog(LOG_ERR, "TAPDEV: ioctl failed: %d\n", -ret ); return; } @@ -235,7 +245,7 @@ unsigned int tapdev_read(unsigned char *buf, unsigned int buflen) ret = read(gtapdevfd, buf, buflen); if (ret < 0) { - syslog("TAPDEV: read failed: %d\n", -ret); + syslog(LOG_ERR, "TAPDEV: read failed: %d\n", -ret); return 0; } @@ -247,12 +257,12 @@ void tapdev_send(unsigned char *buf, unsigned int buflen) { int ret; #ifdef TAPDEV_DEBUG - syslog("tapdev_send: sending %d bytes\n", buflen); + syslog(LOG_INFO, "tapdev_send: sending %d bytes\n", buflen); gdrop++; if (gdrop % 8 == 7) { - syslog("Dropped a packet!\n"); + syslog(LOG_ERR, "TAPDEV: Dropped a packet!\n"); return; } #endif @@ -260,7 +270,7 @@ void tapdev_send(unsigned char *buf, unsigned int buflen) ret = write(gtapdevfd, buf, buflen); if (ret < 0) { - syslog("TAPDEV: write failed: %d", -ret); + syslog(LOG_ERR, "TAPDEV: write failed: %d", -ret); exit(1); } dump_ethhdr("write", buf, buflen); diff --git a/arch/x86/src/common/up_assert.c b/arch/x86/src/common/up_assert.c index 30aee2b23d..93d541e5b1 100644 --- a/arch/x86/src/common/up_assert.c +++ b/arch/x86/src/common/up_assert.c @@ -39,6 +39,17 @@ #include +/* Output debug info if stack dump is selected -- even if debug is not + * selected. + */ + +#ifdef CONFIG_ARCH_STACKDUMP +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +#endif + #include #include #include @@ -64,15 +75,6 @@ # undef CONFIG_ARCH_USBDUMP #endif -/* Output debug info if stack dump is selected -- even if - * debug is not selected. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /* The following is just intended to keep some ugliness out of the mainline * code. We are going to print the task name if: * @@ -120,9 +122,22 @@ static void up_stackdump(uint32_t sp, uint32_t stack_base) ****************************************************************************/ #ifdef CONFIG_ARCH_USBDUMP -static int assert_tracecallback(struct usbtrace_s *trace, void *arg) +static int usbtrace_syslog(FAR const char *fmt, ...) { - usbtrace_trprintf((trprintf_t)lowsyslog, trace->event, trace->value); + va_list ap; + int ret; + + /* Let vsyslog do the real work */ + + va_start(ap, fmt); + ret = lowvsyslog(LOG_INFO, fmt, ap); + va_end(ap); + return ret; +} + +static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg) +{ + usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value); return 0; } #endif diff --git a/arch/x86/src/i486/up_regdump.c b/arch/x86/src/i486/up_regdump.c index e30670128c..4cc2d8cb36 100644 --- a/arch/x86/src/i486/up_regdump.c +++ b/arch/x86/src/i486/up_regdump.c @@ -39,6 +39,13 @@ #include +/* Output debug info -- even if debug is not selected. */ + +#undef CONFIG_DEBUG +#undef CONFIG_DEBUG_VERBOSE +#define CONFIG_DEBUG 1 +#define CONFIG_DEBUG_VERBOSE 1 + #include #include @@ -48,11 +55,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* Output debug info -- even if debug is not selected. */ - -#undef lldbg -#define lldbg lowsyslog - /**************************************************************************** * Private Data ****************************************************************************/ diff --git a/arch/z16/src/common/up_assert.c b/arch/z16/src/common/up_assert.c index df7121c040..00f840b528 100644 --- a/arch/z16/src/common/up_assert.c +++ b/arch/z16/src/common/up_assert.c @@ -39,6 +39,17 @@ #include +/* Output debug info if stack dump is selected -- even if debug is not + * selected. + */ + +#ifdef CONFIG_ARCH_STACKDUMP +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +#endif + #include #include #include @@ -57,21 +68,13 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* USB trace dumping */ #ifndef CONFIG_USBDEV_TRACE # undef CONFIG_ARCH_USBDUMP #endif -/* Output debug info if stack dump is selected -- even if - * debug is not selected. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /**************************************************************************** * Private Data ****************************************************************************/ @@ -112,9 +115,22 @@ static void _up_assert(int errorcode) /* noreturn_function */ ****************************************************************************/ #ifdef CONFIG_ARCH_USBDUMP -static int assert_tracecallback(struct usbtrace_s *trace, void *arg) +static int usbtrace_syslog(FAR const char *fmt, ...) { - usbtrace_trprintf((trprintf_t)lowsyslog, trace->event, trace->value); + va_list ap; + int ret; + + /* Let vsyslog do the real work */ + + va_start(ap, fmt); + ret = lowvsyslog(LOG_INFO, fmt, ap); + va_end(ap); + return ret; +} + +static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg) +{ + usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value); return 0; } #endif diff --git a/arch/z16/src/common/up_registerdump.c b/arch/z16/src/common/up_registerdump.c index 30b6227de7..a447cbc457 100644 --- a/arch/z16/src/common/up_registerdump.c +++ b/arch/z16/src/common/up_registerdump.c @@ -39,6 +39,17 @@ #include +/* Output debug info if stack dump is selected -- even if + * debug is not selected. + */ + +#ifdef CONFIG_ARCH_STACKDUMP +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +#endif + #include #include @@ -47,18 +58,11 @@ #include "up_internal.h" -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Output debug info if stack dump is selected -- even if - * debug is not selected. - */ - #ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ /**************************************************************************** * Private Data @@ -72,7 +76,6 @@ * Name: up_registerdump ****************************************************************************/ -#ifdef CONFIG_ARCH_STACKDUMP static void up_registerdump(void) { FAR uint32_t *regs32 = (FAR uint32_t*)current_regs; @@ -86,4 +89,5 @@ static void up_registerdump(void) lldbg("FP :%08x SP :%08x FLG:%04x\n" regs32[REG_R14/2], regs32[REG_R15/2], current_regs[REG_FLAGS]); } -#endif + +#endif /* CONFIG_ARCH_STACKDUMP */ diff --git a/arch/z16/src/common/up_stackdump.c b/arch/z16/src/common/up_stackdump.c index a1271b2d9f..ee70a0c040 100644 --- a/arch/z16/src/common/up_stackdump.c +++ b/arch/z16/src/common/up_stackdump.c @@ -39,24 +39,24 @@ #include +/* Output debug info -- even if debug is not selected. */ + +#undef CONFIG_DEBUG +#undef CONFIG_DEBUG_VERBOSE +#define CONFIG_DEBUG 1 +#define CONFIG_DEBUG_VERBOSE 1 + #include #include "chip/chip.h" #include "sched/sched.h" #include "up_internal.h" -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Output debug info if stack dump is selected -- even if - * debug is not selected. - */ - #ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ /**************************************************************************** * Private Data @@ -75,7 +75,6 @@ * Name: up_stackdump ****************************************************************************/ -#ifdef CONFIG_ARCH_STACKDUMP static void up_stackdump(void) { struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head; @@ -105,4 +104,5 @@ static void up_stackdump(void) } } } -#endif + +#endif /* CONFIG_ARCH_STACKDUMP */ diff --git a/arch/z16/src/z16f/z16f_sysexec.c b/arch/z16/src/z16f/z16f_sysexec.c index 6a74f7ee4a..b250c2b585 100644 --- a/arch/z16/src/z16f/z16f_sysexec.c +++ b/arch/z16/src/z16f/z16f_sysexec.c @@ -48,15 +48,9 @@ #include "up_internal.h" /*************************************************************************** - * Definitions + * Pre-processor Definitions ***************************************************************************/ -#ifdef CONFIG_ARCH_LOWPUTC -# define SYSDBG lowsyslog -#else -# define SYSDBG syslog -#endif - /*************************************************************************** * Private Types ***************************************************************************/ @@ -94,42 +88,42 @@ void z16f_sysexec(FAR chipreg_t *regs) excp = getreg16(Z16F_SYSEXCP); if ((excp & Z16F_SYSEXCP_SPOVF) != 0) { - SYSDBG("SP OVERFLOW\n"); + lowsyslog(LOG_ERR, "SP OVERFLOW\n"); } if ((excp & Z16F_SYSEXCP_PCOVF) != 0) { - SYSDBG("PC OVERFLOW\n"); + lowsyslog(LOG_ERR, "PC OVERFLOW\n"); } if ((excp & Z16F_SYSEXCP_DIV0) != 0) { - SYSDBG("Divide by zero\n"); + lowsyslog(LOG_ERR, "Divide by zero\n"); } if ((excp & Z16F_SYSEXCP_DIVOVF) != 0) { - SYSDBG("Divide overflow\n"); + lowsyslog(LOG_ERR, "Divide overflow\n"); } if ((excp & Z16F_SYSEXCP_ILL) != 0) { - SYSDBG("Illegal instruction\n"); + lowsyslog(LOG_ERR, "Illegal instruction\n"); } if ((excp & Z16F_SYSEXCP_WDTOSC) != 0) { - SYSDBG("WDT oscillator failure\n"); + lowsyslog(LOG_ERR, "WDT oscillator failure\n"); } if ((excp & Z16F_SYSEXCP_PRIOSC) != 0) { - SYSDBG("Primary Oscillator Failure\n"); + lowsyslog(LOG_ERR, "Primary Oscillator Failure\n"); } if ((excp & Z16F_SYSEXCP_WDT) != 0) { - SYSDBG("Watchdog timeout\n"); + lowsyslog(LOG_ERR, "Watchdog timeout\n"); z16f_reset(); } diff --git a/arch/z80/src/common/up_assert.c b/arch/z80/src/common/up_assert.c index 4734232623..628557a285 100644 --- a/arch/z80/src/common/up_assert.c +++ b/arch/z80/src/common/up_assert.c @@ -39,6 +39,17 @@ #include +/* Output debug info if stack dump is selected -- even if debug is not + * selected. + */ + +#ifdef CONFIG_ARCH_STACKDUMP +# undef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# define CONFIG_DEBUG 1 +# define CONFIG_DEBUG_VERBOSE 1 +#endif + #include #include #include @@ -56,21 +67,13 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* USB trace dumping */ #ifndef CONFIG_USBDEV_TRACE # undef CONFIG_ARCH_USBDUMP #endif -/* Output debug info if stack dump is selected -- even if - * debug is not selected. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /**************************************************************************** * Private Data ****************************************************************************/ @@ -111,9 +114,22 @@ static void _up_assert(int errorcode) /* noreturn_function */ ****************************************************************************/ #ifdef CONFIG_ARCH_USBDUMP +static int usbtrace_syslog(FAR const char *fmt, ...) +{ + va_list ap; + int ret; + + /* Let vsyslog do the real work */ + + va_start(ap, fmt); + ret = lowvsyslog(LOG_INFO, fmt, ap); + va_end(ap); + return ret; +} + static int assert_tracecallback(struct usbtrace_s *trace, void *arg) { - usbtrace_trprintf((trprintf_t)lowsyslog, trace->event, trace->value); + usbtrace_trprintf(FAR usbtrace_syslog, trace->event, FAR trace->value); return 0; } #endif diff --git a/arch/z80/src/common/up_doirq.c b/arch/z80/src/common/up_doirq.c index caa03ea9a4..120fefd2c6 100644 --- a/arch/z80/src/common/up_doirq.c +++ b/arch/z80/src/common/up_doirq.c @@ -77,7 +77,7 @@ FAR chipreg_t *up_doirq(uint8_t irq, FAR chipreg_t *regs) #ifdef CONFIG_SUPPRESS_INTERRUPTS - lowsyslog("Unexpected IRQ\n"); + lowsyslog(LOG_ERR, "Unexpected IRQ\n"); IRQ_ENTER(regs); PANIC(); return NULL; /* Won't get here */ diff --git a/arch/z80/src/common/up_stackdump.c b/arch/z80/src/common/up_stackdump.c index 93dfb7291d..dc19f76ed8 100644 --- a/arch/z80/src/common/up_stackdump.c +++ b/arch/z80/src/common/up_stackdump.c @@ -39,6 +39,13 @@ #include +/* Output debug info -- even if debug is not selected. */ + +#undef CONFIG_DEBUG +#undef CONFIG_DEBUG_VERBOSE +#define CONFIG_DEBUG 1 +#define CONFIG_DEBUG_VERBOSE 1 + #include #include @@ -46,18 +53,11 @@ #include "sched/sched.h" #include "up_internal.h" -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Output debug info if stack dump is selected -- even if - * debug is not selected. - */ - #ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ /**************************************************************************** * Private Data @@ -76,7 +76,6 @@ * Name: up_stackdump ****************************************************************************/ -#ifdef CONFIG_ARCH_STACKDUMP static void up_stackdump(void) { struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head; @@ -106,4 +105,5 @@ static void up_stackdump(void) } } } -#endif + +#endif /* CONFIG_ARCH_STACKDUMP */ diff --git a/arch/z80/src/ez80/ez80_registerdump.c b/arch/z80/src/ez80/ez80_registerdump.c index 85ab0a42a9..880bdbe5e9 100644 --- a/arch/z80/src/ez80/ez80_registerdump.c +++ b/arch/z80/src/ez80/ez80_registerdump.c @@ -39,6 +39,13 @@ #include +/* Output debug info -- even if debug is not selected. */ + +#undef CONFIG_DEBUG +#undef CONFIG_DEBUG_VERBOSE +#define CONFIG_DEBUG 1 +#define CONFIG_DEBUG_VERBOSE 1 + #include #include @@ -47,18 +54,11 @@ #include "chip/switch.h" #include "up_internal.h" -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Output debug info if stack dump is selected -- even if - * debug is not selected. - */ - #ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ /**************************************************************************** * Private Data @@ -72,7 +72,6 @@ * Name: z80_registerdump ****************************************************************************/ -#ifdef CONFIG_ARCH_STACKDUMP static void ez80_registerdump(void) { if (current_regs) @@ -98,4 +97,5 @@ static void ez80_registerdump(void) #endif } } -#endif + +#endif /* CONFIG_ARCH_STACKDUMP */ diff --git a/arch/z80/src/z180/z180_registerdump.c b/arch/z80/src/z180/z180_registerdump.c index 9b4ed60f94..bf6e52bd4d 100644 --- a/arch/z80/src/z180/z180_registerdump.c +++ b/arch/z80/src/z180/z180_registerdump.c @@ -39,6 +39,13 @@ #include +/* Output debug info -- even if debug is not selected. */ + +#undef CONFIG_DEBUG +#undef CONFIG_DEBUG_VERBOSE +#define CONFIG_DEBUG 1 +#define CONFIG_DEBUG_VERBOSE 1 + #include #include @@ -47,19 +54,12 @@ #include "chip/switch.h" #include "up_internal.h" +#ifdef CONFIG_ARCH_STACKDUMP + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ -/* Output debug info if stack dump is selected -- even if - * debug is not selected. - */ - -#ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif - /**************************************************************************** * Private Data ****************************************************************************/ @@ -72,7 +72,6 @@ * Name: z180_registerdump ****************************************************************************/ -#ifdef CONFIG_ARCH_STACKDUMP static void z180_registerdump(void) { if (current_regs) @@ -89,4 +88,5 @@ static void z180_registerdump(void) inp(Z180_MMU_CBAR), inp(Z180_MMU_BBR), inp(Z180_MMU_CBR)); } } -#endif + +#endif /* CONFIG_ARCH_STACKDUMP */ diff --git a/arch/z80/src/z8/z8_registerdump.c b/arch/z80/src/z8/z8_registerdump.c index c80b7da684..df6c761a7c 100644 --- a/arch/z80/src/z8/z8_registerdump.c +++ b/arch/z80/src/z8/z8_registerdump.c @@ -39,6 +39,13 @@ #include +/* Output debug info -- even if debug is not selected. */ + +#undef CONFIG_DEBUG +#undef CONFIG_DEBUG_VERBOSE +#define CONFIG_DEBUG 1 +#define CONFIG_DEBUG_VERBOSE 1 + #include #include @@ -48,18 +55,11 @@ #include "chip/switch.h" #include "up_internal.h" -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Output debug info if stack dump is selected -- even if - * debug is not selected. - */ - #ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ /**************************************************************************** * Private Data @@ -69,7 +69,6 @@ * Private Functions ****************************************************************************/ -#ifdef CONFIG_ARCH_STACKDUMP static inline void z8_dumpregs(FAR chipret_t *regs) { lldbg("REGS: %04x %04x %04x %04x %04x %04x %04x %04x\n", @@ -84,8 +83,6 @@ static inline void z8_dumpstate(chipreg_t sp, chipreg_t pc, uint8_t irqctl, sp, pc, irqctl & 0xff, rpflags >> 8, rpflags & 0xff); } -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -94,7 +91,6 @@ static inline void z8_dumpstate(chipreg_t sp, chipreg_t pc, uint8_t irqctl, * Name: z8_registerdump ****************************************************************************/ -#ifdef CONFIG_ARCH_STACKDUMP void z8_registerdump(void) { FAR chipret_t *regs; @@ -137,4 +133,5 @@ void z8_registerdump(void) break; } } -#endif + +#endif /* CONFIG_ARCH_STACKDUMP */ diff --git a/arch/z80/src/z80/z80_registerdump.c b/arch/z80/src/z80/z80_registerdump.c index 86b2e18952..4d80a545c2 100644 --- a/arch/z80/src/z80/z80_registerdump.c +++ b/arch/z80/src/z80/z80_registerdump.c @@ -39,6 +39,13 @@ #include +/* Output debug info -- even if debug is not selected. */ + +#undef CONFIG_DEBUG +#undef CONFIG_DEBUG_VERBOSE +#define CONFIG_DEBUG 1 +#define CONFIG_DEBUG_VERBOSE 1 + #include #include @@ -47,18 +54,11 @@ #include "chip/switch.h" #include "up_internal.h" -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Output debug info if stack dump is selected -- even if - * debug is not selected. - */ - #ifdef CONFIG_ARCH_STACKDUMP -# undef lldbg -# define lldbg lowsyslog -#endif + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ /**************************************************************************** * Private Data @@ -72,7 +72,6 @@ * Name: z80_registerdump ****************************************************************************/ -#ifdef CONFIG_ARCH_STACKDUMP static void z80_registerdump(void) { if (current_regs) @@ -87,4 +86,5 @@ static void z80_registerdump(void) current_regs[XCPT_SP], current_regs[XCPT_PC]); } } -#endif + +#endif /* CONFIG_ARCH_STACKDUMP */