mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
All NSH-related files under nuttx/configs changed to use the corrected syslog interfaces
This commit is contained in:
@@ -41,7 +41,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user