Changes for clean STM32 USB host driver build

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5040 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2012-08-20 16:06:39 +00:00
parent cadc799f21
commit 435fb483a8
6 changed files with 161 additions and 31 deletions

View File

@ -669,6 +669,27 @@ STM3220G-EVAL-specific Configuration Options
STM3220G-EVAL LCD Hardware Configuration
STM32 USB OTG FS Host Driver Support
Pre-requisites
CONFIG_USBHOST - Enable general USB host support
CONFIG_STM32_OTGFS - Enable the STM32 USB OTG FS block
CONFIG_STM32_SYSCFG - Needed
Options:
CONFIG_STM32_OTGFS_RXFIFO_SIZE - Size of the RX FIFO in 32-bit words.
Default 128 (512 bytes)
CONFIG_STM32_OTGFS_NPTXFIFO_SIZE - Size of the non-periodic Tx FIFO
in 32-bit words. Default 96 (384 bytes)
CONFIG_STM32_OTGFS_PTXFIFO_SIZE - Size of the periodic Tx FIFO in 32-bit
words. Default 96 (384 bytes)
CONFIG_STM32_OTGFS_SOFINTR - Enable SOF interrupts. Why would you ever
want to do that?
CONFIG_STM32_USBHOST_REGDEBUG - Enable very low-level register access
debug. Depends on CONFIG_DEBUG.
Configurations
==============
@ -834,7 +855,15 @@ Where <subdir> is one of the following:
CONFIG_NX=y : Enable graphics suppport
CONFIG_MM_REGIONS=2 : When FSMC is enabled, so is the on-board SRAM memory region
8. This configuration requires that jumper JP22 be set to enable RS-232 operation.
8. USB OTG FS Device or Host Support
CONFIG_USBDEV - Enable USB device support
CONFIG_USBHOST - Enable USB host support
CONFIG_STM32_OTGFS - Enable the STM32 USB OTG FS block
CONFIG_STM32_SYSCFG - Needed
CONFIG_SCHED_WORKQUEUE - Worker thread support is required
9. This configuration requires that jumper JP22 be set to enable RS-232 operation.
nsh2:
-----

View File

@ -998,7 +998,7 @@ CONFIG_STMPE811_THRESHX=26
CONFIG_STMPE811_THRESHY=34
#
# USB Device Configuration
# STM32 USB OTG FS Device Configuration
#
# CONFIG_USBDEV
# Enables USB device support
@ -1025,6 +1025,36 @@ CONFIG_USBDEV_MAXPOWER=100
CONFIG_USBDEV_TRACE=n
CONFIG_USBDEV_TRACE_NRECORDS=128
#
# STM32 USB OTG FS Host Configuration
#
# Pre-requisites
#
# CONFIG_USBHOST - Enable general USB host support
# CONFIG_STM32_OTGFS - Enable the STM32 USB OTG FS block
# CONFIG_STM32_SYSCFG - Needed
# CONFIG_SCHED_WORKQUEUE - Worker thread support is required
#
# Options:
#
# CONFIG_STM32_OTGFS_RXFIFO_SIZE - Size of the RX FIFO in 32-bit words.
# Default 128 (512 bytes)
# CONFIG_STM32_OTGFS_NPTXFIFO_SIZE - Size of the non-periodic Tx FIFO
# in 32-bit words. Default 96 (384 bytes)
# CONFIG_STM32_OTGFS_PTXFIFO_SIZE - Size of the periodic Tx FIFO in 32-bit
# words. Default 96 (384 bytes)
# CONFIG_STM32_OTGFS_SOFINTR - Enable SOF interrupts. Why would you ever
# want to do that?
# CONFIG_STM32_USBHOST_REGDEBUG - Enable very low-level register access
# debug. Depends on CONFIG_DEBUG.
#
CONFIG_USBHOST=n
# ONFIG_STM32_OTGFS_RXFIFO_SIZE
#CONFIG_STM32_OTGFS_NPTXFIFO_SIZE
#CONFIG_STM32_OTGFS_PTXFIFO_SIZE
CONFIG_STM32_OTGFS_SOFINTR=n
CONFIG_STM32_USBHOST_REGDEBUG=n
#
# USB Serial Device Configuration
#

View File

@ -55,7 +55,12 @@
# include <nuttx/mmcsd.h>
#endif
#ifdef CONFIG_STM32_OTGFS
# include "stm32_usbhost.h"
#endif
#include "stm32_internal.h"
#include "stm3220g-internal.h"
/****************************************************************************
* Pre-Processor Definitions
@ -67,29 +72,19 @@
#undef CONFIG_STM32_SPI1
/* PORT and SLOT number probably depend on the board configuration */
/* MMCSD PORT and SLOT number probably depend on the board configuration */
#ifdef CONFIG_ARCH_BOARD_STM3220G_EVAL
# define CONFIG_NSH_HAVEUSBDEV 1
# define CONFIG_NSH_HAVEMMCSD 1
# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0
# error "Only one MMC/SD slot"
# undef CONFIG_NSH_MMCSDSLOTNO
# endif
# ifndef CONFIG_NSH_MMCSDSLOTNO
# define CONFIG_NSH_MMCSDSLOTNO 0
# endif
#else
/* Add configuration for new STM32 boards here */
# error "Unrecognized STM32 board"
# undef CONFIG_NSH_HAVEUSBDEV
# undef CONFIG_NSH_HAVEMMCSD
#define HAVE_USBDEV 1
#define HAVE_MMCSD 1
#define HAVE_USBHOST 1
#if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0
# error "Only one MMC/SD slot"
# undef CONFIG_NSH_MMCSDSLOTNO
#endif
/* Can't support USB features if USB is not enabled */
#ifndef CONFIG_USBDEV
# undef CONFIG_NSH_HAVEUSBDEV
#ifndef CONFIG_NSH_MMCSDSLOTNO
# define CONFIG_NSH_MMCSDSLOTNO 0
#endif
/* Can't support MMC/SD features if mountpoints are disabled or if SDIO support
@ -97,13 +92,32 @@
*/
#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_STM32_SDIO)
# undef CONFIG_NSH_HAVEMMCSD
# undef HAVE_MMCSD
#endif
#ifndef CONFIG_NSH_MMCSDMINOR
# define CONFIG_NSH_MMCSDMINOR 0
#endif
/* Can't support USB host or device features if USB OTG FS is not enabled */
#ifndef CONFIG_STM32_OTGFS
# undef HAVE_USBDEV
# undef HAVE_USBHOST
#endif
/* Can't support USB device is USB device is not enabled */
#ifndef CONFIG_USBDEV
# undef HAVE_USBDEV
#endif
/* Can't support USB host is USB host is not enabled */
#ifndef CONFIG_USBHOST
# undef HAVE_USBHOST
#endif
/* Debug ********************************************************************/
#ifdef CONFIG_CPP_HAVE_VARARGS
@ -138,8 +152,10 @@ int nsh_archinitialize(void)
FAR struct spi_dev_s *spi;
FAR struct mtd_dev_s *mtd;
#endif
#ifdef CONFIG_NSH_HAVEMMCSD
#ifdef HAVE_MMCSD
FAR struct sdio_dev_s *sdio;
#endif
#if defined(HAVE_MMCSD) || defined (HAVE_USBHOST)
int ret;
#endif
@ -169,7 +185,7 @@ int nsh_archinitialize(void)
/* Mount the SDIO-based MMC/SD block driver */
#ifdef CONFIG_NSH_HAVEMMCSD
#ifdef HAVE_MMCSD
/* First, get an instance of the SDIO interface */
message("nsh_archinitialize: Initializing SDIO slot %d\n",
@ -203,7 +219,7 @@ int nsh_archinitialize(void)
* will monitor for USB connection and disconnection events.
*/
#if defined(CONFIG_STM32_OTGFS) && defined(CONFIG_USBHOST)
#ifdef HAVE_USBHOST
ret = stm32_usbhost_initialize();
if (ret != OK)
{

View File

@ -43,6 +43,8 @@
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <sched.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/usb/usbdev.h>
@ -59,10 +61,10 @@
* Definitions
************************************************************************************/
#if defined(CONFIG_USBDEV) || defined(CONFIG_USBDEV)
#if defined(CONFIG_USBDEV) || defined(CONFIG_USBHOST)
# define HAVE_USB 1
#else
# warning "CONFIG_STM32_OTGFS is enabled but neither CONFIG_USBDEV nor CONFIG_USBDEV"
# warning "CONFIG_STM32_OTGFS is enabled but neither CONFIG_USBDEV nor CONFIG_USBHOST"
# undef HAVE_USB
#endif
@ -78,7 +80,7 @@
* Private Data
************************************************************************************/
#ifdef CONFIG_NSH_HAVEUSBHOST
#ifdef CONFIG_USBHOST
static struct usbhost_driver_s *g_drvr;
#endif
@ -94,7 +96,7 @@ static struct usbhost_driver_s *g_drvr;
*
****************************************************************************/
#ifdef CONFIG_NSH_HAVEUSBHOST
#ifdef CONFIG_USBHOST
static int usbhost_waiter(int argc, char *argv[])
{
bool connected = false;

View File

@ -831,6 +831,28 @@ STM3240G-EVAL-specific Configuration Options
CONFIG_STM32_ILI9320_DISABLE (includes ILI9321)
CONFIG_STM32_ILI9325_DISABLE
STM32 USB OTG FS Host Driver Support
Pre-requisites
CONFIG_USBHOST - Enable USB host support
CONFIG_STM32_OTGFS - Enable the STM32 USB OTG FS block
CONFIG_STM32_SYSCFG - Needed
CONFIG_SCHED_WORKQUEUE - Worker thread support is required
Options:
CONFIG_STM32_OTGFS_RXFIFO_SIZE - Size of the RX FIFO in 32-bit words.
Default 128 (512 bytes)
CONFIG_STM32_OTGFS_NPTXFIFO_SIZE - Size of the non-periodic Tx FIFO
in 32-bit words. Default 96 (384 bytes)
CONFIG_STM32_OTGFS_PTXFIFO_SIZE - Size of the periodic Tx FIFO in 32-bit
words. Default 96 (384 bytes)
CONFIG_STM32_OTGFS_SOFINTR - Enable SOF interrupts. Why would you ever
want to do that?
CONFIG_STM32_USBHOST_REGDEBUG - Enable very low-level register access
debug. Depends on CONFIG_DEBUG.
Configurations
==============
@ -996,7 +1018,15 @@ Where <subdir> is one of the following:
CONFIG_NX=y : Enable graphics suppport
CONFIG_MM_REGIONS=3 : When FSMC is enabled, so is the on-board SRAM memory region
8. This configuration requires that jumper JP22 be set to enable RS-232
8. USB OTG FS Device or Host Support
CONFIG_USBDEV - Enable USB device support
CONFIG_USBHOST - Enable USB host support
CONFIG_STM32_OTGFS - Enable the STM32 USB OTG FS block
CONFIG_STM32_SYSCFG - Needed
CONFIG_SCHED_WORKQUEUE - Worker thread support is required
9. This configuration requires that jumper JP22 be set to enable RS-232
operation.
nsh2:

View File

@ -883,6 +883,29 @@ STM32F4Discovery-specific Configuration Options
CONFIG_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
4-bit transfer mode.
STM32 USB OTG FS Host Driver Support
Pre-requisites
CONFIG_USBDEV - Enable USB device support
CONFIG_USBHOST - Enable USB host support
CONFIG_STM32_OTGFS - Enable the STM32 USB OTG FS block
CONFIG_STM32_SYSCFG - Needed
CONFIG_SCHED_WORKQUEUE - Worker thread support is required
Options:
CONFIG_STM32_OTGFS_RXFIFO_SIZE - Size of the RX FIFO in 32-bit words.
Default 128 (512 bytes)
CONFIG_STM32_OTGFS_NPTXFIFO_SIZE - Size of the non-periodic Tx FIFO
in 32-bit words. Default 96 (384 bytes)
CONFIG_STM32_OTGFS_PTXFIFO_SIZE - Size of the periodic Tx FIFO in 32-bit
words. Default 96 (384 bytes)
CONFIG_STM32_OTGFS_SOFINTR - Enable SOF interrupts. Why would you ever
want to do that?
CONFIG_STM32_USBHOST_REGDEBUG - Enable very low-level register access
debug. Depends on CONFIG_DEBUG.
Configurations
==============