If asynchronous tranfers are supported, then there must also be a mechanism to cancel the pending transfer

This commit is contained in:
Gregory Nutt
2015-04-24 11:23:52 -06:00
parent 2768f13153
commit 7d7ab442e1
4 changed files with 237 additions and 26 deletions
+28
View File
@@ -513,6 +513,28 @@
((drvr)->asynch(drvr,ep,buffer,buflen,callback,arg))
#endif
/************************************************************************************
* Name: DRVR_CANCEL
*
* Description:
* Cancel a pending asynchronous transfer on an endpoint.
*
* Input Parameters:
* drvr - The USB host driver instance obtained as a parameter from the call to
* the class create() method.
* ep - The IN or OUT endpoint descriptor for the device endpoint on which an
* asynchronous transfer should be transferred.
*
* Returned Values:
* On success, zero (OK) is returned. On a failure, a negated errno value is
* returned indicating the nature of the failure.
*
************************************************************************************/
#ifdef CONFIG_USBHOST_ASYNCH
# define DRVR_CANCEL(drvr,ep) ((drvr)->cancel(drvr,ep))
#endif
/************************************************************************************
* Name: DRVR_CONNECT
*
@@ -823,6 +845,12 @@ struct usbhost_driver_s
usbhost_asynch_t callback, FAR void *arg);
#endif
#ifdef CONFIG_USBHOST_ASYNCH
/* Cancel any pending asynchronous transfer on an endpoint */
int (*cancel)(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep);
#endif
#ifdef CONFIG_USBHOST_HUB
/* New connections may be detected by an attached hub. This method is the
* mechanism that is used by the hub class to introduce a new connection