diff options
Diffstat (limited to 'nuttx/configs/sam4e-ek/src/sam_nsh.c')
-rw-r--r-- | nuttx/configs/sam4e-ek/src/sam_nsh.c | 97 |
1 files changed, 28 insertions, 69 deletions
diff --git a/nuttx/configs/sam4e-ek/src/sam_nsh.c b/nuttx/configs/sam4e-ek/src/sam_nsh.c index 43cdd21f7..7d47ca334 100644 --- a/nuttx/configs/sam4e-ek/src/sam_nsh.c +++ b/nuttx/configs/sam4e-ek/src/sam_nsh.c @@ -39,63 +39,23 @@ #include <nuttx/config.h> +#include <sys/mount.h> + #include <stdbool.h> #include <stdio.h> -#include <debug.h> #include <errno.h> +#include <debug.h> -#include <nuttx/sdio.h> -#include <nuttx/mmcsd.h> +#ifdef CONFIG_SYSTEM_USBMONITOR +# include <apps/usbmonitor.h> +#endif -#include "sam_hsmci.h" #include "sam4e-ek.h" /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ -/* Configuration ************************************************************/ - -/* PORT and SLOT number probably depend on the board configuration */ - -#define NSH_HAVE_USBDEV 1 -#define NSH_HAVE_MMCSD 1 - -/* Can't support MMC/SD if the card interface is not enable */ - -#ifndef CONFIG_SAM34_HSMCI -# undef NSH_HAVE_MMCSD -#endif - -/* Can't support MMC/SD features if mountpoints are disabled or if SDIO support - * is not enabled. - */ - -#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAM34_HSMCI) -# undef NSH_HAVE_MMCSD -#endif - -#ifdef NSH_HAVE_MMCSD -# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0 -# error "Only one MMC/SD slot" -# undef CONFIG_NSH_MMCSDSLOTNO -# endif - -# ifndef CONFIG_NSH_MMCSDMINOR -# define CONFIG_NSH_MMCSDMINOR 0 -# endif - -# ifndef CONFIG_NSH_MMCSDSLOTNO -# define CONFIG_NSH_MMCSDSLOTNO 0 -# endif -#endif - -/* Can't support USB features if USB is not enabled */ - -#ifndef CONFIG_USBDEV -# undef NSH_HAVE_USBDEV -#endif - /* Debug ********************************************************************/ #ifdef CONFIG_CPP_HAVE_VARARGS @@ -126,41 +86,40 @@ int nsh_archinitialize(void) { -#ifdef NSH_HAVE_MMCSD - FAR struct sdio_dev_s *sdio; +#if defined(HAVE_AT25) || defined(HAVE_HSMCI) || defined(HAVE_USBMONITOR) int ret; +#endif - /* 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); +#ifdef HAVE_AT25 + /* Initialize the AT25 driver */ - sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); - if (!sdio) + ret = sam_at25_automount(0); + if (ret < 0) { - message("nsh_archinitialize: Failed to initialize SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); - return -ENODEV; + message("ERROR: sam_at25_automount() failed: %d\n", ret); + return ret; } +#endif - /* 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); +#ifdef HAVE_HSMCI + /* Initialize the HSMCI driver */ - ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio); - if (ret != OK) + ret = sam_hsmci_initialize(0); + if (ret < 0) { - message("nsh_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); + message("ERROR: sam_hsmci_initialize(0) failed: %d\n", ret); return ret; } +#endif - message("nsh_archinitialize: 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. */ +#ifdef HAVE_USBMONITOR + /* Start the USB Monitor */ - sdio_mediachange(sdio, sam_cardinserted(0)); + ret = usbmonitor_start(0, NULL); + if (ret != OK) + { + message("nsh_archinitialize: Start USB monitor: %d\n", ret); + } #endif return OK; |