diff --git a/Kconfig b/Kconfig index cc8f3122df..3e781bcc57 100644 --- a/Kconfig +++ b/Kconfig @@ -1104,14 +1104,14 @@ config DEBUG_I2C_WARN default n depends on DEBUG_WARN ---help--- - Enable I2c driver 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 driver informational output to SYSLOG. + Enable I2C driver informational output to SYSLOG. endif # DEBUG_I2C @@ -1154,14 +1154,43 @@ config DEBUG_I2S_INFO endif # DEBUG_I2S config DEBUG_PWM - bool "PWM Debug Output" + bool "PWM Debug Features" default n depends on PWM ---help--- - Enable PWM driver debug SYSLOG output (disabled by default). + Enable PWM debug features. + Support for this debug option is architecture-specific and may not be available for some MCUs. +if DEBUG_PWM + +config DEBUG_PWM_ERROR + bool "PWM Error Output" + default n + depends on DEBUG_ERROR + ---help--- + Enable PWM driver error output to SYSLOG. + + Support for this debug option is architecture-specific and may not + be available for some MCUs. + +config DEBUG_PWM_WARN + bool "PWM Warnings Output" + default n + depends on DEBUG_WARN + ---help--- + Enable PWM driver warning output to SYSLOG. + +config DEBUG_PWM_INFO + bool "PWM Informational Output" + default n + depends on DEBUG_INFO + ---help--- + Enable PWM driver informational output to SYSLOG. + +endif # DEBUG_PWM + config DEBUG_RTC bool "RTC Debug Output" default n diff --git a/arch/arm/src/efm32/efm32_pwm.c b/arch/arm/src/efm32/efm32_pwm.c index 815ae7ed96..0f149f8dc4 100644 --- a/arch/arm/src/efm32/efm32_pwm.c +++ b/arch/arm/src/efm32/efm32_pwm.c @@ -75,29 +75,10 @@ /* The following definitions are used to identify the various time types */ /* Debug ********************************************************************/ -/* Non-standard debug that may be enabled just for testing PWM */ -#ifndef CONFIG_DEBUG_FEATURES -# undef CONFIG_DEBUG_PWM -#endif - -#ifdef CONFIG_DEBUG_PWM -# define pwmerr err -# define pwmllerr llerr -# ifdef CONFIG_DEBUG_INFO -# define pwminfo info -# define pwmllinfo llinfo -# define pwm_dumpgpio(p,m) efm32_dumpgpio(p,m) -# else -# define pwminfo(x...) -# define pwmllinfo(x...) -# define pwm_dumpgpio(p,m) -# endif +#ifdef CONFIG_DEBUG_PWM_INFO +# define pwm_dumpgpio(p,m) efm32_dumpgpio(p,m) #else -# define pwmerr(x...) -# define pwmllerr(x...) -# define pwminfo(x...) -# define pwmllinfo(x...) # define pwm_dumpgpio(p,m) #endif @@ -136,7 +117,7 @@ static uint32_t pwm_getreg(struct efm32_pwmtimer_s *priv, int offset); static void pwm_putreg(struct efm32_pwmtimer_s *priv, int offset, uint32_t value); -#if defined(CONFIG_DEBUG_PWM) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_PWM_INFO static void pwm_dumpregs(struct efm32_pwmtimer_s *priv, FAR const char *msg); #else # define pwm_dumpregs(priv,msg) @@ -323,7 +304,7 @@ static void pwm_putreg(struct efm32_pwmtimer_s *priv, int offset, uint32_t value * ****************************************************************************/ -#if defined(CONFIG_DEBUG_PWM) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_PWM_INFO static void pwm_dumpregs(struct efm32_pwmtimer_s *priv, FAR const char *msg) { /* TODO debug pwm_dumpregs */ @@ -843,7 +824,7 @@ static int pwm_stop(FAR struct pwm_lowerhalf_s *dev) static int pwm_ioctl(FAR struct pwm_lowerhalf_s *dev, int cmd, unsigned long arg) { -#ifdef CONFIG_DEBUG_PWM +#ifdef CONFIG_DEBUG_PWM_INFO FAR struct efm32_pwmtimer_s *priv = (FAR struct efm32_pwmtimer_s *)dev; /* There are no platform-specific ioctl commands */ diff --git a/arch/arm/src/kinetis/kinetis_pwm.c b/arch/arm/src/kinetis/kinetis_pwm.c index 1f552d8e4b..9ac5afbd95 100644 --- a/arch/arm/src/kinetis/kinetis_pwm.c +++ b/arch/arm/src/kinetis/kinetis_pwm.c @@ -76,29 +76,10 @@ /* PWM/Timer Definitions ****************************************************/ /* Debug ********************************************************************/ -/* Non-standard debug that may be enabled just for testing PWM */ -#ifndef CONFIG_DEBUG_FEATURES -# undef CONFIG_DEBUG_PWM -#endif - -#ifdef CONFIG_DEBUG_PWM -# define pwmerr err -# define pwmllerr llerr -# ifdef CONFIG_DEBUG_INFO -# define pwminfo info -# define pwmllinfo llinfo -# define pwm_dumpgpio(p,m) kinetis_pindump(p,m) -# else -# define pwmllerr(x...) -# define pwmllinfo(x...) -# define pwm_dumpgpio(p,m) -# endif +#ifdef CONFIG_DEBUG_PWM_INFO +# define pwm_dumpgpio(p,m) kinetis_pindump(p,m) #else -# define pwmerr(x...) -# define pwmllerr(x...) -# define pwminfo(x...) -# define pwmllinfo(x...) # define pwm_dumpgpio(p,m) #endif @@ -126,7 +107,7 @@ struct kinetis_pwmtimer_s static uint32_t pwm_getreg(struct kinetis_pwmtimer_s *priv, int offset); static void pwm_putreg(struct kinetis_pwmtimer_s *priv, int offset, uint32_t value); -#if defined(CONFIG_DEBUG_PWM) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_PWM_INFO static void pwm_dumpregs(struct kinetis_pwmtimer_s *priv, FAR const char *msg); #else # define pwm_dumpregs(priv,msg) @@ -260,7 +241,7 @@ static void pwm_putreg(struct kinetis_pwmtimer_s *priv, int offset, uint32_t val * ****************************************************************************/ -#if defined(CONFIG_DEBUG_PWM) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_PWM_INFO static void pwm_dumpregs(struct kinetis_pwmtimer_s *priv, FAR const char *msg) { int nchannels = (priv->tpmid == 0) ? 8 : 2; @@ -739,7 +720,7 @@ static int pwm_stop(FAR struct pwm_lowerhalf_s *dev) static int pwm_ioctl(FAR struct pwm_lowerhalf_s *dev, int cmd, unsigned long arg) { -#ifdef CONFIG_DEBUG_PWM +#ifdef CONFIG_DEBUG_PWM_INFO FAR struct kinetis_pwmtimer_s *priv = (FAR struct kinetis_pwmtimer_s *)dev; /* There are no platform-specific ioctl commands */ diff --git a/arch/arm/src/kl/kl_pwm.c b/arch/arm/src/kl/kl_pwm.c index 3ff80e32f0..3da236c34c 100644 --- a/arch/arm/src/kl/kl_pwm.c +++ b/arch/arm/src/kl/kl_pwm.c @@ -73,29 +73,10 @@ /* PWM/Timer Definitions ****************************************************/ /* Debug ********************************************************************/ -/* Non-standard debug that may be enabled just for testing PWM */ -#ifndef CONFIG_DEBUG_FEATURES -# undef CONFIG_DEBUG_PWM -#endif - -#ifdef CONFIG_DEBUG_PWM -# define pwmerr err -# define pwmllerr llerr -# ifdef CONFIG_DEBUG_INFO -# define pwminfo info -# define pwmllinfo llinfo -# define pwm_dumpgpio(p,m) kl_dumpgpio(p,m) -# else -# define pwminfo(x...) -# define pwmllinfo(x...) -# define pwm_dumpgpio(p,m) -# endif +#ifdef CONFIG_DEBUG_PWM_INFO +# define pwm_dumpgpio(p,m) kl_dumpgpio(p,m) #else -# define pwmerr(x...) -# define pwmllerr(x...) -# define pwminfo(x...) -# define pwmllinfo(x...) # define pwm_dumpgpio(p,m) #endif @@ -122,7 +103,7 @@ struct kl_pwmtimer_s static uint32_t pwm_getreg(struct kl_pwmtimer_s *priv, int offset); static void pwm_putreg(struct kl_pwmtimer_s *priv, int offset, uint32_t value); -#if defined(CONFIG_DEBUG_PWM) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_PWM_INFO static void pwm_dumpregs(struct kl_pwmtimer_s *priv, FAR const char *msg); #else # define pwm_dumpregs(priv,msg) @@ -253,7 +234,7 @@ static void pwm_putreg(struct kl_pwmtimer_s *priv, int offset, uint32_t value) * ****************************************************************************/ -#if defined(CONFIG_DEBUG_PWM) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_PWM_INFO static void pwm_dumpregs(struct kl_pwmtimer_s *priv, FAR const char *msg) { int nchannels = (priv->tpmid == 0) ? 6 : 2; @@ -691,7 +672,7 @@ static int pwm_stop(FAR struct pwm_lowerhalf_s *dev) static int pwm_ioctl(FAR struct pwm_lowerhalf_s *dev, int cmd, unsigned long arg) { -#ifdef CONFIG_DEBUG_PWM +#ifdef CONFIG_DEBUG_PWM_INFO FAR struct kl_pwmtimer_s *priv = (FAR struct kl_pwmtimer_s *)dev; /* There are no platform-specific ioctl commands */ diff --git a/arch/arm/src/lpc11xx/lpc11_timer.c b/arch/arm/src/lpc11xx/lpc11_timer.c index cb18e4c158..56e5f34471 100644 --- a/arch/arm/src/lpc11xx/lpc11_timer.c +++ b/arch/arm/src/lpc11xx/lpc11_timer.c @@ -80,31 +80,11 @@ #define TIMTYPE_TIM1 TIMTYPE_ADVANCED - /* Debug ********************************************************************/ -/* Non-standard debug that may be enabled just for testing PWM */ -#ifndef CONFIG_DEBUG_FEATURES -# undef CONFIG_DEBUG_PWM -#endif - -#ifdef CONFIG_DEBUG_PWM -# define pwmerr err -# define pwmllerr llerr -# ifdef CONFIG_DEBUG_INFO -# define pwminfo info -# define pwmllinfo llinfo -# define pwm_dumpgpio(p,m) stm32_dumpgpio(p,m) -# else -# define pwminfo(x...) -# define pwmllinfo(x...) -# define pwm_dumpgpio(p,m) -# endif +#ifdef CONFIG_DEBUG_PWM_INFO +# define pwm_dumpgpio(p,m) stm32_dumpgpio(p,m) #else -# define pwmerr(x...) -# define pwmllerr(x...) -# define pwminfo(x...) -# define pwmllinfo(x...) # define pwm_dumpgpio(p,m) #endif @@ -133,7 +113,7 @@ struct lpc11_timer_s static uint32_t timer_getreg(struct lpc11_timer_s *priv, int offset); static void timer_putreg(struct lpc11_timer_s *priv, int offset, uint32_t value); -#if defined(CONFIG_DEBUG_PWM) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_PWM_INFO static void timer_dumpregs(struct lpc11_timer_s *priv, FAR const char *msg); #else # define timer_dumpregs(priv,msg) @@ -242,11 +222,11 @@ static void timer_putreg(struct lpc11_timer_s *priv, int offset, * ****************************************************************************/ -#if defined(CONFIG_DEBUG_PWM) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_PWM_INFO static void timer_dumpregs(struct lpc11_timer_s *priv, FAR const char *msg) { - pwmerr("%s:\n", msg); - pwmerr(" CR1: %04x CR2: %04x SMCR: %04x DIER: %04x\n", + pwminfo("%s:\n", msg); + pwminfo(" CR1: %04x CR2: %04x SMCR: %04x DIER: %04x\n", timer_getreg(priv, LPC11_PWM_MR0_OFFSET), timer_getreg(priv, LPC11_PWM_MR1_OFFSET), timer_getreg(priv, LPC11_PWM_MR2_OFFSET), @@ -254,7 +234,7 @@ static void timer_dumpregs(struct lpc11_timer_s *priv, FAR const char *msg) #if defined(CONFIG_LPC11_TMR0) if (priv->timtype == TIMTYPE_ADVANCED) { - pwmerr(" RCR: %04x BDTR: %04x DCR: %04x DMAR: %04x\n", + pwminfo(" RCR: %04x BDTR: %04x DCR: %04x DMAR: %04x\n", timer_getreg(priv, LPC11_PWM_MR0_OFFSET), timer_getreg(priv, LPC11_PWM_MR1_OFFSET), timer_getreg(priv, LPC11_PWM_MR2_OFFSET), @@ -263,7 +243,7 @@ static void timer_dumpregs(struct lpc11_timer_s *priv, FAR const char *msg) else #endif { - pwmerr(" DCR: %04x DMAR: %04x\n", + pwminfo(" DCR: %04x DMAR: %04x\n", timer_getreg(priv, LPC11_PWM_MR2_OFFSET), timer_getreg(priv, LPC11_PWM_MR3_OFFSET)); } diff --git a/arch/arm/src/lpc17xx/lpc17_mcpwm.c b/arch/arm/src/lpc17xx/lpc17_mcpwm.c index 0d0f1db15a..d7d70daeaa 100644 --- a/arch/arm/src/lpc17xx/lpc17_mcpwm.c +++ b/arch/arm/src/lpc17xx/lpc17_mcpwm.c @@ -81,29 +81,10 @@ #define TIMTYPE_TIM1 TIMTYPE_ADVANCED /* Debug ********************************************************************/ -/* Non-standard debug that may be enabled just for testing PWM */ -#ifndef CONFIG_DEBUG_FEATURES -# undef CONFIG_DEBUG_PWM -#endif - -#ifdef CONFIG_DEBUG_PWM -# define pwmerr err -# define pwmllerr llerr -# ifdef CONFIG_DEBUG_INFO -# define pwminfo info -# define pwmllinfo llinfo -# define pwm_dumpgpio(p,m) stm32_dumpgpio(p,m) -# else -# define pwminfo(x...) -# define pwmllinfo(x...) -# define pwm_dumpgpio(p,m) -# endif +#ifdef CONFIG_DEBUG_PWM_INFO +# define pwm_dumpgpio(p,m) stm32_dumpgpio(p,m) #else -# define pwmerr(x...) -# define pwmllerr(x...) -# define pwminfo(x...) -# define pwmllinfo(x...) # define pwm_dumpgpio(p,m) #endif @@ -132,7 +113,7 @@ struct lpc17_mcpwmtimer_s static uint32_t mcpwm_getreg(struct lpc17_mcpwmtimer_s *priv, int offset); static void mcpwm_putreg(struct lpc17_mcpwmtimer_s *priv, int offset, uint32_t value); -#if defined(CONFIG_DEBUG_PWM) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_PWM_INFO static void mcpwm_dumpregs(struct lpc17_mcpwmtimer_s *priv, FAR const char *msg); #else # define mcpwm_dumpregs(priv,msg) @@ -242,7 +223,7 @@ static void mcpwm_putreg(struct lpc17_mcpwmtimer_s *priv, int offset, uint32_t v * ****************************************************************************/ -#if defined(CONFIG_DEBUG_PWM) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_PWM_INFO static void mcpwm_dumpregs(FAR struct lpc17_mcpwmtimer_s *priv, FAR const char *msg) { @@ -625,7 +606,7 @@ static int mcpwm_stop(FAR struct pwm_lowerhalf_s *dev) static int mcpwm_ioctl(FAR struct pwm_lowerhalf_s *dev, int cmd, unsigned long arg) { -#ifdef CONFIG_DEBUG_PWM +#ifdef CONFIG_DEBUG_PWM_INFO FAR struct lpc17_mcpwmtimer_s *priv = (FAR struct lpc17_mcpwmtimer_s *)dev; /* There are no platform-specific ioctl commands */ diff --git a/arch/arm/src/lpc17xx/lpc17_pwm.c b/arch/arm/src/lpc17xx/lpc17_pwm.c index 2d668b07b2..5bcbeab20b 100644 --- a/arch/arm/src/lpc17xx/lpc17_pwm.c +++ b/arch/arm/src/lpc17xx/lpc17_pwm.c @@ -99,29 +99,10 @@ #define TCR_PWM_EN (0x00000008) /* Debug ********************************************************************/ -/* Non-standard debug that may be enabled just for testing PWM */ -#ifndef CONFIG_DEBUG_FEATURES -# undef CONFIG_DEBUG_PWM -#endif - -#ifdef CONFIG_DEBUG_PWM -# define pwmerr err -# define pwmllerr llerr -# ifdef CONFIG_DEBUG_INFO -# define pwminfo info -# define pwmllinfo llinfo -# define pwm_dumpgpio(p,m) stm32_dumpgpio(p,m) -# else -# define pwminfo(x...) -# define pwmllinfo(x...) -# define pwm_dumpgpio(p,m) -# endif +#ifdef CONFIG_DEBUG_PWM_INFO +# define pwm_dumpgpio(p,m) stm32_dumpgpio(p,m) #else -# define pwmerr(x...) -# define pwmllerr(x...) -# define pwminfo(x...) -# define pwmllinfo(x...) # define pwm_dumpgpio(p,m) #endif @@ -150,7 +131,7 @@ struct lpc17_pwmtimer_s static uint32_t pwm_getreg(struct lpc17_pwmtimer_s *priv, int offset); static void pwm_putreg(struct lpc17_pwmtimer_s *priv, int offset, uint32_t value); -#if defined(CONFIG_DEBUG_PWM) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_PWM_INFO static void pwm_dumpregs(struct lpc17_pwmtimer_s *priv, FAR const char *msg); #else # define pwm_dumpregs(priv,msg) @@ -258,7 +239,7 @@ static void pwm_putreg(struct lpc17_pwmtimer_s *priv, int offset, uint32_t value * ****************************************************************************/ -#if defined(CONFIG_DEBUG_PWM) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_PWM_INFO static void pwm_dumpregs(struct lpc17_pwmtimer_s *priv, FAR const char *msg) { pwminfo("%s:\n", msg); @@ -596,7 +577,7 @@ static int pwm_stop(FAR struct pwm_lowerhalf_s *dev) static int pwm_ioctl(FAR struct pwm_lowerhalf_s *dev, int cmd, unsigned long arg) { -#ifdef CONFIG_DEBUG_PWM +#ifdef CONFIG_DEBUG_PWM_INFO FAR struct lpc17_pwmtimer_s *priv = (FAR struct lpc17_pwmtimer_s *)dev; /* There are no platform-specific ioctl commands */ diff --git a/arch/arm/src/lpc17xx/lpc17_timer.c b/arch/arm/src/lpc17xx/lpc17_timer.c index d609b1f4f5..6ce3c1f79e 100644 --- a/arch/arm/src/lpc17xx/lpc17_timer.c +++ b/arch/arm/src/lpc17xx/lpc17_timer.c @@ -82,29 +82,10 @@ /* Debug ********************************************************************/ -/* Non-standard debug that may be enabled just for testing PWM */ -#ifndef CONFIG_DEBUG_FEATURES -# undef CONFIG_DEBUG_PWM -#endif - -#ifdef CONFIG_DEBUG_PWM -# define pwmerr err -# define pwmllerr llerr -# ifdef CONFIG_DEBUG_INFO -# define pwminfo info -# define pwmllinfo llinfo -# define pwm_dumpgpio(p,m) stm32_dumpgpio(p,m) -# else -# define pwminfo(x...) -# define pwmllinfo(x...) -# define pwm_dumpgpio(p,m) -# endif +#ifdef CONFIG_DEBUG_PWM_INFO +# define pwm_dumpgpio(p,m) stm32_dumpgpio(p,m) #else -# define pwmerr(x...) -# define pwmllerr(x...) -# define pwminfo(x...) -# define pwmllinfo(x...) # define pwm_dumpgpio(p,m) #endif @@ -133,7 +114,7 @@ struct lpc17_timer_s static uint32_t timer_getreg(struct lpc17_timer_s *priv, int offset); static void timer_putreg(struct lpc17_timer_s *priv, int offset, uint32_t value); -#if defined(CONFIG_DEBUG_PWM) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_PWM_INFO static void timer_dumpregs(struct lpc17_timer_s *priv, FAR const char *msg); #else # define timer_dumpregs(priv,msg) @@ -242,11 +223,11 @@ static void timer_putreg(struct lpc17_timer_s *priv, int offset, * ****************************************************************************/ -#if defined(CONFIG_DEBUG_PWM) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_PWM_INFO static void timer_dumpregs(struct lpc17_timer_s *priv, FAR const char *msg) { - pwmerr("%s:\n", msg); - pwmerr(" CR1: %04x CR2: %04x SMCR: %04x DIER: %04x\n", + pwminfo("%s:\n", msg); + pwminfo(" CR1: %04x CR2: %04x SMCR: %04x DIER: %04x\n", timer_getreg(priv, LPC17_PWM_MR0_OFFSET), timer_getreg(priv, LPC17_PWM_MR1_OFFSET), timer_getreg(priv, LPC17_PWM_MR2_OFFSET), @@ -254,7 +235,7 @@ static void timer_dumpregs(struct lpc17_timer_s *priv, FAR const char *msg) #if defined(CONFIG_LPC17_TMR0) if (priv->timtype == TIMTYPE_ADVANCED) { - pwmerr(" RCR: %04x BDTR: %04x DCR: %04x DMAR: %04x\n", + pwminfo(" RCR: %04x BDTR: %04x DCR: %04x DMAR: %04x\n", timer_getreg(priv, LPC17_PWM_MR0_OFFSET), timer_getreg(priv, LPC17_PWM_MR1_OFFSET), timer_getreg(priv, LPC17_PWM_MR2_OFFSET), @@ -263,7 +244,7 @@ static void timer_dumpregs(struct lpc17_timer_s *priv, FAR const char *msg) else #endif { - pwmerr(" DCR: %04x DMAR: %04x\n", + pwminfo(" DCR: %04x DMAR: %04x\n", timer_getreg(priv, LPC17_PWM_MR2_OFFSET), timer_getreg(priv, LPC17_PWM_MR3_OFFSET)); } diff --git a/arch/arm/src/sama5/sam_pwm.c b/arch/arm/src/sama5/sam_pwm.c index ea53643377..6fe331db44 100644 --- a/arch/arm/src/sama5/sam_pwm.c +++ b/arch/arm/src/sama5/sam_pwm.c @@ -393,30 +393,6 @@ #define PWM_PINMASK (PIO_PORT_MASK | PIO_PIN_MASK) #define PWM_MKINPUT(cfg) (((cfg) & PWM_PINMASK) | PWM_INPUTCFG) -/* Debug ********************************************************************/ -/* Non-standard debug that may be enabled just for testing PWM */ - -#ifndef CONFIG_DEBUG_FEATURES -# undef CONFIG_DEBUG_PWM -#endif - -#ifdef CONFIG_DEBUG_PWM -# define pwmerr err -# define pwmllerr llerr -# ifdef CONFIG_DEBUG_INFO -# define pwminfo info -# define pwmllinfo llinfo -# else -# define pwminfo(x...) -# define pwmllinfo(x...) -# endif -#else -# define pwmerr(x...) -# define pwmllerr(x...) -# define pwminfo(x...) -# define pwmllinfo(x...) -#endif - /**************************************************************************** * Private Types ****************************************************************************/ @@ -480,7 +456,7 @@ static bool pwm_checkreg(FAR struct sam_pwm_s *chan, bool wr, uint32_t regval, static uint32_t pwm_getreg(FAR struct sam_pwm_chan_s *chan, int offset); static void pwm_putreg(FAR struct sam_pwm_chan_s *chan, int offset, uint32_t regval); -#if defined(CONFIG_DEBUG_PWM) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_PWM_INFO static void pwm_dumpregs(FAR struct sam_pwm_chan_s *chan, FAR const char *msg); #else # define pwm_dumpregs(chan,msg) @@ -914,7 +890,7 @@ static void pwm_chan_putreg(struct sam_pwm_chan_s *chan, int offset, * ****************************************************************************/ -#if defined(CONFIG_DEBUG_PWM) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_PWM_INFO static void pwm_dumpregs(struct sam_pwm_chan_s *chan, FAR const char *msg) { pwminfo("PWM: %s\n", msg); @@ -1231,7 +1207,7 @@ static int pwm_stop(FAR struct pwm_lowerhalf_s *dev) static int pwm_ioctl(FAR struct pwm_lowerhalf_s *dev, int cmd, unsigned long arg) { -#ifdef CONFIG_DEBUG_PWM +#ifdef CONFIG_DEBUG_PWM_INFO FAR struct sam_pwm_chan_s *chan = (FAR struct sam_pwm_chan_s *)dev; /* There are no platform-specific ioctl commands */ diff --git a/arch/arm/src/stm32/stm32_pwm.c b/arch/arm/src/stm32/stm32_pwm.c index 53e28f6ae1..77534effa8 100644 --- a/arch/arm/src/stm32/stm32_pwm.c +++ b/arch/arm/src/stm32/stm32_pwm.c @@ -115,29 +115,10 @@ #define TIMTYPE_TIM17 TIMTYPE_COUNTUP16 /* Debug ********************************************************************/ -/* Non-standard debug that may be enabled just for testing PWM */ -#ifndef CONFIG_DEBUG_FEATURES -# undef CONFIG_DEBUG_PWM -#endif - -#ifdef CONFIG_DEBUG_PWM -# define pwmerr err -# define pwmllerr llerr -# ifdef CONFIG_DEBUG_INFO -# define pwminfo info -# define pwmllinfo llinfo -# define pwm_dumpgpio(p,m) stm32_dumpgpio(p,m) -# else -# define pwminfo(x...) -# define pwmllinfo(x...) -# define pwm_dumpgpio(p,m) -# endif +#ifdef CONFIG_DEBUG_PWM_INFO +# define pwm_dumpgpio(p,m) stm32_dumpgpio(p,m) #else -# define pwmerr(x...) -# define pwmllerr(x...) -# define pwminfo(x...) -# define pwmllinfo(x...) # define pwm_dumpgpio(p,m) #endif @@ -204,7 +185,7 @@ struct stm32_pwmtimer_s static uint16_t pwm_getreg(struct stm32_pwmtimer_s *priv, int offset); static void pwm_putreg(struct stm32_pwmtimer_s *priv, int offset, uint16_t value); -#if defined(CONFIG_DEBUG_PWM) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_PWM_INFO static void pwm_dumpregs(struct stm32_pwmtimer_s *priv, FAR const char *msg); #else # define pwm_dumpregs(priv,msg) @@ -969,7 +950,7 @@ static void pwm_putreg(struct stm32_pwmtimer_s *priv, int offset, uint16_t value * ****************************************************************************/ -#if defined(CONFIG_DEBUG_PWM) && defined(CONFIG_DEBUG_INFO) +#ifdef CONFIG_DEBUG_PWM_INFO static void pwm_dumpregs(struct stm32_pwmtimer_s *priv, FAR const char *msg) { pwminfo("%s:\n", msg); @@ -2383,7 +2364,7 @@ static int pwm_stop(FAR struct pwm_lowerhalf_s *dev) static int pwm_ioctl(FAR struct pwm_lowerhalf_s *dev, int cmd, unsigned long arg) { -#ifdef CONFIG_DEBUG_PWM +#ifdef CONFIG_DEBUG_PWM_INFO FAR struct stm32_pwmtimer_s *priv = (FAR struct stm32_pwmtimer_s *)dev; /* There are no platform-specific ioctl commands */ diff --git a/configs/nucleo-f303re/src/stm32_pwm.c b/configs/nucleo-f303re/src/stm32_pwm.c index 1813271caa..6b940e8879 100644 --- a/configs/nucleo-f303re/src/stm32_pwm.c +++ b/configs/nucleo-f303re/src/stm32_pwm.c @@ -53,37 +53,6 @@ #ifdef CONFIG_PWM -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Debug ********************************************************************/ -/* Non-standard debug that may be enabled just for testing PWM */ - -#ifdef CONFIG_DEBUG_PWM -# define pwmerr err -# define pwminfo info -# define pwmllerr llerr -# define pwmllinfo llinfo -#else -# define pwmerr(x...) -# define pwminfo(x...) -# define pwmllerr(x...) -# define pwmllinfo(x...) -#endif - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/configs/stm3220g-eval/README.txt b/configs/stm3220g-eval/README.txt index d459061684..07c61bc6d5 100644 --- a/configs/stm3220g-eval/README.txt +++ b/configs/stm3220g-eval/README.txt @@ -989,7 +989,7 @@ Where is one of the following: Special PWM-only debug options: - CONFIG_DEBUG_PWM + CONFIG_DEBUG_PWM_INFO 5. This example supports the CAN loopback test (apps/examples/can) but this must be manually enabled by selecting: diff --git a/configs/stm3240g-eval/README.txt b/configs/stm3240g-eval/README.txt index 088564b077..ce2d8a2122 100644 --- a/configs/stm3240g-eval/README.txt +++ b/configs/stm3240g-eval/README.txt @@ -1165,7 +1165,7 @@ Where is one of the following: Special PWM-only debug options: - CONFIG_DEBUG_PWM + CONFIG_DEBUG_PWM_INFO 5. This example supports the CAN loopback test (apps/examples/can) but this must be manually enabled by selecting: diff --git a/configs/stm32_tiny/README.txt b/configs/stm32_tiny/README.txt index dcc6181fb9..7455276723 100644 --- a/configs/stm32_tiny/README.txt +++ b/configs/stm32_tiny/README.txt @@ -563,7 +563,7 @@ Where is one of the following: Special PWM-only debug options: - CONFIG_DEBUG_PWM + CONFIG_DEBUG_PWM_INFO 7. USB Support (CDC/ACM device) diff --git a/configs/stm32f429i-disco/README.txt b/configs/stm32f429i-disco/README.txt index 87fa07a37e..c803960bf5 100644 --- a/configs/stm32f429i-disco/README.txt +++ b/configs/stm32f429i-disco/README.txt @@ -640,7 +640,7 @@ Where is one of the following: Special PWM-only debug options: - CONFIG_DEBUG_PWM + CONFIG_DEBUG_PWM_INFO 5. This example supports the Quadrature Encode test (apps/examples/qencoder) but this must be manually enabled by selecting: diff --git a/configs/stm32f4discovery/README.txt b/configs/stm32f4discovery/README.txt index 4f7accd205..9dc0ceb95c 100644 --- a/configs/stm32f4discovery/README.txt +++ b/configs/stm32f4discovery/README.txt @@ -1566,7 +1566,7 @@ Where is one of the following: Special PWM-only debug options: - CONFIG_DEBUG_PWM + CONFIG_DEBUG_PWM_INFO 5. This example supports the Quadrature Encode test (apps/examples/qencoder) but this must be manually enabled by selecting: diff --git a/drivers/pwm.c b/drivers/pwm.c index d8b023042b..6a215538d6 100644 --- a/drivers/pwm.c +++ b/drivers/pwm.c @@ -64,24 +64,6 @@ #ifdef CONFIG_PWM -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ -/* Debug ********************************************************************/ -/* Non-standard debug that may be enabled just for testing PWM */ - -#ifdef CONFIG_DEBUG_PWM -# define pwmerr err -# define pwminfo info -# define pwmllerr llerr -# define pwmllinfo llinfo -#else -# define pwmerr(x...) -# define pwminfo(x...) -# define pwmllerr(x...) -# define pwmllinfo(x...) -#endif - /**************************************************************************** * Private Type Definitions ****************************************************************************/ diff --git a/include/debug.h b/include/debug.h index 5f654d5908..c644cb48bc 100644 --- a/include/debug.h +++ b/include/debug.h @@ -693,6 +693,30 @@ # define i2sllinfo(x...) #endif +#ifdef CONFIG_DEBUG_PWM_ERROR +# define pwmerr(format, ...) err(format, ##__VA_ARGS__) +# define pwmllerr(format, ...) llerr(format, ##__VA_ARGS__) +#else +# define pwmerr(x...) +# define pwmllerr(x...) +#endif + +#ifdef CONFIG_DEBUG_PWM_WARN +# define pwmwarn(format, ...) warn(format, ##__VA_ARGS__) +# define pwmllwarn(format, ...) llwarn(format, ##__VA_ARGS__) +#else +# define pwmwarn(x...) +# define pwmllwarn(x...) +#endif + +#ifdef CONFIG_DEBUG_PWM_INFO +# define pwminfo(format, ...) info(format, ##__VA_ARGS__) +# define pwmllinfo(format, ...) llinfo(format, ##__VA_ARGS__) +#else +# define pwminfo(x...) +# define pwmllinfo(x...) +#endif + #ifdef CONFIG_DEBUG_SENSORS_ERROR # define snerr(format, ...) err(format, ##__VA_ARGS__) # define snllerr(format, ...) llerr(format, ##__VA_ARGS__) @@ -1282,6 +1306,30 @@ # define i2sllinfo (void) #endif +#ifdef CONFIG_DEBUG_PWM_ERROR +# define pwmerr err +# define pwmllerr llerr +#else +# define pwmerr (void) +# define pwmllerr (void) +#endif + +#ifdef CONFIG_DEBUG_PWM_WARN +# define pwmwarn warn +# define pwmllwarn llwarn +#else +# define pwmwarn (void) +# define pwmllwarn (void) +#endif + +#ifdef CONFIG_DEBUG_PWM_INFO +# define pwminfo info +# define pwmllinfo llinfo +#else +# define pwminfo (void) +# define pwmllinfo (void) +#endif + #ifdef CONFIG_DEBUG_SENSORS_ERROR # define snerr err # define snllerr llerr @@ -1508,6 +1556,14 @@ # define i2sinfodumpbuffer(m,b,n) #endif +#ifdef CONFIG_DEBUG_PWM +# define pwmerrdumpbuffer(m,b,n) errdumpbuffer(m,b,n) +# define pwminfodumpbuffer(m,b,n) infodumpbuffer(m,b,n) +#else +# define pwmerrdumpbuffer(m,b,n) +# define pwminfodumpbuffer(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) diff --git a/include/nuttx/pwm.h b/include/nuttx/pwm.h index 78369a793b..fe13a4efc6 100644 --- a/include/nuttx/pwm.h +++ b/include/nuttx/pwm.h @@ -72,8 +72,7 @@ * number of pulses. This might be used, for example to support a stepper * motor. If the hardware will support a fixed pulse count, then this * configuration should be set to enable the capability. - * CONFIG_DEBUG_PWM - If enabled (with CONFIG_DEBUG_FEATURES and, optionally, - * CONFIG_DEBUG_INFO), this will generate output that can be use dto + * CONFIG_DEBUG_PWM_INFO - This will generate output that can be use to * debug the PWM driver. */