Centralize definitions associated with CONFIG_DEBUG_WATCHDOG

This commit is contained in:
Gregory Nutt 2016-06-16 06:28:04 -06:00
parent 03cbe671ad
commit 6b517ed017
10 changed files with 156 additions and 205 deletions

37
Kconfig
View File

@ -405,10 +405,6 @@ config DEBUG_FEATURES
Note that enabling this option by itself does not produce debug output. Note that enabling this option by itself does not produce debug output.
Debug output must also be selected on a subsystem-by-subsystem basis. Debug output must also be selected on a subsystem-by-subsystem basis.
config ARCH_HAVE_HEAPCHECK
bool
default n
if DEBUG_FEATURES if DEBUG_FEATURES
comment "Debug SYSLOG Output Controls" comment "Debug SYSLOG Output Controls"
@ -1321,14 +1317,39 @@ config DEBUG_USB_INFO
endif # DEBUG_USB endif # DEBUG_USB
config DEBUG_WATCHDOG config DEBUG_WATCHDOG
bool "Watchdog Timer Debug Output" bool "Watchdog Timer Debug Features"
default n default n
depends on WATCHDOG depends on WATCHDOG
---help--- ---help---
Enable watchdog timer debug SYSLOG output (disabled by default). Enable watchdog timer debug features.
Support for this debug option is architecture-specific and may not Support for this debug option is architecture-specific and may not
be available for some MCUs. be available for some MCUs.
if DEBUG_WATCHDOG
config DEBUG_WATCHDOG_ERROR
bool "Watchdog Timer Error Output"
default n
depends on DEBUG_ERROR
---help---
Enable watchdog time error output to SYSLOG.
config DEBUG_WATCHDOG_WARN
bool "Watchdog Timer Warnings Output"
default n
depends on DEBUG_WARN
---help---
Enable watchdog time warning output to SYSLOG.
config DEBUG_WATCHDOG_INFO
bool "Watchdog Timer Informational Output"
default n
depends on DEBUG_INFO
---help---
Enable watchdog time informational output to SYSLOG.
endif # DEBUG_WATCHDOG
endif # DEBUG_FEATURES endif # DEBUG_FEATURES
config ARCH_HAVE_STACKCHECK config ARCH_HAVE_STACKCHECK
@ -1346,6 +1367,10 @@ config STACK_COLORATION
Only supported by a few architectures. Only supported by a few architectures.
config ARCH_HAVE_HEAPCHECK
bool
default n
config HEAP_COLORATION config HEAP_COLORATION
bool "Heap coloration" bool "Heap coloration"
default n default n

View File

@ -81,20 +81,6 @@
# define CONFIG_SAM34_WDT_DEFTIMOUT WDT_MAXTIMEOUT # define CONFIG_SAM34_WDT_DEFTIMOUT WDT_MAXTIMEOUT
#endif #endif
/* Debug ********************************************************************/
/* Non-standard debug that may be enabled just for testing the watchdog
* driver. NOTE: that only llerr types are used so that the output is
* immediately available.
*/
#ifdef CONFIG_DEBUG_WATCHDOG
# define wderr llerr
# define wdinfo llinfo
#else
# define wderr(x...)
# define wdinfo(x...)
#endif
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/

View File

@ -80,20 +80,6 @@
#define WDT_MINTIMEOUT ((1000 + WDT_FREQUENCY - 1) / WDT_FREQUENCY) #define WDT_MINTIMEOUT ((1000 + WDT_FREQUENCY - 1) / WDT_FREQUENCY)
#define WDT_MAXTIMEOUT ((4096 * 1000) / WDT_FREQUENCY) #define WDT_MAXTIMEOUT ((4096 * 1000) / WDT_FREQUENCY)
/* Debug ********************************************************************/
/* Non-standard debug that may be enabled just for testing the watchdog
* driver. NOTE: that only llerr types are used so that the output is
* immediately available.
*/
#ifdef CONFIG_DEBUG_WATCHDOG
# define wderr llerr
# define wdinfo llinfo
#else
# define wderr(x...)
# define wdinfo(x...)
#endif
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/

View File

@ -80,20 +80,6 @@
#define RSWDT_MINTIMEOUT ((1000 + RSWDT_FREQUENCY - 1) / RSWDT_FREQUENCY) #define RSWDT_MINTIMEOUT ((1000 + RSWDT_FREQUENCY - 1) / RSWDT_FREQUENCY)
#define RSWDT_MAXTIMEOUT ((4096 * 1000) / RSWDT_FREQUENCY) #define RSWDT_MAXTIMEOUT ((4096 * 1000) / RSWDT_FREQUENCY)
/* Debug ********************************************************************/
/* Non-standard debug that may be enabled just for testing the watchdog
* driver. NOTE: that only llerr types are used so that the output is
* immediately available.
*/
#ifdef CONFIG_DEBUG_WATCHDOG
# define wderr llerr
# define wdinfo llinfo
#else
# define wderr(x...)
# define wdinfo(x...)
#endif
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/

View File

@ -80,20 +80,6 @@
#define WDT_MINTIMEOUT ((1000 + WDT_FREQUENCY - 1) / WDT_FREQUENCY) #define WDT_MINTIMEOUT ((1000 + WDT_FREQUENCY - 1) / WDT_FREQUENCY)
#define WDT_MAXTIMEOUT ((4096 * 1000) / WDT_FREQUENCY) #define WDT_MAXTIMEOUT ((4096 * 1000) / WDT_FREQUENCY)
/* Debug ********************************************************************/
/* Non-standard debug that may be enabled just for testing the watchdog
* driver. NOTE: that only llerr types are used so that the output is
* immediately available.
*/
#ifdef CONFIG_DEBUG_WATCHDOG
# define wderr llerr
# define wdinfo llinfo
#else
# define wderr(x...)
# define wdinfo(x...)
#endif
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/

View File

@ -105,20 +105,6 @@
# error "Both CONFIG_STM32_IWDG_ONETIMESETUP and CONFIG_STM32_IWDG_DEFERREDSETUP are defined" # error "Both CONFIG_STM32_IWDG_ONETIMESETUP and CONFIG_STM32_IWDG_DEFERREDSETUP are defined"
#endif #endif
/* Debug ********************************************************************/
/* Non-standard debug that may be enabled just for testing the watchdog
* driver. NOTE: that only llerr types are used so that the output is
* immediately available.
*/
#ifdef CONFIG_DEBUG_WATCHDOG
# define wderr llerr
# define wdinfo llinfo
#else
# define wderr(x...)
# define wdinfo(x...)
#endif
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/

View File

@ -81,20 +81,6 @@
# define CONFIG_STM32_WWDG_DEFTIMOUT WWDG_MAXTIMEOUT # define CONFIG_STM32_WWDG_DEFTIMOUT WWDG_MAXTIMEOUT
#endif #endif
/* Debug ********************************************************************/
/* Non-standard debug that may be enabled just for testing the watchdog
* driver. NOTE: that only llerr types are used so that the output is
* immediately available.
*/
#ifdef CONFIG_DEBUG_WATCHDOG
# define wderr llerr
# define wdinfo llinfo
#else
# define wderr(x...)
# define wdinfo(x...)
#endif
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/

View File

@ -82,34 +82,6 @@
# error "WDT_THREAD_INTERVAL must be greater than or equal to WDT_MINTIME" # error "WDT_THREAD_INTERVAL must be greater than or equal to WDT_MINTIME"
#endif #endif
/* Debug ***************************************************************************/
/* Non-standard debug that may be enabled just for testing the watchdog timer */
#ifndef CONFIG_DEBUG_FEATURES
# undef CONFIG_DEBUG_WATCHDOG
#endif
#ifdef CONFIG_DEBUG_WATCHDOG
# define wdgerr err
# define wdgllerr llerr
# ifdef CONFIG_DEBUG_INFO
# define wdginfo info
# define wdgllinfo llinfo
# else
# define wdginfo(x...)
# define wdgllinfo(x...)
# endif
#else
# define wdgerr(x...)
# define wdgllerr(x...)
# define wdginfo(x...)
# define wdgllinfo(x...)
#endif
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************ /************************************************************************************
* Public Functions * Public Functions
************************************************************************************/ ************************************************************************************/
@ -124,21 +96,21 @@ static int wdog_daemon(int argc, char *argv[])
/* Open the watchdog device for reading */ /* Open the watchdog device for reading */
wdginfo("Opening.\n"); wdinfo("Opening.\n");
fd = open(CONFIG_WATCHDOG_DEVPATH, O_RDONLY); fd = open(CONFIG_WATCHDOG_DEVPATH, O_RDONLY);
if (fd < 0) if (fd < 0)
{ {
wdgerr("ERROR: open %s failed: %d\n", CONFIG_WATCHDOG_DEVPATH, errno); wderr("ERROR: open %s failed: %d\n", CONFIG_WATCHDOG_DEVPATH, errno);
goto errout; goto errout;
} }
/* Start the watchdog timer. */ /* Start the watchdog timer. */
wdginfo("Starting.\n"); wdinfo("Starting.\n");
ret = ioctl(fd, WDIOC_START, 0); ret = ioctl(fd, WDIOC_START, 0);
if (ret < 0) if (ret < 0)
{ {
wdgerr("ERROR: ioctl(WDIOC_START) failed: %d\n", errno); wderr("ERROR: ioctl(WDIOC_START) failed: %d\n", errno);
goto errout_with_dev; goto errout_with_dev;
} }
@ -147,11 +119,11 @@ static int wdog_daemon(int argc, char *argv[])
{ {
usleep((CONFIG_WDT_THREAD_INTERVAL)*1000); usleep((CONFIG_WDT_THREAD_INTERVAL)*1000);
wdginfo("ping\n"); wdinfo("ping\n");
ret = ioctl(fd, WDIOC_KEEPALIVE, 0); ret = ioctl(fd, WDIOC_KEEPALIVE, 0);
if (ret < 0) if (ret < 0)
{ {
wdgerr("ERROR: ioctl(WDIOC_KEEPALIVE) failed: %d\n", errno); wderr("ERROR: ioctl(WDIOC_KEEPALIVE) failed: %d\n", errno);
goto errout_with_dev; goto errout_with_dev;
} }
} }
@ -181,36 +153,36 @@ int sam_watchdog_initialize(void)
/* Initialize tha register the watchdog timer device */ /* Initialize tha register the watchdog timer device */
wdginfo("Initializing Watchdog driver...\n"); wdinfo("Initializing Watchdog driver...\n");
sam_wdtinitialize(CONFIG_WATCHDOG_DEVPATH); sam_wdtinitialize(CONFIG_WATCHDOG_DEVPATH);
/* Open the watchdog device */ /* Open the watchdog device */
wdginfo("Opening.\n"); wdinfo("Opening.\n");
fd = open(CONFIG_WATCHDOG_DEVPATH, O_RDONLY); fd = open(CONFIG_WATCHDOG_DEVPATH, O_RDONLY);
if (fd < 0) if (fd < 0)
{ {
wdgerr("ERROR: open %s failed: %d\n", CONFIG_WATCHDOG_DEVPATH, errno); wderr("ERROR: open %s failed: %d\n", CONFIG_WATCHDOG_DEVPATH, errno);
goto errout; goto errout;
} }
/* Set the watchdog timeout */ /* Set the watchdog timeout */
wdginfo("Timeout = %d.\n", CONFIG_WDT_TIMEOUT); wdinfo("Timeout = %d.\n", CONFIG_WDT_TIMEOUT);
ret = ioctl(fd, WDIOC_SETTIMEOUT, (unsigned long)CONFIG_WDT_TIMEOUT); ret = ioctl(fd, WDIOC_SETTIMEOUT, (unsigned long)CONFIG_WDT_TIMEOUT);
if (ret < 0) if (ret < 0)
{ {
wdgerr("ERROR: ioctl(WDIOC_SETTIMEOUT) failed: %d\n", errno); wderr("ERROR: ioctl(WDIOC_SETTIMEOUT) failed: %d\n", errno);
goto errout_with_dev; goto errout_with_dev;
} }
/* Set the watchdog minimum time */ /* Set the watchdog minimum time */
wdginfo("MinTime = %d.\n", CONFIG_WDT_MINTIME); wdinfo("MinTime = %d.\n", CONFIG_WDT_MINTIME);
ret = ioctl(fd, WDIOC_MINTIME, (unsigned long)CONFIG_WDT_MINTIME); ret = ioctl(fd, WDIOC_MINTIME, (unsigned long)CONFIG_WDT_MINTIME);
if (ret < 0) if (ret < 0)
{ {
wdgerr("ERROR: ioctl(WDIOC_MINTIME) failed: %d\n", errno); wderr("ERROR: ioctl(WDIOC_MINTIME) failed: %d\n", errno);
goto errout_with_dev; goto errout_with_dev;
} }

View File

@ -56,24 +56,6 @@
#ifdef CONFIG_WATCHDOG #ifdef CONFIG_WATCHDOG
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Debug ********************************************************************/
/* Non-standard debug that may be enabled just for testing the watchdog driver */
#ifdef CONFIG_DEBUG_WATCHDOG
# define wderr err
# define wdinfo info
# define wdllerr llerr
# define wdllinfo llinfo
#else
# define wderr(x...)
# define wdinfo(x...)
# define wdllerr(x...)
# define wdllinfo(x...)
#endif
/**************************************************************************** /****************************************************************************
* Private Type Definitions * Private Type Definitions
****************************************************************************/ ****************************************************************************/

View File

@ -285,30 +285,6 @@
# define nllinfo(x...) # define nllinfo(x...)
#endif #endif
#ifdef CONFIG_DEBUG_USB_ERROR
# define uerr(format, ...) err(format, ##__VA_ARGS__)
# define ullerr(format, ...) llerr(format, ##__VA_ARGS__)
#else
# define uerr(x...)
# define ullerr(x...)
#endif
#ifdef CONFIG_DEBUG_USB_WARN
# define uwarn(format, ...) warn(format, ##__VA_ARGS__)
# define ullwarn(format, ...) llwarn(format, ##__VA_ARGS__)
#else
# define uwarn(x...)
# define ullwarn(x...)
#endif
#ifdef CONFIG_DEBUG_USB_INFO
# define uinfo(format, ...) info(format, ##__VA_ARGS__)
# define ullinfo(format, ...) llinfo(format, ##__VA_ARGS__)
#else
# define uinfo(x...)
# define ullinfo(x...)
#endif
#ifdef CONFIG_DEBUG_FS_ERROR #ifdef CONFIG_DEBUG_FS_ERROR
# define ferr(format, ...) err(format, ##__VA_ARGS__) # define ferr(format, ...) err(format, ##__VA_ARGS__)
# define fllerr(format, ...) llerr(format, ##__VA_ARGS__) # define fllerr(format, ...) llerr(format, ##__VA_ARGS__)
@ -765,6 +741,54 @@
# define spillinfo(x...) # define spillinfo(x...)
#endif #endif
#ifdef CONFIG_DEBUG_USB_ERROR
# define uerr(format, ...) err(format, ##__VA_ARGS__)
# define ullerr(format, ...) llerr(format, ##__VA_ARGS__)
#else
# define uerr(x...)
# define ullerr(x...)
#endif
#ifdef CONFIG_DEBUG_USB_WARN
# define uwarn(format, ...) warn(format, ##__VA_ARGS__)
# define ullwarn(format, ...) llwarn(format, ##__VA_ARGS__)
#else
# define uwarn(x...)
# define ullwarn(x...)
#endif
#ifdef CONFIG_DEBUG_USB_INFO
# define uinfo(format, ...) info(format, ##__VA_ARGS__)
# define ullinfo(format, ...) llinfo(format, ##__VA_ARGS__)
#else
# define uinfo(x...)
# define ullinfo(x...)
#endif
#ifdef CONFIG_DEBUG_WATCHDOG_ERROR
# define wderr(format, ...) err(format, ##__VA_ARGS__)
# define wdllerr(format, ...) llerr(format, ##__VA_ARGS__)
#else
# define wderr(x...)
# define wdllerr(x...)
#endif
#ifdef CONFIG_DEBUG_WATCHDOG_WARN
# define wdwarn(format, ...) warn(format, ##__VA_ARGS__)
# define wdllwarn(format, ...) llwarn(format, ##__VA_ARGS__)
#else
# define wdwarn(x...)
# define wdllwarn(x...)
#endif
#ifdef CONFIG_DEBUG_WATCHDOG_INFO
# define wdinfo(format, ...) info(format, ##__VA_ARGS__)
# define wdllinfo(format, ...) llinfo(format, ##__VA_ARGS__)
#else
# define wdinfo(x...)
# define wdllinfo(x...)
#endif
#else /* CONFIG_CPP_HAVE_VARARGS */ #else /* CONFIG_CPP_HAVE_VARARGS */
/* Variadic macros NOT supported */ /* Variadic macros NOT supported */
@ -898,30 +922,6 @@
# define nllinfo (void) # define nllinfo (void)
#endif #endif
#ifdef CONFIG_DEBUG_USB_ERROR
# define uerr err
# define ullerr llerr
#else
# define uerr (void)
# define ullerr (void)
#endif
#ifdef CONFIG_DEBUG_USB_WARN
# define uwarn warn
# define ullwarn llwarn
#else
# define uwarn (void)
# define ullwarn (void)
#endif
#ifdef CONFIG_DEBUG_USB_INFO
# define uinfo info
# define ullinfo llinfo
#else
# define uinfo (void)
# define ullinfo (void)
#endif
#ifdef CONFIG_DEBUG_FS_ERROR #ifdef CONFIG_DEBUG_FS_ERROR
# define ferr err # define ferr err
# define fllerr llerr # define fllerr llerr
@ -1378,6 +1378,54 @@
# define spillinfo (void) # define spillinfo (void)
#endif #endif
#ifdef CONFIG_DEBUG_USB_ERROR
# define uerr err
# define ullerr llerr
#else
# define uerr (void)
# define ullerr (void)
#endif
#ifdef CONFIG_DEBUG_USB_WARN
# define uwarn warn
# define ullwarn llwarn
#else
# define uwarn (void)
# define ullwarn (void)
#endif
#ifdef CONFIG_DEBUG_USB_INFO
# define uinfo info
# define ullinfo llinfo
#else
# define uinfo (void)
# define ullinfo (void)
#endif
#ifdef CONFIG_DEBUG_WATCHDOG_ERROR
# define wderr err
# define wdllerr llerr
#else
# define wderr (void)
# define wdllerr (void)
#endif
#ifdef CONFIG_DEBUG_WATCHDOG_WARN
# define wdwarn warn
# define wdllwarn llwarn
#else
# define wdwarn (void)
# define wdllwarn (void)
#endif
#ifdef CONFIG_DEBUG_WATCHDOG_INFO
# define wdinfo info
# define wdllinfo llinfo
#else
# define wdinfo (void)
# define wdllinfo (void)
#endif
#endif /* CONFIG_CPP_HAVE_VARARGS */ #endif /* CONFIG_CPP_HAVE_VARARGS */
/* Buffer dumping macros do not depend on varargs */ /* Buffer dumping macros do not depend on varargs */
@ -1428,14 +1476,6 @@
# define ninfodumpbuffer(m,b,n) # define ninfodumpbuffer(m,b,n)
#endif #endif
#ifdef CONFIG_DEBUG_USB
# define uerrdumpbuffer(m,b,n) errdumpbuffer(m,b,n)
# define uinfodumpbuffer(m,b,n) infodumpbuffer(m,b,n)
#else
# define uerrdumpbuffer(m,b,n)
# define uinfodumpbuffer(m,b,n)
#endif
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
# define ferrdumpbuffer(m,b,n) errdumpbuffer(m,b,n) # define ferrdumpbuffer(m,b,n) errdumpbuffer(m,b,n)
# define finfodumpbuffer(m,b,n) infodumpbuffer(m,b,n) # define finfodumpbuffer(m,b,n) infodumpbuffer(m,b,n)
@ -1572,6 +1612,22 @@
# define sninfodumpbuffer(m,b,n) # define sninfodumpbuffer(m,b,n)
#endif #endif
#ifdef CONFIG_DEBUG_USB
# define uerrdumpbuffer(m,b,n) errdumpbuffer(m,b,n)
# define uinfodumpbuffer(m,b,n) infodumpbuffer(m,b,n)
#else
# define uerrdumpbuffer(m,b,n)
# define uinfodumpbuffer(m,b,n)
#endif
#ifdef CONFIG_DEBUG_WATCHDOG
# define wderrdumpbuffer(m,b,n) errdumpbuffer(m,b,n)
# define wdinfodumpbuffer(m,b,n) infodumpbuffer(m,b,n)
#else
# define wderrdumpbuffer(m,b,n)
# define wdinfodumpbuffer(m,b,n)
#endif
/**************************************************************************** /****************************************************************************
* Public Type Declarations * Public Type Declarations
****************************************************************************/ ****************************************************************************/