Add last option to configure method

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1010 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2008-10-09 15:14:17 +00:00
parent 7e9f5e7b0c
commit d1c08b6853
2 changed files with 17 additions and 10 deletions

View File

@ -969,7 +969,7 @@ static int usbclass_setconfig(FAR struct usbser_dev_s *priv, ubyte config)
/* Configure the IN interrupt endpoint */
ret = EP_CONFIGURE(priv->epintin, &g_epintindesc);
ret = EP_CONFIGURE(priv->epintin, &g_epintindesc, FALSE);
if (ret < 0)
{
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_EPINTINCONFIGFAIL), 0);
@ -990,9 +990,9 @@ static int usbclass_setconfig(FAR struct usbser_dev_s *priv, ubyte config)
}
usbclass_mkepbulkdesc(&g_epbulkindesc, bulkmxpacket, &epdesc);
ret = EP_CONFIGURE(priv->epbulkin, &epdesc);
ret = EP_CONFIGURE(priv->epbulkin, &epdesc, FALSE);
#else
ret = EP_CONFIGURE(priv->epbulkin, &g_epbulkindesc);
ret = EP_CONFIGURE(priv->epbulkin, &g_epbulkindesc, FALSE);
#endif
if (ret < 0)
{
@ -1006,9 +1006,9 @@ static int usbclass_setconfig(FAR struct usbser_dev_s *priv, ubyte config)
#ifdef CONFIG_USBDEV_DUALSPEED
usbclass_mkepbulkdesc(&g_epbulkoutdesc, bulkmxpacket, &epdesc);
ret = EP_CONFIGURE(priv->epbulkout, &epdesc);
ret = EP_CONFIGURE(priv->epbulkout, &epdesc, TRUE);
#else
ret = EP_CONFIGURE(priv->epbulkout, &g_epbulkoutdesc);
ret = EP_CONFIGURE(priv->epbulkout, &g_epbulkoutdesc, TRUE);
#endif
if (ret < 0)
{

View File

@ -56,10 +56,15 @@
/* Endpoint helpers *****************************************************************/
/* Configure endpoint, making it usable. The class driver may deallocate or re-use
* the 'desc' structure after returning
* the 'desc' structure after returning:
*
* ep - the struct usbdev_ep_s instance obtained from allocep()
* desc - A struct usb_epdesc_s instance describing the endpoint
* last - TRUE if this this last endpoint to be configured. Some hardware needs
* to take special action when all of the endpoints have been configured.
*/
#define EP_CONFIGURE(ep,desc) (ep)->ops->configure(ep,desc)
#define EP_CONFIGURE(ep,desc,last) (ep)->ops->configure(ep,desc,last)
/* The endpoint will no longer be used */
@ -97,8 +102,9 @@
/* Allocate an endpoint:
*
* epphy - 7-bit physical endpoint number (without diretion bit). Zero means
* that any endpoint matching the other requirements will suffice.
* ep - 7-bit logical endpoint number (direction bit ignored). Zero means
* that any endpoint matching the other requirements will suffice. The
* assigned endpoint can be found in the eplog field.
* in - TRUE: IN (device-to-host) endpoint requested
* eptype - Endpoint type. One of {USB_EP_ATTR_XFER_ISOC, USB_EP_ATTR_XFER_BULK,
* USB_EP_ATTR_XFER_INT}
@ -197,7 +203,7 @@ struct usbdev_epops_s
{
/* Configure/enable and disable endpoint */
int (*configure)(FAR struct usbdev_ep_s *ep, FAR const struct usb_epdesc_s *desc);
int (*configure)(FAR struct usbdev_ep_s *ep, FAR const struct usb_epdesc_s *desc, boolean last);
int (*disable)(FAR struct usbdev_ep_s *ep);
/* Allocate and free I/O requests */
@ -227,6 +233,7 @@ struct usbdev_epops_s
struct usbdev_ep_s
{
const struct usbdev_epops_s *ops; /* Endpoint operations */
ubyte eplog; /* Logical endpoint address */
uint16 maxpacket; /* Maximum packet size for this endpoint */
void *private; /* For use by class driver */
};