diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-10-08 12:48:47 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-10-08 12:48:47 -0600 |
commit | ce145c005c24d2e785601208dfd2322e47454a5b (patch) | |
tree | 4cfe2e74efa83e9cacbb8a99ea7a48c11beb2a4d | |
parent | 26710412ad35431bf2c992c2add76314962f401a (diff) | |
download | nuttx-ce145c005c24d2e785601208dfd2322e47454a5b.tar.gz nuttx-ce145c005c24d2e785601208dfd2322e47454a5b.tar.bz2 nuttx-ce145c005c24d2e785601208dfd2322e47454a5b.zip |
Update everything under nuttx/arch to use the corrected syslog interfaces
46 files changed, 576 insertions, 375 deletions
diff --git a/nuttx/arch/arm/src/arm/up_assert.c b/nuttx/arch/arm/src/arm/up_assert.c index c594a58de..4c54e099b 100644 --- a/nuttx/arch/arm/src/arm/up_assert.c +++ b/nuttx/arch/arm/src/arm/up_assert.c @@ -39,6 +39,18 @@ #include <nuttx/config.h> +/* 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 <stdarg.h> #include <stdint.h> #include <stdlib.h> #include <assert.h> @@ -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, ...) +{ + 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((trprintf_t)lowsyslog, trace->event, trace->value); + usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value); return 0; } #endif diff --git a/nuttx/arch/arm/src/arm/up_dataabort.c b/nuttx/arch/arm/src/arm/up_dataabort.c index dc2a08a47..2dbf898e1 100644 --- a/nuttx/arch/arm/src/arm/up_dataabort.c +++ b/nuttx/arch/arm/src/arm/up_dataabort.c @@ -39,6 +39,17 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <debug.h> @@ -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/nuttx/arch/arm/src/arm/up_prefetchabort.c b/nuttx/arch/arm/src/arm/up_prefetchabort.c index 577bc1b8b..69fba8be5 100644 --- a/nuttx/arch/arm/src/arm/up_prefetchabort.c +++ b/nuttx/arch/arm/src/arm/up_prefetchabort.c @@ -39,6 +39,17 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <debug.h> @@ -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/nuttx/arch/arm/src/arm/up_syscall.c b/nuttx/arch/arm/src/arm/up_syscall.c index 4d4110b12..990baed25 100644 --- a/nuttx/arch/arm/src/arm/up_syscall.c +++ b/nuttx/arch/arm/src/arm/up_syscall.c @@ -39,6 +39,17 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <debug.h> @@ -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/nuttx/arch/arm/src/arm/up_undefinedinsn.c b/nuttx/arch/arm/src/arm/up_undefinedinsn.c index bb80be9b2..fc5742721 100644 --- a/nuttx/arch/arm/src/arm/up_undefinedinsn.c +++ b/nuttx/arch/arm/src/arm/up_undefinedinsn.c @@ -39,6 +39,17 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <assert.h> #include <debug.h> @@ -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/nuttx/arch/arm/src/armv6-m/up_assert.c b/nuttx/arch/arm/src/armv6-m/up_assert.c index 492ee730e..69af23fa0 100644 --- a/nuttx/arch/arm/src/armv6-m/up_assert.c +++ b/nuttx/arch/arm/src/armv6-m/up_assert.c @@ -39,6 +39,17 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <stdlib.h> #include <assert.h> @@ -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, ...) +{ + 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((trprintf_t)lowsyslog, trace->event, trace->value); + usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value); return 0; } #endif diff --git a/nuttx/arch/arm/src/armv7-a/arm_assert.c b/nuttx/arch/arm/src/armv7-a/arm_assert.c index a97f09197..c08da07b4 100644 --- a/nuttx/arch/arm/src/armv7-a/arm_assert.c +++ b/nuttx/arch/arm/src/armv7-a/arm_assert.c @@ -39,6 +39,17 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <stdlib.h> #include <assert.h> @@ -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, ...) +{ + 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((trprintf_t)lowsyslog, trace->event, trace->value); + usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value); return 0; } #endif diff --git a/nuttx/arch/arm/src/armv7-a/arm_dataabort.c b/nuttx/arch/arm/src/armv7-a/arm_dataabort.c index 073afe210..1066a8d21 100644 --- a/nuttx/arch/arm/src/armv7-a/arm_dataabort.c +++ b/nuttx/arch/arm/src/armv7-a/arm_dataabort.c @@ -39,6 +39,17 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <debug.h> @@ -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/nuttx/arch/arm/src/armv7-a/arm_prefetchabort.c b/nuttx/arch/arm/src/armv7-a/arm_prefetchabort.c index 089e6105c..1b4bd6dcf 100644 --- a/nuttx/arch/arm/src/armv7-a/arm_prefetchabort.c +++ b/nuttx/arch/arm/src/armv7-a/arm_prefetchabort.c @@ -39,6 +39,17 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <debug.h> @@ -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/nuttx/arch/arm/src/armv7-a/arm_syscall.c b/nuttx/arch/arm/src/armv7-a/arm_syscall.c index 343226a86..9814b7e8e 100644 --- a/nuttx/arch/arm/src/armv7-a/arm_syscall.c +++ b/nuttx/arch/arm/src/armv7-a/arm_syscall.c @@ -39,6 +39,17 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <string.h> #include <syscall.h> @@ -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/nuttx/arch/arm/src/armv7-a/arm_undefinedinsn.c b/nuttx/arch/arm/src/armv7-a/arm_undefinedinsn.c index a1af60a4c..392cfb974 100644 --- a/nuttx/arch/arm/src/armv7-a/arm_undefinedinsn.c +++ b/nuttx/arch/arm/src/armv7-a/arm_undefinedinsn.c @@ -39,6 +39,17 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <assert.h> #include <debug.h> @@ -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/nuttx/arch/arm/src/armv7-m/up_assert.c b/nuttx/arch/arm/src/armv7-m/up_assert.c index a01cc0b48..7be0d02cb 100644 --- a/nuttx/arch/arm/src/armv7-m/up_assert.c +++ b/nuttx/arch/arm/src/armv7-m/up_assert.c @@ -39,6 +39,17 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <stdlib.h> #include <assert.h> @@ -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, ...) +{ + 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((trprintf_t)lowsyslog, trace->event, trace->value); + usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value); return 0; } #endif diff --git a/nuttx/arch/arm/src/dm320/dm320_decodeirq.c b/nuttx/arch/arm/src/dm320/dm320_decodeirq.c index 7616fe918..efdade56a 100644 --- a/nuttx/arch/arm/src/dm320/dm320_decodeirq.c +++ b/nuttx/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/nuttx/arch/arm/src/imx/imx_decodeirq.c b/nuttx/arch/arm/src/imx/imx_decodeirq.c index e241ae393..4e7c4e653 100644 --- a/nuttx/arch/arm/src/imx/imx_decodeirq.c +++ b/nuttx/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/nuttx/arch/arm/src/lpc214x/lpc214x_decodeirq.c b/nuttx/arch/arm/src/lpc214x/lpc214x_decodeirq.c index ea0eb5683..f5e467358 100644 --- a/nuttx/arch/arm/src/lpc214x/lpc214x_decodeirq.c +++ b/nuttx/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/nuttx/arch/arm/src/lpc2378/lpc23xx_decodeirq.c b/nuttx/arch/arm/src/lpc2378/lpc23xx_decodeirq.c index 85e0d3a1a..009414e92 100644 --- a/nuttx/arch/arm/src/lpc2378/lpc23xx_decodeirq.c +++ b/nuttx/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/nuttx/arch/arm/src/lpc31xx/lpc31_decodeirq.c b/nuttx/arch/arm/src/lpc31xx/lpc31_decodeirq.c index 355f13af3..1a29da818 100644 --- a/nuttx/arch/arm/src/lpc31xx/lpc31_decodeirq.c +++ b/nuttx/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/nuttx/arch/arm/src/stm32/stm32_i2c.c b/nuttx/arch/arm/src/stm32/stm32_i2c.c index cd4714fd4..b8bbd5820 100644 --- a/nuttx/arch/arm/src/stm32/stm32_i2c.c +++ b/nuttx/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/nuttx/arch/arm/src/stm32/stm32_i2c_alt.c b/nuttx/arch/arm/src/stm32/stm32_i2c_alt.c index 9a6e90999..51f0238dd 100755 --- a/nuttx/arch/arm/src/stm32/stm32_i2c_alt.c +++ b/nuttx/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/nuttx/arch/arm/src/stm32/stm32f30xxx_i2c.c b/nuttx/arch/arm/src/stm32/stm32f30xxx_i2c.c index f816bad30..8118133c0 100644 --- a/nuttx/arch/arm/src/stm32/stm32f30xxx_i2c.c +++ b/nuttx/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/nuttx/arch/arm/src/str71x/str71x_decodeirq.c b/nuttx/arch/arm/src/str71x/str71x_decodeirq.c index 0eacccf9c..6e9c9f738 100644 --- a/nuttx/arch/arm/src/str71x/str71x_decodeirq.c +++ b/nuttx/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/nuttx/arch/avr/src/avr/up_dumpstate.c b/nuttx/arch/avr/src/avr/up_dumpstate.c index 8802dd80c..78a8c50bf 100644 --- a/nuttx/arch/avr/src/avr/up_dumpstate.c +++ b/nuttx/arch/avr/src/avr/up_dumpstate.c @@ -39,6 +39,13 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <stdlib.h> #include <assert.h> @@ -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/nuttx/arch/avr/src/avr32/up_dumpstate.c b/nuttx/arch/avr/src/avr32/up_dumpstate.c index 345eb3486..55c4a7cba 100644 --- a/nuttx/arch/avr/src/avr32/up_dumpstate.c +++ b/nuttx/arch/avr/src/avr32/up_dumpstate.c @@ -39,6 +39,13 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <stdlib.h> #include <assert.h> @@ -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/nuttx/arch/avr/src/common/up_assert.c b/nuttx/arch/avr/src/common/up_assert.c index ee180f17f..411f7d68b 100644 --- a/nuttx/arch/avr/src/common/up_assert.c +++ b/nuttx/arch/avr/src/common/up_assert.c @@ -39,6 +39,17 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <stdlib.h> #include <assert.h> @@ -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, ...) +{ + 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((trprintf_t)lowsyslog, trace->event, trace->value); + usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value); return 0; } #endif diff --git a/nuttx/arch/hc/src/m9s12/m9s12_assert.c b/nuttx/arch/hc/src/m9s12/m9s12_assert.c index 89c4c953f..9ab95d3a9 100644 --- a/nuttx/arch/hc/src/m9s12/m9s12_assert.c +++ b/nuttx/arch/hc/src/m9s12/m9s12_assert.c @@ -39,6 +39,17 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <stdlib.h> #include <assert.h> @@ -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, ...) +{ + 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((trprintf_t)lowsyslog, trace->event, trace->value); + usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value); return 0; } #endif diff --git a/nuttx/arch/mips/src/mips32/up_assert.c b/nuttx/arch/mips/src/mips32/up_assert.c index a5af9dabc..80e95203b 100644 --- a/nuttx/arch/mips/src/mips32/up_assert.c +++ b/nuttx/arch/mips/src/mips32/up_assert.c @@ -39,6 +39,17 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <stdlib.h> #include <assert.h> @@ -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, ...) +{ + 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((trprintf_t)lowsyslog, trace->event, trace->value); + usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value); return 0; } #endif diff --git a/nuttx/arch/mips/src/mips32/up_dumpstate.c b/nuttx/arch/mips/src/mips32/up_dumpstate.c index f4b35e54d..714e9a882 100644 --- a/nuttx/arch/mips/src/mips32/up_dumpstate.c +++ b/nuttx/arch/mips/src/mips32/up_dumpstate.c @@ -39,6 +39,13 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <stdlib.h> #include <assert.h> @@ -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/nuttx/arch/sh/src/common/up_assert.c b/nuttx/arch/sh/src/common/up_assert.c index 1aab5b7ee..f53cc38dd 100644 --- a/nuttx/arch/sh/src/common/up_assert.c +++ b/nuttx/arch/sh/src/common/up_assert.c @@ -39,6 +39,17 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <stdlib.h> #include <assert.h> @@ -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, ...) +{ + 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((trprintf_t)lowsyslog, trace->event, trace->value); + usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value); return 0; } #endif diff --git a/nuttx/arch/sh/src/m16c/m16c_dumpstate.c b/nuttx/arch/sh/src/m16c/m16c_dumpstate.c index 41363322e..8da3c7977 100644 --- a/nuttx/arch/sh/src/m16c/m16c_dumpstate.c +++ b/nuttx/arch/sh/src/m16c/m16c_dumpstate.c @@ -39,6 +39,13 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <debug.h> @@ -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/nuttx/arch/sh/src/sh1/sh1_dumpstate.c b/nuttx/arch/sh/src/sh1/sh1_dumpstate.c index 5472261b3..a6e714d8c 100644 --- a/nuttx/arch/sh/src/sh1/sh1_dumpstate.c +++ b/nuttx/arch/sh/src/sh1/sh1_dumpstate.c @@ -39,6 +39,13 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <debug.h> @@ -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/nuttx/arch/sim/src/up_initialize.c b/nuttx/arch/sim/src/up_initialize.c index 0ab1add7f..6ae39f94a 100644 --- a/nuttx/arch/sim/src/up_initialize.c +++ b/nuttx/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/nuttx/arch/sim/src/up_tapdev.c b/nuttx/arch/sim/src/up_tapdev.c index 32ddade60..11459e15e 100644 --- a/nuttx/arch/sim/src/up_tapdev.c +++ b/nuttx/arch/sim/src/up_tapdev.c @@ -61,9 +61,6 @@ #include <linux/if_tun.h> #include <linux/net.h> -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 ****************************************************************************/ @@ -104,6 +106,13 @@ struct sel_arg_struct ****************************************************************************/ /**************************************************************************** + * 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/nuttx/arch/x86/src/common/up_assert.c b/nuttx/arch/x86/src/common/up_assert.c index 30aee2b23..93d541e5b 100644 --- a/nuttx/arch/x86/src/common/up_assert.c +++ b/nuttx/arch/x86/src/common/up_assert.c @@ -39,6 +39,17 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <stdlib.h> #include <assert.h> @@ -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, ...) +{ + 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((trprintf_t)lowsyslog, trace->event, trace->value); + usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value); return 0; } #endif diff --git a/nuttx/arch/x86/src/i486/up_regdump.c b/nuttx/arch/x86/src/i486/up_regdump.c index e30670128..4cc2d8cb3 100644 --- a/nuttx/arch/x86/src/i486/up_regdump.c +++ b/nuttx/arch/x86/src/i486/up_regdump.c @@ -39,6 +39,13 @@ #include <nuttx/config.h> +/* 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 <debug.h> #include <nuttx/irq.h> @@ -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/nuttx/arch/z16/src/common/up_assert.c b/nuttx/arch/z16/src/common/up_assert.c index df7121c04..00f840b52 100644 --- a/nuttx/arch/z16/src/common/up_assert.c +++ b/nuttx/arch/z16/src/common/up_assert.c @@ -39,6 +39,17 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <stdlib.h> #include <assert.h> @@ -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, ...) +{ + 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((trprintf_t)lowsyslog, trace->event, trace->value); + usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value); return 0; } #endif diff --git a/nuttx/arch/z16/src/common/up_registerdump.c b/nuttx/arch/z16/src/common/up_registerdump.c index 30b6227de..a447cbc45 100644 --- a/nuttx/arch/z16/src/common/up_registerdump.c +++ b/nuttx/arch/z16/src/common/up_registerdump.c @@ -39,6 +39,17 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <debug.h> @@ -47,19 +58,12 @@ #include "up_internal.h" +#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 ****************************************************************************/ @@ -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/nuttx/arch/z16/src/common/up_stackdump.c b/nuttx/arch/z16/src/common/up_stackdump.c index a1271b2d9..ee70a0c04 100644 --- a/nuttx/arch/z16/src/common/up_stackdump.c +++ b/nuttx/arch/z16/src/common/up_stackdump.c @@ -39,25 +39,25 @@ #include <nuttx/config.h> +/* 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 <debug.h> #include "chip/chip.h" #include "sched/sched.h" #include "up_internal.h" +#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 ****************************************************************************/ @@ -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/nuttx/arch/z16/src/z16f/z16f_sysexec.c b/nuttx/arch/z16/src/z16f/z16f_sysexec.c index 6a74f7ee4..b250c2b58 100644 --- a/nuttx/arch/z16/src/z16f/z16f_sysexec.c +++ b/nuttx/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/nuttx/arch/z80/src/common/up_assert.c b/nuttx/arch/z80/src/common/up_assert.c index 473423262..628557a28 100644 --- a/nuttx/arch/z80/src/common/up_assert.c +++ b/nuttx/arch/z80/src/common/up_assert.c @@ -39,6 +39,17 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <stdlib.h> #include <assert.h> @@ -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/nuttx/arch/z80/src/common/up_doirq.c b/nuttx/arch/z80/src/common/up_doirq.c index caa03ea9a..120fefd2c 100644 --- a/nuttx/arch/z80/src/common/up_doirq.c +++ b/nuttx/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/nuttx/arch/z80/src/common/up_stackdump.c b/nuttx/arch/z80/src/common/up_stackdump.c index 93dfb7291..dc19f76ed 100644 --- a/nuttx/arch/z80/src/common/up_stackdump.c +++ b/nuttx/arch/z80/src/common/up_stackdump.c @@ -39,6 +39,13 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <debug.h> @@ -46,19 +53,12 @@ #include "sched/sched.h" #include "up_internal.h" +#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 ****************************************************************************/ @@ -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/nuttx/arch/z80/src/ez80/ez80_registerdump.c b/nuttx/arch/z80/src/ez80/ez80_registerdump.c index 85ab0a42a..880bdbe5e 100644 --- a/nuttx/arch/z80/src/ez80/ez80_registerdump.c +++ b/nuttx/arch/z80/src/ez80/ez80_registerdump.c @@ -39,6 +39,13 @@ #include <nuttx/config.h> +/* 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 <debug.h> #include <nuttx/irq.h> @@ -47,19 +54,12 @@ #include "chip/switch.h" #include "up_internal.h" +#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 ****************************************************************************/ @@ -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/nuttx/arch/z80/src/z180/z180_registerdump.c b/nuttx/arch/z80/src/z180/z180_registerdump.c index 9b4ed60f9..bf6e52bd4 100644 --- a/nuttx/arch/z80/src/z180/z180_registerdump.c +++ b/nuttx/arch/z80/src/z180/z180_registerdump.c @@ -39,6 +39,13 @@ #include <nuttx/config.h> +/* 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 <debug.h> #include <nuttx/irq.h> @@ -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/nuttx/arch/z80/src/z8/z8_registerdump.c b/nuttx/arch/z80/src/z8/z8_registerdump.c index c80b7da68..df6c761a7 100644 --- a/nuttx/arch/z80/src/z8/z8_registerdump.c +++ b/nuttx/arch/z80/src/z8/z8_registerdump.c @@ -39,6 +39,13 @@ #include <nuttx/config.h> +/* 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 <stdint.h> #include <debug.h> @@ -48,19 +55,12 @@ #include "chip/switch.h" #include "up_internal.h" +#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 ****************************************************************************/ @@ -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/nuttx/arch/z80/src/z80/z80_registerdump.c b/nuttx/arch/z80/src/z80/z80_registerdump.c index 86b2e1895..4d80a545c 100644 --- a/nuttx/arch/z80/src/z80/z80_registerdump.c +++ b/nuttx/arch/z80/src/z80/z80_registerdump.c @@ -39,6 +39,13 @@ #include <nuttx/config.h> +/* 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 <debug.h> #include <nuttx/irq.h> @@ -47,19 +54,12 @@ #include "chip/switch.h" #include "up_internal.h" +#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 ****************************************************************************/ @@ -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 */ diff --git a/nuttx/include/syslog.h b/nuttx/include/syslog.h index b9fe547ee..6aebb367e 100644 --- a/nuttx/include/syslog.h +++ b/nuttx/include/syslog.h @@ -98,6 +98,11 @@ #define LOG_INFO 1 /* Informational message */ #define LOG_DEBUG 0 /* Debug-level message */ +/* Used with setlogmask() */ + +#define LOG_MASK(p) (1 << (p)) +#define LOG_UPTO(p) ((1 << (p)) - 1) + /**************************************************************************** * Public Type Declarations ****************************************************************************/ |