git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3175 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2010-12-14 19:02:49 +00:00
parent ce984b707a
commit 108f6c2bad
2 changed files with 26 additions and 12 deletions

View File

@ -54,12 +54,17 @@ static struct usbhost_class_s *usbhost_create(struct usbhost_driver_s *drvr);
struct usbhost_registry_s g_storage =
{
NULL, /* flink */
usbhost_create, /* create */
NULL, /* flink */
usbhost_create, /* create */
1, /* nids */
{
USB_CLASS_MASS_STORAGE, /* id.class */
0, /* id.vid */
0 /* id.pid */
{
USB_CLASS_MASS_STORAGE, /* id[0].base */
SUBSTRG_SUBCLASS_SCSI, /* id[0].subclass */
USBSTRG_PROTO_BULKONLY, /* id[0].proto */
0, /* id[0].vid */
0 /* id[0].pid */
}
}
};
@ -82,6 +87,8 @@ struct usbhost_registry_s g_storage =
* drvr - An instance of struct usbhost_driver_s that the class
* implementation will "bind" to its state structure and will
* subsequently use to communicate with the USB host driver.
* id - In the case where the device supports multiple base classes,
* subclasses, or protocols, this specifies which to configure for.
*
* Returned Values:
* On success, this function will return a non-NULL instance of struct
@ -92,7 +99,8 @@ struct usbhost_registry_s g_storage =
*
****************************************************************************/
static struct usbhost_class_s *usbhost_create(struct usbhost_driver_s *drvr)
static struct usbhost_class_s *usbhost_create(struct usbhost_driver_s *drvr,
const struct usbhost_id_s *id)
{
#warning "Not implemented"
return NULL;

View File

@ -71,6 +71,8 @@
* drvr - An instance of struct usbhost_driver_s that the class implementation will
* "bind" to its state structure and will subsequently use to communicate with
* the USB host driver.
* id - In the case where the device supports multiple base classes, subclasses, or
* protocols, this specifies which to configure for.
*
* Returned Values:
* On success, this function will return a non-NULL instance of struct
@ -81,7 +83,7 @@
*
************************************************************************************/
#definei CLASS_CREATE(reg, drvr) (reg->create(drvr))
#definei CLASS_CREATE(reg, drvr, id) (reg->create(drvr))
/************************************************************************************
* Public Types
@ -93,9 +95,11 @@
struct usbhost_id_s
{
uint8_t class; /* Device class code (see USB_CLASS_* defines in usb.h) */
uint16_t vid; /* Vendor ID (for vendor/product specific devices) */
uint16_t pid; /* Product ID (for vendor/product specific devices) */
uint8_t base; /* Base device class code (see USB_CLASS_* defines in usb.h) */
uint8_t subclass; /* Sub-class, depends on base class. Eg., See USBSTRG_SUBCLASS_* */
uint8_t proto; /* Protocol, depends on base class. Eg., See USBSTRG_PROTO_* */
uint16_t vid; /* Vendor ID (for vendor/product specific devices) */
uint16_t pid; /* Product ID (for vendor/product specific devices) */
};
/* The struct usbhost_registry_s type describes information that is kept in the the
@ -122,13 +126,15 @@ struct usbhost_registry_s
* simultaneously connected (see the CLASS_CREATE() macro above).
*/
struct usbhost_class_s *(*create)(struct usbhost_driver_s *drvr);
struct usbhost_class_s *(*create)(struct usbhost_driver_s *drvr,
const struct usbhost_id_s *id)
/* This information uniquely identifies the USB host class implementation that
* goes with a specific USB device.
*/
struct usbhost_id_s id;
uint8_t nids; /* Number of IDs in the id[] array */
struct usbhost_id_s id[1]; /* Actual dimension is nids */
};
/************************************************************************************