EA3131: Framework for USB host support
This commit is contained in:
parent
e53ba01b64
commit
c7657c9c5e
@ -6068,4 +6068,6 @@
|
||||
* drivers/mtd/mtd_onfi.c and include/nuttx/mtd/onfi.h: Add sharedi
|
||||
NAND routines for use with ONFI compatible NAND FLASH devices
|
||||
(2013-11-15).
|
||||
* configs/ea3131/src/up_usbhost.c: Board-specific USB host support
|
||||
for the EA3131 board (2013-11-15).
|
||||
|
||||
|
@ -57,6 +57,7 @@
|
||||
|
||||
#include "up_arch.h"
|
||||
|
||||
#include "lpc31_internal.h"
|
||||
#include "lpc31_cgudrvr.h"
|
||||
#include "lpc31_syscreg.h"
|
||||
#include "lpc31_evntrtr.h"
|
||||
@ -4125,6 +4126,19 @@ FAR struct usbhost_connection_s *lpc31_ehci_initialize(int controller)
|
||||
while ((getreg32(LPC31_USBDEV_USBCMD) & USBDEV_USBCMD_RST) != 0)
|
||||
;
|
||||
|
||||
/* Program the controller to be the USB host controller
|
||||
*
|
||||
* CM = Host mode
|
||||
* ES = 0, Little endian mode.
|
||||
* SLOM Not used in host mode.
|
||||
* SDIS = 1, Stream disable mode. Eliminates overruns/underruns at
|
||||
* the expense of some performance.
|
||||
* VBPS = 1, off chip power source
|
||||
*/
|
||||
|
||||
putreg32(USBHOST_USBMODE_CMHOST | USBHOST_USBMODE_SDIS | USBHOST_USBMODE_VBPS,
|
||||
LPC31_USBDEV_USBMODE);
|
||||
|
||||
/* "In order to initialize the host controller, software should perform the
|
||||
* following steps:
|
||||
*
|
||||
@ -4315,7 +4329,7 @@ FAR struct usbhost_connection_s *lpc31_ehci_initialize(int controller)
|
||||
* PORTSC register to enable power.
|
||||
*/
|
||||
|
||||
lpc31_usbhost_vbusdrive(true);
|
||||
lpc31_usbhost_vbusdrive(0, true);
|
||||
up_mdelay(50);
|
||||
|
||||
/* If there is a USB device in the slot at power up, then we will not
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* arch/arm/src/lpc31xx/lpc31_internal.h
|
||||
*
|
||||
* Copyright (C) 2009-2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2009-2011, 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -76,7 +76,8 @@
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
@ -157,7 +158,7 @@ static inline void gpio_outputhigh(uint32_t ioconfig, uint32_t bit)
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
EXTERN void lpc31_lowsetup(void);
|
||||
void lpc31_lowsetup(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc31_clockconfig
|
||||
@ -167,7 +168,7 @@ EXTERN void lpc31_lowsetup(void);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
EXTERN void lpc31_clockconfig(void);
|
||||
void lpc31_clockconfig(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc31_spiselect and lpc31_spistatus
|
||||
@ -200,10 +201,10 @@ EXTERN void lpc31_clockconfig(void);
|
||||
|
||||
struct spi_dev_s;
|
||||
enum spi_dev_e;
|
||||
EXTERN void lpc31_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
|
||||
EXTERN uint8_t lpc31_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
|
||||
void lpc31_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
|
||||
uint8_t lpc31_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
|
||||
#ifdef CONFIG_SPI_CMDDATA
|
||||
EXTERN int lpc31_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
|
||||
int lpc31_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
@ -218,8 +219,10 @@ EXTERN int lpc31_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, boo
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#if defined(CONFIG_LPC31_USBOTG) && defined(CONFIG_USBDEV)
|
||||
struct usbdev_s;
|
||||
EXTERN int lpc31_usbpullup(FAR struct usbdev_s *dev, bool enable);
|
||||
int lpc31_usbpullup(FAR struct usbdev_s *dev, bool enable);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc31_usbsuspend
|
||||
@ -232,8 +235,61 @@ EXTERN int lpc31_usbpullup(FAR struct usbdev_s *dev, bool enable);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#if defined(CONFIG_LPC31_USBOTG) && defined(CONFIG_USBDEV)
|
||||
struct usbdev_s;
|
||||
EXTERN void lpc31_usbsuspend(FAR struct usbdev_s *dev, bool resume);
|
||||
void lpc31_usbsuspend(FAR struct usbdev_s *dev, bool resume);
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* Name: lpc31_ehci_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize USB EHCI host controller hardware.
|
||||
*
|
||||
* Input Parameters:
|
||||
* controller -- If the device supports more than one EHCI interface, then
|
||||
* this identifies which controller is being intialized. Normally, this
|
||||
* is just zero.
|
||||
*
|
||||
* Returned Value:
|
||||
* And instance of the USB host interface. The controlling task should
|
||||
* use this interface to (1) call the wait() method to wait for a device
|
||||
* to be connected, and (2) call the enumerate() method to bind the device
|
||||
* to a class driver.
|
||||
*
|
||||
* Assumptions:
|
||||
* - This function should called in the initialization sequence in order
|
||||
* to initialize the USB device functionality.
|
||||
* - Class drivers should be initialized prior to calling this function.
|
||||
* Otherwise, there is a race condition if the device is already connected.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
#if defined(CONFIG_LPC31_USBOTG) && defined(CONFIG_USBHOST)
|
||||
struct usbhost_connection_s;
|
||||
FAR struct usbhost_connection_s *lpc31_ehci_initialize(int controller);
|
||||
#endif
|
||||
|
||||
/***********************************************************************************
|
||||
* Name: lpc31_usbhost_vbusdrive
|
||||
*
|
||||
* Description:
|
||||
* Enable/disable driving of VBUS 5V output. This function must be provided by
|
||||
* each platform that implements the EHCI host interface
|
||||
*
|
||||
* Input Parameters:
|
||||
* rhport - Selects root hub port to be powered host interface. This is not used
|
||||
* with the LPC31 since it supports only a single root hub port.
|
||||
* enable - true: enable VBUS power; false: disable VBUS power
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
***********************************************************************************/
|
||||
|
||||
#if defined(CONFIG_LPC31_USBOTG) && defined(CONFIG_USBHOST)
|
||||
void lpc31_usbhost_vbusdrive(int rhport, bool enable);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sdio_initialize
|
||||
@ -250,7 +306,7 @@ EXTERN void lpc31_usbsuspend(FAR struct usbdev_s *dev, bool resume);
|
||||
****************************************************************************/
|
||||
|
||||
struct sdio_dev_s; /* See include/nuttx/sdio.h */
|
||||
EXTERN FAR struct sdio_dev_s *sdio_initialize(int slotno);
|
||||
FAR struct sdio_dev_s *sdio_initialize(int slotno);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sdio_mediachange
|
||||
@ -271,7 +327,7 @@ EXTERN FAR struct sdio_dev_s *sdio_initialize(int slotno);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot);
|
||||
void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sdio_wrprotect
|
||||
@ -289,7 +345,7 @@ EXTERN void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN void sdio_wrprotect(FAR struct sdio_dev_s *dev, bool wrprotect);
|
||||
void sdio_wrprotect(FAR struct sdio_dev_s *dev, bool wrprotect);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
|
@ -2545,7 +2545,6 @@ void up_usbinitialize(void)
|
||||
goto errout;
|
||||
}
|
||||
|
||||
|
||||
/* Program the controller to be the USB device controller */
|
||||
|
||||
lpc31_putreg (USBDEV_USBMODE_SDIS | USBDEV_USBMODE_SLOM | USBDEV_USBMODE_CMDEVICE,
|
||||
|
@ -35,45 +35,56 @@
|
||||
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
CFLAGS += -I$(TOPDIR)/sched
|
||||
CFLAGS += -I$(TOPDIR)/sched
|
||||
|
||||
ASRCS =
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
ASRCS =
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
|
||||
CSRCS = up_boot.c up_clkinit.c
|
||||
|
||||
CSRCS = up_boot.c up_clkinit.c
|
||||
ifeq ($(CONFIG_ARCH_BUTTONS),y)
|
||||
CSRCS += up_buttons.c
|
||||
CSRCS += up_buttons.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LPC31_EXTDRAM),y)
|
||||
CSRCS += up_mem.c
|
||||
CSRCS += up_mem.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||
CSRCS += up_leds.c
|
||||
CSRCS += up_leds.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LPC31_SPI),y)
|
||||
CSRCS += up_spi.c
|
||||
CSRCS += up_spi.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NSH_ARCHINIT),y)
|
||||
CSRCS += up_nsh.c
|
||||
CSRCS += up_nsh.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PAGING),y)
|
||||
CSRCS += up_fillpage.c
|
||||
CSRCS += up_fillpage.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LPC31_USBOTG),y)
|
||||
ifeq ($(CONFIG_USBHOST),y)
|
||||
CSRCS += up_usbhost.c
|
||||
endif
|
||||
ifeq ($(CONFIG_USBMSC),y)
|
||||
CSRCS += up_usbmsc.c
|
||||
CSRCS += up_usbmsc.c
|
||||
endif
|
||||
endif
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
|
||||
ifeq ($(WINTOOL),y)
|
||||
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
|
||||
-I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
|
||||
-I "${shell cygpath -w $(ARCH_SRCDIR)/arm}"
|
||||
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" -I "${shell cygpath -w $(ARCH_SRCDIR)/arm}"
|
||||
else
|
||||
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/arm
|
||||
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/arm
|
||||
endif
|
||||
|
||||
all: libboard$(LIBEXT)
|
||||
|
@ -87,7 +87,7 @@
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_LPC31_EXTDRAM
|
||||
extern void lpc31_meminitialize(void);
|
||||
void lpc31_meminitialize(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
@ -98,17 +98,46 @@ extern void lpc31_meminitialize(void);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
extern void weak_function lpc31_spiinitialize(void);
|
||||
void weak_function lpc31_spiinitialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc31_usbinitialize
|
||||
* Name: lpc31_usbdev_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called to setup USB-related GPIO pins for the EA3131 board.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
extern void weak_function lpc31_usbinitialize(void);
|
||||
#if defined(CONFIG_LPC31_USBOTG) && defined(CONFIG_USBDEV)
|
||||
void weak_function lpc31_usbdev_initialize(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc31_usbhost_bootinitialize
|
||||
*
|
||||
* Description:
|
||||
* Called from lpc31_boardinitialize very early in inialization to setup USB
|
||||
* host-related GPIO pins for the EA3131 board.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#if defined(CONFIG_LPC31_USBOTG) && defined(CONFIG_USBHOST)
|
||||
void weak_function lpc31_usbhost_bootinitialize(void);
|
||||
#endif
|
||||
|
||||
/***********************************************************************************
|
||||
* Name: lpc31_usbhost_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called at application startup time to initialize the USB host functionality.
|
||||
* This function will start a thread that will monitor for device
|
||||
* connection/disconnection events.
|
||||
*
|
||||
***********************************************************************************/
|
||||
|
||||
#if defined(CONFIG_LPC31_USBOTG) && defined(CONFIG_USBHOST)
|
||||
int lpc31_usbhost_initialize(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc31_pginitialize
|
||||
@ -119,7 +148,7 @@ extern void weak_function lpc31_usbinitialize(void);
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PAGING
|
||||
extern void weak_function lpc31_pginitialize(void);
|
||||
void weak_function lpc31_pginitialize(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
@ -91,14 +91,27 @@ void lpc31_boardinitialize(void)
|
||||
#endif
|
||||
|
||||
/* Initialize USB is 1) USBDEV is selected, 2) the USB controller is not
|
||||
* disabled, and 3) the weak function lpc31_usbinitialize() has been brought
|
||||
* disabled, and 3) the weak function lpc31_usbdev_initialize() has been brought
|
||||
* into the build.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_USBDEV) && defined(CONFIG_LPC31_USBOTG)
|
||||
if (lpc31_usbinitialize)
|
||||
if (lpc31_usbdev_initialize)
|
||||
{
|
||||
lpc31_usbinitialize();
|
||||
lpc31_usbdev_initialize();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Initialize USB if the 1) the HS host or device controller is in the
|
||||
* configuration and 2) the weak function sam_usbinitialize() has been brought
|
||||
* into the build. Presumeably either CONFIG_USBDEV or CONFIG_USBHOST is also
|
||||
* selected.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_SAMA5_UHPHS) || defined(CONFIG_SAMA5_UDPHS)
|
||||
if (lpc31_usbhost_bootinitialize)
|
||||
{
|
||||
lpc31_usbhost_bootinitialize();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
317
configs/ea3131/src/up_usbhost.c
Normal file
317
configs/ea3131/src/up_usbhost.c
Normal file
@ -0,0 +1,317 @@
|
||||
/************************************************************************************
|
||||
* configs/ea3131/src/up_usbhost.c
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/usb/usbdev.h>
|
||||
#include <nuttx/usb/usbhost.h>
|
||||
#include <nuttx/usb/usbdev_trace.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
|
||||
#include "lpc31_internal.h"
|
||||
#include "ea3131_internal.h"
|
||||
|
||||
#if defined(CONFIG_LPC31_USBOTG) || defined(CONFIG_USBHOST)
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef CONFIG_USBHOST_DEFPRIO
|
||||
# define CONFIG_USBHOST_DEFPRIO 50
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_USBHOST_STACKSIZE
|
||||
# define CONFIG_USBHOST_STACKSIZE 1024
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_USBDEV
|
||||
# undef CONFIG_LPC31_USBOTG_RHPORT1
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Data
|
||||
************************************************************************************/
|
||||
/* Retained device driver handle */
|
||||
|
||||
static struct usbhost_connection_s *g_ehciconn;
|
||||
|
||||
/* Overcurrent interrupt handler */
|
||||
|
||||
#if 0 /* Not yet implemented */
|
||||
static xcpt_t g_ochandler;
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: ehci_waiter
|
||||
*
|
||||
* Description:
|
||||
* Wait for USB devices to be connected to the EHCI root hub.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
static int ehci_waiter(int argc, char *argv[])
|
||||
{
|
||||
bool connected = false;
|
||||
int rhpndx;
|
||||
int ret;
|
||||
|
||||
uvdbg("Waiter Running\n");
|
||||
for (;;)
|
||||
{
|
||||
/* Wait for the device to change state */
|
||||
|
||||
rhpndx = CONN_WAIT(g_ehciconn, &connected);
|
||||
DEBUGASSERT(rhpndx >= 0 && rhpndx < 1);
|
||||
|
||||
connected = !connected;
|
||||
|
||||
uvdbg("RHport1 %s\n",
|
||||
connected ? "connected" : "disconnected");
|
||||
|
||||
/* Did we just become connected? */
|
||||
|
||||
if (connected)
|
||||
{
|
||||
/* Yes.. enumerate the newly connected device */
|
||||
|
||||
ret = CONN_ENUMERATE(g_ehciconn, rhpndx);
|
||||
if (ret < 0)
|
||||
{
|
||||
uvdbg("RHport1 CONN_ENUMERATE failed: %d\n", ret);
|
||||
connected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Keep the compiler from complaining */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc31_usbhost_bootinitialize
|
||||
*
|
||||
* Description:
|
||||
* Called from lpc31_boardinitialize very early in inialization to setup USB
|
||||
* host-related GPIO pins for the EA3131 board.
|
||||
*
|
||||
* USB host VBUS power is controlled by a Micrel USB power switch. That switch is
|
||||
* driver by a discrete that comes from the I2C-contrrol PCA9532 GPIO expander.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void weak_function lpc31_usbhost_bootinitialize(void)
|
||||
{
|
||||
/* Get an instance of the I2C interface. This will be needed to control the
|
||||
* PCA9532 GPIO expander.
|
||||
*/
|
||||
#warning Missing logic
|
||||
|
||||
/* Use the I2C interface to initialize the PCA9532 GPIO expander driver */
|
||||
#warning Missing logic
|
||||
|
||||
/* Configure pin to drive VBUS power using the PCA8532 GPIO expander */
|
||||
#warning Missing logic
|
||||
|
||||
/* Configure pin to detect overrcurrent errors */
|
||||
#warning Missing logic
|
||||
}
|
||||
|
||||
/***********************************************************************************
|
||||
* Name: lpc31_usbhost_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called at application startup time to initialize the USB host functionality.
|
||||
* This function will start a thread that will monitor for device
|
||||
* connection/disconnection events.
|
||||
*
|
||||
***********************************************************************************/
|
||||
|
||||
int lpc31_usbhost_initialize(void)
|
||||
{
|
||||
pid_t pid;
|
||||
int ret;
|
||||
|
||||
/* First, register all of the class drivers needed to support the drivers
|
||||
* that we care about
|
||||
*
|
||||
* Register theUSB host Mass Storage Class:
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_USBHOST_MSC
|
||||
ret = usbhost_storageinit();
|
||||
if (ret != OK)
|
||||
{
|
||||
udbg("ERROR: Failed to register the mass storage class: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Register the USB host HID keyboard class driver */
|
||||
|
||||
#ifdef CONFIG_USBHOST_HIDKBD
|
||||
ret = usbhost_kbdinit();
|
||||
if (ret != OK)
|
||||
{
|
||||
udbg("ERROR: Failed to register the KBD class\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Then get an instance of the USB EHCI interface. */
|
||||
|
||||
g_ehciconn = lpc31_ehci_initialize(0);
|
||||
if (!g_ehciconn)
|
||||
{
|
||||
udbg("ERROR: lpc31_ehci_initialize failed\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Start a thread to handle device connection. */
|
||||
|
||||
pid = TASK_CREATE("EHCI Monitor", CONFIG_USBHOST_DEFPRIO, CONFIG_USBHOST_STACKSIZE,
|
||||
(main_t)ehci_waiter, (FAR char * const *)NULL);
|
||||
if (pid < 0)
|
||||
{
|
||||
udbg("ERROR: Failed to create ehci_waiter task: %d\n", ret);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***********************************************************************************
|
||||
* Name: lpc31_usbhost_vbusdrive
|
||||
*
|
||||
* Description:
|
||||
* Enable/disable driving of VBUS 5V output. This function must be provided by
|
||||
* each platform that implements the OHCI or EHCI host interface
|
||||
*
|
||||
* Input Parameters:
|
||||
* rhport - Selects root hub port to be powered host interface. See SAM_RHPORT_*
|
||||
* definitions above.
|
||||
* enable - true: enable VBUS power; false: disable VBUS power
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
***********************************************************************************/
|
||||
|
||||
void lpc31_usbhost_vbusdrive(int rhport, bool enable)
|
||||
{
|
||||
uvdbg("RHPort%d: enable=%d\n", rhport+1, enable);
|
||||
|
||||
/* The LPC3131 has only a single root hub port */
|
||||
|
||||
if (rhport == 0)
|
||||
{
|
||||
/* Then enable or disable VBUS power */
|
||||
|
||||
if (enable)
|
||||
{
|
||||
/* Enable the Power Switch by driving the enable pin low */
|
||||
#warning Missing logic
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Disable the Power Switch by driving the enable pin high */
|
||||
#warning Missing logic
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc31_setup_overcurrent
|
||||
*
|
||||
* Description:
|
||||
* Setup to receive an interrupt-level callback if an overcurrent condition is
|
||||
* detected.
|
||||
*
|
||||
* Input parameter:
|
||||
* handler - New overcurrent interrupt handler
|
||||
*
|
||||
* Returned value:
|
||||
* Old overcurrent interrupt handler
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#if 0 /* Not ready yet */
|
||||
xcpt_t lpc31_setup_overcurrent(xcpt_t handler)
|
||||
{
|
||||
xcpt_t oldhandler;
|
||||
irqstate_t flags;
|
||||
|
||||
/* Disable interrupts until we are done. This guarantees that the
|
||||
* following operations are atomic.
|
||||
*/
|
||||
|
||||
flags = irqsave();
|
||||
|
||||
/* Get the old button interrupt handler and save the new one */
|
||||
|
||||
oldhandler = g_ochandler;
|
||||
g_ochandler = handler;
|
||||
|
||||
/* Configure the interrupt */
|
||||
#warning Missing logic
|
||||
|
||||
/* Return the old button handler (so that it can be restored) */
|
||||
|
||||
irqrestore(flags);
|
||||
return oldhandler;
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
#endif /* CONFIG_LPC31_USBOTG || CONFIG_USBHOST */
|
@ -1,5 +1,5 @@
|
||||
/************************************************************************************
|
||||
* configs/sama5d3x-ek/src/up_usb.c
|
||||
* configs/sama5d3x-ek/src/sam_usb.c
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -533,4 +533,4 @@ void sam_usbsuspend(FAR struct usbdev_s *dev, bool resume)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_SAMA5_UHPHS || CONFIG_SAMA5_UDPHS*/
|
||||
#endif /* CONFIG_SAMA5_UHPHS || CONFIG_SAMA5_UDPHS */
|
||||
|
@ -613,7 +613,7 @@ bool sam_writeprotected(int slotno);
|
||||
*
|
||||
* Description:
|
||||
* Called from sam_usbinitialize very early in inialization to setup USB-related
|
||||
* GPIO pins for the STM32F4Discovery board.
|
||||
* PIO pins for the SAMA5D3x-EK board.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
|
@ -86,7 +86,7 @@ if MTD_NAND
|
||||
config MTD_NAND_EMBEDDEDECC
|
||||
bool "Support devices with Embedded ECC"
|
||||
default n
|
||||
---help--
|
||||
---help---
|
||||
Some NAND devices have internal, embedded ECC function. One (the
|
||||
only one supported) is Micron, 4-bit ECC, device size = 1Gb or 2Gb
|
||||
or 4Gb.
|
||||
|
Loading…
Reference in New Issue
Block a user