summaryrefslogtreecommitdiff
path: root/nuttx/include/nuttx/usb/usbhost.h
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-12-15 18:39:19 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-12-15 18:39:19 +0000
commit0a2f7d9abbd176e77c58c316a8e7bb59f531188e (patch)
treefe311f8ca63483815c4bd0b8447072e00e40665b /nuttx/include/nuttx/usb/usbhost.h
parente53bd2a7d92bfb7b522462d00b01d46745bab9e0 (diff)
downloadnuttx-0a2f7d9abbd176e77c58c316a8e7bb59f531188e.tar.gz
nuttx-0a2f7d9abbd176e77c58c316a8e7bb59f531188e.tar.bz2
nuttx-0a2f7d9abbd176e77c58c316a8e7bb59f531188e.zip
Add disconnected method
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3182 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include/nuttx/usb/usbhost.h')
-rw-r--r--nuttx/include/nuttx/usb/usbhost.h41
1 files changed, 32 insertions, 9 deletions
diff --git a/nuttx/include/nuttx/usb/usbhost.h b/nuttx/include/nuttx/usb/usbhost.h
index aedd57f26..b4d51e258 100644
--- a/nuttx/include/nuttx/usb/usbhost.h
+++ b/nuttx/include/nuttx/usb/usbhost.h
@@ -83,7 +83,7 @@
*
************************************************************************************/
-#define CLASS_CREATE(reg, drvr, id) (reg->create(drvr))
+#define CLASS_CREATE(reg, drvr, id) ((reg)->create(drvr))
/************************************************************************************
* Name: CLASS_CONFIGDESC
@@ -105,7 +105,26 @@
*
************************************************************************************/
-#definei CLASS_CONFIGDESC(class, configdesc, desclen) (class->create(class, configdesc, desclen))
+#definei CLASS_CONFIGDESC(class, configdesc, desclen) ((class)->configdesc(class, configdesc, desclen))
+
+/************************************************************************************
+ * Name: CLASS_DISCONNECTED
+ *
+ * Description:
+ * This macro will call the disconnected() method of struct usbhost_class_s. This
+ * method is a callback into the class implementation. It is used to inform the
+ * class that the USB device has been disconnected.
+ *
+ * Input Parameters:
+ * class - The USB host class entry previously obtained from a call to create().
+ *
+ * Returned Values:
+ * On success, zero (OK) is returned. On a failure, a negated errno value is
+ * returned indicating the nature of the failure
+ *
+ ************************************************************************************/
+
+#definei CLASS_DISCONNECTED(class) ((class)->disconnected(class))
/************************************************************************************
* Public Types
@@ -139,7 +158,7 @@ struct usbhost_registry_s
* provide those instances in write-able memory (RAM).
*/
- struct usbhost_registry_s flink;
+ struct usbhost_registry_s flink;
/* This is a callback into the class implementation. It is used to (1) create
* a new instance of the USB host class state and to (2) bind a USB host driver
@@ -148,15 +167,15 @@ struct usbhost_registry_s
* simultaneously connected (see the CLASS_CREATE() macro above).
*/
- struct usbhost_class_s *(*create)(struct usbhost_driver_s *drvr,
- const struct usbhost_id_s *id)
+ FAR struct usbhost_class_s *(*create)(FAR struct usbhost_driver_s *drvr,
+ FAR const struct usbhost_id_s *id)
/* This information uniquely identifies the USB host class implementation that
* goes with a specific USB device.
*/
- uint8_t nids; /* Number of IDs in the id[] array */
- const struct usbhost_id_s *id; /* An array of ID info. Actual dimension is nids */
+ uint8_t nids; /* Number of IDs in the id[] array */
+ FAR const struct usbhost_id_s *id; /* An array of ID info. Actual dimension is nids */
};
/* struct usbhost_class_s provides access from the USB host driver to the USB host
@@ -165,12 +184,16 @@ struct usbhost_registry_s
struct usbhost_class_s
{
- /* Provides the configuration descripor to the class. The configuration
+ /* Provides the configuration descriptor to the class. The configuration
* descriptor contains critical information needed by the class in order to
* initialize properly (such as endpoint selections).
*/
- int (*configdesc)(struct usbhost_class_s *class, const uint8_t *confidesc, int desclen);
+ int (*configdesc)(FAR struct usbhost_class_s *class, FAR const uint8_t *confidesc, int desclen);
+
+ /* This method informs the class that the USB device has been disconnected. */
+
+ int (*disconnected)(FAR struct usbhost_class_s *class);
};
/* struct usbhost_driver_s provides access to the USB host driver from the USB host