diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-08-20 16:06:39 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-08-20 16:06:39 +0000 |
commit | dc2f456623665ea79fae78fc78c0c3aa83f511b0 (patch) | |
tree | 65fef6247c6478e1fe13fdf3a01d057ef7875fe3 /nuttx/configs/stm3220g-eval/src | |
parent | c1b91e741d3baf2af4c99fcdefdb408935bba827 (diff) | |
download | px4-nuttx-dc2f456623665ea79fae78fc78c0c3aa83f511b0.tar.gz px4-nuttx-dc2f456623665ea79fae78fc78c0c3aa83f511b0.tar.bz2 px4-nuttx-dc2f456623665ea79fae78fc78c0c3aa83f511b0.zip |
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
Diffstat (limited to 'nuttx/configs/stm3220g-eval/src')
-rw-r--r-- | nuttx/configs/stm3220g-eval/src/up_nsh.c | 64 | ||||
-rw-r--r-- | nuttx/configs/stm3220g-eval/src/up_usb.c | 10 |
2 files changed, 46 insertions, 28 deletions
diff --git a/nuttx/configs/stm3220g-eval/src/up_nsh.c b/nuttx/configs/stm3220g-eval/src/up_nsh.c index 3b061902b..e1359de96 100644 --- a/nuttx/configs/stm3220g-eval/src/up_nsh.c +++ b/nuttx/configs/stm3220g-eval/src/up_nsh.c @@ -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 -#endif +#define HAVE_USBDEV 1 +#define HAVE_MMCSD 1 +#define HAVE_USBHOST 1 -/* Can't support USB features if USB is not enabled */ +#if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0 +# error "Only one MMC/SD slot" +# undef CONFIG_NSH_MMCSDSLOTNO +#endif -#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) { diff --git a/nuttx/configs/stm3220g-eval/src/up_usb.c b/nuttx/configs/stm3220g-eval/src/up_usb.c index 374d974ff..be303a8a5 100644 --- a/nuttx/configs/stm3220g-eval/src/up_usb.c +++ b/nuttx/configs/stm3220g-eval/src/up_usb.c @@ -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; |