SAM4S Xplained: Add logic to autostart the USB monitor

This commit is contained in:
Gregory Nutt 2014-04-21 18:16:44 -06:00
parent 349ba4b7a5
commit b5c7f41c5d
2 changed files with 47 additions and 7 deletions

View File

@ -57,6 +57,8 @@
#define HAVE_HSMCI 1
#define HAVE_PROC 1
#define HAVE_USBDEV 1
#undef HAVE_USBMONITOR
/* HSMCI */
/* Can't support MMC/SD if the card interface is not enabled */
@ -71,7 +73,7 @@
/* Can't support MMC/SD features if mountpoints are disabled */
if defined(HAVE_HSMCI) && defined(CONFIG_DISABLE_MOUNTPOINT)
#if defined(HAVE_HSMCI) && defined(CONFIG_DISABLE_MOUNTPOINT)
# warning Mountpoints disabled. No MMC/SD support
# undef HAVE_HSMCI
#endif
@ -88,6 +90,25 @@ if defined(HAVE_HSMCI) && defined(CONFIG_DISABLE_MOUNTPOINT)
# undef HAVE_HSMCI
#endif
/* USB Device */
/* CONFIG_SAM34_UDP and CONFIG_USBDEV must be defined, or there is no USB
* device.
*/
#if !defined(CONFIG_SAM34_UDP) || !defined(CONFIG_USBDEV)
# undef HAVE_USBDEV
#endif
/* Check if we should enable the USB monitor before starting NSH */
#ifndef HAVE_USBDEV
# undef CONFIG_USBDEV_TRACE
#endif
#if !defined(CONFIG_SYSTEM_USBMONITOR) && !defined(CONFIG_USBDEV_TRACE)
# undef HAVE_USBMONITOR
#endif
/* There are four LEDs on board the SAM4S Xplained board, two of these can be
* controlled by software in the SAM4S:
*

View File

@ -1,6 +1,6 @@
/****************************************************************************
* config/sam4s-xplained-pro/src/sam_nsh.c
*
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
@ -50,6 +50,14 @@
# include <apps/usbmonitor.h>
#endif
#ifdef CONFIG_CDCACM
# include <nuttx/usb/cdcacm.h>
#endif
#ifdef CONFIG_PL2303
# include <nuttx/usb/pl2303.h>
#endif
#include "sam4s-xplained-pro.h"
/****************************************************************************
@ -86,7 +94,7 @@
int nsh_archinitialize(void)
{
#if (defined(HAVE_HSMCI) || defined (HAVE_PROC))
#if defined(HAVE_HSMCI) || defined (HAVE_PROC) || defined(HAVE_USBMONITOR)
int ret;
#endif
@ -94,7 +102,7 @@ int nsh_archinitialize(void)
#ifdef HAVE_HSMCI
/* Initialize the HSMCI driver */
ret = sam_hsmci_initialize();
if (ret < 0)
{
@ -105,20 +113,31 @@ int nsh_archinitialize(void)
#ifdef HAVE_PROC
/* mount the proc filesystem */
ret = mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0)
{
fdbg("ERROR: Failed to mount the PROC filesystem: %d\n", errno);
message("ERROR: Failed to mount the PROC filesystem: %d\n", errno);
return ret;
}
#endif
#ifdef HAVE_USBMONITOR
/* Start the USB Monitor */
ret = usbmonitor_start(0, NULL);
if (ret != OK)
{
message("nsh_archinitialize: Start USB monitor: %d\n", ret);
return ret;
}
#endif
#warning "add automount config...."
ret = mount("/dev/mmcsd0", "/fat", "vfat", 0, NULL);
if (ret < 0)
{
fdbg("ERROR: Failed to mount the FAT filesystem: %d\n", errno);
message("ERROR: Failed to mount the FAT filesystem: %d\n", errno);
return ret;
}