summaryrefslogtreecommitdiffstats
path: root/nuttx/configs/stm3220g-eval/src
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-08-20 16:06:39 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-08-20 16:06:39 +0000
commit7964bc4dca71e9416fdde408bd7ee8aae4e7383d (patch)
tree65fef6247c6478e1fe13fdf3a01d057ef7875fe3 /nuttx/configs/stm3220g-eval/src
parentd72818289eb221c2bceca1341f3ddd3a7ff62b31 (diff)
Changes for clean STM32 USB host driver build
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5040 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/configs/stm3220g-eval/src')
-rw-r--r--nuttx/configs/stm3220g-eval/src/up_nsh.c64
-rw-r--r--nuttx/configs/stm3220g-eval/src/up_usb.c10
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 3b061902ba..e1359de96a 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 374d974ffc..be303a8a5b 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;