All NSH-related files under nuttx/configs changed to use the corrected syslog interfaces
This commit is contained in:
parent
c0d179f4a8
commit
f40857c04f
@ -40,7 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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
|
||||
****************************************************************************/
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
@ -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;
|
||||
}
|
||||
|
@ -42,31 +42,13 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
/****************************************************************************
|
||||
* 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
|
||||
****************************************************************************/
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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
|
||||
|
@ -41,29 +41,13 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#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
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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 */
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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 */
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
@ -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
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
@ -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
|
||||
****************************************************************************/
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
@ -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;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
@ -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;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
@ -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
|
||||
****************************************************************************/
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "chip.h"
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
@ -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;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
@ -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
|
||||
****************************************************************************/
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
@ -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;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
@ -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
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#ifdef CONFIG_PIC32MX_SPI2
|
||||
# include <nuttx/spi/spi.h>
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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
|
||||
****************************************************************************/
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
@ -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;
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
@ -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;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
@ -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
|
||||
|
@ -46,7 +46,7 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
@ -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
|
||||
****************************************************************************/
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
@ -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;
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
@ -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,
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <nuttx/lcd/hd4478ou.h>
|
||||
#include <arch/board/board.h>
|
||||
@ -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
|
||||
****************************************************************************/
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
@ -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
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
@ -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;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/sdio.h>
|
||||
@ -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. */
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#ifdef CONFIG_SYSTEM_USBMONITOR
|
||||
# include <apps/usbmonitor.h>
|
||||
@ -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
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
@ -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
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#ifdef CONFIG_SYSTEM_USBMONITOR
|
||||
# include <apps/usbmonitor.h>
|
||||
@ -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
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#ifdef CONFIG_SYSTEM_USBMONITOR
|
||||
# include <apps/usbmonitor.h>
|
||||
@ -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
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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
|
||||
|
@ -43,7 +43,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
@ -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
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
@ -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
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
@ -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
|
||||
****************************************************************************/
|
||||
|
@ -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,
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
@ -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
|
||||
****************************************************************************/
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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 */
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#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
|
||||
****************************************************************************/
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#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
|
||||
****************************************************************************/
|
||||
|
@ -46,7 +46,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi/spi.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
|
||||
|
Loading…
Reference in New Issue
Block a user