diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-01-25 19:27:20 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-01-25 19:27:20 +0000 |
commit | 77b0da454b6e82c56311cb08d5a5e957326d077c (patch) | |
tree | d1683a543f98f232bab2f1d9a554138f3f35139f /nuttx/include | |
parent | 4acd60377103f9e793c8eb196c0dc19299b6729b (diff) | |
download | px4-nuttx-77b0da454b6e82c56311cb08d5a5e957326d077c.tar.gz px4-nuttx-77b0da454b6e82c56311cb08d5a5e957326d077c.tar.bz2 px4-nuttx-77b0da454b6e82c56311cb08d5a5e957326d077c.zip |
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
Diffstat (limited to 'nuttx/include')
-rw-r--r-- | nuttx/include/nuttx/usb/cdc_serial.h | 44 | ||||
-rw-r--r-- | nuttx/include/nuttx/usb/usbdev.h | 51 | ||||
-rw-r--r-- | nuttx/include/nuttx/usb/usbdev_trace.h | 19 |
3 files changed, 112 insertions, 2 deletions
diff --git a/nuttx/include/nuttx/usb/cdc_serial.h b/nuttx/include/nuttx/usb/cdc_serial.h index 8a975666a..33ad03bb7 100644 --- a/nuttx/include/nuttx/usb/cdc_serial.h +++ b/nuttx/include/nuttx/usb/cdc_serial.h @@ -291,6 +291,50 @@ typedef FAR void (*cdcser_callback_t)(enum cdcser_event_e event); ****************************************************************************/ /**************************************************************************** + * 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 * * Description: diff --git a/nuttx/include/nuttx/usb/usbdev.h b/nuttx/include/nuttx/usb/usbdev.h index bd9a66db8..8c4b3ff26 100644 --- a/nuttx/include/nuttx/usb/usbdev.h +++ b/nuttx/include/nuttx/usb/usbdev.h @@ -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 */ @@ -354,6 +356,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 * * Description: @@ -435,6 +464,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 * * Description: diff --git a/nuttx/include/nuttx/usb/usbdev_trace.h b/nuttx/include/nuttx/usb/usbdev_trace.h index 4ffd79057..ebf883132 100644 --- a/nuttx/include/nuttx/usb/usbdev_trace.h +++ b/nuttx/include/nuttx/usb/usbdev_trace.h @@ -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 |