forked from nuttx/nuttx-update
Composite: Private functions need to be marked static. Move static functions out of 'Public Functions' to 'Private Functions' where they belong. Disable composite configuration 1 in all STM32 F1 configurations.
This commit is contained in:
parent
cfaa4ece13
commit
74b916ff84
5 changed files with 251 additions and 239 deletions
|
@ -167,7 +167,7 @@ static int board_mscclassobject(int minor,
|
|||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBMSC_COMPOSITE
|
||||
void board_mscuninitialize(FAR struct usbdevclass_driver_s *classdev)
|
||||
static void board_mscuninitialize(FAR struct usbdevclass_driver_s *classdev)
|
||||
{
|
||||
DEBUGASSERT(g_mschandle != NULL);
|
||||
usbmsc_uninitialize(g_mschandle);
|
||||
|
@ -175,69 +175,6 @@ void board_mscuninitialize(FAR struct usbdevclass_driver_s *classdev)
|
|||
}
|
||||
#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 lpc2148_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
|
||||
FAR struct spi_dev_s *spi;
|
||||
int ret;
|
||||
|
||||
/* Get the SPI port */
|
||||
|
||||
syslog(LOG_INFO, "Initializing SPI port %d\n", LPC214X_MMCSDSPIPORTNO);
|
||||
|
||||
spi = lpc214x_spibus_initialize(LPC214X_MMCSDSPIPORTNO);
|
||||
if (!spi)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n",
|
||||
LPC214X_MMCSDSPIPORTNO);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
syslog(LOG_INFO, "Successfully initialized SPI port %d\n",
|
||||
LPC214X_MMCSDSPIPORTNO);
|
||||
|
||||
/* Bind the SPI port to the slot */
|
||||
|
||||
syslog(LOG_INFO, "Binding SPI port %d to MMC/SD slot %d\n",
|
||||
LPC214X_MMCSDSPIPORTNO, LPC214X_MMCSDSLOTNO);
|
||||
|
||||
ret = mmcsd_spislotinitialize(0, LPC214X_MMCSDSLOTNO, spi);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to bind SPI port %d to MMC/SD slot %d: %d\n",
|
||||
LPC214X_MMCSDSPIPORTNO, LPC214X_MMCSDSLOTNO, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
syslog(LOG_INFO, "Successfully bound SPI port %d to MMC/SD slot %d\n",
|
||||
LPC214X_MMCSDSPIPORTNO, LPC214X_MMCSDSLOTNO);
|
||||
|
||||
#endif /* CONFIG_NSH_BUILTIN_APPS */
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_composite0_connect
|
||||
*
|
||||
|
@ -255,7 +192,7 @@ int board_composite_initialize(int port)
|
|||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBMSC_COMPOSITE
|
||||
FAR void *board_composite0_connect(int port)
|
||||
static FAR void *board_composite0_connect(int port)
|
||||
{
|
||||
/* Here we are composing the configuration of the usb composite device.
|
||||
*
|
||||
|
@ -352,7 +289,7 @@ FAR void *board_composite0_connect(int port)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR void *board_composite1_connect(int port)
|
||||
static FAR void *board_composite1_connect(int port)
|
||||
{
|
||||
struct composite_devdesc_s dev[2];
|
||||
int strbase = COMPOSITE_NSTRIDS;
|
||||
|
@ -395,6 +332,69 @@ FAR void *board_composite1_connect(int port)
|
|||
return composite_initialize(2, dev);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* 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 lpc2148_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
|
||||
FAR struct spi_dev_s *spi;
|
||||
int ret;
|
||||
|
||||
/* Get the SPI port */
|
||||
|
||||
syslog(LOG_INFO, "Initializing SPI port %d\n", LPC214X_MMCSDSPIPORTNO);
|
||||
|
||||
spi = lpc214x_spibus_initialize(LPC214X_MMCSDSPIPORTNO);
|
||||
if (!spi)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n",
|
||||
LPC214X_MMCSDSPIPORTNO);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
syslog(LOG_INFO, "Successfully initialized SPI port %d\n",
|
||||
LPC214X_MMCSDSPIPORTNO);
|
||||
|
||||
/* Bind the SPI port to the slot */
|
||||
|
||||
syslog(LOG_INFO, "Binding SPI port %d to MMC/SD slot %d\n",
|
||||
LPC214X_MMCSDSPIPORTNO, LPC214X_MMCSDSLOTNO);
|
||||
|
||||
ret = mmcsd_spislotinitialize(0, LPC214X_MMCSDSLOTNO, spi);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to bind SPI port %d to MMC/SD slot %d: %d\n",
|
||||
LPC214X_MMCSDSPIPORTNO, LPC214X_MMCSDSLOTNO, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
syslog(LOG_INFO, "Successfully bound SPI port %d to MMC/SD slot %d\n",
|
||||
LPC214X_MMCSDSPIPORTNO, LPC214X_MMCSDSLOTNO);
|
||||
|
||||
#endif /* CONFIG_NSH_BUILTIN_APPS */
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_composite_connect
|
||||
*
|
||||
|
|
|
@ -182,7 +182,7 @@ static int board_mscclassobject(int minor,
|
|||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBMSC_COMPOSITE
|
||||
void board_mscuninitialize(FAR struct usbdevclass_driver_s *classdev)
|
||||
static void board_mscuninitialize(FAR struct usbdevclass_driver_s *classdev)
|
||||
{
|
||||
DEBUGASSERT(g_mschandle != NULL);
|
||||
usbmsc_uninitialize(g_mschandle);
|
||||
|
@ -190,64 +190,6 @@ void board_mscuninitialize(FAR struct usbdevclass_driver_s *classdev)
|
|||
}
|
||||
#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.
|
||||
*/
|
||||
|
||||
FAR struct spi_dev_s *spi;
|
||||
int ret;
|
||||
|
||||
/* First, get an instance of the SPI interface */
|
||||
|
||||
syslog(LOG_INFO, "Initializing SPI port %d\n",
|
||||
OLIMEXINO_STM32_MMCSDSPIPORTNO);
|
||||
|
||||
spi = stm32_spibus_initialize(OLIMEXINO_STM32_MMCSDSPIPORTNO);
|
||||
if (!spi)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n",
|
||||
OLIMEXINO_STM32_MMCSDSPIPORTNO);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
syslog(LOG_INFO, "Successfully initialized SPI port %d\n",
|
||||
OLIMEXINO_STM32_MMCSDSPIPORTNO);
|
||||
|
||||
/* Now bind the SPI interface to the MMC/SD driver */
|
||||
|
||||
syslog(LOG_INFO, "Bind SPI to the MMC/SD driver, minor=0 slot=%d\n",
|
||||
OLIMEXINO_STM32_MMCSDSLOTNO);
|
||||
|
||||
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=0 slot=%d %d\n",
|
||||
OLIMEXINO_STM32_MMCSDSPIPORTNO, OLIMEXINO_STM32_MMCSDSLOTNO,
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
syslog(LOG_INFO, "Successfully bound SPI to the MMC/SD driver\n");
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_composite0_connect
|
||||
*
|
||||
|
@ -265,7 +207,7 @@ int board_composite_initialize(int port)
|
|||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBMSC_COMPOSITE
|
||||
FAR void *board_composite0_connect(int port)
|
||||
static FAR void *board_composite0_connect(int port)
|
||||
{
|
||||
/* Here we are composing the configuration of the usb composite device.
|
||||
*
|
||||
|
@ -362,20 +304,21 @@ FAR void *board_composite0_connect(int port)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR void *board_composite1_connect(int port)
|
||||
static FAR void *board_composite1_connect(int port)
|
||||
{
|
||||
struct composite_devdesc_s dev[2];
|
||||
int strbase = COMPOSITE_NSTRIDS;
|
||||
int ifnobase = 0;
|
||||
int epno;
|
||||
int i;
|
||||
|
||||
/* REVISIT: This configuration currently fails. stm32_epallocpma() fails
|
||||
* allocate a buffer for the 6th endpoint. Currenlty it supports 7x64 byte
|
||||
* buffers, two required for EP0, leaving only buffers for 5 additional
|
||||
* endpoints.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
struct composite_devdesc_s dev[2];
|
||||
int strbase = COMPOSITE_NSTRIDS;
|
||||
int ifnobase = 0;
|
||||
int epno;
|
||||
int i;
|
||||
|
||||
for (i = 0, epno = 1; i < 2; i++)
|
||||
{
|
||||
/* Ask the cdcacm driver to fill in the constants we didn't know here */
|
||||
|
@ -409,6 +352,67 @@ FAR void *board_composite1_connect(int port)
|
|||
}
|
||||
|
||||
return composite_initialize(2, dev);
|
||||
#else
|
||||
return NULL;
|
||||
#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.
|
||||
*/
|
||||
|
||||
FAR struct spi_dev_s *spi;
|
||||
int ret;
|
||||
|
||||
/* First, get an instance of the SPI interface */
|
||||
|
||||
syslog(LOG_INFO, "Initializing SPI port %d\n",
|
||||
OLIMEXINO_STM32_MMCSDSPIPORTNO);
|
||||
|
||||
spi = stm32_spibus_initialize(OLIMEXINO_STM32_MMCSDSPIPORTNO);
|
||||
if (!spi)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n",
|
||||
OLIMEXINO_STM32_MMCSDSPIPORTNO);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
syslog(LOG_INFO, "Successfully initialized SPI port %d\n",
|
||||
OLIMEXINO_STM32_MMCSDSPIPORTNO);
|
||||
|
||||
/* Now bind the SPI interface to the MMC/SD driver */
|
||||
|
||||
syslog(LOG_INFO, "Bind SPI to the MMC/SD driver, minor=0 slot=%d\n",
|
||||
OLIMEXINO_STM32_MMCSDSLOTNO);
|
||||
|
||||
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=0 slot=%d %d\n",
|
||||
OLIMEXINO_STM32_MMCSDSPIPORTNO, OLIMEXINO_STM32_MMCSDSLOTNO,
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
syslog(LOG_INFO, "Successfully bound SPI to the MMC/SD driver\n");
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -150,7 +150,7 @@ static int board_mscclassobject(int minor,
|
|||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBMSC_COMPOSITE
|
||||
void board_mscuninitialize(FAR struct usbdevclass_driver_s *classdev)
|
||||
static void board_mscuninitialize(FAR struct usbdevclass_driver_s *classdev)
|
||||
{
|
||||
DEBUGASSERT(g_mschandle != NULL);
|
||||
usbmsc_uninitialize(g_mschandle);
|
||||
|
|
|
@ -384,7 +384,7 @@ static int board_mscclassobject(int minor,
|
|||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBMSC_COMPOSITE
|
||||
void board_mscuninitialize(FAR struct usbdevclass_driver_s *classdev)
|
||||
static void board_mscuninitialize(FAR struct usbdevclass_driver_s *classdev)
|
||||
{
|
||||
DEBUGASSERT(g_mschandle != NULL);
|
||||
usbmsc_uninitialize(g_mschandle);
|
||||
|
@ -392,27 +392,6 @@ void board_mscuninitialize(FAR struct usbdevclass_driver_s *classdev)
|
|||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_composite_initialize
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture specific initialization of a composite USB device.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_composite_initialize(int port)
|
||||
{
|
||||
#ifdef CONFIG_NSH_BUILTIN_APPS
|
||||
return OK;
|
||||
#else
|
||||
return stm32_composite_initialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_composite0_connect
|
||||
*
|
||||
|
@ -430,7 +409,7 @@ int board_composite_initialize(int port)
|
|||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBMSC_COMPOSITE
|
||||
FAR void *board_composite0_connect(int port)
|
||||
static FAR void *board_composite0_connect(int port)
|
||||
{
|
||||
/* Here we are composing the configuration of the usb composite device.
|
||||
*
|
||||
|
@ -527,20 +506,21 @@ FAR void *board_composite0_connect(int port)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR void *board_composite1_connect(int port)
|
||||
static FAR void *board_composite1_connect(int port)
|
||||
{
|
||||
struct composite_devdesc_s dev[2];
|
||||
int strbase = COMPOSITE_NSTRIDS;
|
||||
int ifnobase = 0;
|
||||
int epno;
|
||||
int i;
|
||||
|
||||
/* REVISIT: This configuration currently fails. stm32_epallocpma() fails
|
||||
* allocate a buffer for the 6th endpoint. Currenlty it supports 7x64 byte
|
||||
* buffers, two required for EP0, leaving only buffers for 5 additional
|
||||
* endpoints.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
struct composite_devdesc_s dev[2];
|
||||
int strbase = COMPOSITE_NSTRIDS;
|
||||
int ifnobase = 0;
|
||||
int epno;
|
||||
int i;
|
||||
|
||||
for (i = 0, epno = 1; i < 2; i++)
|
||||
{
|
||||
/* Ask the cdcacm driver to fill in the constants we didn't know here */
|
||||
|
@ -575,6 +555,30 @@ FAR void *board_composite1_connect(int port)
|
|||
|
||||
return composite_initialize(2, dev);
|
||||
}
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_composite_initialize
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture specific initialization of a composite USB device.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_composite_initialize(int port)
|
||||
{
|
||||
#ifdef CONFIG_NSH_BUILTIN_APPS
|
||||
return OK;
|
||||
#else
|
||||
return stm32_composite_initialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_composite_connect
|
||||
|
@ -594,7 +598,7 @@ FAR void *board_composite1_connect(int port)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR void *board_composite_connect(int port, int configid)
|
||||
static FAR void *board_composite_connect(int port, int configid)
|
||||
{
|
||||
if (configid == 0)
|
||||
{
|
||||
|
|
|
@ -178,7 +178,7 @@ static int board_mscclassobject(int minor,
|
|||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBMSC_COMPOSITE
|
||||
void board_mscuninitialize(FAR struct usbdevclass_driver_s *classdev)
|
||||
static void board_mscuninitialize(FAR struct usbdevclass_driver_s *classdev)
|
||||
{
|
||||
DEBUGASSERT(g_mschandle != NULL);
|
||||
usbmsc_uninitialize(g_mschandle);
|
||||
|
@ -186,71 +186,6 @@ void board_mscuninitialize(FAR struct usbdevclass_driver_s *classdev)
|
|||
}
|
||||
#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
|
||||
FAR struct sdio_dev_s *sdio;
|
||||
int ret;
|
||||
|
||||
/* First, get an instance of the SDIO interface */
|
||||
|
||||
syslog(LOG_INFO, "Initializing SDIO slot %d\n", STM32_MMCSDSLOTNO);
|
||||
|
||||
sdio = sdio_initialize(STM32_MMCSDSLOTNO);
|
||||
if (!sdio)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n",
|
||||
STM32_MMCSDSLOTNO);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Now bind the SDIO interface to the MMC/SD driver */
|
||||
|
||||
syslog(LOG_INFO, "Bind SDIO to the MMC/SD driver, minor=0\n");
|
||||
|
||||
ret = mmcsd_slotinitialize(0, sdio);
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
syslog(LOG_INFO, "Successfully bound SDIO to the MMC/SD driver\n");
|
||||
|
||||
/* Then let's guess and say that there is a card in the slot. I need to check to
|
||||
* see if the STM3210E-EVAL board supports a GPIO to detect if there is a card in
|
||||
* the slot.
|
||||
*/
|
||||
|
||||
sdio_mediachange(sdio, true);
|
||||
|
||||
#endif /* CONFIG_NSH_BUILTIN_APPS */
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_composite0_connect
|
||||
*
|
||||
|
@ -268,7 +203,7 @@ int board_composite_initialize(int port)
|
|||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBMSC_COMPOSITE
|
||||
FAR void *board_composite0_connect(int port)
|
||||
static FAR void *board_composite0_connect(int port)
|
||||
{
|
||||
/* Here we are composing the configuration of the usb composite device.
|
||||
*
|
||||
|
@ -365,20 +300,21 @@ FAR void *board_composite0_connect(int port)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR void *board_composite1_connect(int port)
|
||||
static FAR void *board_composite1_connect(int port)
|
||||
{
|
||||
struct composite_devdesc_s dev[2];
|
||||
int strbase = COMPOSITE_NSTRIDS;
|
||||
int ifnobase = 0;
|
||||
int epno;
|
||||
int i;
|
||||
|
||||
/* REVISIT: This configuration currently fails. stm32_epallocpma() fails
|
||||
* allocate a buffer for the 6th endpoint. Currenlty it supports 7x64 byte
|
||||
* buffers, two required for EP0, leaving only buffers for 5 additional
|
||||
* endpoints.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
struct composite_devdesc_s dev[2];
|
||||
int strbase = COMPOSITE_NSTRIDS;
|
||||
int ifnobase = 0;
|
||||
int epno;
|
||||
int i;
|
||||
|
||||
for (i = 0, epno = 1; i < 2; i++)
|
||||
{
|
||||
/* Ask the cdcacm driver to fill in the constants we didn't know here */
|
||||
|
@ -412,6 +348,74 @@ FAR void *board_composite1_connect(int port)
|
|||
}
|
||||
|
||||
return composite_initialize(2, dev);
|
||||
#else
|
||||
return NULL;
|
||||
#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
|
||||
FAR struct sdio_dev_s *sdio;
|
||||
int ret;
|
||||
|
||||
/* First, get an instance of the SDIO interface */
|
||||
|
||||
syslog(LOG_INFO, "Initializing SDIO slot %d\n", STM32_MMCSDSLOTNO);
|
||||
|
||||
sdio = sdio_initialize(STM32_MMCSDSLOTNO);
|
||||
if (!sdio)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n",
|
||||
STM32_MMCSDSLOTNO);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Now bind the SDIO interface to the MMC/SD driver */
|
||||
|
||||
syslog(LOG_INFO, "Bind SDIO to the MMC/SD driver, minor=0\n");
|
||||
|
||||
ret = mmcsd_slotinitialize(0, sdio);
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
syslog(LOG_INFO, "Successfully bound SDIO to the MMC/SD driver\n");
|
||||
|
||||
/* Then let's guess and say that there is a card in the slot. I need to check to
|
||||
* see if the STM3210E-EVAL board supports a GPIO to detect if there is a card in
|
||||
* the slot.
|
||||
*/
|
||||
|
||||
sdio_mediachange(sdio, true);
|
||||
|
||||
#endif /* CONFIG_NSH_BUILTIN_APPS */
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
Loading…
Reference in a new issue