diff --git a/Kconfig b/Kconfig index 74dd7cfc00..cc8f3122df 100644 --- a/Kconfig +++ b/Kconfig @@ -1104,26 +1104,55 @@ config DEBUG_I2C_WARN default n depends on DEBUG_WARN ---help--- - Enable I2C drive warning output to SYSLOG. + Enable I2c driver warning output to SYSLOG. config DEBUG_I2C_INFO bool "I2C Informational Output" default n depends on DEBUG_INFO ---help--- - Enable I2C drive informational output to SYSLOG. + Enable I2c driver informational output to SYSLOG. endif # DEBUG_I2C config DEBUG_I2S - bool "I2S Debug Output" + bool "I2S Debug Features" default n depends on I2S ---help--- - Enable I2S driver debug SYSLOG output (disabled by default). + Enable I2S debug features. + Support for this debug option is architecture-specific and may not be available for some MCUs. +if DEBUG_I2S + +config DEBUG_I2S_ERROR + bool "I2S Error Output" + default n + depends on DEBUG_ERROR + ---help--- + Enable I2S driver error output to SYSLOG. + + Support for this debug option is architecture-specific and may not + be available for some MCUs. + +config DEBUG_I2S_WARN + bool "I2S Warnings Output" + default n + depends on DEBUG_WARN + ---help--- + Enable I2S driver warning output to SYSLOG. + +config DEBUG_I2S_INFO + bool "I2S Informational Output" + default n + depends on DEBUG_INFO + ---help--- + Enable I2S driver informational output to SYSLOG. + +endif # DEBUG_I2S + config DEBUG_PWM bool "PWM Debug Output" default n diff --git a/arch/arm/src/sama5/sam_ssc.c b/arch/arm/src/sama5/sam_ssc.c index 61b790ad04..d33b1588ff 100644 --- a/arch/arm/src/sama5/sam_ssc.c +++ b/arch/arm/src/sama5/sam_ssc.c @@ -397,12 +397,7 @@ * include/debug.h */ -#ifndef CONFIG_DEBUG_FEATURES -# undef CONFIG_DEBUG_INFO -# undef CONFIG_DEBUG_I2S -#endif - -#ifndef CONFIG_DEBUG_I2S +#ifndef CONFIG_DEBUG_I2S_INFO # undef CONFIG_SAMA5_SSC_DMADEBUG # undef CONFIG_SAMA5_SSC_REGDEBUG # undef CONFIG_SAMA5_SSC_QDEBUG @@ -413,22 +408,6 @@ # undef CONFIG_SAMA5_SSC_DMADEBUG #endif -#ifdef CONFIG_DEBUG_I2S -# define i2serr err -# define i2sllerr llerr -# ifdef CONFIG_DEBUG_INFO -# define i2sinfo err -# define i2sllinfo llerr -# else -# define i2sinfo(x...) -# endif -#else -# define i2serr(x...) -# define i2sllerr(x...) -# define i2sinfo(x...) -# define i2sllinfo(x...) -#endif - #define DMA_INITIAL 0 #define DMA_AFTER_SETUP 1 #define DMA_AFTER_START 2 @@ -539,7 +518,7 @@ static inline void ssc_putreg(struct sam_ssc_s *priv, unsigned int offset, static inline uintptr_t ssc_physregaddr(struct sam_ssc_s *priv, unsigned int offset); -#if defined(CONFIG_DEBUG_I2S) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_I2S_INFO static void scc_dump_regs(struct sam_ssc_s *priv, const char *msg); #else # define scc_dump_regs(s,m) @@ -817,7 +796,7 @@ static inline uintptr_t ssc_physregaddr(struct sam_ssc_s *priv, * ****************************************************************************/ -#if defined(CONFIG_DEBUG_I2S) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_I2S_INFO static void scc_dump_regs(struct sam_ssc_s *priv, const char *msg) { i2sinfo("SSC%d: %s\n", priv->sscno, msg); diff --git a/arch/arm/src/samv7/sam_ssc.c b/arch/arm/src/samv7/sam_ssc.c index c8be8e850d..c9204f093f 100644 --- a/arch/arm/src/samv7/sam_ssc.c +++ b/arch/arm/src/samv7/sam_ssc.c @@ -368,7 +368,7 @@ /* Debug *******************************************************************/ /* Check if SSC debug is enabled */ -#ifndef CONFIG_DEBUG_I2S +#ifndef CONFIG_DEBUG_I2S_INFO # undef CONFIG_SAMV7_SSC_DMADEBUG # undef CONFIG_SAMV7_SSC_REGDEBUG # undef CONFIG_SAMV7_SSC_QDEBUG @@ -379,22 +379,6 @@ # undef CONFIG_SAMV7_SSC_DMADEBUG #endif -#ifdef CONFIG_DEBUG_I2S -# define i2serr err -# define i2sllerr llerr -# define i2swarn warn -# define i2sllwarn llwarn -# define i2sinfo info -# define i2sllinfo llinfo -#else -# define i2serr(x...) -# define i2sllerr(x...) -# define i2swarn(x...) -# define i2sllwarn(x...) -# define i2sinfo(x...) -# define i2sllinfo(x...) -#endif - #define DMA_INITIAL 0 #define DMA_AFTER_SETUP 1 #define DMA_AFTER_START 2 @@ -505,7 +489,7 @@ static inline void ssc_putreg(struct sam_ssc_s *priv, unsigned int offset, static inline uintptr_t ssc_regaddr(struct sam_ssc_s *priv, unsigned int offset); -#if defined(CONFIG_DEBUG_I2S) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_I2S_INFO static void scc_dump_regs(struct sam_ssc_s *priv, const char *msg); #else # define scc_dump_regs(s,m) @@ -782,7 +766,7 @@ static inline uintptr_t ssc_regaddr(struct sam_ssc_s *priv, unsigned int offset) * ****************************************************************************/ -#if defined(CONFIG_DEBUG_I2S) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_I2S_INFO static void scc_dump_regs(struct sam_ssc_s *priv, const char *msg) { i2sinfo("SSC%d: %s\n", priv->sscno, msg); diff --git a/drivers/audio/i2schar.c b/drivers/audio/i2schar.c index acecda9f83..2701a67dc2 100644 --- a/drivers/audio/i2schar.c +++ b/drivers/audio/i2schar.c @@ -75,32 +75,6 @@ #define DEVNAME_FMT "/dev/i2schar%d" #define DEVNAME_FMTLEN (12 + 3 + 1) -/* Debug *******************************************************************/ -/* Check if SSC debut is enabled (non-standard.. no support in - * include/debug.h - */ - -#ifndef CONFIG_DEBUG_FEATURES -# undef CONFIG_DEBUG_INFO -# undef CONFIG_DEBUG_I2S -#endif - -#ifdef CONFIG_DEBUG_I2S -# define i2serr err -# define i2sllerr llerr -# ifdef CONFIG_DEBUG_INFO -# define i2sinfo err -# define i2sllinfo llerr -# else -# define i2sinfo(x...) -# endif -#else -# define i2serr(x...) -# define i2sllerr(x...) -# define i2sinfo(x...) -# define i2sllinfo(x...) -#endif - /**************************************************************************** * Private Types ****************************************************************************/ diff --git a/include/debug.h b/include/debug.h index c86ad7e39f..5f654d5908 100644 --- a/include/debug.h +++ b/include/debug.h @@ -669,6 +669,30 @@ # define i2cllinfo(x...) #endif +#ifdef CONFIG_DEBUG_I2S_ERROR +# define i2serr(format, ...) err(format, ##__VA_ARGS__) +# define i2sllerr(format, ...) llerr(format, ##__VA_ARGS__) +#else +# define i2serr(x...) +# define i2sllerr(x...) +#endif + +#ifdef CONFIG_DEBUG_I2S_WARN +# define i2swarn(format, ...) warn(format, ##__VA_ARGS__) +# define i2sllwarn(format, ...) llwarn(format, ##__VA_ARGS__) +#else +# define i2swarn(x...) +# define i2sllwarn(x...) +#endif + +#ifdef CONFIG_DEBUG_I2S_INFO +# define i2sinfo(format, ...) info(format, ##__VA_ARGS__) +# define i2sllinfo(format, ...) llinfo(format, ##__VA_ARGS__) +#else +# define i2sinfo(x...) +# define i2sllinfo(x...) +#endif + #ifdef CONFIG_DEBUG_SENSORS_ERROR # define snerr(format, ...) err(format, ##__VA_ARGS__) # define snllerr(format, ...) llerr(format, ##__VA_ARGS__) @@ -1234,6 +1258,30 @@ # define i2cllinfo (void) #endif +#ifdef CONFIG_DEBUG_I2S_ERROR +# define i2serr err +# define i2sllerr llerr +#else +# define i2serr (void) +# define i2sllerr (void) +#endif + +#ifdef CONFIG_DEBUG_I2S_WARN +# define i2swarn warn +# define i2sllwarn llwarn +#else +# define i2swarn (void) +# define i2sllwarn (void) +#endif + +#ifdef CONFIG_DEBUG_I2S_INFO +# define i2sinfo info +# define i2sllinfo llinfo +#else +# define i2sinfo (void) +# define i2sllinfo (void) +#endif + #ifdef CONFIG_DEBUG_SENSORS_ERROR # define snerr err # define snllerr llerr @@ -1452,6 +1500,14 @@ # define i2cinfodumpbuffer(m,b,n) #endif +#ifdef CONFIG_DEBUG_I2S +# define i2serrdumpbuffer(m,b,n) errdumpbuffer(m,b,n) +# define i2sinfodumpbuffer(m,b,n) infodumpbuffer(m,b,n) +#else +# define i2serrdumpbuffer(m,b,n) +# define i2sinfodumpbuffer(m,b,n) +#endif + #ifdef CONFIG_DEBUG_SENSORS # define snerrdumpbuffer(m,b,n) errdumpbuffer(m,b,n) # define sninfodumpbuffer(m,b,n) infodumpbuffer(m,b,n)