diff --git a/configs/fire-stm32v2/src/Makefile b/configs/fire-stm32v2/src/Makefile index ea45dc76231..b848ce4993e 100644 --- a/configs/fire-stm32v2/src/Makefile +++ b/configs/fire-stm32v2/src/Makefile @@ -68,8 +68,4 @@ ifeq ($(CONFIG_USBMSC),y) CSRCS += stm32_usbmsc.c endif -ifeq ($(CONFIG_USBDEV_COMPOSITE),y) -CSRCS += stm32_composite.c -endif - include $(TOPDIR)/configs/Board.mk diff --git a/configs/fire-stm32v2/src/stm32_composite.c b/configs/fire-stm32v2/src/stm32_composite.c deleted file mode 100644 index 4a171aebe44..00000000000 --- a/configs/fire-stm32v2/src/stm32_composite.c +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** - * configs/fire-stm32v2/src/stm32_composite.c - * - * Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Configure and register the STM32 SPI-based MMC/SD block driver. - * - * 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 - -#include - -#include - -#include "fire-stm32v2.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* Device minor number */ - -#ifndef CONFIG_SYSTEM_COMPOSITE_DEVMINOR1 -# define CONFIG_SYSTEM_COMPOSITE_DEVMINOR1 0 -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_composite_initialize - * - * Description: - * Perform architecture specific initialization of a composite USB device. - * - ****************************************************************************/ - -int board_composite_initialize(int port) -{ - /* If system/composite is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() (see stm32_appinit.c). - * In this case, there is nothing further to be done here. - * - * NOTE: CONFIG_NSH_BUILTIN_APPS is not a fool-proof indication that NSH - * was built. - */ - -#ifndef CONFIG_NSH_BUILTIN_APPS - return sd_mount(CONFIG_SYSTEM_COMPOSITE_DEVMINOR1); -#else - return OK; -#endif /* CONFIG_NSH_BUILTIN_APPS */ -} diff --git a/configs/mcu123-lpc214x/src/lpc2148_composite.c b/configs/mcu123-lpc214x/src/lpc2148_composite.c index ac00b3f02fb..ae776dbc576 100644 --- a/configs/mcu123-lpc214x/src/lpc2148_composite.c +++ b/configs/mcu123-lpc214x/src/lpc2148_composite.c @@ -55,16 +55,12 @@ #include "lpc214x_spi.h" +#if defined(CONFIG_BOARDCTL_USBDEVCTRL) && defined(CONFIG_USBDEV_COMPOSITE) + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ -/* Configuration ************************************************************/ - -#ifndef CONFIG_SYSTEM_COMPOSITE_DEVMINOR1 -# define CONFIG_SYSTEM_COMPOSITE_DEVMINOR1 0 -#endif - /* PORT and SLOT number depend on the board configuration */ #define LPC214X_MMCSDSPIPORTNO 1 @@ -116,8 +112,8 @@ static int board_mscclassobject(int minor, /* Configure the mass storage device */ - uinfo("Configuring with NLUNS=%d\n", CONFIG_SYSTEM_COMPOSITE_NLUNS); - ret = usbmsc_configure(CONFIG_SYSTEM_COMPOSITE_NLUNS, &g_mschandle); + uinfo("Configuring with NLUNS=1\n"); + ret = usbmsc_configure(1, &g_mschandle); if (ret < 0) { uerr("ERROR: usbmsc_configure failed: %d\n", -ret); @@ -128,48 +124,17 @@ static int board_mscclassobject(int minor, /* Bind the LUN(s) */ - uinfo("Bind LUN=0 to %s\n", CONFIG_SYSTEM_COMPOSITE_DEVPATH1); - ret = usbmsc_bindlun(g_mschandle, CONFIG_SYSTEM_COMPOSITE_DEVPATH1, - 0, 0, 0, false); + uinfo("Bind LUN=0 to /dev/mmcsd0\n"); + ret = usbmsc_bindlun(g_mschandle, "/dev/mmcsd0", 0, 0, 0, false); if (ret < 0) { - uerr("ERROR: usbmsc_bindlun failed for LUN 1 using %s: %d\n", - CONFIG_SYSTEM_COMPOSITE_DEVPATH1, -ret); + uerr("ERROR: usbmsc_bindlun failed for LUN 1 at /dev/mmcsd0: %d\n", + ret); usbmsc_uninitialize(g_mschandle); g_mschandle = NULL; return ret; } -#if CONFIG_SYSTEM_COMPOSITE_NLUNS > 1 - - uinfo("Bind LUN=1 to %s\n", CONFIG_SYSTEM_COMPOSITE_DEVPATH2); - ret = usbmsc_bindlun(g_mschandle, CONFIG_SYSTEM_COMPOSITE_DEVPATH2, - 1, 0, 0, false); - if (ret < 0) - { - uerr("ERROR: usbmsc_bindlun failed for LUN 2 using %s: %d\n", - CONFIG_SYSTEM_COMPOSITE_DEVPATH2, -ret); - usbmsc_uninitialize(g_mschandle); - g_mschandle = NULL; - return ret; - } - -#if CONFIG_SYSTEM_COMPOSITE_NLUNS > 2 - - uinfo("Bind LUN=2 to %s\n", CONFIG_SYSTEM_COMPOSITE_DEVPATH3); - ret = usbmsc_bindlun(g_mschandle, CONFIG_SYSTEM_COMPOSITE_DEVPATH3, - 2, 0, 0, false); - if (ret < 0) - { - uerr("ERROR: usbmsc_bindlun failed for LUN 3 using %s: %d\n", - CONFIG_SYSTEM_COMPOSITE_DEVPATH3, -ret); - usbmsc_uninitialize(g_mschandle); - g_mschandle = NULL; - return ret; - } -#endif -#endif - /* Get the mass storage device's class object */ ret = usbmsc_classobject(g_mschandle, devdesc, classdev); @@ -256,8 +221,7 @@ int board_composite_initialize(int port) syslog(LOG_INFO, "Binding SPI port %d to MMC/SD slot %d\n", LPC214X_MMCSDSPIPORTNO, LPC214X_MMCSDSLOTNO); - ret = mmcsd_spislotinitialize(CONFIG_SYSTEM_COMPOSITE_DEVMINOR1, - LPC214X_MMCSDSLOTNO, spi); + ret = mmcsd_spislotinitialize(0, LPC214X_MMCSDSLOTNO, spi); if (ret < 0) { syslog(LOG_ERR, @@ -319,7 +283,7 @@ FAR void *board_composite0_connect(int port) /* Interfaces */ dev[0].devdesc.ifnobase = ifnobase; /* Offset to Interface-IDs */ - dev[0].minor = CONFIG_SYSTEM_COMPOSITE_TTYUSB; /* The minor interface number */ + dev[0].minor = 0; /* The minor interface number */ /* Strings */ @@ -352,7 +316,7 @@ FAR void *board_composite0_connect(int port) /* Interfaces */ dev[1].devdesc.ifnobase = ifnobase; /* Offset to Interface-IDs */ - dev[1].minor = CONFIG_SYSTEM_COMPOSITE_DEVMINOR1; /* The minor interface number */ + dev[1].minor = 0; /* The minor interface number */ /* Strings */ @@ -469,3 +433,4 @@ FAR void *board_composite_connect(int port, int configid) } } +#endif /* CONFIG_BOARDCTL_USBDEVCTRL && CONFIG_USBDEV_COMPOSITE */ diff --git a/configs/olimexino-stm32/src/stm32_appinit.c b/configs/olimexino-stm32/src/stm32_appinit.c index dcd7d24a301..b2a3d230011 100644 --- a/configs/olimexino-stm32/src/stm32_appinit.c +++ b/configs/olimexino-stm32/src/stm32_appinit.c @@ -99,11 +99,9 @@ int board_app_initialize(uintptr_t arg) #endif #endif -#ifdef CONFIG_USBDEV_COMPOSITE -#if !defined(CONFIG_NSH_BUILTIN_APPS) && !defined(CONFIG_SYSTEM_COMPOSITE) +#if !defined(CONFIG_NSH_BUILTIN_APPS) && defined(CONFIG_USBDEV_COMPOSITE) ret = board_composite_initialize(0); #endif -#endif #ifdef CONFIG_CAN /* Initialize CAN and register the CAN driver. */ diff --git a/configs/olimexino-stm32/src/stm32_composite.c b/configs/olimexino-stm32/src/stm32_composite.c index 29698c2adbb..eb29e9a0cd4 100644 --- a/configs/olimexino-stm32/src/stm32_composite.c +++ b/configs/olimexino-stm32/src/stm32_composite.c @@ -57,16 +57,16 @@ /* There is nothing to do here if SPI support is not selected. */ -#ifdef CONFIG_STM32_SPI +#if defined(CONFIG_BOARDCTL_USBDEVCTRL) && defined(CONFIG_USBDEV_COMPOSITE) /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ -/* Configuration ************************************************************/ +/* No SPI? Then no USB MSC device in composite */ -#ifndef CONFIG_SYSTEM_COMPOSITE_DEVMINOR1 -# define CONFIG_SYSTEM_COMPOSITE_DEVMINOR1 0 +#ifndef CONFIG_STM32_SPI +# undef CONFIG_USBMSC_COMPOSITE #endif /* SLOT number(s) could depend on the board configuration */ @@ -127,8 +127,8 @@ static int board_mscclassobject(int minor, /* Configure the mass storage device */ - uinfo("Configuring with NLUNS=%d\n", CONFIG_SYSTEM_COMPOSITE_NLUNS); - ret = usbmsc_configure(CONFIG_SYSTEM_COMPOSITE_NLUNS, &g_mschandle); + uinfo("Configuring with NLUNS=1\n"); + ret = usbmsc_configure(1, &g_mschandle); if (ret < 0) { uerr("ERROR: usbmsc_configure failed: %d\n", -ret); @@ -139,48 +139,17 @@ static int board_mscclassobject(int minor, /* Bind the LUN(s) */ - uinfo("Bind LUN=0 to %s\n", CONFIG_SYSTEM_COMPOSITE_DEVPATH1); - ret = usbmsc_bindlun(g_mschandle, CONFIG_SYSTEM_COMPOSITE_DEVPATH1, - 0, 0, 0, false); + uinfo("Bind LUN=0 to /dev/mmcsd0\n"); + ret = usbmsc_bindlun(g_mschandle, "/dev/mmcsd0", 0, 0, 0, false); if (ret < 0) { - uerr("ERROR: usbmsc_bindlun failed for LUN 1 using %s: %d\n", - CONFIG_SYSTEM_COMPOSITE_DEVPATH1, -ret); + uerr("ERROR: usbmsc_bindlun failed for LUN 1 at /dev/mmcsd0: %d\n", + ret); usbmsc_uninitialize(g_mschandle); g_mschandle = NULL; return ret; } -#if CONFIG_SYSTEM_COMPOSITE_NLUNS > 1 - - uinfo("Bind LUN=1 to %s\n", CONFIG_SYSTEM_COMPOSITE_DEVPATH2); - ret = usbmsc_bindlun(g_mschandle, CONFIG_SYSTEM_COMPOSITE_DEVPATH2, - 1, 0, 0, false); - if (ret < 0) - { - uerr("ERROR: usbmsc_bindlun failed for LUN 2 using %s: %d\n", - CONFIG_SYSTEM_COMPOSITE_DEVPATH2, -ret); - usbmsc_uninitialize(g_mschandle); - g_mschandle = NULL; - return ret; - } - -#if CONFIG_SYSTEM_COMPOSITE_NLUNS > 2 - - uinfo("Bind LUN=2 to %s\n", CONFIG_SYSTEM_COMPOSITE_DEVPATH3); - ret = usbmsc_bindlun(g_mschandle, CONFIG_SYSTEM_COMPOSITE_DEVPATH3, - 2, 0, 0, false); - if (ret < 0) - { - uerr("ERROR: usbmsc_bindlun failed for LUN 3 using %s: %d\n", - CONFIG_SYSTEM_COMPOSITE_DEVPATH3, -ret); - usbmsc_uninitialize(g_mschandle); - g_mschandle = NULL; - return ret; - } -#endif -#endif - /* Get the mass storage device's class object */ ret = usbmsc_classobject(g_mschandle, devdesc, classdev); @@ -261,17 +230,16 @@ int board_composite_initialize(int port) /* Now bind the SPI interface to the MMC/SD driver */ - syslog(LOG_INFO, "Bind SPI to the MMC/SD driver, minor=%d slot=%d\n", - CONFIG_SYSTEM_COMPOSITE_DEVMINOR1, OLIMEXINO_STM32_MMCSDSLOTNO); + syslog(LOG_INFO, "Bind SPI to the MMC/SD driver, minor=0 slot=%d\n", + OLIMEXINO_STM32_MMCSDSLOTNO); - ret = mmcsd_spislotinitialize(CONFIG_SYSTEM_COMPOSITE_DEVMINOR1, - OLIMEXINO_STM32_MMCSDSLOTNO, spi); + ret = mmcsd_spislotinitialize(0, OLIMEXINO_STM32_MMCSDSLOTNO, spi); if (ret != OK) { syslog(LOG_ERR, - "ERROR: Failed to bind SPI port %d to MMC/SD minor=%d slot=%d %d\n", - OLIMEXINO_STM32_MMCSDSPIPORTNO, CONFIG_SYSTEM_COMPOSITE_DEVMINOR1, - OLIMEXINO_STM32_MMCSDSLOTNO, ret); + "ERROR: Failed to bind SPI port %d to MMC/SD minor=0 slot=%d %d\n", + OLIMEXINO_STM32_MMCSDSPIPORTNO, OLIMEXINO_STM32_MMCSDSLOTNO, + ret); return ret; } @@ -325,7 +293,7 @@ FAR void *board_composite0_connect(int port) /* Interfaces */ dev[0].devdesc.ifnobase = ifnobase; /* Offset to Interface-IDs */ - dev[0].minor = CONFIG_SYSTEM_COMPOSITE_TTYUSB; /* The minor interface number */ + dev[0].minor = 0; /* The minor interface number */ /* Strings */ @@ -358,7 +326,7 @@ FAR void *board_composite0_connect(int port) /* Interfaces */ dev[1].devdesc.ifnobase = ifnobase; /* Offset to Interface-IDs */ - dev[1].minor = CONFIG_SYSTEM_COMPOSITE_DEVMINOR1; /* The minor interface number */ + dev[1].minor = 0; /* The minor interface number */ /* Strings */ @@ -475,4 +443,4 @@ FAR void *board_composite_connect(int port, int configid) } } -#endif /* CONFIG_STM32_SPI */ +#endif /* CONFIG_BOARDCTL_USBDEVCTRL && CONFIG_USBDEV_COMPOSITE */ diff --git a/configs/samv71-xult/src/sam_composite.c b/configs/samv71-xult/src/sam_composite.c index c3de2422138..9cab73e1965 100644 --- a/configs/samv71-xult/src/sam_composite.c +++ b/configs/samv71-xult/src/sam_composite.c @@ -95,8 +95,8 @@ static int board_mscclassobject(int minor, /* Configure the mass storage device */ - uinfo("Configuring with NLUNS=%d\n", CONFIG_SYSTEM_COMPOSITE_NLUNS); - ret = usbmsc_configure(CONFIG_SYSTEM_COMPOSITE_NLUNS, &g_mschandle); + uinfo("Configuring with NLUNS=1\n"); + ret = usbmsc_configure(1, &g_mschandle); if (ret < 0) { uerr("ERROR: usbmsc_configure failed: %d\n", -ret); @@ -107,48 +107,17 @@ static int board_mscclassobject(int minor, /* Bind the LUN(s) */ - uinfo("Bind LUN=0 to %s\n", CONFIG_SYSTEM_COMPOSITE_DEVPATH1); - ret = usbmsc_bindlun(g_mschandle, CONFIG_SYSTEM_COMPOSITE_DEVPATH1, - 0, 0, 0, false); + uinfo("Bind LUN=0 to /dev/mmcsd0\n"); + ret = usbmsc_bindlun(g_mschandle, "/dev/mmcsd0", 0, 0, 0, false); if (ret < 0) { - uerr("ERROR: usbmsc_bindlun failed for LUN 1 using %s: %d\n", - CONFIG_SYSTEM_COMPOSITE_DEVPATH1, -ret); + uerr("ERROR: usbmsc_bindlun failed for LUN 1 at /dev/mmcsd0: %d\n", + ret); usbmsc_uninitialize(g_mschandle); g_mschandle = NULL; return ret; } -#if CONFIG_SYSTEM_COMPOSITE_NLUNS > 1 - - uinfo("Bind LUN=1 to %s\n", CONFIG_SYSTEM_COMPOSITE_DEVPATH2); - ret = usbmsc_bindlun(g_mschandle, CONFIG_SYSTEM_COMPOSITE_DEVPATH2, - 1, 0, 0, false); - if (ret < 0) - { - uerr("ERROR: usbmsc_bindlun failed for LUN 2 using %s: %d\n", - CONFIG_SYSTEM_COMPOSITE_DEVPATH2, -ret); - usbmsc_uninitialize(g_mschandle); - g_mschandle = NULL; - return ret; - } - -#if CONFIG_SYSTEM_COMPOSITE_NLUNS > 2 - - uinfo("Bind LUN=2 to %s\n", CONFIG_SYSTEM_COMPOSITE_DEVPATH3); - ret = usbmsc_bindlun(g_mschandle, CONFIG_SYSTEM_COMPOSITE_DEVPATH3, - 2, 0, 0, false); - if (ret < 0) - { - uerr("ERROR: usbmsc_bindlun failed for LUN 3 using %s: %d\n", - CONFIG_SYSTEM_COMPOSITE_DEVPATH3, -ret); - usbmsc_uninitialize(g_mschandle); - g_mschandle = NULL; - return ret; - } -#endif -#endif - /* Get the mass storage device's class object */ ret = usbmsc_classobject(g_mschandle, devdesc, classdev); @@ -255,7 +224,7 @@ FAR void *board_composite_connect(int port, int configid) /* Interfaces */ dev[0].devdesc.ifnobase = ifnobase; /* Offset to Interface-IDs */ - dev[0].minor = CONFIG_SYSTEM_COMPOSITE_TTYUSB; /* The minor interface number */ + dev[0].minor = 0; /* The minor interface number */ /* Strings */ @@ -288,11 +257,11 @@ FAR void *board_composite_connect(int port, int configid) /* Interfaces */ dev[1].devdesc.ifnobase = ifnobase; /* Offset to Interface-IDs */ - dev[1].minor = CONFIG_SYSTEM_COMPOSITE_DEVMINOR1; /* The minor interface number */ + dev[1].minor = 0; /* The minor interface number */ /* Strings */ - dev[1].devdesc.strbase = strbase; /* Offset to String Numbers */ + dev[1].devdesc.strbase = strbase; /* Offset to String Numbers */ /* Endpoints */ diff --git a/configs/shenzhou/src/Makefile b/configs/shenzhou/src/Makefile index beecc845826..9c1705874a2 100644 --- a/configs/shenzhou/src/Makefile +++ b/configs/shenzhou/src/Makefile @@ -68,10 +68,6 @@ ifeq ($(CONFIG_USBMSC),y) CSRCS += stm32_usbmsc.c endif -ifeq ($(CONFIG_USBDEV_COMPOSITE),y) -CSRCS += stm32_composite.c -endif - ifeq ($(CONFIG_CAN),y) CSRCS += stm32_can.c endif diff --git a/configs/shenzhou/src/stm32_composite.c b/configs/shenzhou/src/stm32_composite.c deleted file mode 100644 index 4b6c6250a01..00000000000 --- a/configs/shenzhou/src/stm32_composite.c +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** - * configs/shenzhou/src/stm32_composite.c - * - * Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Configure and register the STM32 SPI-based MMC/SD block driver. - * - * 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 - -#include - -#include "shenzhou.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* Device minor number */ - -#ifndef CONFIG_SYSTEM_COMPOSITE_DEVMINOR1 -# define CONFIG_SYSTEM_COMPOSITE_DEVMINOR1 0 -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_composite_initialize - * - * Description: - * Perform architecture specific initialization of a composite USB device. - * - ****************************************************************************/ - -int board_composite_initialize(int port) -{ - /* If system/composite is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() (see - * stm32_appinit.c). In this case, there is nothing further to be done here. - * - * NOTE: CONFIG_NSH_BUILTIN_APPS is not a fool-proof indication that NSH - * was built. - */ - -#ifndef CONFIG_NSH_BUILTIN_APPS - return sd_mount(CONFIG_SYSTEM_COMPOSITE_DEVMINOR1); -#else - return OK; -#endif /* CONFIG_NSH_BUILTIN_APPS */ -} diff --git a/configs/spark/composite/defconfig b/configs/spark/composite/defconfig index 9b3ae296250..7f0ed8f05ca 100644 --- a/configs/spark/composite/defconfig +++ b/configs/spark/composite/defconfig @@ -98,8 +98,6 @@ CONFIG_STM32_SPI_DMA=y CONFIG_STM32_USART2=y CONFIG_STM32_USB=y CONFIG_SYMTAB_ORDEREDBYNAME=y -CONFIG_SYSTEM_COMPOSITE_DEVPATH1="/dev/mtdblock0" -CONFIG_SYSTEM_COMPOSITE_DEVPATH2="/dev/mtdblock1" CONFIG_SYSTEM_COMPOSITE=y CONFIG_TASK_NAME_SIZE=7 CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=768 diff --git a/configs/spark/src/stm32_composite.c b/configs/spark/src/stm32_composite.c index 3bc3653356c..7f9bb495247 100644 --- a/configs/spark/src/stm32_composite.c +++ b/configs/spark/src/stm32_composite.c @@ -70,6 +70,8 @@ #include "stm32.h" #include "spark.h" +#if defined(CONFIG_BOARDCTL_USBDEVCTRL) && defined(CONFIG_USBDEV_COMPOSITE) + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -326,8 +328,8 @@ static int board_mscclassobject(int minor, /* Configure the mass storage device */ - uinfo("Configuring with NLUNS=%d\n", CONFIG_SYSTEM_COMPOSITE_NLUNS); - ret = usbmsc_configure(CONFIG_SYSTEM_COMPOSITE_NLUNS, &g_mschandle); + uinfo("Configuring with NLUNS=1\n"); + ret = usbmsc_configure(1, &g_mschandle); if (ret < 0) { uerr("ERROR: usbmsc_configure failed: %d\n", -ret); @@ -338,48 +340,17 @@ static int board_mscclassobject(int minor, /* Bind the LUN(s) */ - uinfo("Bind LUN=0 to %s\n", CONFIG_SYSTEM_COMPOSITE_DEVPATH1); - ret = usbmsc_bindlun(g_mschandle, CONFIG_SYSTEM_COMPOSITE_DEVPATH1, - 0, 0, 0, false); + uinfo("Bind LUN=0 to /dev/mtdblock0\n"); + ret = usbmsc_bindlun(g_mschandle, "/dev/mtdblock0", 0, 0, 0, false); if (ret < 0) { - uerr("ERROR: usbmsc_bindlun failed for LUN 1 using %s: %d\n", - CONFIG_SYSTEM_COMPOSITE_DEVPATH1, -ret); + uerr("ERROR: usbmsc_bindlun failed for LUN 1 at /dev/mtdblock0: %d\n", + ret); usbmsc_uninitialize(g_mschandle); g_mschandle = NULL; return ret; } -#if CONFIG_SYSTEM_COMPOSITE_NLUNS > 1 - - uinfo("Bind LUN=1 to %s\n", CONFIG_SYSTEM_COMPOSITE_DEVPATH2); - ret = usbmsc_bindlun(g_mschandle, CONFIG_SYSTEM_COMPOSITE_DEVPATH2, - 1, 0, 0, false); - if (ret < 0) - { - uerr("ERROR: usbmsc_bindlun failed for LUN 2 using %s: %d\n", - CONFIG_SYSTEM_COMPOSITE_DEVPATH2, -ret); - usbmsc_uninitialize(g_mschandle); - g_mschandle = NULL; - return ret; - } - -#if CONFIG_SYSTEM_COMPOSITE_NLUNS > 2 - - uinfo("Bind LUN=2 to %s\n", CONFIG_SYSTEM_COMPOSITE_DEVPATH3); - ret = usbmsc_bindlun(g_mschandle, CONFIG_SYSTEM_COMPOSITE_DEVPATH3, - 2, 0, 0, false); - if (ret < 0) - { - uerr("ERROR: usbmsc_bindlun failed for LUN 3 using %s: %d\n", - CONFIG_SYSTEM_COMPOSITE_DEVPATH3, -ret); - usbmsc_uninitialize(g_mschandle); - g_mschandle = NULL; - return ret; - } -#endif -#endif - /* Get the mass storage device's class object */ ret = usbmsc_classobject(g_mschandle, devdesc, classdev); @@ -483,7 +454,7 @@ FAR void *board_composite0_connect(int port) /* Interfaces */ dev[0].devdesc.ifnobase = ifnobase; /* Offset to Interface-IDs */ - dev[0].minor = CONFIG_SYSTEM_COMPOSITE_TTYUSB; /* The minor interface number */ + dev[0].minor = 0; /* The minor interface number */ /* Strings */ @@ -516,11 +487,11 @@ FAR void *board_composite0_connect(int port) /* Interfaces */ dev[1].devdesc.ifnobase = ifnobase; /* Offset to Interface-IDs */ - dev[1].minor = CONFIG_SYSTEM_COMPOSITE_DEVMINOR1; /* The minor interface number */ + dev[1].minor = 0; /* The minor interface number */ /* Strings */ - dev[1].devdesc.strbase = strbase; /* Offset to String Numbers */ + dev[1].devdesc.strbase = strbase; /* Offset to String Numbers */ /* Endpoints */ @@ -632,3 +603,5 @@ FAR void *board_composite_connect(int port, int configid) return NULL; } } + +#endif /* CONFIG_BOARDCTL_USBDEVCTRL && CONFIG_USBDEV_COMPOSITE */ diff --git a/configs/stm3210e-eval/src/stm32_composite.c b/configs/stm3210e-eval/src/stm32_composite.c index 6156486d8a4..be2a672188b 100644 --- a/configs/stm3210e-eval/src/stm32_composite.c +++ b/configs/stm3210e-eval/src/stm32_composite.c @@ -55,18 +55,16 @@ #include "stm32.h" -/* There is nothing to do here if SDIO support is not selected. */ - -#if defined(CONFIG_STM32_SDIO) && defined(CONFIG_USBDEV_COMPOSITE) +#if defined(CONFIG_BOARDCTL_USBDEVCTRL) && defined(CONFIG_USBDEV_COMPOSITE) /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ -/* Configuration ************************************************************/ +/* No SDIO? Then no USB MSC device in composite */ -#ifndef CONFIG_SYSTEM_COMPOSITE_DEVMINOR1 -# define CONFIG_SYSTEM_COMPOSITE_DEVMINOR1 0 +#ifndef CONFIG_STM32_SDIO +# undef CONFIG_USBMSC_COMPOSITE #endif /* SLOT number(s) could depend on the board configuration */ @@ -125,8 +123,8 @@ static int board_mscclassobject(int minor, /* Configure the mass storage device */ - uinfo("Configuring with NLUNS=%d\n", CONFIG_SYSTEM_COMPOSITE_NLUNS); - ret = usbmsc_configure(CONFIG_SYSTEM_COMPOSITE_NLUNS, &g_mschandle); + uinfo("Configuring with NLUNS=1\n"); + ret = usbmsc_configure(1, &g_mschandle); if (ret < 0) { uerr("ERROR: usbmsc_configure failed: %d\n", -ret); @@ -137,48 +135,17 @@ static int board_mscclassobject(int minor, /* Bind the LUN(s) */ - uinfo("Bind LUN=0 to %s\n", CONFIG_SYSTEM_COMPOSITE_DEVPATH1); - ret = usbmsc_bindlun(g_mschandle, CONFIG_SYSTEM_COMPOSITE_DEVPATH1, - 0, 0, 0, false); + uinfo("Bind LUN=0 to /dev/mmcsd0\n"); + ret = usbmsc_bindlun(g_mschandle, "/dev/mmcsd0", 0, 0, 0, false); if (ret < 0) { - uerr("ERROR: usbmsc_bindlun failed for LUN 1 using %s: %d\n", - CONFIG_SYSTEM_COMPOSITE_DEVPATH1, -ret); + uerr("ERROR: usbmsc_bindlun failed for LUN 1 at /dev/mmcsd0: %d\n", + ret); usbmsc_uninitialize(g_mschandle); g_mschandle = NULL; return ret; } -#if CONFIG_SYSTEM_COMPOSITE_NLUNS > 1 - - uinfo("Bind LUN=1 to %s\n", CONFIG_SYSTEM_COMPOSITE_DEVPATH2); - ret = usbmsc_bindlun(g_mschandle, CONFIG_SYSTEM_COMPOSITE_DEVPATH2, - 1, 0, 0, false); - if (ret < 0) - { - uerr("ERROR: usbmsc_bindlun failed for LUN 2 using %s: %d\n", - CONFIG_SYSTEM_COMPOSITE_DEVPATH2, -ret); - usbmsc_uninitialize(g_mschandle); - g_mschandle = NULL; - return ret; - } - -#if CONFIG_SYSTEM_COMPOSITE_NLUNS > 2 - - uinfo("Bind LUN=2 to %s\n", CONFIG_SYSTEM_COMPOSITE_DEVPATH3); - ret = usbmsc_bindlun(g_mschandle, CONFIG_SYSTEM_COMPOSITE_DEVPATH3, - 2, 0, 0, false); - if (ret < 0) - { - uerr("ERROR: usbmsc_bindlun failed for LUN 3 using %s: %d\n", - CONFIG_SYSTEM_COMPOSITE_DEVPATH3, -ret); - usbmsc_uninitialize(g_mschandle); - g_mschandle = NULL; - return ret; - } -#endif -#endif - /* Get the mass storage device's class object */ ret = usbmsc_classobject(g_mschandle, devdesc, classdev); @@ -259,10 +226,9 @@ int board_composite_initialize(int port) /* Now bind the SDIO interface to the MMC/SD driver */ - syslog(LOG_INFO, "Bind SDIO to the MMC/SD driver, minor=%d\n", - CONFIG_SYSTEM_COMPOSITE_DEVMINOR1); + syslog(LOG_INFO, "Bind SDIO to the MMC/SD driver, minor=0\n"); - ret = mmcsd_slotinitialize(CONFIG_SYSTEM_COMPOSITE_DEVMINOR1, sdio); + ret = mmcsd_slotinitialize(0, sdio); if (ret != OK) { syslog(LOG_ERR, @@ -330,7 +296,7 @@ FAR void *board_composite0_connect(int port) /* Interfaces */ dev[0].devdesc.ifnobase = ifnobase; /* Offset to Interface-IDs */ - dev[0].minor = CONFIG_SYSTEM_COMPOSITE_TTYUSB; /* The minor interface number */ + dev[0].minor = 0; /* The minor interface number */ /* Strings */ @@ -363,7 +329,7 @@ FAR void *board_composite0_connect(int port) /* Interfaces */ dev[1].devdesc.ifnobase = ifnobase; /* Offset to Interface-IDs */ - dev[1].minor = CONFIG_SYSTEM_COMPOSITE_DEVMINOR1; /* The minor interface number */ + dev[1].minor = 0; /* The minor interface number */ /* Strings */ @@ -480,4 +446,4 @@ FAR void *board_composite_connect(int port, int configid) } } -#endif /* CONFIG_STM32_SDIO && CONFIG_USBDEV_COMPOSITE */ +#endif /* CONFIG_BOARDCTL_USBDEVCTRL && CONFIG_USBDEV_COMPOSITE */