diff --git a/configs/arduino-due/src/sam_nsh.c b/configs/arduino-due/src/sam_nsh.c index 283bfde76e..e6ef08aa3c 100644 --- a/configs/arduino-due/src/sam_nsh.c +++ b/configs/arduino-due/src/sam_nsh.c @@ -40,7 +40,7 @@ #include #include -#include +#include #include "arduino-due.h" @@ -66,22 +66,6 @@ # endif #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -104,8 +88,9 @@ int nsh_archinitialize(void) int ret = sam_sdinitialize(CONFIG_NSH_MMCSDMINOR); if (ret < 0) { - message("nsh_archinitialize: Failed to initialize MMC/SD slot: %d\n", - ret); + syslog(LOG_ERR, + "nsh_archinitialize: Failed to initialize MMC/SD slot: %d\n", + ret); return ret; } } diff --git a/configs/cloudctrl/src/up_nsh.c b/configs/cloudctrl/src/up_nsh.c index a43b98d47e..9754b60f81 100644 --- a/configs/cloudctrl/src/up_nsh.c +++ b/configs/cloudctrl/src/up_nsh.c @@ -43,7 +43,7 @@ #include #include -#include +#include #include #include "stm32.h" @@ -97,22 +97,6 @@ # undef HAVE_USBHOST #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -137,8 +121,8 @@ int nsh_archinitialize(void) ret = stm32_w25initialize(CONFIG_NSH_W25MINOR); if (ret < 0) { - message("nsh_archinitialize: Failed to initialize W25 minor %d: %d\n", - CONFIG_NSH_W25MINOR, ret); + syslog(LOG_ERR, "ERROR: Failed to initialize W25 minor %d: %d\n", + CONFIG_NSH_W25MINOR, ret); return ret; } #endif @@ -151,7 +135,7 @@ int nsh_archinitialize(void) ret = stm32_usbhost_initialize(); if (ret != OK) { - message("nsh_archinitialize: Failed to initialize USB host: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); return ret; } #endif diff --git a/configs/demo9s12ne64/src/up_nsh.c b/configs/demo9s12ne64/src/up_nsh.c index c4773c0ac5..dae0a848fc 100644 --- a/configs/demo9s12ne64/src/up_nsh.c +++ b/configs/demo9s12ne64/src/up_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include "demo9s12ne64.h" @@ -50,22 +50,6 @@ * Pre-Processor Definitions ****************************************************************************/ -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/configs/ea3131/src/up_nsh.c b/configs/ea3131/src/up_nsh.c index 67d2c4a149..41bdfccb93 100644 --- a/configs/ea3131/src/up_nsh.c +++ b/configs/ea3131/src/up_nsh.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include #ifdef CONFIG_LPC31_MCI @@ -96,22 +96,6 @@ # define CONFIG_NSH_MMCSDMINOR 0 #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -132,27 +116,30 @@ int nsh_archinitialize(void) /* First, get an instance of the SDIO interface */ - message("nsh_archinitialize: Initializing SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Initializing SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); + sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); if (!sdio) { - message("nsh_archinitialize: Failed to initialize SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); return -ENODEV; } /* Now bind the SPI interface to the MMC/SD driver */ - message("nsh_archinitialize: Bind SDIO to the MMC/SD driver, minor=%d\n", - CONFIG_NSH_MMCSDMINOR); + syslog(LOG_INFO, "Bind SDIO to the MMC/SD driver, minor=%d\n", + CONFIG_NSH_MMCSDMINOR); + ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio); if (ret != OK) { - message("nsh_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); return ret; } - message("nsh_archinitialize: Successfully bound SDIO to the MMC/SD driver\n"); + + syslog(LOG_INFO, "Successfully bound SDIO to the MMC/SD driver\n"); /* Then let's guess and say that there is a card in the slot. I need to check to * see if the LPC313X10E-EVAL board supports a GPIO to detect if there is a card in diff --git a/configs/ea3152/src/up_nsh.c b/configs/ea3152/src/up_nsh.c index 5c94c053c3..8e0815860a 100644 --- a/configs/ea3152/src/up_nsh.c +++ b/configs/ea3152/src/up_nsh.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include #ifdef CONFIG_LPC31_MCI @@ -96,22 +96,6 @@ # define CONFIG_NSH_MMCSDMINOR 0 #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -132,27 +116,30 @@ int nsh_archinitialize(void) /* First, get an instance of the SDIO interface */ - message("nsh_archinitialize: Initializing SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Initializing SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); + sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); if (!sdio) { - message("nsh_archinitialize: Failed to initialize SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); return -ENODEV; } /* Now bind the SPI interface to the MMC/SD driver */ - message("nsh_archinitialize: Bind SDIO to the MMC/SD driver, minor=%d\n", - CONFIG_NSH_MMCSDMINOR); + syslog(LOG_INFO, "Bind SDIO to the MMC/SD driver, minor=%d\n", + CONFIG_NSH_MMCSDMINOR); + ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio); if (ret != OK) { - message("nsh_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); return ret; } - message("nsh_archinitialize: Successfully bound SDIO to the MMC/SD driver\n"); + + syslog(LOG_INFO, "Successfully bound SDIO to the MMC/SD driver\n"); /* Then let's guess and say that there is a card in the slot. I need to check to * see if the LPC313X10E-EVAL board supports a GPIO to detect if there is a card in diff --git a/configs/eagle100/src/up_nsh.c b/configs/eagle100/src/up_nsh.c index 4b81631824..0d9cda1be2 100644 --- a/configs/eagle100/src/up_nsh.c +++ b/configs/eagle100/src/up_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include @@ -91,22 +91,6 @@ # define CONFIG_NSH_MMCSDMINOR 0 #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -126,34 +110,34 @@ int nsh_archinitialize(void) /* Get the SPI port */ - message("nsh_archinitialize: Initializing SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_INFO, "Initializing SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); spi = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO); if (!spi) { - message("nsh_archinitialize: Failed to initialize SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); return -ENODEV; } - message("nsh_archinitialize: Successfully initialized SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_INFO, "Successfully initialized SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); /* Bind the SPI port to the slot */ - message("nsh_archinitialize: Binding SPI port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Binding SPI port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, spi); if (ret < 0) { - message("nsh_archinitialize: Failed to bind SPI port %d to MMC/SD slot %d: %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); + syslog(LOG_ERR, "ERROR: Failed to bind SPI port %d to MMC/SD slot %d: %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); return ret; } - message("nsh_archinitialize: Successfuly bound SPI port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Successfuly bound SPI port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); return OK; } diff --git a/configs/ekk-lm3s9b96/src/up_nsh.c b/configs/ekk-lm3s9b96/src/up_nsh.c index f54fb726c5..611261a618 100644 --- a/configs/ekk-lm3s9b96/src/up_nsh.c +++ b/configs/ekk-lm3s9b96/src/up_nsh.c @@ -42,31 +42,13 @@ #include #include -#include +#include #include /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ -/* Configuration ************************************************************/ - -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/configs/fire-stm32v2/src/up_nsh.c b/configs/fire-stm32v2/src/up_nsh.c index 7c0b3dc387..7d10445a16 100644 --- a/configs/fire-stm32v2/src/up_nsh.c +++ b/configs/fire-stm32v2/src/up_nsh.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include #include "stm32.h" @@ -123,22 +123,6 @@ # undef HAVE_USBDEV #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -163,8 +147,8 @@ int nsh_archinitialize(void) ret = stm32_w25initialize(CONFIG_NSH_W25MINOR); if (ret < 0) { - message("nsh_archinitialize: Failed to initialize W25 minor %d: %d\n", - CONFIG_NSH_W25MINOR, ret); + syslog(LOG_ERR, "ERROR: Failed to initialize W25 minor %d: %d\n", + CONFIG_NSH_W25MINOR, ret); return ret; } #endif @@ -175,8 +159,8 @@ int nsh_archinitialize(void) ret = stm32_sdinitialize(CONFIG_NSH_MMCSDMINOR); if (ret < 0) { - message("nsh_archinitialize: Failed to initialize MMC/SD slot %d: %d\n", - CONFIG_NSH_MMCSDSLOTNO, ret); + syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot %d: %d\n", + CONFIG_NSH_MMCSDSLOTNO, ret); return ret; } #endif diff --git a/configs/freedom-kl25z/src/kl_nsh.c b/configs/freedom-kl25z/src/kl_nsh.c index 3b91874660..c5476f55cc 100644 --- a/configs/freedom-kl25z/src/kl_nsh.c +++ b/configs/freedom-kl25z/src/kl_nsh.c @@ -41,29 +41,13 @@ #include #include +#include #ifdef CONFIG_NSH_LIBRARY /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ -/* Configuration ************************************************************/ - -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# if defined(CONFIG_DEBUG) || !defined(CONFIG_NSH_ARCHINIT) -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# if defined(CONFIG_DEBUG) || !defined(CONFIG_NSH_ARCHINIT) -# define message lowsyslog -# else -# define message printf -# endif -#endif /**************************************************************************** * Public Functions diff --git a/configs/hymini-stm32v/src/up_nsh.c b/configs/hymini-stm32v/src/up_nsh.c index 680271dc29..7c29bc2c0a 100644 --- a/configs/hymini-stm32v/src/up_nsh.c +++ b/configs/hymini-stm32v/src/up_nsh.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include #ifdef CONFIG_STM32_SPI1 @@ -68,7 +68,6 @@ #undef CONFIG_STM32_SPI1 - /* Check if we can have USB device in NSH */ #define NSH_HAVEUSBDEV 1 @@ -104,23 +103,6 @@ # endif #endif - -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Private Data ****************************************************************************/ @@ -190,27 +172,30 @@ int nsh_archinitialize(void) /* First, get an instance of the SDIO interface */ - message("nsh_archinitialize: Initializing SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Initializing SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); + g_sdiodev = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); if (!g_sdiodev) { - message("nsh_archinitialize: Failed to initialize SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); return -ENODEV; } /* Now bind the SDIO interface to the MMC/SD driver */ - message("nsh_archinitialize: Bind SDIO to the MMC/SD driver, minor=%d\n", - CONFIG_NSH_MMCSDMINOR); + syslog(LOG_INFO, "Bind SDIO to the MMC/SD driver, minor=%d\n", + CONFIG_NSH_MMCSDMINOR); + ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, g_sdiodev); if (ret != OK) { - message("nsh_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); return ret; } - dbg("nsh_archinitialize: Successfully bound SDIO to the MMC/SD driver\n"); + + syslog(LOG_INFO, "Successfully bound SDIO to the MMC/SD driver\n"); /* Use SD card detect pin to check if a card is inserted */ diff --git a/configs/kwikstik-k40/src/up_nsh.c b/configs/kwikstik-k40/src/up_nsh.c index 1e52c931e6..42885d12f4 100644 --- a/configs/kwikstik-k40/src/up_nsh.c +++ b/configs/kwikstik-k40/src/up_nsh.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include #ifdef CONFIG_KINETIS_SDHC @@ -105,22 +105,6 @@ # error "CONFIG_KINETIS_PORTEINTS required for card detect interrupt" #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Private Types ****************************************************************************/ @@ -222,29 +206,30 @@ int nsh_archinitialize(void) /* Mount the SDHC-based MMC/SD block driver */ /* First, get an instance of the SDHC interface */ - message("nsh_archinitialize: Initializing SDHC slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Initializing SDHC slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); g_nsh.sdhc = sdhc_initialize(CONFIG_NSH_MMCSDSLOTNO); if (!g_nsh.sdhc) { - message("nsh_archinitialize: Failed to initialize SDHC slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_ERR, "ERROR: Failed to initialize SDHC slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); return -ENODEV; } /* Now bind the SDHC interface to the MMC/SD driver */ - message("nsh_archinitialize: Bind SDHC to the MMC/SD driver, minor=%d\n", - CONFIG_NSH_MMCSDMINOR); + syslog(LOG_INFO, "Bind SDHC to the MMC/SD driver, minor=%d\n", + CONFIG_NSH_MMCSDMINOR); ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, g_nsh.sdhc); if (ret != OK) { - message("nsh_archinitialize: Failed to bind SDHC to the MMC/SD driver: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to bind SDHC to the MMC/SD driver: %d\n", ret); return ret; } - message("nsh_archinitialize: Successfully bound SDHC to the MMC/SD driver\n"); + + syslog(LOG_INFO, "Successfully bound SDHC to the MMC/SD driver\n"); /* Handle the initial card state */ diff --git a/configs/lincoln60/src/up_nsh.c b/configs/lincoln60/src/up_nsh.c index 0dda48bb2f..d54c140c33 100644 --- a/configs/lincoln60/src/up_nsh.c +++ b/configs/lincoln60/src/up_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include @@ -50,23 +50,6 @@ /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ -/* Configuration ************************************************************/ - -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif /**************************************************************************** * Public Functions diff --git a/configs/lm3s6432-s2e/src/up_nsh.c b/configs/lm3s6432-s2e/src/up_nsh.c index a480ade46e..009849bc7b 100644 --- a/configs/lm3s6432-s2e/src/up_nsh.c +++ b/configs/lm3s6432-s2e/src/up_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include @@ -51,24 +51,6 @@ * Pre-Processor Definitions ****************************************************************************/ -/* Configuration ************************************************************/ - -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/configs/lm3s6965-ek/src/up_nsh.c b/configs/lm3s6965-ek/src/up_nsh.c index 92a19e5007..65770f0a94 100644 --- a/configs/lm3s6965-ek/src/up_nsh.c +++ b/configs/lm3s6965-ek/src/up_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include @@ -91,22 +91,6 @@ # define CONFIG_NSH_MMCSDMINOR 0 #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -126,34 +110,34 @@ int nsh_archinitialize(void) /* Get the SPI port */ - message("nsh_archinitialize: Initializing SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_INFO, "Initializing SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); spi = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO); if (!spi) { - message("nsh_archinitialize: Failed to initialize SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); return -ENODEV; } - message("nsh_archinitialize: Successfully initialized SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_INFO, "Successfully initialized SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); /* Bind the SPI port to the slot */ - message("nsh_archinitialize: Binding SPI port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Binding SPI port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, spi); if (ret < 0) { - message("nsh_archinitialize: Failed to bind SPI port %d to MMC/SD slot %d: %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); + syslog(LOG_ERR, "ERROR: Failed to bind SPI port %d to MMC/SD slot %d: %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); return ret; } - message("nsh_archinitialize: Successfuly bound SPI port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Successfuly bound SPI port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); return OK; } diff --git a/configs/lm3s8962-ek/src/up_nsh.c b/configs/lm3s8962-ek/src/up_nsh.c index 13985a25c9..9063dee4dd 100644 --- a/configs/lm3s8962-ek/src/up_nsh.c +++ b/configs/lm3s8962-ek/src/up_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include @@ -91,22 +91,6 @@ # define CONFIG_NSH_MMCSDMINOR 0 #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -126,34 +110,34 @@ int nsh_archinitialize(void) /* Get the SPI port */ - message("nsh_archinitialize: Initializing SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_INFO, "Initializing SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); spi = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO); if (!spi) { - message("nsh_archinitialize: Failed to initialize SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); return -ENODEV; } - message("nsh_archinitialize: Successfully initialized SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_INFO, "Successfully initialized SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); /* Bind the SPI port to the slot */ - message("nsh_archinitialize: Binding SPI port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Binding SPI port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, spi); if (ret < 0) { - message("nsh_archinitialize: Failed to bind SPI port %d to MMC/SD slot %d: %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); + syslog(LOG_ERR, "ERROR: Failed to bind SPI port %d to MMC/SD slot %d: %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); return ret; } - message("nsh_archinitialize: Successfuly bound SPI port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Successfuly bound SPI port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); return OK; } diff --git a/configs/lm4f120-launchpad/src/lm4f_nsh.c b/configs/lm4f120-launchpad/src/lm4f_nsh.c index 22a9103d83..f3eed743b5 100644 --- a/configs/lm4f120-launchpad/src/lm4f_nsh.c +++ b/configs/lm4f120-launchpad/src/lm4f_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include @@ -68,22 +68,6 @@ # undef NSH_HAVEUSBDEV #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/configs/lpc4330-xplorer/src/up_nsh.c b/configs/lpc4330-xplorer/src/up_nsh.c index df1f0ddf7f..732c4f8f14 100644 --- a/configs/lpc4330-xplorer/src/up_nsh.c +++ b/configs/lpc4330-xplorer/src/up_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include "chip.h" diff --git a/configs/lpcxpresso-lpc1768/src/up_nsh.c b/configs/lpcxpresso-lpc1768/src/up_nsh.c index 47c4dc0bb7..93cb3c0b2c 100644 --- a/configs/lpcxpresso-lpc1768/src/up_nsh.c +++ b/configs/lpcxpresso-lpc1768/src/up_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include @@ -99,22 +99,6 @@ # define CONFIG_NSH_MMCSDMINOR 0 #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Private Data ****************************************************************************/ @@ -146,26 +130,26 @@ int nsh_archinitialize(void) ssp = lpc17_sspinitialize(CONFIG_NSH_MMCSDSPIPORTNO); if (!ssp) { - message("nsh_archinitialize: Failed to initialize SSP port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_ERR, "ERROR: Failed to initialize SSP port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); return -ENODEV; } - message("Successfully initialized SSP port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_INFO, "Successfully initialized SSP port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); /* Bind the SSP port to the slot */ ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, ssp); if (ret < 0) { - message("nsh_archinitialize: Failed to bind SSP port %d to MMC/SD slot %d: %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); + syslog(LOG_ERR, "ERROR: Failed to bind SSP port %d to MMC/SD slot %d: %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); return ret; } - message("Successfuly bound SSP port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Successfuly bound SSP port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); #endif return OK; } diff --git a/configs/mbed/src/up_nsh.c b/configs/mbed/src/up_nsh.c index ab865033ad..4d7ac8b4e8 100644 --- a/configs/mbed/src/up_nsh.c +++ b/configs/mbed/src/up_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include @@ -68,22 +68,6 @@ # undef NSH_HAVEUSBDEV #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/configs/mcu123-lpc214x/src/up_nsh.c b/configs/mcu123-lpc214x/src/up_nsh.c index 989dc2952c..2496f38d7e 100644 --- a/configs/mcu123-lpc214x/src/up_nsh.c +++ b/configs/mcu123-lpc214x/src/up_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include @@ -91,22 +91,6 @@ # define CONFIG_NSH_MMCSDMINOR 0 #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -126,34 +110,34 @@ int nsh_archinitialize(void) /* Get the SPI port */ - message("nsh_archinitialize: Initializing SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_INFO, "Initializing SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); spi = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO); if (!spi) { - message("nsh_archinitialize: Failed to initialize SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); return -ENODEV; } - message("nsh_archinitialize: Successfully initialized SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_INFO, "Successfully initialized SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); /* Bind the SPI port to the slot */ - message("nsh_archinitialize: Binding SPI port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Binding SPI port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, spi); if (ret < 0) { - message("nsh_archinitialize: Failed to bind SPI port %d to MMC/SD slot %d: %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); + syslog(LOG_ERR, "ERROR: Failed to bind SPI port %d to MMC/SD slot %d: %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); return ret; } - message("nsh_archinitialize: Successfuly bound SPI port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Successfuly bound SPI port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); return OK; } diff --git a/configs/mikroe-stm32f4/src/up_nsh.c b/configs/mikroe-stm32f4/src/up_nsh.c index 31e9be21dc..b68101c0a4 100644 --- a/configs/mikroe-stm32f4/src/up_nsh.c +++ b/configs/mikroe-stm32f4/src/up_nsh.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include #include @@ -147,22 +147,6 @@ # endif #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Private Data ****************************************************************************/ @@ -192,28 +176,29 @@ int nsh_archinitialize(void) #ifdef CONFIG_STM32_SPI3 /* Get the SPI port */ - message("nsh_archinitialize: Initializing SPI port 3\n"); + syslog(LOG_INFO, "Initializing SPI port 3\n"); spi = up_spiinitialize(3); if (!spi) { - message("nsh_archinitialize: Failed to initialize SPI port 3\n"); + syslog(LOG_ERR, "ERROR: Failed to initialize SPI port 3\n"); return -ENODEV; } - message("nsh_archinitialize: Successfully initialized SPI port 3\n"); + syslog(LOG_INFO, "Successfully initialized SPI port 3\n"); /* Now bind the SPI interface to the M25P8 SPI FLASH driver */ #if defined(CONFIG_MTD) && defined(CONFIG_MIKROE_FLASH) - message("nsh_archinitialize: Bind SPI to the SPI flash driver\n"); + syslog(LOG_INFO, "Bind SPI to the SPI flash driver\n"); + mtd = m25p_initialize(spi); if (!mtd) { - message("nsh_archinitialize: Failed to bind SPI port 3 to the SPI FLASH driver\n"); + syslog(LOG_ERR, "ERROR: Failed to bind SPI port 3 to the SPI FLASH driver\n"); } else { - message("nsh_archinitialize: Successfully bound SPI port 3 to the SPI FLASH driver\n"); + syslog(LOG_INFO, "Successfully bound SPI port 3 to the SPI FLASH driver\n"); #ifdef CONFIG_MIKROE_FLASH_PART { @@ -317,16 +302,17 @@ int nsh_archinitialize(void) #ifdef NSH_HAVEMMCSD /* Bind the spi interface to the MMC/SD driver */ - message("nsh_archinitialize: Bind SDIO to the MMC/SD driver, minor=%d\n", - CONFIG_NSH_MMCSDMINOR); + syslog(LOG_INFO, "Bind SDIO to the MMC/SD driver, minor=%d\n", + CONFIG_NSH_MMCSDMINOR); + ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, spi); if (ret != OK) { - message("nsh_archinitialize: Failed to bind SPI to the MMC/SD driver: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to bind SPI to the MMC/SD driver: %d\n", ret); } else { - message("nsh_archinitialize: Successfully bound SPI to the MMC/SD driver\n"); + syslog(LOG_INFO, "Successfully bound SPI to the MMC/SD driver\n"); } #endif @@ -338,7 +324,7 @@ int nsh_archinitialize(void) ret = stm32_usbhost_initialize(); if (ret != OK) { - message("nsh_archinitialize: Failed to initialize USB host: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); return ret; } #endif @@ -349,19 +335,19 @@ int nsh_archinitialize(void) ret = usbmonitor_start(0, NULL); if (ret != OK) { - message("nsh_archinitialize: Start USB monitor: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d\n", ret); } #endif #if defined(CONFIG_LCD_MIO283QT2) || defined(CONFIG_LCD_MIO283QT9A) /* Configure the TFT LCD module */ - message("nsh_archinitialize: Initializing TFT LCD module\n"); + syslog(LOG_INFO, "Initializing TFT LCD module\n"); ret = up_lcdinitialize(); if (ret != OK) { - message("nsh_archinitialize: Failed to initialize TFT LCD module\n"); + syslog(LOG_ERR, "ERROR: Failed to initialize TFT LCD module\n"); } #endif diff --git a/configs/mirtoo/src/up_nsh.c b/configs/mirtoo/src/up_nsh.c index f81104c2bd..9aa1f9aa9e 100644 --- a/configs/mirtoo/src/up_nsh.c +++ b/configs/mirtoo/src/up_nsh.c @@ -45,7 +45,7 @@ #include #include #include -#include +#include #ifdef CONFIG_PIC32MX_SPI2 # include diff --git a/configs/ne64badge/src/up_nsh.c b/configs/ne64badge/src/up_nsh.c index 10e0e74d5b..b0cbbd635e 100644 --- a/configs/ne64badge/src/up_nsh.c +++ b/configs/ne64badge/src/up_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include "ne64badge_internal.h" @@ -50,22 +50,6 @@ * Pre-Processor Definitions ****************************************************************************/ -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/configs/nucleo-f401re/src/stm32_nsh.c b/configs/nucleo-f401re/src/stm32_nsh.c index 3074d57c17..43aef2c59e 100644 --- a/configs/nucleo-f401re/src/stm32_nsh.c +++ b/configs/nucleo-f401re/src/stm32_nsh.c @@ -40,7 +40,7 @@ #include #include -#include +#include #include #include @@ -57,23 +57,6 @@ /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ -/* Configuration ************************************************************/ - -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif /**************************************************************************** * Private Data @@ -127,8 +110,8 @@ int nsh_archinitialize(void) g_sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); if (!g_sdio) { - message("[boot] Failed to initialize SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); return -ENODEV; } @@ -137,7 +120,9 @@ int nsh_archinitialize(void) ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, g_sdio); if (ret != OK) { - message("ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); + syslog(LOG_ERR, + "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", + ret); return ret; } @@ -147,7 +132,7 @@ int nsh_archinitialize(void) sdio_mediachange(g_sdio, true); - message("[boot] Initialized SDIO\n"); + syslog(LOG_INFO, "[boot] Initialized SDIO\n"); #endif return OK; diff --git a/configs/nucleus2g/src/up_nsh.c b/configs/nucleus2g/src/up_nsh.c index 8dbdf91348..7bfc89d3e9 100644 --- a/configs/nucleus2g/src/up_nsh.c +++ b/configs/nucleus2g/src/up_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include @@ -93,22 +93,6 @@ # define CONFIG_NSH_MMCSDMINOR 0 #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Private Data ****************************************************************************/ @@ -139,26 +123,26 @@ int nsh_archinitialize(void) ssp = lpc17_sspinitialize(CONFIG_NSH_MMCSDSPIPORTNO); if (!ssp) { - message("nsh_archinitialize: Failed to initialize SSP port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_ERR, "ERROR: Failed to initialize SSP port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); return -ENODEV; } - message("Successfully initialized SSP port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_INFO, "Successfully initialized SSP port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); /* Bind the SSP port to the slot */ ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, ssp); if (ret < 0) { - message("nsh_archinitialize: Failed to bind SSP port %d to MMC/SD slot %d: %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); + syslog(LOG_ERR, "ERROR: Failed to bind SSP port %d to MMC/SD slot %d: %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); return ret; } - message("Successfuly bound SSP port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Successfuly bound SSP port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); return OK; } diff --git a/configs/olimex-lpc-h3131/src/lpc31_nsh.c b/configs/olimex-lpc-h3131/src/lpc31_nsh.c index bb72ee88b6..f800a12206 100644 --- a/configs/olimex-lpc-h3131/src/lpc31_nsh.c +++ b/configs/olimex-lpc-h3131/src/lpc31_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #ifdef CONFIG_SYSTEM_USBMONITOR @@ -69,22 +69,6 @@ # endif #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -106,12 +90,12 @@ int nsh_archinitialize(void) #ifdef HAVE_MMCSD /* Create the SDIO-based MMC/SD device */ - message("nsh_archinitialize: Create the MMC/SD device\n"); + syslog(LOG_INFO, "Create the MMC/SD device\n"); ret = lpc31_mmcsd_initialize(CONFIG_NSH_MMCSDSLOTNO); if (!sdio) { - message("nsh_archinitialize: Failed to initialize SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO, CONFIG_NSH_MMCSDMINOR); + syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO, CONFIG_NSH_MMCSDMINOR); return -ENODEV; } #endif @@ -121,11 +105,11 @@ int nsh_archinitialize(void) * will monitor for USB connection and disconnection events. */ - message("nsh_archinitialize: Start USB host services\n"); + syslog(LOG_INFO, "Start USB host services\n"); ret = lpc31_usbhost_initialize(); if (ret != OK) { - message("ERROR: Failed to start USB host services: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to start USB host services: %d\n", ret); return ret; } #endif @@ -133,11 +117,11 @@ int nsh_archinitialize(void) #ifdef HAVE_USBMONITOR /* Start the USB Monitor */ - message("nsh_archinitialize: Start the USB monitor\n"); + syslog(LOG_ERR, "ERROR: Failed to start the USB monitor\n"); ret = usbmonitor_start(0, NULL); if (ret != OK) { - message("nsh_archinitialize: Failed to start USB monitor: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d\n", ret); } #endif diff --git a/configs/olimex-lpc1766stk/src/lpc17_nsh.c b/configs/olimex-lpc1766stk/src/lpc17_nsh.c index 204ac7f4bc..c72817fd83 100644 --- a/configs/olimex-lpc1766stk/src/lpc17_nsh.c +++ b/configs/olimex-lpc1766stk/src/lpc17_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include @@ -117,22 +117,6 @@ # endif #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Private Data ****************************************************************************/ @@ -158,7 +142,7 @@ static int nsh_waiter(int argc, char *argv[]) { bool connected = false; - message("nsh_waiter: Running\n"); + syslog(LOG_INFO, "nsh_waiter: Running\n"); for (;;) { /* Wait for the device to change state */ @@ -166,7 +150,7 @@ static int nsh_waiter(int argc, char *argv[]) DEBUGVERIFY(CONN_WAIT(g_usbconn, &connected)); connected = !connected; - message("nsh_waiter: %s\n", connected ? "connected" : "disconnected"); + syslog(LOG_INFO, "%s\n", connected ? "connected" : "disconnected"); /* Did we just become connected? */ @@ -207,14 +191,14 @@ static int nsh_sdinitialize(void) ssp = lpc17_sspinitialize(CONFIG_NSH_MMCSDSPIPORTNO); if (!ssp) { - message("nsh_archinitialize: Failed to initialize SSP port %d\n", + syslog(LOG_ERR, "ERROR: Failed to initialize SSP port %d\n", CONFIG_NSH_MMCSDSPIPORTNO); ret = -ENODEV; goto errout; } - message("Successfully initialized SSP port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_INFO, "Successfully initialized SSP port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); /* Bind the SSP port to the slot */ @@ -222,16 +206,16 @@ static int nsh_sdinitialize(void) CONFIG_NSH_MMCSDSLOTNO, ssp); if (ret < 0) { - message("nsh_sdinitialize: " - "Failed to bind SSP port %d to MMC/SD slot %d: %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, - CONFIG_NSH_MMCSDSLOTNO, ret); + syslog(LOG_ERR, + "ERROR: Failed to bind SSP port %d to MMC/SD slot %d: %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, + CONFIG_NSH_MMCSDSLOTNO, ret); goto errout; } - message("Successfuly bound SSP port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Successfully bound SSP port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, + CONFIG_NSH_MMCSDSLOTNO); return OK; /* Disable power to the SD/MMC via a GPIO. HIGH disables SD/MMC. */ @@ -262,28 +246,29 @@ static int nsh_usbhostinitialize(void) * that we care about: */ - message("nsh_usbhostinitialize: Register class drivers\n"); + syslog(LOG_INFO, "Register class drivers\n"); ret = usbhost_storageinit(); if (ret != OK) { - message("nsh_usbhostinitialize: Failed to register the mass storage class\n"); + syslog(LOG_ERR, "ERROR: Failed to register the mass storage class\n"); } /* Then get an instance of the USB host interface */ - message("nsh_usbhostinitialize: Initialize USB host\n"); + syslog(LOG_INFO, "Initialize USB host\n"); g_usbconn = lpc17_usbhost_initialize(0); if (g_usbconn) { /* Start a thread to handle device connection. */ - message("nsh_usbhostinitialize: Start nsh_waiter\n"); + syslog(LOG_ERR, "ERROR: Start nsh_waiter\n"); pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO, CONFIG_USBHOST_STACKSIZE, (main_t)nsh_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } + return -ENODEV; } #else diff --git a/configs/olimex-lpc2378/src/lpc2378_nsh.c b/configs/olimex-lpc2378/src/lpc2378_nsh.c index 903af225ef..4b3ed84ca9 100644 --- a/configs/olimex-lpc2378/src/lpc2378_nsh.c +++ b/configs/olimex-lpc2378/src/lpc2378_nsh.c @@ -46,7 +46,7 @@ #include #include -#include +#include #include #include @@ -79,22 +79,6 @@ # define CONFIG_NSH_MMCSDMINOR 0 #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/configs/olimex-stm32-h405/src/stm32_nsh.c b/configs/olimex-stm32-h405/src/stm32_nsh.c index a3c6486588..73f7923f15 100644 --- a/configs/olimex-stm32-h405/src/stm32_nsh.c +++ b/configs/olimex-stm32-h405/src/stm32_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #ifdef CONFIG_SYSTEM_USBMONITOR @@ -59,24 +59,6 @@ * Pre-Processor Definitions ****************************************************************************/ -/* Configuration ************************************************************/ - -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# if defined(CONFIG_DEBUG) || !defined(CONFIG_NSH_ARCHINIT) -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# if defined(CONFIG_DEBUG) || !defined(CONFIG_NSH_ARCHINIT) -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -108,7 +90,7 @@ int nsh_archinitialize(void) ret = stm32_can_initialize(); if (ret != OK) { - message("nsh_archinitialize: Failed to initialize CAN: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to initialize CAN: %d\n", ret); } #endif @@ -118,7 +100,7 @@ int nsh_archinitialize(void) ret = stm32_adc_initialize(); if (ret != OK) { - message("nsh_archinitialize: Failed to initialize ADC: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to initialize ADC: %d\n", ret); } #endif diff --git a/configs/olimex-stm32-p207/src/up_nsh.c b/configs/olimex-stm32-p207/src/up_nsh.c index 49f481c15b..824ece45be 100644 --- a/configs/olimex-stm32-p207/src/up_nsh.c +++ b/configs/olimex-stm32-p207/src/up_nsh.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include #ifdef CONFIG_SYSTEM_USBMONITOR @@ -93,22 +93,6 @@ # undef HAVE_USBMONITOR #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# if defined(CONFIG_DEBUG) || !defined(CONFIG_NSH_ARCHINIT) -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# if defined(CONFIG_DEBUG) || !defined(CONFIG_NSH_ARCHINIT) -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -140,7 +124,7 @@ int nsh_archinitialize(void) ret = stm32_can_initialize(); if (ret != OK) { - message("nsh_archinitialize: Failed to initialize CAN: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to initialize CAN: %d\n", ret); } #endif @@ -150,7 +134,7 @@ int nsh_archinitialize(void) ret = stm32_adc_initialize(); if (ret != OK) { - message("nsh_archinitialize: Failed to initialize ADC: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to initialize ADC: %d\n", ret); } #endif @@ -162,7 +146,7 @@ int nsh_archinitialize(void) ret = stm32_usbhost_initialize(); if (ret != OK) { - message("nsh_archinitialize: Failed to initialize USB host: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); return ret; } #endif @@ -173,7 +157,7 @@ int nsh_archinitialize(void) ret = usbmonitor_start(0, NULL); if (ret != OK) { - message("nsh_archinitialize: Start USB monitor: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d\n", ret); } #endif diff --git a/configs/olimex-strp711/src/up_nsh.c b/configs/olimex-strp711/src/up_nsh.c index 693a51d2a8..6f7cc7a19b 100644 --- a/configs/olimex-strp711/src/up_nsh.c +++ b/configs/olimex-strp711/src/up_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include @@ -95,22 +95,6 @@ # define CONFIG_NSH_MMCSDMINOR 0 #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -131,35 +115,35 @@ int nsh_archinitialize(void) /* Get the SPI port */ - message("nsh_archinitialize: Initializing SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_INFO, "Initializing SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); spi = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO); if (!spi) { - message("nsh_archinitialize: Failed to initialize SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); return -ENODEV; } - message("nsh_archinitialize: Successfully initialized SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_INFO, "Successfully initialized SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); /* Bind the SPI port to the slot */ - message("nsh_archinitialize: Binding SPI port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Binding SPI port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, spi); if (ret < 0) { - message("nsh_archinitialize: Failed to bind SPI port %d to MMC/SD slot %d: %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); + syslog(LOG_ERR, "ERROR: Failed to bind SPI port %d to MMC/SD slot %d: %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); return ret; } - message("nsh_archinitialize: Successfuly bound SPI port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Successfully bound SPI port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); #endif return OK; diff --git a/configs/open1788/src/lpc17_nsh.c b/configs/open1788/src/lpc17_nsh.c index 56f01ce3d5..9cb7570c9e 100644 --- a/configs/open1788/src/lpc17_nsh.c +++ b/configs/open1788/src/lpc17_nsh.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include #include @@ -143,22 +143,6 @@ # undef NSH_HAVE_USBDEV #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# if defined(CONFIG_DEBUG) || !defined(CONFIG_NSH_ARCHINIT) -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# if defined(CONFIG_DEBUG) || !defined(CONFIG_NSH_ARCHINIT) -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Private Data ****************************************************************************/ @@ -188,7 +172,7 @@ static int nsh_waiter(int argc, char *argv[]) bool connected = false; int ret; - message("nsh_waiter: Running\n"); + syslog(LOG_INFO, "nsh_waiter: Running\n"); for (;;) { /* Wait for the device to change state */ @@ -197,7 +181,8 @@ static int nsh_waiter(int argc, char *argv[]) DEBUGASSERT(ret == OK); connected = !connected; - message("nsh_waiter: %s\n", connected ? "connected" : "disconnected"); + syslog(LOG_INFO, "nsh_waiter: %s\n", + connected ? "connected" : "disconnected"); /* Did we just become connected? */ @@ -275,8 +260,8 @@ static int nsh_sdinitialize(void) g_sdiodev = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); if (!g_sdiodev) { - message("nsh_archinitialize: Failed to initialize SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); return -ENODEV; } @@ -285,10 +270,9 @@ static int nsh_sdinitialize(void) ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, g_sdiodev); if (ret != OK) { - message("nsh_archinitialize: " - "Failed to bind SDIO to the MMC/SD driver: %d\n", - ret); - + syslog(LOG_ERR, + "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", + ret); return ret; } @@ -326,22 +310,22 @@ static int nsh_usbhostinitialize(void) * that we care about: */ - message("nsh_usbhostinitialize: Register class drivers\n"); + syslog(LOG_INFO, "Register class drivers\n"); ret = usbhost_storageinit(); if (ret != OK) { - message("nsh_usbhostinitialize: Failed to register the mass storage class\n"); + syslog(LOG_ERR, "ERROR: Failed to register the mass storage class\n"); } /* Then get an instance of the USB host interface */ - message("nsh_usbhostinitialize: Initialize USB host\n"); + syslog(LOG_INFO, "Initialize USB host\n"); g_usbconn = lpc17_usbhost_initialize(0); if (g_usbconn) { /* Start a thread to handle device connection. */ - message("nsh_usbhostinitialize: Start nsh_waiter\n"); + syslog(LOG_INFO, "Start nsh_waiter\n"); pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO, CONFIG_USBHOST_STACKSIZE, diff --git a/configs/pcblogic-pic32mx/src/pic32mx_nsh.c b/configs/pcblogic-pic32mx/src/pic32mx_nsh.c index 8154125f8f..e30001ef37 100644 --- a/configs/pcblogic-pic32mx/src/pic32mx_nsh.c +++ b/configs/pcblogic-pic32mx/src/pic32mx_nsh.c @@ -39,7 +39,7 @@ #include -#include +#include #include #include @@ -56,22 +56,6 @@ # define OK 0 #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/configs/pic32-starterkit/src/up_nsh.c b/configs/pic32-starterkit/src/up_nsh.c index 6500e0a412..2a03da2a27 100644 --- a/configs/pic32-starterkit/src/up_nsh.c +++ b/configs/pic32-starterkit/src/up_nsh.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include #include @@ -150,22 +150,6 @@ # endif #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Private Data ****************************************************************************/ @@ -192,7 +176,7 @@ static int nsh_waiter(int argc, char *argv[]) bool connected = false; int ret; - message("nsh_waiter: Running\n"); + syslog(LOG_INFO, "nsh_waiter: Running\n"); for (;;) { /* Wait for the device to change state */ @@ -201,7 +185,8 @@ static int nsh_waiter(int argc, char *argv[]) DEBUGASSERT(ret == OK); connected = !connected; - message("nsh_waiter: %s\n", connected ? "connected" : "disconnected"); + syslog(LOG_INFO, "nsh_waiter: %s\n", + connected ? "connected" : "disconnected"); /* Did we just become connected? */ @@ -238,14 +223,14 @@ static int nsh_sdinitialize(void) ssp = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO); if (!ssp) { - message("nsh_archinitialize: Failed to initialize SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); ret = -ENODEV; goto errout; } - message("Successfully initialized SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_INFO, "Successfully initialized SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); /* Bind the SPI port to the slot */ @@ -253,16 +238,16 @@ static int nsh_sdinitialize(void) CONFIG_NSH_MMCSDSLOTNO, ssp); if (ret < 0) { - message("nsh_sdinitialize: " - "Failed to bind SPI port %d to MMC/SD slot %d: %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, - CONFIG_NSH_MMCSDSLOTNO, ret); + syslog(LOG_ERR, + "ERROR: Failed to bind SPI port %d to MMC/SD slot %d: %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, + CONFIG_NSH_MMCSDSLOTNO, ret); goto errout; } - message("Successfuly bound SPI port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Successfuly bound SPI port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, + CONFIG_NSH_MMCSDSLOTNO); return OK; errout: @@ -290,28 +275,29 @@ static int nsh_usbhostinitialize(void) * that we care about: */ - message("nsh_usbhostinitialize: Register class drivers\n"); + syslog(LOG_INFO, "Register class drivers\n"); ret = usbhost_storageinit(); if (ret != OK) { - message("nsh_usbhostinitialize: Failed to register the mass storage class\n"); + syslog(LOG_ERR, "ERROR: Failed to register the mass storage class\n"); } /* Then get an instance of the USB host interface */ - message("nsh_usbhostinitialize: Initialize USB host\n"); + syslog(LOG_INFO, "Initialize USB host\n"); g_usbconn = pic32_usbhost_initialize(0); if (g_usbconn) { /* Start a thread to handle device connection. */ - message("nsh_usbhostinitialize: Start nsh_waiter\n"); + syslog(LOG_INFO, "Start nsh_waiter\n"); pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO, CONFIG_USBHOST_STACKSIZE, (main_t)nsh_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } + return -ENODEV; } #else diff --git a/configs/pic32mx7mmb/src/up_nsh.c b/configs/pic32mx7mmb/src/up_nsh.c index 77bfedaaf1..c6e1ec5503 100644 --- a/configs/pic32mx7mmb/src/up_nsh.c +++ b/configs/pic32mx7mmb/src/up_nsh.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include #include @@ -149,22 +149,6 @@ # endif #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Private Data ****************************************************************************/ @@ -191,7 +175,7 @@ static int nsh_waiter(int argc, char *argv[]) bool connected = false; int ret; - message("nsh_waiter: Running\n"); + syslog(LOG_INFO, "nsh_waiter: Running\n"); for (;;) { /* Wait for the device to change state */ @@ -200,7 +184,8 @@ static int nsh_waiter(int argc, char *argv[]) DEBUGASSERT(ret == OK); connected = !connected; - message("nsh_waiter: %s\n", connected ? "connected" : "disconnected"); + syslog(LOG_INFO, "nsh_waiter: %s\n", + connected ? "connected" : "disconnected"); /* Did we just become connected? */ @@ -237,14 +222,14 @@ static int nsh_sdinitialize(void) spi = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO); if (!spi) { - message("nsh_archinitialize: Failed to initialize SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); ret = -ENODEV; goto errout; } - message("Successfully initialized SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_INFO, "Successfully initialized SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); /* The SPI should be in 8-bit (default) and mode2: CKP=1, CKE=0. * The MMC/SD driver will control the SPI frequency. WARNING: @@ -261,16 +246,18 @@ static int nsh_sdinitialize(void) CONFIG_NSH_MMCSDSLOTNO, spi); if (ret < 0) { - message("nsh_sdinitialize: " - "Failed to bind SPI port %d to MMC/SD slot %d: %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, - CONFIG_NSH_MMCSDSLOTNO, ret); + syslog(LOG_ERR, + "ERROR: Failed to bind SPI port %d to MMC/SD slot %d: %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, + CONFIG_NSH_MMCSDSLOTNO, ret); goto errout; } - message("Successfuly bound SPI port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, + "Successfully bound SPI port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, + CONFIG_NSH_MMCSDSLOTNO); + return OK; errout: @@ -298,22 +285,22 @@ static int nsh_usbhostinitialize(void) * that we care about: */ - message("nsh_usbhostinitialize: Register class drivers\n"); + syslog(LOG_INFO, "Register class drivers\n"); ret = usbhost_storageinit(); if (ret != OK) { - message("nsh_usbhostinitialize: Failed to register the mass storage class\n"); + syslog(LOG_ERR, "ERROR: Failed to register the mass storage class\n"); } /* Then get an instance of the USB host interface */ - message("nsh_usbhostinitialize: Initialize USB host\n"); + syslog(LOG_INFO, "Initialize USB host\n"); g_usbconn = pic32_usbhost_initialize(0); if (g_usbconn) { /* Start a thread to handle device connection. */ - message("nsh_usbhostinitialize: Start nsh_waiter\n"); + syslog(LOG_INFO, "Start nsh_waiter\n"); pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO, CONFIG_USBHOST_STACKSIZE, @@ -381,5 +368,6 @@ int nsh_archinitialize(void) ret = nsh_usbdevinitialize(); } + return ret; } diff --git a/configs/sam3u-ek/src/up_nsh.c b/configs/sam3u-ek/src/up_nsh.c index ded7d5527a..e20a7e1a96 100644 --- a/configs/sam3u-ek/src/up_nsh.c +++ b/configs/sam3u-ek/src/up_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include @@ -96,22 +96,6 @@ # undef NSH_HAVE_USBDEV #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) syslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message syslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -133,27 +117,30 @@ int nsh_archinitialize(void) /* Mount the SDIO-based MMC/SD block driver */ /* First, get an instance of the SDIO interface */ - message("nsh_archinitialize: Initializing SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Initializing SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); + sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); if (!sdio) { - message("nsh_archinitialize: Failed to initialize SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); return -ENODEV; } /* Now bind the SDIO interface to the MMC/SD driver */ - message("nsh_archinitialize: Bind SDIO to the MMC/SD driver, minor=%d\n", - CONFIG_NSH_MMCSDMINOR); + syslog(LOG_INFO, "Bind SDIO to the MMC/SD driver, minor=%d\n", + CONFIG_NSH_MMCSDMINOR); + ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio); if (ret != OK) { - message("nsh_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); return ret; } - message("nsh_archinitialize: Successfully bound SDIO to the MMC/SD driver\n"); + + syslog(LOG_INFO, "Successfully bound SDIO to the MMC/SD driver\n"); /* Then inform the HSMCI driver if there is or is not a card in the slot. */ diff --git a/configs/sam4e-ek/src/sam_nsh.c b/configs/sam4e-ek/src/sam_nsh.c index a103ceaab1..c567eedf03 100644 --- a/configs/sam4e-ek/src/sam_nsh.c +++ b/configs/sam4e-ek/src/sam_nsh.c @@ -44,7 +44,7 @@ #include #include #include -#include +#include #ifdef CONFIG_SYSTEM_USBMONITOR # include @@ -56,22 +56,6 @@ * Pre-Processor Definitions ****************************************************************************/ -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) syslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message syslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -96,7 +80,7 @@ int nsh_archinitialize(void) ret = sam_at25_automount(0); if (ret < 0) { - message("ERROR: sam_at25_automount() failed: %d\n", ret); + syslog(LOG_ERR, "ERROR: sam_at25_automount() failed: %d\n", ret); return ret; } #endif @@ -107,7 +91,7 @@ int nsh_archinitialize(void) ret = sam_hsmci_initialize(0); if (ret < 0) { - message("ERROR: sam_hsmci_initialize(0) failed: %d\n", ret); + syslog(LOG_ERR, "ERROR: sam_hsmci_initialize(0) failed: %d\n", ret); return ret; } #endif @@ -118,7 +102,7 @@ int nsh_archinitialize(void) ret = usbmonitor_start(0, NULL); if (ret != OK) { - message("nsh_archinitialize: Start USB monitor: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d\n", ret); return ret; } #endif diff --git a/configs/sam4l-xplained/src/sam_nsh.c b/configs/sam4l-xplained/src/sam_nsh.c index 2e4a5709f2..ac60b39cfd 100644 --- a/configs/sam4l-xplained/src/sam_nsh.c +++ b/configs/sam4l-xplained/src/sam_nsh.c @@ -40,7 +40,7 @@ #include #include -#include +#include #include "sam4l-xplained.h" @@ -69,22 +69,6 @@ # endif #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -106,8 +90,8 @@ int nsh_archinitialize(void) int ret = sam_slcd_initialize(); if (ret < 0) { - message("nsh_archinitialize: Failed to initialize the LCD: %d\n", - ret); + syslog(LOG_ERR, "ERROR: Failed to initialize the LCD: %d\n", + ret); return ret; } } @@ -119,8 +103,8 @@ int nsh_archinitialize(void) int ret = sam_sdinitialize(CONFIG_NSH_MMCSDMINOR); if (ret < 0) { - message("nsh_archinitialize: Failed to initialize MMC/SD slot: %d\n", - ret); + syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n", + ret); return ret; } } diff --git a/configs/sam4s-xplained-pro/src/sam_nsh.c b/configs/sam4s-xplained-pro/src/sam_nsh.c index cc7a66c376..7353dd29dc 100644 --- a/configs/sam4s-xplained-pro/src/sam_nsh.c +++ b/configs/sam4s-xplained-pro/src/sam_nsh.c @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include @@ -72,22 +72,6 @@ * Pre-Processor Definitions ****************************************************************************/ -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) syslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message syslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -108,11 +92,14 @@ int nsh_archinitialize(void) #endif #ifdef HAVE_USBDEV - message("Registering CDC/ACM serial driver\n"); + syslog(LOG_INFO, "Registering CDC/ACM serial driver\n"); + ret = cdcacm_initialize(CONFIG_SAM4S_XPLAINED_PRO_CDCACM_DEVMINOR, NULL); if (ret < 0) { - message("ERROR: Failed to create the CDC/ACM serial device: %d (%d)\n", ret, errno); + syslog(LOG_ERR, + "ERROR: Failed to create the CDC/ACM serial device: %d (%d)\n", + ret, errno); return ret; } #endif @@ -120,11 +107,14 @@ int nsh_archinitialize(void) #ifdef HAVE_HSMCI /* Initialize the HSMCI driver */ - message("initializing HSMCI\n"); + syslog(LOG_INFO, "initializing HSMCI\n"); + ret = sam_hsmci_initialize(); if (ret < 0) { - message("ERROR: sam_hsmci_initialize() failed: %d (%d)\n", ret, errno); + syslog(LOG_ERR, + "ERROR: sam_hsmci_initialize() failed: %d (%d)\n", + ret, errno); return ret; } #endif @@ -132,21 +122,27 @@ int nsh_archinitialize(void) #ifdef HAVE_PROC /* mount the proc filesystem */ - message("Mounting procfs to /proc\n"); + syslog(LOG_INFO, "Mounting procfs to /proc\n"); + ret = mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { - message("ERROR: Failed to mount the PROC filesystem: %d (%d)\n", ret, errno); + syslog(LOG_ERR, + "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", + ret, errno); return ret; } #endif #if HAVE_HSMCI - message("Mounting /dev/mmcsd0 to /fat\n"); + syslog(LOG_INFO, "Mounting /dev/mmcsd0 to /fat\n"); + ret = mount("/dev/mmcsd0", "/fat", "vfat", 0, NULL); if (ret < 0) { - message("ERROR: Failed to mount the FAT filesystem: %d (%d)\n", ret, errno); + syslog(LOG_ERR, + "ERROR: Failed to mount the FAT filesystem: %d (%d)\n", + ret, errno); return ret; } #endif @@ -154,11 +150,11 @@ int nsh_archinitialize(void) #ifdef HAVE_USBMONITOR /* Start the USB Monitor */ - message("Starting USB Monitor\n"); + syslog(LOG_INFO, "Starting USB Monitor\n"); ret = usbmonitor_start(0, NULL); if (ret != OK) { - message("nsh_archinitialize: Start USB monitor: %d (%d)\n", ret, errno); + syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d (%d)\n", ret, errno); return ret; } #endif diff --git a/configs/sama5d3-xplained/src/sam_nsh.c b/configs/sama5d3-xplained/src/sam_nsh.c index 20cb0ae854..842d807ae4 100644 --- a/configs/sama5d3-xplained/src/sam_nsh.c +++ b/configs/sama5d3-xplained/src/sam_nsh.c @@ -44,7 +44,7 @@ #include #include #include -#include +#include #ifdef CONFIG_SYSTEM_USBMONITOR # include @@ -56,22 +56,6 @@ * Pre-Processor Definitions ****************************************************************************/ -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) syslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message syslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -97,7 +81,7 @@ int nsh_archinitialize(void) ret = sam_nand_automount(NAND_MINOR); if (ret < 0) { - message("ERROR: sam_nand_automount failed: %d\n", ret); + syslog(LOG_ERR, "ERROR: sam_nand_automount failed: %d\n", ret); return ret; } #endif @@ -108,7 +92,7 @@ int nsh_archinitialize(void) ret = sam_at25_automount(AT25_MINOR); if (ret < 0) { - message("ERROR: sam_at25_automount failed: %d\n", ret); + syslog(LOG_ERR, "ERROR: sam_at25_automount failed: %d\n", ret); return ret; } #endif @@ -120,8 +104,8 @@ int nsh_archinitialize(void) ret = sam_hsmci_initialize(HSMCI0_SLOTNO, HSMCI0_MINOR); if (ret < 0) { - message("ERROR: sam_hsmci_initialize(%d,%d) failed: %d\n", - HSMCI0_SLOTNO, HSMCI0_MINOR, ret); + syslog(LOG_ERR, "ERROR: sam_hsmci_initialize(%d,%d) failed: %d\n", + HSMCI0_SLOTNO, HSMCI0_MINOR, ret); return ret; } #endif @@ -132,8 +116,8 @@ int nsh_archinitialize(void) ret = sam_hsmci_initialize(HSMCI1_SLOTNO, HSMCI1_MINOR); if (ret < 0) { - message("ERROR: sam_hsmci_initialize(%d,%d) failed: %d\n", - HSMCI1_SLOTNO, HSMCI1_MINOR, ret); + syslog(LOG_ERR, "ERROR: sam_hsmci_initialize(%d,%d) failed: %d\n", + HSMCI1_SLOTNO, HSMCI1_MINOR, ret); return ret; } #endif @@ -147,7 +131,7 @@ int nsh_archinitialize(void) ret = sam_usbhost_initialize(); if (ret != OK) { - message("ERROR: Failed to initialize USB host: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); return ret; } #endif @@ -158,7 +142,7 @@ int nsh_archinitialize(void) ret = usbmonitor_start(0, NULL); if (ret != OK) { - message("nsh_archinitialize: Start USB monitor: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d\n", ret); } #endif diff --git a/configs/sama5d3x-ek/src/sam_nsh.c b/configs/sama5d3x-ek/src/sam_nsh.c index e057c51440..deaaf53d18 100644 --- a/configs/sama5d3x-ek/src/sam_nsh.c +++ b/configs/sama5d3x-ek/src/sam_nsh.c @@ -44,7 +44,7 @@ #include #include #include -#include +#include #ifdef CONFIG_SYSTEM_USBMONITOR # include @@ -56,22 +56,6 @@ * Pre-Processor Definitions ****************************************************************************/ -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) syslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message syslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -98,7 +82,7 @@ int nsh_archinitialize(void) ret = sam_nand_automount(NAND_MINOR); if (ret < 0) { - message("ERROR: sam_nand_automount failed: %d\n", ret); + syslog(LOG_ERR, "ERROR: sam_nand_automount failed: %d\n", ret); return ret; } #endif @@ -109,7 +93,7 @@ int nsh_archinitialize(void) ret = sam_at25_automount(AT25_MINOR); if (ret < 0) { - message("ERROR: sam_at25_automount failed: %d\n", ret); + syslog(LOG_ERR, "ERROR: sam_at25_automount failed: %d\n", ret); return ret; } #endif @@ -120,7 +104,7 @@ int nsh_archinitialize(void) ret = sam_at24_automount(AT24_MINOR); if (ret < 0) { - message("ERROR: sam_at24_automount failed: %d\n", ret); + syslog(LOG_ERR, "ERROR: sam_at24_automount failed: %d\n", ret); return ret; } #endif @@ -132,8 +116,8 @@ int nsh_archinitialize(void) ret = sam_hsmci_initialize(HSMCI0_SLOTNO, HSMCI0_MINOR); if (ret < 0) { - message("ERROR: sam_hsmci_initialize(%d,%d) failed: %d\n", - HSMCI0_SLOTNO, HSMCI0_MINOR, ret); + syslog(LOG_ERR, "ERROR: sam_hsmci_initialize(%d,%d) failed: %d\n", + HSMCI0_SLOTNO, HSMCI0_MINOR, ret); return ret; } #endif @@ -144,8 +128,8 @@ int nsh_archinitialize(void) ret = sam_hsmci_initialize(HSMCI1_SLOTNO, HSMCI1_MINOR); if (ret < 0) { - message("ERROR: sam_hsmci_initialize(%d,%d) failed: %d\n", - HSMCI1_SLOTNO, HSMCI1_MINOR, ret); + syslog(LOG_ERR, "ERROR: sam_hsmci_initialize(%d,%d) failed: %d\n", + HSMCI1_SLOTNO, HSMCI1_MINOR, ret); return ret; } #endif @@ -159,7 +143,7 @@ int nsh_archinitialize(void) ret = sam_usbhost_initialize(); if (ret != OK) { - message("ERROR: Failed to initialize USB host: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); return ret; } #endif @@ -170,7 +154,7 @@ int nsh_archinitialize(void) ret = usbmonitor_start(0, NULL); if (ret != OK) { - message("nsh_archinitialize: Start USB monitor: %d\n", ret); + syslog(LOG_ERR, "ERROR: Start USB monitor: %d\n", ret); } #endif @@ -180,7 +164,8 @@ int nsh_archinitialize(void) ret = sam_wm8904_initialize(0); if (ret != OK) { - message("ERROR: Failed to initialize WM8904 audio: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to initialize WM8904 audio: %d\n", + ret); } #endif diff --git a/configs/samd20-xplained/src/sam_nsh.c b/configs/samd20-xplained/src/sam_nsh.c index e781b51b76..e2b69b53df 100644 --- a/configs/samd20-xplained/src/sam_nsh.c +++ b/configs/samd20-xplained/src/sam_nsh.c @@ -40,7 +40,7 @@ #include #include -#include +#include #include "sam_config.h" #include "samd20-xplained.h" @@ -91,22 +91,6 @@ # endif #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -128,8 +112,8 @@ int nsh_archinitialize(void) int ret = sam_sdinitialize(SPI_PORTNO, CONFIG_NSH_MMCSDMINOR); if (ret < 0) { - message("nsh_archinitialize: Failed to initialize MMC/SD slot: %d\n", - ret); + syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n", + ret); return ret; } } diff --git a/configs/shenzhou/src/up_nsh.c b/configs/shenzhou/src/up_nsh.c index 0b98025810..2e8726f51a 100644 --- a/configs/shenzhou/src/up_nsh.c +++ b/configs/shenzhou/src/up_nsh.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include #include "stm32.h" @@ -145,22 +145,6 @@ # undef HAVE_USBHOST #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -185,7 +169,7 @@ int nsh_archinitialize(void) ret = stm32_w25initialize(CONFIG_NSH_W25MINOR); if (ret < 0) { - message("nsh_archinitialize: Failed to initialize W25 minor %d: %d\n", + syslog(LOG_ERR, "ERROR: Failed to initialize W25 minor %d: %d\n", CONFIG_NSH_W25MINOR, ret); return ret; } @@ -197,7 +181,7 @@ int nsh_archinitialize(void) ret = stm32_sdinitialize(CONFIG_NSH_MMCSDMINOR); if (ret < 0) { - message("nsh_archinitialize: Failed to initialize MMC/SD slot %d: %d\n", + syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot %d: %d\n", CONFIG_NSH_MMCSDSLOTNO, ret); return ret; } @@ -211,7 +195,7 @@ int nsh_archinitialize(void) ret = stm32_usbhost_initialize(); if (ret != OK) { - message("nsh_archinitialize: Failed to initialize USB host: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); return ret; } #endif diff --git a/configs/spark/src/up_nsh.c b/configs/spark/src/up_nsh.c index 45bd8f5e4d..9992347b1c 100644 --- a/configs/spark/src/up_nsh.c +++ b/configs/spark/src/up_nsh.c @@ -43,7 +43,7 @@ #include #include -#include +#include #include #include @@ -116,22 +116,6 @@ # undef HAVE_USBMONITOR #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Private Data ****************************************************************************/ @@ -159,33 +143,34 @@ int nsh_archinitialize(void) /* Get the SPI port */ - message("nsh_archinitialize: Initializing SPI port %d\n", - CONFIG_SPARK_FLASH_SPI); + syslog(LOG_INFO, "Initializing SPI port %d\n", + CONFIG_SPARK_FLASH_SPI); spi = up_spiinitialize(CONFIG_SPARK_FLASH_SPI); if (!spi) { - message("nsh_archinitialize: ERROR: Failed to initialize SPI port %d\n", - CONFIG_SPARK_FLASH_SPI); + syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n", + CONFIG_SPARK_FLASH_SPI); return -ENODEV; } - message("nsh_archinitialize: Successfully initialized SPI port %d\n", - CONFIG_SPARK_FLASH_SPI); + syslog(LOG_INFO, "Successfully initialized SPI port %d\n", + CONFIG_SPARK_FLASH_SPI); /* Now bind the SPI interface to the SST25 SPI FLASH driver */ - message("nsh_archinitialize: Bind SPI to the SPI flash driver\n"); + syslog(LOG_INFO, "Bind SPI to the SPI flash driver\n"); + mtd = sst25_initialize(spi); if (!mtd) { - message("nsh_archinitialize: Failed to bind SPI port %d to the SPI FLASH driver\n", - CONFIG_SPARK_FLASH_SPI); + syslog(LOG_ERR, "ERROR: Failed to bind SPI port %d to the SPI FLASH driver\n", + CONFIG_SPARK_FLASH_SPI); } else { - message("nsh_archinitialize: Successfully bound SPI port %d to the SPI FLASH driver\n", - CONFIG_SPARK_FLASH_SPI); + syslog(LOG_INFO, "Successfully bound SPI port %d to the SPI FLASH driver\n", + CONFIG_SPARK_FLASH_SPI); } #ifndef CONFIG_SPARK_FLASH_PART @@ -293,7 +278,7 @@ int nsh_archinitialize(void) ret = usbmonitor_start(0, NULL); if (ret != OK) { - message("nsh_archinitialize: Start USB monitor: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d\n", ret); } #endif diff --git a/configs/stm3210e-eval/src/up_nsh.c b/configs/stm3210e-eval/src/up_nsh.c index 58e7e6214b..3431676cbc 100644 --- a/configs/stm3210e-eval/src/up_nsh.c +++ b/configs/stm3210e-eval/src/up_nsh.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include #ifdef CONFIG_STM32_SPI1 @@ -104,22 +104,6 @@ # define CONFIG_NSH_MMCSDMINOR 0 #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -148,25 +132,27 @@ int nsh_archinitialize(void) #ifdef CONFIG_STM32_SPI1 /* Get the SPI port */ - message("nsh_archinitialize: Initializing SPI port 1\n"); + syslog(LOG_INFO, "Initializing SPI port 1\n"); spi = up_spiinitialize(1); if (!spi) { - message("nsh_archinitialize: Failed to initialize SPI port 0\n"); + syslog(LOG_ERR, "ERROR: Failed to initialize SPI port 0\n"); return -ENODEV; } - message("nsh_archinitialize: Successfully initialized SPI port 0\n"); + syslog(LOG_INFO, "Successfully initialized SPI port 0\n"); /* Now bind the SPI interface to the M25P64/128 SPI FLASH driver */ - message("nsh_archinitialize: Bind SPI to the SPI flash driver\n"); + syslog(LOG_INFO, "Bind SPI to the SPI flash driver\n"); + mtd = m25p_initialize(spi); if (!mtd) { - message("nsh_archinitialize: Failed to bind SPI port 0 to the SPI FLASH driver\n"); + syslog(LOG_ERR, "ERROR: Failed to bind SPI port 0 to the SPI FLASH driver\n"); return -ENODEV; } - message("nsh_archinitialize: Successfully bound SPI port 0 to the SPI FLASH driver\n"); + + syslog(LOG_INFO, "Successfully bound SPI port 0 to the SPI FLASH driver\n"); #warning "Now what are we going to do with this SPI FLASH driver?" #endif @@ -180,27 +166,29 @@ int nsh_archinitialize(void) #ifdef NSH_HAVEMMCSD /* First, get an instance of the SDIO interface */ - message("nsh_archinitialize: Initializing SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Initializing SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); + sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); if (!sdio) { - message("nsh_archinitialize: Failed to initialize SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); return -ENODEV; } /* Now bind the SDIO interface to the MMC/SD driver */ - message("nsh_archinitialize: Bind SDIO to the MMC/SD driver, minor=%d\n", - CONFIG_NSH_MMCSDMINOR); + syslog(LOG_INFO, "Bind SDIO to the MMC/SD driver, minor=%d\n", + CONFIG_NSH_MMCSDMINOR); + ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio); if (ret != OK) { - message("nsh_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); return ret; } - message("nsh_archinitialize: Successfully bound SDIO to the MMC/SD driver\n"); + syslog(LOG_INFO, "Successfully bound SDIO to the MMC/SD driver\n"); /* Then let's guess and say that there is a card in the slot. I need to check to * see if the STM3210E-EVAL board supports a GPIO to detect if there is a card in diff --git a/configs/stm3220g-eval/src/up_nsh.c b/configs/stm3220g-eval/src/up_nsh.c index c0f74edbd0..5a4e588e2e 100644 --- a/configs/stm3220g-eval/src/up_nsh.c +++ b/configs/stm3220g-eval/src/up_nsh.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include #ifdef CONFIG_STM32_SPI1 @@ -118,22 +118,6 @@ # undef HAVE_USBHOST #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -167,7 +151,7 @@ int nsh_archinitialize(void) spi = up_spiinitialize(1); if (!spi) { - message("nsh_archinitialize: Failed to initialize SPI port 0\n"); + syslog(LOG_ERR, "ERROR: Failed to initialize SPI port 0\n"); return -ENODEV; } @@ -176,7 +160,7 @@ int nsh_archinitialize(void) mtd = m25p_initialize(spi); if (!mtd) { - message("nsh_archinitialize: Failed to bind SPI port 0 to the SPI FLASH driver\n"); + syslog(LOG_ERR, "ERROR: Failed to bind SPI port 0 to the SPI FLASH driver\n"); return -ENODEV; } @@ -188,13 +172,11 @@ int nsh_archinitialize(void) #ifdef HAVE_MMCSD /* First, get an instance of the SDIO interface */ - message("nsh_archinitialize: Initializing SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); if (!sdio) { - message("nsh_archinitialize: Failed to initialize SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); return -ENODEV; } @@ -203,7 +185,7 @@ int nsh_archinitialize(void) ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio); if (ret != OK) { - message("nsh_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); return ret; } @@ -223,7 +205,7 @@ int nsh_archinitialize(void) ret = stm32_usbhost_initialize(); if (ret != OK) { - message("nsh_archinitialize: Failed to initialize USB host: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); return ret; } #endif diff --git a/configs/stm3240g-eval/src/up_nsh.c b/configs/stm3240g-eval/src/up_nsh.c index 6d297fcf68..982e5fbabb 100644 --- a/configs/stm3240g-eval/src/up_nsh.c +++ b/configs/stm3240g-eval/src/up_nsh.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include #ifdef CONFIG_STM32_SPI1 @@ -124,22 +124,6 @@ # undef HAVE_USBHOST #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -173,7 +157,7 @@ int nsh_archinitialize(void) spi = up_spiinitialize(1); if (!spi) { - message("nsh_archinitialize: Failed to initialize SPI port 0\n"); + syslog(LOG_ERR, "ERROR: Failed to initialize SPI port 0\n"); return -ENODEV; } @@ -182,7 +166,7 @@ int nsh_archinitialize(void) mtd = m25p_initialize(spi); if (!mtd) { - message("nsh_archinitialize: Failed to bind SPI port 0 to the SPI FLASH driver\n"); + syslog(LOG_ERR, "ERROR: Failed to bind SPI port 0 to the SPI FLASH driver\n"); return -ENODEV; } #warning "Now what are we going to do with this SPI FLASH driver?" @@ -196,8 +180,8 @@ int nsh_archinitialize(void) sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); if (!sdio) { - message("nsh_archinitialize: Failed to initialize SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); return -ENODEV; } @@ -206,7 +190,7 @@ int nsh_archinitialize(void) ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio); if (ret != OK) { - message("nsh_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); return ret; } @@ -226,7 +210,7 @@ int nsh_archinitialize(void) ret = stm32_usbhost_initialize(); if (ret != OK) { - message("nsh_archinitialize: Failed to initialize USB host: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); return ret; } #endif diff --git a/configs/stm32_tiny/src/up_nsh.c b/configs/stm32_tiny/src/up_nsh.c index cbef9ac415..1ceb3b56c8 100644 --- a/configs/stm32_tiny/src/up_nsh.c +++ b/configs/stm32_tiny/src/up_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include "stm32.h" @@ -51,22 +51,6 @@ * Pre-Processor Definitions ****************************************************************************/ -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -82,7 +66,7 @@ int nsh_archinitialize(void) { #if defined(CONFIG_WL_NRF24L01) - message("Register the nRF24L01 module"); + syslog(LOG_INFO, "Register the nRF24L01 module"); up_wlinitialize(); #endif diff --git a/configs/stm32f3discovery/src/up_nsh.c b/configs/stm32f3discovery/src/up_nsh.c index 08737a320a..113a1f7043 100644 --- a/configs/stm32f3discovery/src/up_nsh.c +++ b/configs/stm32f3discovery/src/up_nsh.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include #ifdef CONFIG_SYSTEM_USBMONITOR @@ -83,22 +83,6 @@ # undef HAVE_USBMONITOR #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -121,7 +105,7 @@ int nsh_archinitialize(void) ret = usbmonitor_start(0, NULL); if (ret != OK) { - message("nsh_archinitialize: Start USB monitor: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d\n", ret); } #endif diff --git a/configs/stm32f429i-disco/src/stm32_nsh.c b/configs/stm32f429i-disco/src/stm32_nsh.c index c949ececa7..2f22a07480 100644 --- a/configs/stm32f429i-disco/src/stm32_nsh.c +++ b/configs/stm32f429i-disco/src/stm32_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include @@ -112,22 +112,6 @@ # undef HAVE_USBMONITOR #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# if defined(CONFIG_DEBUG) || !defined(CONFIG_NSH_ARCHINIT) -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# if defined(CONFIG_DEBUG) || !defined(CONFIG_NSH_ARCHINIT) -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -165,15 +149,16 @@ int nsh_archinitialize(void) #ifdef CONFIG_STM32_SPI4 /* Get the SPI port */ - message("nsh_archinitialize: Initializing SPI port 4\n"); + syslog(LOG_INFO, "Initializing SPI port 4\n"); + spi = up_spiinitialize(4); if (!spi) { - message("nsh_archinitialize: Failed to initialize SPI port 4\n"); + syslog(LOG_ERR, "ERROR: Failed to initialize SPI port 4\n"); return -ENODEV; } - message("nsh_archinitialize: Successfully initialized SPI port 4\n"); + syslog(LOG_INFO, "Successfully initialized SPI port 4\n"); /* Now bind the SPI interface to the SST25F064 SPI FLASH driver. This * is a FLASH device that has been added external to the board (i.e. @@ -181,15 +166,16 @@ int nsh_archinitialize(void) */ #if defined(CONFIG_MTD) && defined(CONFIG_MTD_SST25XX) - message("nsh_archinitialize: Bind SPI to the SPI flash driver\n"); + syslog(LOG_INFO, "Bind SPI to the SPI flash driver\n"); + mtd = sst25xx_initialize(spi); if (!mtd) { - message("nsh_archinitialize: Failed to bind SPI port 4 to the SPI FLASH driver\n"); + syslog(LOG_ERR, "ERROR: Failed to bind SPI port 4 to the SPI FLASH driver\n"); } else { - message("nsh_archinitialize: Successfully bound SPI port 4 to the SPI FLASH driver\n"); + syslog(LOG_INFO, "Successfully bound SPI port 4 to the SPI FLASH driver\n"); #ifdef CONFIG_STM32F429I_DISCO_FLASH_PART { @@ -314,7 +300,7 @@ int nsh_archinitialize(void) ret = stm32_usbhost_initialize(); if (ret != OK) { - message("nsh_archinitialize: Failed to initialize USB host: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); return ret; } @@ -324,7 +310,7 @@ int nsh_archinitialize(void) ret = usbhost_storageinit(); if (ret != OK) { - message("nsh_archinitialize: Failed to initialize USB host storage: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to initialize USB host storage: %d\n", ret); return ret; } @@ -338,7 +324,7 @@ int nsh_archinitialize(void) ret = usbmonitor_start(0, NULL); if (ret != OK) { - message("nsh_archinitialize: Start USB monitor: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d\n", ret); } #endif diff --git a/configs/stm32ldiscovery/src/stm32_nsh.c b/configs/stm32ldiscovery/src/stm32_nsh.c index bd633b6593..b3bc54095c 100644 --- a/configs/stm32ldiscovery/src/stm32_nsh.c +++ b/configs/stm32ldiscovery/src/stm32_nsh.c @@ -40,7 +40,7 @@ #include -#include +#include #include @@ -50,24 +50,6 @@ * Pre-Processor Definitions ****************************************************************************/ -/* Configuration ************************************************************/ - -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/configs/sure-pic32mx/src/pic32mx_nsh.c b/configs/sure-pic32mx/src/pic32mx_nsh.c index 30820b61ff..6c89c1854c 100644 --- a/configs/sure-pic32mx/src/pic32mx_nsh.c +++ b/configs/sure-pic32mx/src/pic32mx_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include @@ -141,22 +141,6 @@ # undef NSH_HAVE_USBMONITOR #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Private Data ****************************************************************************/ @@ -183,7 +167,7 @@ static int nsh_waiter(int argc, char *argv[]) bool connected = false; int ret; - message("nsh_waiter: Running\n"); + syslog(LOG_INFO, "nsh_waiter: Running\n"); for (;;) { /* Wait for the device to change state */ @@ -192,7 +176,8 @@ static int nsh_waiter(int argc, char *argv[]) DEBUGASSERT(ret == OK); connected = !connected; - message("nsh_waiter: %s\n", connected ? "connected" : "disconnected"); + syslog(LOG_INFO, "nsh_waiter: %s\n", + connected ? "connected" : "disconnected"); /* Did we just become connected? */ @@ -229,14 +214,14 @@ static int nsh_sdinitialize(void) spi = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO); if (!spi) { - message("nsh_archinitialize: Failed to initialize SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); ret = -ENODEV; goto errout; } - message("Successfully initialized SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); + syslog(LOG_INFO, "Successfully initialized SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); /* The SPI should be in 8-bit (default) and mode2: CKP=1, CKE=0. * The MMC/SD driver will control the SPI frequency. WARNING: @@ -253,16 +238,16 @@ static int nsh_sdinitialize(void) CONFIG_NSH_MMCSDSLOTNO, spi); if (ret < 0) { - message("nsh_sdinitialize: " - "Failed to bind SPI port %d to MMC/SD slot %d: %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, - CONFIG_NSH_MMCSDSLOTNO, ret); + syslog(LOG_ERR, + "ERROR: Failed to bind SPI port %d to MMC/SD slot %d: %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, + CONFIG_NSH_MMCSDSLOTNO, ret); goto errout; } - message("Successfuly bound SPI port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Successfully bound SPI port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, + CONFIG_NSH_MMCSDSLOTNO); return OK; errout: @@ -290,22 +275,24 @@ static int nsh_usbhostinitialize(void) * that we care about: */ - message("nsh_usbhostinitialize: Register class drivers\n"); + syslog(LOG_INFO, "Register class drivers\n"); + ret = usbhost_storageinit(); if (ret != OK) { - message("nsh_usbhostinitialize: Failed to register the mass storage class\n"); + syslog(LOG_ERR, "ERROR: Failed to register the mass storage class\n"); } /* Then get an instance of the USB host interface */ - message("nsh_usbhostinitialize: Initialize USB host\n"); + syslog(LOG_INFO, "Initialize USB host\n"); + g_usbconn = pic32_usbhost_initialize(0); if (g_usbconn) { /* Start a thread to handle device connection. */ - message("nsh_usbhostinitialize: Start nsh_waiter\n"); + syslog(LOG_INFO, "Start nsh_waiter\n"); pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO, CONFIG_USBHOST_STACKSIZE, diff --git a/configs/tm4c123g-launchpad/src/tm4c_nsh.c b/configs/tm4c123g-launchpad/src/tm4c_nsh.c index 88cc3544c2..54fe013d3e 100644 --- a/configs/tm4c123g-launchpad/src/tm4c_nsh.c +++ b/configs/tm4c123g-launchpad/src/tm4c_nsh.c @@ -40,7 +40,7 @@ #include #include -#include +#include #include #include @@ -58,22 +58,6 @@ # undef NSH_HAVEUSBDEV #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/configs/twr-k60n512/src/up_nsh.c b/configs/twr-k60n512/src/up_nsh.c index 8069e3f966..7d3e35009d 100644 --- a/configs/twr-k60n512/src/up_nsh.c +++ b/configs/twr-k60n512/src/up_nsh.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include #ifdef CONFIG_KINETIS_SDHC @@ -105,22 +105,6 @@ # error "CONFIG_KINETIS_PORTEINTS required for card detect interrupt" #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Private Types ****************************************************************************/ @@ -231,29 +215,30 @@ int nsh_archinitialize(void) /* Mount the SDHC-based MMC/SD block driver */ /* First, get an instance of the SDHC interface */ - message("nsh_archinitialize: Initializing SDHC slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_INFO, "Initializing SDHC slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); g_nsh.sdhc = sdhc_initialize(CONFIG_NSH_MMCSDSLOTNO); if (!g_nsh.sdhc) { - message("nsh_archinitialize: Failed to initialize SDHC slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); + syslog(LOG_ERR, "ERROR: Failed to initialize SDHC slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); return -ENODEV; } /* Now bind the SDHC interface to the MMC/SD driver */ - message("nsh_archinitialize: Bind SDHC to the MMC/SD driver, minor=%d\n", - CONFIG_NSH_MMCSDMINOR); + syslog(LOG_INFO, "Bind SDHC to the MMC/SD driver, minor=%d\n", + CONFIG_NSH_MMCSDMINOR); ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, g_nsh.sdhc); if (ret != OK) { - message("nsh_archinitialize: Failed to bind SDHC to the MMC/SD driver: %d\n", ret); + syslog(LOG_ERR, "ERROR: Failed to bind SDHC to the MMC/SD driver: %d\n", ret); return ret; } - message("nsh_archinitialize: Successfully bound SDHC to the MMC/SD driver\n"); + + syslog(LOG_INFO, "Successfully bound SDHC to the MMC/SD driver\n"); /* Handle the initial card state */ diff --git a/configs/ubw32/src/up_nsh.c b/configs/ubw32/src/up_nsh.c index 7c64520045..64de3cdeff 100644 --- a/configs/ubw32/src/up_nsh.c +++ b/configs/ubw32/src/up_nsh.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include "pic32mx-internal.h" #include "ubw32-internal.h" @@ -50,22 +50,6 @@ * Pre-Processor Definitions ****************************************************************************/ -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Private Data ****************************************************************************/ diff --git a/configs/viewtool-stm32f107/src/stm32_nsh.c b/configs/viewtool-stm32f107/src/stm32_nsh.c index 265d90ed04..f79672f587 100644 --- a/configs/viewtool-stm32f107/src/stm32_nsh.c +++ b/configs/viewtool-stm32f107/src/stm32_nsh.c @@ -40,6 +40,7 @@ #include #include +#include #include "viewtool_stm32f107.h" @@ -63,22 +64,6 @@ #endif #endif -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lowsyslog(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lowsyslog -# else -# define message printf -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/configs/zkit-arm-1769/src/up_nsh.c b/configs/zkit-arm-1769/src/up_nsh.c index a74c8796f2..5e28d637dc 100644 --- a/configs/zkit-arm-1769/src/up_nsh.c +++ b/configs/zkit-arm-1769/src/up_nsh.c @@ -46,7 +46,7 @@ #include #include -#include +#include #include #include diff --git a/include/syslog.h b/include/syslog.h index 6aebb367ee..c71d95176f 100644 --- a/include/syslog.h +++ b/include/syslog.h @@ -89,19 +89,20 @@ * of decreasing importance: */ -#define LOG_EMERG 7 /* System is unusable */ -#define LOG_ALERT 6 /* Action must be taken immediately */ -#define LOG_CRIT 5 /* Critical conditions */ -#define LOG_ERR 4 /* Error conditions */ -#define LOG_WARNING 3 /* Warning conditions */ -#define LOG_NOTICE 2 /* Normal, but significant, condition */ -#define LOG_INFO 1 /* Informational message */ -#define LOG_DEBUG 0 /* Debug-level message */ +#define LOG_EMERG 0 /* System is unusable */ +#define LOG_ALERT 1 /* Action must be taken immediately */ +#define LOG_CRIT 2 /* Critical conditions */ +#define LOG_ERR 3 /* Error conditions */ +#define LOG_WARNING 4 /* Warning conditions */ +#define LOG_NOTICE 5 /* Normal, but significant, condition */ +#define LOG_INFO 6 /* Informational message */ +#define LOG_DEBUG 7 /* Debug-level message */ /* Used with setlogmask() */ #define LOG_MASK(p) (1 << (p)) #define LOG_UPTO(p) ((1 << (p)) - 1) +#define LOG_ALL 0xff /**************************************************************************** * Public Type Declarations