Add a text for the new composite USB device

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4341 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2012-01-26 23:14:27 +00:00
parent 22a1b8dfe5
commit 23a8f1d218
18 changed files with 1886 additions and 21 deletions
+2 -2
View File
@@ -64,7 +64,7 @@
#include "cdcacm.h"
#ifdef CONFIG_USBMSC_COMPOSITE
# include <nuttx/composite.h>
# include <nuttx/usb/composite.h>
# include "composite.h"
#endif
@@ -2116,7 +2116,7 @@ int cdcacm_initialize(int minor)
*
****************************************************************************/
#ifndef CONFIG_CDCACM_COMPOSITE
#ifdef CONFIG_CDCACM_COMPOSITE
void cdcacm_uninitialize(FAR struct usbdevclass_driver_s *classdev)
{
FAR struct cdcacm_driver_s *drvr = (FAR struct cdcacm_driver_s *)classdev;
+11 -8
View File
@@ -108,7 +108,7 @@ static void composite_freereq(FAR struct usbdev_ep_s *ep,
/* USB class device ********************************************************/
static int composite_bind(FAR struct usbdevclass_driver_s *driver,
FAR struct usbdev_s *dev)
FAR struct usbdev_s *dev);
static void composite_unbind(FAR struct usbdevclass_driver_s *driver,
FAR struct usbdev_s *dev);
static int composite_setup(FAR struct usbdevclass_driver_s *driver,
@@ -319,7 +319,7 @@ static int composite_bind(FAR struct usbdevclass_driver_s *driver,
return OK;
errout:
composite_unbind(dev);
composite_unbind(driver, dev);
return ret;
}
@@ -821,7 +821,7 @@ FAR void *composite_initialize(void)
goto errout_with_alloc;
}
return (FAR void *)priv;
return (FAR void *)alloc;
errout_with_alloc:
kfree(alloc);
@@ -829,7 +829,7 @@ errout_with_alloc:
}
/****************************************************************************
* Name: usbmsc_uninitialize
* Name: composite_uninitialize
*
* Description:
* Un-initialize the USB composite driver. The handle is the USB composite
@@ -846,14 +846,16 @@ errout_with_alloc:
*
***************************************************************************/
void usbmsc_uninitialize(FAR void *handle)
void composite_uninitialize(FAR void *handle)
{
FAR struct composite_dev_s *priv = (FAR struct composite_dev_s *)handle;
FAR struct composite_alloc_s *alloc = (FAR struct composite_alloc_s *)handle;
FAR struct composite_dev_s *priv;
DEBUGASSERT(priv != NULL);
DEBUGASSERT(alloc != NULL);
/* Uninitialize each of the member classes */
priv = &alloc->dev;
if (priv->dev1)
{
DEV1_UNINITIALIZE(priv->dev1);
@@ -868,9 +870,10 @@ void usbmsc_uninitialize(FAR void *handle)
/* Then unregister and destroy the composite class */
usbdev_unregister(&priv->drvr.drvr);
usbdev_unregister(&alloc->drvr.drvr);
/* Free any resources used by the composite driver */
/* None */
/* Then free the composite driver state structure itself */
+2 -2
View File
@@ -162,7 +162,7 @@
#elif defined(CONFIG_CDCACM_COMPOSITE) && !defined(DEV1_IS_USBMSC)
# define DEV2_IS_USBMSC 1
# define DEV2_MKCFGDESC usbmsc_mkcfgdesc
# define DEV1_UNINITIALIZE board_mscuninitialize
# define DEV2_UNINITIALIZE board_mscuninitialize
# define DEV2_CLASSOBJECT board_mscclassobject
# define DEV2_NCONFIGS USBMSC_NCONFIGS
# define DEV2_CONFIGID USBMSC_CONFIGID
@@ -181,7 +181,7 @@
# warning "The first interface number should be zero"
#endif
#if (DEV1_FIRSTINTERFACE + DEV2_NINTERFACES) != DEV2_FIRSTINTERFACE
#if (DEV1_FIRSTINTERFACE + DEV1_NINTERFACES) != DEV2_FIRSTINTERFACE
# warning "Interface numbers are not contiguous"
#endif
+47 -1
View File
@@ -83,7 +83,7 @@
#include "usbmsc.h"
#ifdef CONFIG_USBMSC_COMPOSITE
# include <nuttx/composite.h>
# include <nuttx/usb/composite.h>
# include "composite.h"
#endif
@@ -139,6 +139,9 @@ static void usbmsc_disconnect(FAR struct usbdevclass_driver_s *driver,
/* Initialization/Uninitialization ******************************************/
static void usbmsc_lununinitialize(struct usbmsc_lun_s *lun);
#ifndef CONFIG_USBMSC_COMPOSITE
static int usbmsc_exportluns(FAR void *handle);
#endif
/****************************************************************************
* Private Data
@@ -1571,6 +1574,9 @@ int usbmsc_unbindlun(FAR void *handle, unsigned int lunno)
*
****************************************************************************/
#ifndef CONFIG_USBMSC_COMPOSITE
static
#endif
int usbmsc_exportluns(FAR void *handle)
{
FAR struct usbmsc_alloc_s *alloc = (FAR struct usbmsc_alloc_s *)handle;
@@ -1634,6 +1640,46 @@ errout_with_mutex:
return ret;
}
/****************************************************************************
* Name: usbmsc_classobject
*
* Description:
* Register USB mass storage device and return the class object.
*
* Input Parameters:
* classdev - The location to return the CDC serial class' device
* instance.
*
* Returned Value:
* 0 on success; a negated errno on failure
*
****************************************************************************/
#ifdef CONFIG_USBMSC_COMPOSITE
int usbmsc_classobject(FAR void *handle,
FAR struct usbdevclass_driver_s **classdev)
{
int ret;
DEBUGASSERT(handle && classdev);
/* Export the LUNs as with the "standalone" USB mass storage driver, but
* don't register the class instance with the USB device infrastructure.
*/
ret = usbmsc_exportluns(handle);
if (ret == OK)
{
/* On sucess, return an (typed) instance of the class instance */
*classdev = (FAR struct usbdevclass_driver_s *)
&((FAR struct usbmsc_alloc_s *)handle)->dev;
}
return ret;
}
#endif
/****************************************************************************
* Name: usbmsc_uninitialize
*