Add untested OHCI driver for the SAMA5; structure naming and header files for USB host initialization prototypes

This commit is contained in:
Gregory Nutt 2013-08-11 17:11:32 -06:00
parent dd3c682443
commit ed49812d2c
24 changed files with 3227 additions and 119 deletions

View File

@ -5352,3 +5352,15 @@
(2013-8-10).
* arch/arm/src/stm32/Kconfig and stm32_serial.c: Added option to
disable serial port reordering. From Lorenz Meier (2013-8-10).
* arch/arm/src/sama5/Kconfig, sam_ohci.c, and
arch/arm/src/sama5/sam_clockconfig.c: Add a OHCI driver for the SAMA5.
Untested on initial check-in (2013-8-11).
* include/nuttx/usb/usbhost.h, arch/arm/src/stm32, arch/arm/src/lpc17xx,
and include/nuttx/usb/usbhost.h, and nuttx/configs/<stm32-boards>:
Move prototype of usbhost_initialize() of usbhost.h and into
architecture specific files. This is necessasrybecause some chips
(like the SAMA5) have multiple, different USB host interfaces
(2013-8-11).
* drivers/usbhost/usbhost_hidkbd.c and usbhost_storage.c: Correct some
compilation errors when pre-allocated class structures are used. Also
eliminate some warnings about uninitialized variables (2013-8-11).

View File

@ -0,0 +1,106 @@
/************************************************************************************
* arch/arm/src/lpc17xx/lpc17_usbhost.h
*
* 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.
*
************************************************************************************/
#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_USBHOST_H
#define __ARCH_ARM_SRC_LPC17XX_LPC17_USBHOST_H
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/************************************************************************************
* Public Types
************************************************************************************/
/************************************************************************************
* Public Data
************************************************************************************/
/************************************************************************************
* Public Functions
************************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/*******************************************************************************
* Name: usbhost_initialize
*
* Description:
* Initialize USB host device controller hardware.
*
* Input Parameters:
* controller -- If the device supports more than USB host controller, 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.
*
*******************************************************************************/
#ifdef CONFIG_USBHOST
struct usbhost_driver_s;
FAR struct usbhost_driver_s *usbhost_initialize(int controller);
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_USBHOST_H */

View File

@ -259,7 +259,7 @@ config SAMA5_SPI_DMATHRESHOLD
---help---
When SPI DMA is enabled, small DMA transfers will still be performed
by polling logic. But we need a threshold value to determine what
is small. That value is provided by CONFIG_SAMA5_SPI_DMATHRESHOLD.
is small. That value is provided by SAMA5_SPI_DMATHRESHOLD.
config SAMA5_SPI_DMADEBUG
bool "SPI DMA transfer debug"
@ -335,6 +335,53 @@ config SAMA5_HSMCI_REGDEBUG
endmenu # HSMCI device driver options
endif # SAMA5_HSMCI0 || SAMA5_HSMCI1 || SAMA5_HSMCI2
if SAMA5_UHPHS
menu "USB High Speed Host device driver options"
config SAMA5_OHCI
bool "Full speed OHCI support"
default n
---help---
Build support for the SAMA5 USB full speed Open Host Controller
Interface (OHCI).
if SAMA5_OHCI
config SAMA5_OHCI_NEDS
int "Number of endpoint descriptors"
default 2
config SAMA5_OHCI_NTDS
int "Number of transfer descriptors"
default 3
config SAMA5_OHCI_TDBUFFERS
int "Number of transfer descriptor buffers"
default 2
config SAMA5_OHCI_TDBUFSIZE
int "Size of one transfer descriptor buffer"
default 128
---help---
The size of one transfer descriptor (TD) buffer in bytes. The TD
buffer size must be an even number of 32-bit words
config SAMA5_OHCI_REGDEBUG
bool "Enable low-level OHCI register debug"
default n
depends on DEBUG
endif # OHCI
config SAMA5_EHCI
bool "High speed EHCI support"
default n
---help---
Build support for the SAMA5 USB high speed Enhanced Host Controller
Interface (OHCI).
endmenu # USB High Speed Host driver option
endif # SAMA5_UHPHS
menu "External Memory Configuration"
config SAMA5_DDRCS

View File

@ -115,6 +115,15 @@ else
endif
endif
ifeq ($(CONFIG_SAMA5_UHPHS),y)
ifeq ($(CONFIG_SAMA5_OHCI),y)
CHIP_CSRCS += sam_ohci.c
endif
ifeq ($(CONFIG_SAMA5_EHCI),y)
CHIP_CSRCS += sam_ehci.c
endif
endif
ifeq ($(CONFIG_SAMA5_HSMCI0),y)
CHIP_CSRCS += sam_hsmci.c
else

View File

@ -0,0 +1,107 @@
/****************************************************************************
* arch/arm/src/sama5/chip/sam_ohci.h
*
* 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.
*
****************************************************************************/
#ifndef __ARCH_ARM_SRC_SAMA5_CHIP_SAM_USB_H
#define __ARCH_ARM_SRC_SAMA5_CHIP_SAM_USB_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/usb/ohci.h>
#include "chip.h"
#include "chip/sam_memorymap.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Register offsets *********************************************************/
/* See nuttx/usb/ohci.h */
/* Register addresses *******************************************************/
#define SAM_USBHOST_HCIREV (SAM_UHPOHCI_VSECTION+OHCI_HCIREV_OFFSET)
#define SAM_USBHOST_CTRL (SAM_UHPOHCI_VSECTION+OHCI_CTRL_OFFSET)
#define SAM_USBHOST_CMDST (SAM_UHPOHCI_VSECTION+OHCI_CMDST_OFFSET)
#define SAM_USBHOST_INTST (SAM_UHPOHCI_VSECTION+OHCI_INTST_OFFSET)
#define SAM_USBHOST_INTEN (SAM_UHPOHCI_VSECTION+OHCI_INTEN_OFFSET)
#define SAM_USBHOST_INTDIS (SAM_UHPOHCI_VSECTION+OHCI_INTDIS_OFFSET)
/* Memory pointers (section 7.2) */
#define SAM_USBHOST_HCCA (SAM_UHPOHCI_VSECTION+OHCI_HCCA_OFFSET)
#define SAM_USBHOST_PERED (SAM_UHPOHCI_VSECTION+OHCI_PERED_OFFSET)
#define SAM_USBHOST_CTRLHEADED (SAM_UHPOHCI_VSECTION+OHCI_CTRLHEADED_OFFSET)
#define SAM_USBHOST_CTRLED (SAM_UHPOHCI_VSECTION+OHCI_CTRLED_OFFSET)
#define SAM_USBHOST_BULKHEADED (SAM_UHPOHCI_VSECTION+OHCI_BULKHEADED_OFFSET)
#define SAM_USBHOST_BULKED (SAM_UHPOHCI_VSECTION+OHCI_BULKED_OFFSET)
#define SAM_USBHOST_DONEHEAD (SAM_UHPOHCI_VSECTION+OHCI_DONEHEAD_OFFSET)
/* Frame counters (section 7.3) */
#define SAM_USBHOST_FMINT (SAM_UHPOHCI_VSECTION+OHCI_FMINT_OFFSET)
#define SAM_USBHOST_FMREM (SAM_UHPOHCI_VSECTION+OHCI_FMREM_OFFSET)
#define SAM_USBHOST_FMNO (SAM_UHPOHCI_VSECTION+OHCI_FMNO_OFFSET)
#define SAM_USBHOST_PERSTART (SAM_UHPOHCI_VSECTION+OHCI_PERSTART_OFFSET)
/* Root hub ports (section 7.4) */
#define SAM_USBHOST_LSTHRES (SAM_UHPOHCI_VSECTION+OHCI_LSTHRES_OFFSET)
#define SAM_USBHOST_RHDESCA (SAM_UHPOHCI_VSECTION+OHCI_RHDESCA_OFFSET)
#define SAM_USBHOST_RHDESCB (SAM_UHPOHCI_VSECTION+OHCI_RHDESCB_OFFSET)
#define SAM_USBHOST_RHSTATUS (SAM_UHPOHCI_VSECTION+OHCI_RHSTATUS_OFFSET)
#define SAM_USBHOST_RHPORTST1 (SAM_UHPOHCI_VSECTION+OHCI_RHPORTST1_OFFSET)
#define SAM_USBHOST_RHPORTST2 (SAM_UHPOHCI_VSECTION+OHCI_RHPORTST2_OFFSET)
#define SAM_USBHOST_MODID (SAM_UHPOHCI_VSECTION+SAM_USBHOST_MODID_OFFSET)
/* Register bit definitions *************************************************/
/* See include/nuttx/usb/ohci.h */
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
#endif /* __ARCH_ARM_SRC_SAMA5_CHIP_SAM_USB_H */

View File

@ -321,16 +321,37 @@ static inline void sam_selectplla(void)
}
/****************************************************************************
* Name: sam_upllsetup
* Name: sam_usbclockconfig
*
* Description:
* Select the PLLA output as the input clock for PCK and MCK.
* Configure clocking for USB.
*
****************************************************************************/
static inline void sam_upllsetup(void)
static inline void sam_usbclockconfig(void)
{
#ifdef CONFIG_USBDEV
#ifdef CONFIG_SAMA5_OHCI
/* For OHCI Full-speed operations only, the user has to perform the
* following:
*
* 1) Enable UHP peripheral clock, bit (1 << AT91C_ID_UHPHS) in PMC_PCER
* register.
* 2) Select PLLACK as Input clock of OHCI part, USBS bit in PMC_USB
* register.
* 3) Program the OHCI clocks (UHP48M and UHP12M) with USBDIV field in
* PMC_USB register. USBDIV value is calculated regarding the PLLACK
* value and USB Full-speed accuracy.
* 4) Enable the OHCI clocks, UHP bit in PMC_SCER register.
*
* Steps 2 and 3 are done here. 1 and 2 are performed with the USB device
* driver is opened.
*/
putreg32(BOARD_OHCI_INPUT | BOARD_OHCI_DIVIDER << PMC_USB_USBDIV_SHIFT,
SAM_PMC_USB);
#endif
#if 0 // #ifdef CONFIG_USBDEV
uint32_t regval;
/* Setup UTMI for USB and wait for LOCKU */
@ -512,9 +533,9 @@ void sam_clockconfig(void)
sam_selectplla();
/* Setup UTMI for USB */
/* Setup USB clocking */
sam_upllsetup();
sam_usbclockconfig();
}
#endif /* CONFIG_SAMA5_BOOT_ISRAM || CONFIG_SAMA5_BOOT_CS0FLASH */
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,112 @@
/************************************************************************************
* arch/arm/src/lpc17xx/lpc17_usbhost.h
*
* 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.
*
************************************************************************************/
#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_USBHOST_H
#define __ARCH_ARM_SRC_LPC17XX_LPC17_USBHOST_H
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/************************************************************************************
* Public Types
************************************************************************************/
/************************************************************************************
* Public Data
************************************************************************************/
/************************************************************************************
* Public Data
************************************************************************************/
#ifndef __ASSEMBLY__
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/************************************************************************************
* Public Functions
************************************************************************************/
/*******************************************************************************
* Name: sam_ohci_initialize
*
* Description:
* Initialize USB OHCI host controller hardware.
*
* Input Parameters:
* controller -- If the device supports more than USB host controller, 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.
*
*******************************************************************************/
#ifdef CONFIG_USBHOST
struct usbhost_driver_s;
FAR struct usbhost_driver_s *sam_ohci_initialize(int controller);
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_USBHOST_H */

View File

@ -1,7 +1,7 @@
/************************************************************************************
* arch/arm/src/stm32/stm32_otgfs.h
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -47,6 +47,8 @@
#include "stm32.h"
#include "chip/stm32_otgfs.h"
#ifdef CONFIG_STM32_OTGFS
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
@ -65,11 +67,42 @@
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C" {
extern "C"
{
#else
#define EXTERN extern
#endif
/*******************************************************************************
* Name: stm32_otgfshost_initialize
*
* Description:
* Initialize USB host device controller hardware.
*
* Input Parameters:
* controller -- If the device supports more than USB host controller, 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.
*
*******************************************************************************/
#ifdef CONFIG_USBHOST
struct usbhost_driver_s;
FAR struct usbhost_driver_s *stm32_otgfshost_initialize(int controller);
#endif
/************************************************************************************
* Name: stm32_usbsuspend
*
@ -89,5 +122,6 @@ void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume);
#endif
#endif /* __ASSEMBLY__ */
#endif /* CONFIG_STM32_OTGFS */
#endif /* __ARCH_ARM_SRC_STM32_STM32_OTGFS_H */

View File

@ -4193,7 +4193,7 @@ static inline int stm32_hw_initialize(FAR struct stm32_usbhost_s *priv)
*******************************************************************************/
/*******************************************************************************
* Name: usbhost_initialize
* Name: stm32_otgfshost_initialize
*
* Description:
* Initialize USB host device controller hardware.
@ -4217,7 +4217,7 @@ static inline int stm32_hw_initialize(FAR struct stm32_usbhost_s *priv)
*
*******************************************************************************/
FAR struct usbhost_driver_s *usbhost_initialize(int controller)
FAR struct usbhost_driver_s *stm32_otgfshost_initialize(int controller)
{
/* At present, there is only support for a single OTG FS host. Hence it is
* pre-allocated as g_usbhost. However, in most code, the private data

View File

@ -453,7 +453,6 @@ EXTERN int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
#endif
/************************************************************************************
* Name: pic32mx_dmainitialize
*
* Description:
@ -464,13 +463,11 @@ EXTERN int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
*
************************************************************************************/
#ifdef CONFIG_PIC32MX_DMA
EXTERN void pic32mx_dmainitilaize(void);
#endif
/************************************************************************************
* Name: pic32mx_dmachannel
*
* Description:
@ -484,13 +481,11 @@ EXTERN void pic32mx_dmainitilaize(void);
*
************************************************************************************/
#ifdef CONFIG_PIC32MX_DMA
EXTERN DMA_HANDLE pic32mx_dmachannel(void);
#endif
/************************************************************************************
* Name: pic32mx_dmafree
*
* Description:
@ -502,13 +497,11 @@ EXTERN DMA_HANDLE pic32mx_dmachannel(void);
*
************************************************************************************/
#ifdef CONFIG_PIC32MX_DMA
EXTERN void pic32mx_dmafree(DMA_HANDLE handle);
#endif
/************************************************************************************
* Name: pic32mx_dmasetup
*
* Description:
@ -516,7 +509,6 @@ EXTERN void pic32mx_dmafree(DMA_HANDLE handle);
*
************************************************************************************/
#ifdef CONFIG_PIC32MX_DMA
EXTERN int pic32mx_dmarxsetup(DMA_HANDLE handle,
uint32_t control, uint32_t config,
@ -525,7 +517,6 @@ EXTERN int pic32mx_dmarxsetup(DMA_HANDLE handle,
#endif
/************************************************************************************
* Name: pic32mx_dmastart
*
* Description:
@ -533,13 +524,11 @@ EXTERN int pic32mx_dmarxsetup(DMA_HANDLE handle,
*
************************************************************************************/
#ifdef CONFIG_PIC32MX_DMA
EXTERN int pic32mx_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg);
#endif
/************************************************************************************
* Name: pic32mx_dmastop
*
* Description:
@ -549,13 +538,11 @@ EXTERN int pic32mx_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *ar
*
************************************************************************************/
#ifdef CONFIG_PIC32MX_DMA
EXTERN void pic32mx_dmastop(DMA_HANDLE handle);
#endif
/************************************************************************************
* Name: pic32mx_dmasample
*
* Description:
@ -563,7 +550,6 @@ EXTERN void pic32mx_dmastop(DMA_HANDLE handle);
*
************************************************************************************/
#ifdef CONFIG_PIC32MX_DMA
#ifdef CONFIG_DEBUG_DMA
EXTERN void pic32mx_dmasample(DMA_HANDLE handle, struct pic32mx_dmaregs_s *regs);
@ -573,7 +559,6 @@ EXTERN void pic32mx_dmasample(DMA_HANDLE handle, struct pic32mx_dmaregs_s *regs)
#endif
/************************************************************************************
* Name: pic32mx_dmadump
*
* Description:
@ -581,7 +566,6 @@ EXTERN void pic32mx_dmasample(DMA_HANDLE handle, struct pic32mx_dmaregs_s *regs)
*
************************************************************************************/
#ifdef CONFIG_PIC32MX_DMA
#ifdef CONFIG_DEBUG_DMA
EXTERN void pic32mx_dmadump(DMA_HANDLE handle, const struct pic32mx_dmaregs_s *regs,
@ -592,7 +576,6 @@ EXTERN void pic32mx_dmadump(DMA_HANDLE handle, const struct pic32mx_dmaregs_s *r
#endif
/************************************************************************************
* Name: pic32mx_usbpullup
*
* Description:
@ -604,14 +587,12 @@ EXTERN void pic32mx_dmadump(DMA_HANDLE handle, const struct pic32mx_dmaregs_s *r
*
************************************************************************************/
#ifdef CONFIG_PIC32MX_USBDEV
struct usbdev_s;
EXTERN int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable);
#endif
/************************************************************************************
* Name: pic32mx_usbsuspend
*
* Description:
@ -622,7 +603,6 @@ EXTERN int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable);
*
************************************************************************************/
#ifdef CONFIG_PIC32MX_USBDEV
EXTERN void pic32mx_usbsuspend(FAR struct usbdev_s *dev, bool resume);
#endif
@ -637,7 +617,6 @@ EXTERN void pic32mx_usbsuspend(FAR struct usbdev_s *dev, bool resume);
*
************************************************************************************/
#ifdef CONFIG_PIC32MX_USBDEV
EXTERN void pic32mx_usbattach(void);
EXTERN void pic32mx_usbdetach(void);

View File

@ -2,7 +2,7 @@
* configs/cloudctrl/src/up_usbdev.c
* arch/arm/src/board/up_boot.c
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Darcy Gong <darcy.gong@gmail.com>
*
@ -54,6 +54,7 @@
#include "up_arch.h"
#include "stm32.h"
#include "stm32_otgfs.h"
#include "cloudctrl-internal.h"
#ifdef CONFIG_STM32_OTGFS
@ -186,7 +187,7 @@ int stm32_usbhost_initialize(void)
/* Then get an instance of the USB host interface */
uvdbg("Initialize USB host\n");
g_drvr = usbhost_initialize(0);
g_drvr = stm32_otgfshost_initialize(0);
if (g_drvr)
{
/* Start a thread to handle device connection. */

View File

@ -53,6 +53,7 @@
#include "up_arch.h"
#include "stm32.h"
#include "stm32_otgfs.h"
#include "mikroe-stm32f4-internal.h"
#ifdef CONFIG_STM32_OTGFS
@ -185,7 +186,7 @@ int stm32_usbhost_initialize(void)
/* Then get an instance of the USB host interface */
uvdbg("Initialize USB host\n");
g_drvr = usbhost_initialize(0);
g_drvr = stm32_otgfshost_initialize(0);
if (g_drvr)
{
/* Start a thread to handle device connection. */

View File

@ -51,6 +51,7 @@
#include "lpc17_ssp.h"
#include "lpc17_gpio.h"
#include "lpc17_usbhost.h"
#include "lpc1766stk_internal.h"
/****************************************************************************

View File

@ -52,6 +52,7 @@
#include "lpc17_gpio.h"
#include "lpc17_sdcard.h"
#include "lpc17_usbhost.h"
#include "open1788.h"
/****************************************************************************

View File

@ -694,18 +694,18 @@ SAMA5D3x-EK Configuration Options
Some subsystems can be configured to operate in different ways. The drivers
need to know how to configure the subsystem.
CONFIG_SAMA5_PIOA_IRQ - Support PIOA interrupts
CONFIG_SAMA5_PIOB_IRQ - Support PIOB interrupts
CONFIG_SAMA5_PIOC_IRQ - Support PIOD interrupts
CONFIG_SAMA5_PIOD_IRQ - Support PIOD interrupts
CONFIG_SAMA5_PIOE_IRQ - Support PIOE interrupts
CONFIG_SAMA5_PIOA_IRQ - Support PIOA interrupts
CONFIG_SAMA5_PIOB_IRQ - Support PIOB interrupts
CONFIG_SAMA5_PIOC_IRQ - Support PIOD interrupts
CONFIG_SAMA5_PIOD_IRQ - Support PIOD interrupts
CONFIG_SAMA5_PIOE_IRQ - Support PIOE interrupts
CONFIG_USART0_ISUART - USART0 is configured as a UART
CONFIG_USART1_ISUART - USART1 is configured as a UART
CONFIG_USART2_ISUART - USART2 is configured as a UART
CONFIG_USART3_ISUART - USART3 is configured as a UART
ST91SAM4S specific device driver settings
ST91SAMA5 specific device driver settings
CONFIG_U[S]ARTn_SERIAL_CONSOLE - selects the USARTn (n=0,1,2,3) or UART
m (m=4,5) for the console and ttys0 (default is the USART1).
@ -718,6 +718,34 @@ SAMA5D3x-EK Configuration Options
CONFIG_U[S]ARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
CONFIG_U[S]ARTn_2STOP - Two stop bits
AT91SAMA5 USB Host Configuration
Pre-requisites
CONFIG_USBDEV - Enable USB device support
CONFIG_USBHOST - Enable USB host support
CONFIG_SAMA5_UHPHS - Needed
CONFIG_SAMA5_OHCI - Enable the STM32 USB OTG FS block
CONFIG_SCHED_WORKQUEUE - Worker thread support is required
Options:
CONFIG_SAMA5_OHCI_NEDS
Number of endpoint descriptors
CONFIG_SAMA5_OHCI_NTDS
Number of transfer descriptors
CONFIG_SAMA5_OHCI_TDBUFFERS
Number of transfer descriptor buffers
CONFIG_SAMA5_OHCI_TDBUFSIZE
Size of one transfer descriptor buffer
CONFIG_USBHOST_INT_DISABLE
Disable interrupt endpoint support
CONFIG_USBHOST_ISOC_DISABLE
Disable isochronous endpoint support
CONFIG_USBHOST_BULK_DISABLE
Disable bulk endpoint support
config SAMA5_OHCI_REGDEBUG
Configurations
==============
@ -1084,6 +1112,25 @@ Configurations
volume when it is removed. But those callbacks are not used in
this configuration.
10) Support the USB full-speed OHCI host driver can be enabled by change
the NuttX configuration file as follows:
System Type -> ATSAMA5 Peripheral Support
CONFIG_SAMA5_UHPHS=y : USB Host High Speed
System Type -> USB High Speed Host driver options
CONFIG_SAMA5_OHCI=y : Full-speed OHCI support
: Defaults for values probably OK
Device Drivers
CONFIG_USBHOST=y : Enable USB host support
Device Drivers -> USB Host Driver Support
CONFIG_USBHOST_ISOC_DISABLE=y : Isochronous endpoints not used
CONFIG_USBHOST_MSC=y : Enable the mass storage class driver
Library Routines
CONFIG_SCHED_WORKQUEUE : Worker thread support is required
STATUS:
2013-7-19: This configuration (as do the others) run at 396MHz.
The SAMA5D3 can run at 536MHz. I still need to figure out the
@ -1132,6 +1179,8 @@ Configurations
debug output is suppressed and card insertial and removal works as
expected (at least on the HSMCI1 microSD slot).
2013-8-11: Added OHCI configuration. Untested!
ostest:
This configuration directory, performs a simple OS test using
examples/ostest.

View File

@ -96,9 +96,43 @@
#define BOARD_PMC_MCKR_PLLADIV PMC_MCKR_PLLADIV2
#define BOARD_PMC_MCKR_MDIV PMC_MCKR_MDIV_PCKDIV3
#ifdef CONFIG_SAMA5_OHCI
/* For OHCI Full-speed operations, the user has to perform the following:
*
* 1) Enable UHP peripheral clock, bit (1 << AT91C_ID_UHPHS) in PMC_PCER
* register.
* 2) Select PLLACK as Input clock of OHCI part, USBS bit in PMC_USB
* register.
* 3) Program the OHCI clocks (UHP48M and UHP12M) with USBDIV field in
* PMC_USB register. USBDIV value is calculated regarding the PLLACK
* value and USB Full-speed accuracy.
* 4) Enable the OHCI clocks, UHP bit in PMC_SCER register.
*
* "The USB Host controller requires 48 MHz and 12 MHz clocks for OHCI
* full-speed operations. These clocks must be generated by a PLL with a
* correct accuracy of ± 0.25% thanks to USBDIV field.
*
* "Thus the USB Host peripheral receives three clocks from the Power
* Management Controller (PMC): the Peripheral Clock (MCK domain), the
* UHP48M and the UHP12M (built-in UHP48M divided by four) used by the
* OHCI to interface with the bus USB signals (Recovered 12 MHz domain)
* in Full-speed operations"
*
* USB Clock = PLLACK / (USBDIV + 1) = 48MHz
* USBDIV = PLLACK / 48MHz - 1
* = 16.5
* REVISIT: USBDIV = 16 gives a clock of 46.59MHz which is an error of 3%
*/
# define BOARD_OHCI_INPUT PMC_USB_USBS_PLLA
# define BOARD_OHCI_DIVIDER (16)
#endif
#if 0
/* USB UTMI PLL start-up time */
#define BOARD_CKGR_UCKR_UPLLCOUNT (3 << PMC_CKGR_UCKR_UPLLCOUNT_SHIFT)
#endif
/* Resulting frequencies */

View File

@ -2,7 +2,7 @@
* configs/shenzhou/src/up_usbdev.c
* arch/arm/src/board/up_boot.c
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -53,6 +53,7 @@
#include "up_arch.h"
#include "stm32.h"
#include "stm32_otgfs.h"
#include "shenshou-internal.h"
#ifdef CONFIG_STM32_OTGFS
@ -185,7 +186,7 @@ int stm32_usbhost_initialize(void)
/* Then get an instance of the USB host interface */
uvdbg("Initialize USB host\n");
g_drvr = usbhost_initialize(0);
g_drvr = stm32_otgfshost_initialize(0);
if (g_drvr)
{
/* Start a thread to handle device connection. */

View File

@ -2,7 +2,7 @@
* configs/stm3220g-eval/src/up_usb.c
* arch/arm/src/board/up_usb.c
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -53,6 +53,7 @@
#include "up_arch.h"
#include "stm32.h"
#include "stm32_otgfs.h"
#include "stm3220g-internal.h"
#ifdef CONFIG_STM32_OTGFS
@ -185,7 +186,7 @@ int stm32_usbhost_initialize(void)
/* Then get an instance of the USB host interface */
uvdbg("Initialize USB host\n");
g_drvr = usbhost_initialize(0);
g_drvr = stm32_otgfshost_initialize(0);
if (g_drvr)
{
/* Start a thread to handle device connection. */

View File

@ -2,7 +2,7 @@
* configs/stm3240g-eval/src/up_usbdev.c
* arch/arm/src/board/up_boot.c
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -53,6 +53,7 @@
#include "up_arch.h"
#include "stm32.h"
#include "stm32_otgfs.h"
#include "stm3240g-internal.h"
#ifdef CONFIG_STM32_OTGFS
@ -185,7 +186,7 @@ int stm32_usbhost_initialize(void)
/* Then get an instance of the USB host interface */
uvdbg("Initialize USB host\n");
g_drvr = usbhost_initialize(0);
g_drvr = stm32_otgfshost_initialize(0);
if (g_drvr)
{
/* Start a thread to handle device connection. */

View File

@ -2,7 +2,7 @@
* configs/stm32f4discovery/src/up_usbdev.c
* arch/arm/src/board/up_boot.c
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -53,6 +53,7 @@
#include "up_arch.h"
#include "stm32.h"
#include "stm32_otgfs.h"
#include "stm32f4discovery-internal.h"
#ifdef CONFIG_STM32_OTGFS
@ -185,7 +186,7 @@ int stm32_usbhost_initialize(void)
/* Then get an instance of the USB host interface */
uvdbg("Initialize USB host\n");
g_drvr = usbhost_initialize(0);
g_drvr = stm32_otgfshost_initialize(0);
if (g_drvr)
{
/* Start a thread to handle device connection. */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* drivers/usbhost/usbhost_hidkbd.c
*
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -120,7 +120,7 @@
/* The default is to support scancode mapping for the standard 104 key
* keyboard. Setting CONFIG_HIDKBD_RAWSCANCODES will disable all scancode
* mapping; Setting CONFIG_HIDKBD_ALLSCANCODES will enable mapping of all
* scancodes;
* scancodes;
*/
#ifndef CONFIG_HIDKBD_RAWSCANCODES
@ -201,7 +201,7 @@ struct usbhost_state_s
struct usbhost_driver_s *drvr;
/* The remainder of the fields are provide o the keyboard class driver */
char devchar; /* Character identifying the /dev/kbd[n] device */
volatile bool disconnected; /* TRUE: Device has been disconnected */
volatile bool polling; /* TRUE: Poll thread is running */
@ -321,7 +321,7 @@ static inline int usbhost_tdalloc(FAR struct usbhost_state_s *priv);
static inline int usbhost_tdfree(FAR struct usbhost_state_s *priv);
/* struct usbhost_registry_s methods */
static struct usbhost_class_s *usbhost_create(FAR struct usbhost_driver_s *drvr,
FAR const struct usbhost_id_s *id);
@ -349,7 +349,7 @@ static int usbhost_poll(FAR struct file *filep, FAR struct pollfd *fds,
* Private Data
****************************************************************************/
/* This structure provides the registry entry ID informatino that will be
/* This structure provides the registry entry ID informatino that will be
* used to associate the USB host keyboard class driver to a connected USB
* device.
*/
@ -763,7 +763,7 @@ static void usbhost_destroy(FAR void *arg)
DEBUGASSERT(priv != NULL);
uvdbg("crefs: %d\n", priv->crefs);
/* Unregister the driver */
uvdbg("Unregister driver\n");
@ -1026,12 +1026,12 @@ static int usbhost_kbdpoll(int argc, char *argv[])
priv = g_priv;
DEBUGASSERT(priv != NULL);
priv->polling = true;
priv->crefs++;
usbhost_givesem(&g_syncsem);
sleep(1);
/* Loop here until the device is disconnected */
uvdbg("Entering poll loop\n");
@ -1149,7 +1149,7 @@ static int usbhost_kbdpoll(int argc, char *argv[])
{
keycode &= 0x1f;
}
/* Copy the next keyboard character into the user
* buffer.
*/
@ -1242,13 +1242,13 @@ static int usbhost_kbdpoll(int argc, char *argv[])
* we can destroy it now. Otherwise, we have to wait until the all
* of the file descriptors are closed.
*/
udbg("Keyboard removed, polling halted\n");
priv->polling = false;
if (--priv->crefs < 2)
{
/* Destroy the instance (while we hold the semaphore!) */
usbhost_destroy(priv);
}
else
@ -1299,10 +1299,15 @@ static inline int usbhost_cfgdesc(FAR struct usbhost_state_s *priv,
bool done = false;
int ret;
DEBUGASSERT(priv != NULL &&
DEBUGASSERT(priv != NULL &&
configdesc != NULL &&
desclen >= sizeof(struct usb_cfgdesc_s));
/* Keep the compiler from complaining about uninitialized variables */
memset(&epindesc, 0, sizeof(struct usbhost_epdesc_s));
memset(&epoutdesc, 0, sizeof(struct usbhost_epdesc_s));
/* Verify that we were passed a configuration descriptor */
cfgdesc = (FAR struct usb_cfgdesc_s *)configdesc;
@ -1338,7 +1343,7 @@ static inline int usbhost_cfgdesc(FAR struct usbhost_state_s *priv,
case USB_DESC_TYPE_INTERFACE:
{
FAR struct usb_ifdesc_s *ifdesc = (FAR struct usb_ifdesc_s *)configdesc;
uvdbg("Interface descriptor\n");
DEBUGASSERT(remaining >= USB_SIZEOF_IFDESC);
@ -1429,7 +1434,7 @@ static inline int usbhost_cfgdesc(FAR struct usbhost_state_s *priv,
found |= USBHOST_EPINFOUND;
/* Save the interrupt IN endpoint information */
epindesc.addr = epdesc->addr & USB_EP_ADDR_NUMBER_MASK;
epindesc.in = 1;
epindesc.funcaddr = funcaddr;
@ -1460,13 +1465,13 @@ static inline int usbhost_cfgdesc(FAR struct usbhost_state_s *priv,
}
/* Increment the address of the next descriptor */
configdesc += desc->len;
remaining -= desc->len;
}
/* Sanity checking... did we find all of things that we need? */
if ((found & USBHOST_RQDFOUND) != USBHOST_RQDFOUND)
{
ulldbg("ERROR: Found IF:%s EPIN:%s\n",
@ -1752,7 +1757,7 @@ static inline int usbhost_tdfree(FAR struct usbhost_state_s *priv)
* Name: usbhost_create
*
* Description:
* This function implements the create() method of struct usbhost_registry_s.
* This function implements the create() method of struct usbhost_registry_s.
* The create() method is a callback into the class implementation. It is
* used to (1) create a new instance of the USB host class state and to (2)
* bind a USB host driver "session" to the class instance. Use of this
@ -1812,7 +1817,7 @@ static FAR struct usbhost_class_s *usbhost_create(FAR struct usbhost_driver_s *d
priv->drvr = drvr;
/* Return the instance of the USB keyboard class driver */
return &priv->class;
}
}
@ -1867,7 +1872,7 @@ static int usbhost_connect(FAR struct usbhost_class_s *class,
FAR struct usbhost_state_s *priv = (FAR struct usbhost_state_s *)class;
int ret;
DEBUGASSERT(priv != NULL &&
DEBUGASSERT(priv != NULL &&
configdesc != NULL &&
desclen >= sizeof(struct usb_cfgdesc_s));
@ -1888,7 +1893,7 @@ static int usbhost_connect(FAR struct usbhost_class_s *class,
udbg("usbhost_devinit() failed: %d\n", ret);
}
}
/* ERROR handling: Do nothing. If we return and error during connection,
* the driver is required to call the DISCONNECT method. Possibilities:
*
@ -1958,7 +1963,7 @@ static int usbhost_disconnected(struct usbhost_class_s *class)
if (priv->polling)
{
/* The polling task is still alive. Signal the keyboard polling task.
/* The polling task is still alive. Signal the keyboard polling task.
* When that task wakes up, it will decrement the reference count and,
* perhaps, destroy the class instance. Then it will exit.
*/
@ -2064,7 +2069,7 @@ static int usbhost_close(FAR struct file *filep)
/* Is this the last reference (other than the one held by the USB host
* controller driver)
*/
if (priv->crefs <= 1)
{
irqstate_t flags;
@ -2098,7 +2103,7 @@ static int usbhost_close(FAR struct file *filep)
}
irqrestore(flags);
}
usbhost_givesem(&priv->exclsem);
return OK;
}
@ -2177,7 +2182,7 @@ static ssize_t usbhost_read(FAR struct file *filep, FAR char *buffer, size_t len
}
/* Read data from our internal buffer of received characters */
for (tail = priv->tailndx, nbytes = 0;
tail != priv->headndx && nbytes < len;
nbytes++)

View File

@ -1,7 +1,7 @@
/****************************************************************************
* drivers/usbhost/usbhost_storage.c
*
* Copyright (C) 2010-2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2010-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -139,6 +139,13 @@ struct usbhost_state_s
usbhost_ep_t bulkout; /* Bulk OUT endpoint */
};
/* This is how struct usbhost_state_s looks to the free list logic */
struct usbhost_freestate_s
{
FAR struct usbhost_freestate_s *flink;
};
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
@ -300,7 +307,7 @@ static struct usbhost_state_s g_prealloc[CONFIG_USBHOST_NPREALLOC];
/* This is a list of free, pre-allocated USB host storage class instances */
#if CONFIG_USBHOST_NPREALLOC > 0
static struct usbhost_state_s *g_freelist;
static FAR struct usbhost_freestate_s *g_freelist;
#endif
/* This is a bitmap that is used to allocate device names /dev/sda-z. */
@ -356,7 +363,7 @@ static void usbhost_takesem(sem_t *sem)
#if CONFIG_USBHOST_NPREALLOC > 0
static inline FAR struct usbhost_state_s *usbhost_allocclass(void)
{
struct usbhost_state_s *priv;
FAR struct usbhost_freestate_s *entry;
irqstate_t flags;
/* We may be executing from an interrupt handler so we need to take one of
@ -364,15 +371,15 @@ static inline FAR struct usbhost_state_s *usbhost_allocclass(void)
*/
flags = irqsave();
priv = g_freelist;
if (priv)
entry = g_freelist;
if (entry)
{
g_freelist = priv->class.flink;
priv->class.flink = NULL;
g_freelist = entry->flink;
}
irqrestore(flags);
ullvdbg("Allocated: %p\n", priv);;
return priv;
ullvdbg("Allocated: %p\n", entry);;
return (FAR struct usbhost_state_s *)entry;
}
#else
static inline FAR struct usbhost_state_s *usbhost_allocclass(void)
@ -407,16 +414,17 @@ static inline FAR struct usbhost_state_s *usbhost_allocclass(void)
#if CONFIG_USBHOST_NPREALLOC > 0
static inline void usbhost_freeclass(FAR struct usbhost_state_s *class)
{
FAR struct usbhost_freestate_s *entry = (FAR struct usbhost_freestate_s *)class;
irqstate_t flags;
DEBUGASSERT(class != NULL);
DEBUGASSERT(entry != NULL);
ullvdbg("Freeing: %p\n", class);;
ullvdbg("Freeing: %p\n", entry);
/* Just put the pre-allocated class structure back on the freelist */
flags = irqsave();
class->class.flink = g_freelist;
g_freelist = class;
entry->flink = g_freelist;
g_freelist = entry;
irqrestore(flags);
}
#else
@ -821,7 +829,6 @@ static inline int usbhost_readcapacity(FAR struct usbhost_state_s *priv)
static inline int usbhost_inquiry(FAR struct usbhost_state_s *priv)
{
FAR struct usbmsc_cbw_s *cbw;
FAR struct scsiresp_inquiry_s *resp;
int result;
/* Initialize a CBW (re-using the allocated transfer buffer) */
@ -846,9 +853,12 @@ static inline int usbhost_inquiry(FAR struct usbhost_state_s *priv)
priv->tbuffer, SCSIRESP_INQUIRY_SIZEOF);
if (result == OK)
{
/* TODO: If USB debug is enabled, dump the response data here */
#if 0
FAR struct scsiresp_inquiry_s *resp;
/* TODO: If USB debug is enabled, dump the response data here */
resp = (FAR struct scsiresp_inquiry_s *)priv->tbuffer;
#endif
/* Receive the CSW */
@ -971,6 +981,11 @@ static inline int usbhost_cfgdesc(FAR struct usbhost_state_s *priv,
configdesc != NULL &&
desclen >= sizeof(struct usb_cfgdesc_s));
/* Keep the compiler from complaining about uninitialized variables */
memset(&bindesc, 0, sizeof(struct usbhost_epdesc_s));
memset(&boutdesc, 0, sizeof(struct usbhost_epdesc_s));
/* Verify that we were passed a configuration descriptor */
cfgdesc = (FAR struct usb_cfgdesc_s *)configdesc;
@ -2225,14 +2240,15 @@ int usbhost_storageinit(void)
*/
#if CONFIG_USBHOST_NPREALLOC > 0
FAR struct usbhost_freestate_s *entry;
int i;
g_freelist = NULL;
for (i = 0; i < CONFIG_USBHOST_NPREALLOC; i++)
{
struct usbhost_state_s *class = &g_prealloc[i];
class->class.flink = g_freelist;
g_freelist = class;
entry = (FAR struct usbhost_freestate_s *)&g_prealloc[i];
entry->flink = g_freelist;
g_freelist = entry;
}
#endif

View File

@ -799,33 +799,6 @@ EXTERN int usbhost_kbdinit(void);
EXTERN int usbhost_wlaninit(void);
/*******************************************************************************
* Name: usbhost_initialize
*
* Description:
* Initialize USB host device controller hardware.
*
* Input Parameters:
* controller -- If the device supports more than USB host controller, 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.
*
*******************************************************************************/
EXTERN FAR struct usbhost_driver_s *usbhost_initialize(int controller);
/*******************************************************************************
* Name: usbhost_enumerate
*