SAM4S Xplained: Add logic to autostart the USB monitor
This commit is contained in:
parent
c033ec399f
commit
6ac7bac458
@ -57,6 +57,8 @@
|
|||||||
|
|
||||||
#define HAVE_HSMCI 1
|
#define HAVE_HSMCI 1
|
||||||
#define HAVE_PROC 1
|
#define HAVE_PROC 1
|
||||||
|
#define HAVE_USBDEV 1
|
||||||
|
#undef HAVE_USBMONITOR
|
||||||
|
|
||||||
/* HSMCI */
|
/* HSMCI */
|
||||||
/* Can't support MMC/SD if the card interface is not enabled */
|
/* 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 */
|
/* 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
|
# warning Mountpoints disabled. No MMC/SD support
|
||||||
# undef HAVE_HSMCI
|
# undef HAVE_HSMCI
|
||||||
#endif
|
#endif
|
||||||
@ -88,6 +90,25 @@ if defined(HAVE_HSMCI) && defined(CONFIG_DISABLE_MOUNTPOINT)
|
|||||||
# undef HAVE_HSMCI
|
# undef HAVE_HSMCI
|
||||||
#endif
|
#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
|
/* There are four LEDs on board the SAM4S Xplained board, two of these can be
|
||||||
* controlled by software in the SAM4S:
|
* controlled by software in the SAM4S:
|
||||||
*
|
*
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* config/sam4s-xplained-pro/src/sam_nsh.c
|
* config/sam4s-xplained-pro/src/sam_nsh.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
@ -50,6 +50,14 @@
|
|||||||
# include <apps/usbmonitor.h>
|
# include <apps/usbmonitor.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_CDCACM
|
||||||
|
# include <nuttx/usb/cdcacm.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_PL2303
|
||||||
|
# include <nuttx/usb/pl2303.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "sam4s-xplained-pro.h"
|
#include "sam4s-xplained-pro.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -86,7 +94,7 @@
|
|||||||
|
|
||||||
int nsh_archinitialize(void)
|
int nsh_archinitialize(void)
|
||||||
{
|
{
|
||||||
#if (defined(HAVE_HSMCI) || defined (HAVE_PROC))
|
#if defined(HAVE_HSMCI) || defined (HAVE_PROC) || defined(HAVE_USBMONITOR)
|
||||||
int ret;
|
int ret;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -94,7 +102,7 @@ int nsh_archinitialize(void)
|
|||||||
|
|
||||||
#ifdef HAVE_HSMCI
|
#ifdef HAVE_HSMCI
|
||||||
/* Initialize the HSMCI driver */
|
/* Initialize the HSMCI driver */
|
||||||
|
|
||||||
ret = sam_hsmci_initialize();
|
ret = sam_hsmci_initialize();
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
@ -105,20 +113,31 @@ int nsh_archinitialize(void)
|
|||||||
|
|
||||||
#ifdef HAVE_PROC
|
#ifdef HAVE_PROC
|
||||||
/* mount the proc filesystem */
|
/* mount the proc filesystem */
|
||||||
|
|
||||||
ret = mount(NULL, "/proc", "procfs", 0, NULL);
|
ret = mount(NULL, "/proc", "procfs", 0, NULL);
|
||||||
if (ret < 0)
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#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...."
|
#warning "add automount config...."
|
||||||
ret = mount("/dev/mmcsd0", "/fat", "vfat", 0, NULL);
|
ret = mount("/dev/mmcsd0", "/fat", "vfat", 0, NULL);
|
||||||
if (ret < 0)
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user