Progress toward composite CDC/ACM+MSC USB device

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4332 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2012-01-25 19:27:20 +00:00
parent 215c3a896a
commit 5b9d73ed52
13 changed files with 1086 additions and 281 deletions
+44
View File
@@ -290,6 +290,50 @@ typedef FAR void (*cdcser_callback_t)(enum cdcser_event_e event);
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: board_cdcclassobject
*
* Description:
* If the CDC serial class driver is part of composite device, then
* board-specific logic must provide board_cdcclassobject(). In the simplest
* case, board_cdcclassobject() is simply a wrapper around cdcser_classobject()
* that provides the correct device minor number.
*
* Input Parameters:
* classdev - The location to return the CDC serial class' device
* instance.
*
* Returned Value:
* 0 on success; a negated errno on failure
*
****************************************************************************/
#if defined(CONFIG_USBDEV_COMPOSITE) && defined(CONFIG_CDCSER_COMPOSITE)
EXTERN int board_cdcclassobject(FAR struct usbdevclass_driver_s **classdev);
#endif
/****************************************************************************
* Name: cdcser_classobject
*
* Description:
* Register USB serial port (and USB serial console if so configured) and
* return the class object.
*
* Input Parameter:
* minor - Device minor number. E.g., minor 0 would correspond to
* /dev/ttyUSB0.
* classdev - The location to return the CDC serial class' device
* instance.
*
* Returned Value:
* A pointer to the allocated class object (NULL on failure).
*
****************************************************************************/
#if defined(CONFIG_USBDEV_COMPOSITE) && defined(CONFIG_CDCSER_COMPOSITE)
int cdcser_classobject(int minor, FAR struct usbdevclass_driver_s **classdev);
#endif
/****************************************************************************
* Name: cdcser_initialize
*
+49 -2
View File
@@ -167,11 +167,13 @@
/* Invoked on USB suspend. */
#define CLASS_SUSPEND(drvr,dev) (drvr)->ops->suspend ? (drvr)->ops->suspend(dev) : (void)
#define CLASS_SUSPEND(drvr,dev) \
do { if ((drvr)->ops->suspend) (drvr)->ops->suspend(dev); } while (0)
/* Invoked on USB resume */
#define CLASS_RESUME(drvr,dev) (drvr)->ops->resume ? (drvr)->ops->resume(dev) : (void)
#define CLASS_RESUME(drvr,dev) \
do { if ((drvr)->ops->resume) (drvr)->ops->resume(dev); } while (0)
/* Device speeds */
@@ -353,6 +355,33 @@ EXTERN int usbdev_unregister(FAR struct usbdevclass_driver_s *driver);
EXTERN int usbdev_serialinitialize(int minor);
/****************************************************************************
* Name: board_mscclassobject
*
* Description:
* If the mass storage class driver is part of composite device, then
* its instantiation and configuration is a multi-step, board-specific,
* process (See comments for usbstrg_configure below). In this case,
* board-specific logic must provide board_mscclassobject().
*
* board_mscclassobject() is called from the composite driver. It must
* encapsulate the instantiation and configuration of the mass storage
* class and the return the mass storage device's class driver instance
* to the composite dirver.
*
* Input Parameters:
* classdev - The location to return the mass storage class' device
* instance.
*
* Returned Value:
* 0 on success; a negated errno on failure
*
****************************************************************************/
#if defined(CONFIG_USBDEV_COMPOSITE) && defined(CONFIG_USBSTRG_COMPOSITE)
EXTERN int board_mscclassobject(FAR struct usbdevclass_driver_s **classdev);
#endif
/****************************************************************************
* Name: usbstrg_configure
*
@@ -434,6 +463,24 @@ EXTERN int usbstrg_unbindlun(FAR void *handle, unsigned int lunno);
EXTERN int usbstrg_exportluns(FAR void *handle);
/****************************************************************************
* Name: cdcser_classobject
*
* Description:
* .
*
* Input Parameters:
* handle - The handle returned by a previous call to usbstrg_configure().
*
* Returned Value:
* 0 on success; a negated errno on failure
*
****************************************************************************/
#if defined(CONFIG_USBDEV_COMPOSITE) && defined(CONFIG_USBSTRG_COMPOSITE)
EXTERN int usbstrg_classobject(FAR void *handle, FAR struct usbdevclass_driver_s **classdev);
#endif
/****************************************************************************
* Name: usbstrg_uninitialize
*
+19
View File
@@ -225,6 +225,25 @@
/* USB Storage driver class events ******************************************/
#define USBCOMPOSITE_TRACEERR_REQRESULT 0x0001
#define USBCOMPOSITE_TRACEERR_ALLOCCTRLREQ 0x0002
#define USBCOMPOSITE_TRACEERR_INVALIDARG 0x0003
#define USBCOMPOSITE_TRACEERR_EP0NOTBOUND 0x0004
#define COMPOSITE_TRACEERR_SETUPINVALIDARGS 0x0005
#define COMPOSITE_TRACEERR_EP0NOTBOUND2 0x0006
#define COMPOSITE_TRACEERR_GETUNKNOWNDESC 0x0007
#define COMPOSITE_TRACEERR_UNSUPPORTEDSTDREQ 0x0008
#define COMPOSITE_TRACEERR_EPRESPQ 0x0009
#define USBCOMPOSITE_TRACEERR_ALLOCDEVSTRUCT 0x000a
#define USBCOMPOSITE_TRACEERR_CLASSOBJECT 0x000b
#define USBCOMPOSITE_TRACEERR_DEVREGISTER 0x000c
#define USBCOMPOSITE_TRACEERR_INVALIDARG 0x000d
#define USBCOMPOSITE_TRACEERR_INVALIDARG 0x000f
#define USBCOMPOSITE_TRACEERR_INVALIDARG 0x0010
#define USBCOMPOSITE_TRACEERR_INVALIDARG 0x0011
/* USB Storage driver class events ******************************************/
/* State transitions */
#define USBSTRG_CLASSSTATE_IDLECMDPARSE 0x0001