Correct error in end-of-request handling

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1082 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2008-10-27 16:39:15 +00:00
parent 84acbd6ae7
commit 9da0debd81
2 changed files with 17 additions and 17 deletions

View File

@ -886,7 +886,7 @@ static void dm320_reqcomplete(struct dm320_ep_s *privep, sint16 result)
int stalled = privep->stalled; int stalled = privep->stalled;
irqstate_t flags; irqstate_t flags;
/* Remove the complete request at the head of the endpoint request list */ /* Remove the completed request at the head of the endpoint request list */
flags = irqsave(); flags = irqsave();
privreq = dm320_rqdequeue(privep); privreq = dm320_rqdequeue(privep);
@ -1003,7 +1003,7 @@ static int dm320_wrrequest(struct dm320_ep_s *privep)
* then we are finished with the transfer * then we are finished with the transfer
*/ */
if (bytesleft <= 0 && !privep->txnullpkt) if (privreq->req.xfrd >= privreq->req.len && !privep->txnullpkt)
{ {
usbtrace(TRACE_COMPLETE(privep->epphy), privreq->req.xfrd); usbtrace(TRACE_COMPLETE(privep->epphy), privreq->req.xfrd);
privep->txnullpkt = 0; privep->txnullpkt = 0;
@ -1214,7 +1214,7 @@ static inline void dm320_ep0setup(struct dm320_usbdev_s *priv)
value = GETUINT16(ctrl.value); value = GETUINT16(ctrl.value);
len = GETUINT16(ctrl.len); len = GETUINT16(ctrl.len);
uvdbg("type=%02x req=%02x value=%04x index=%04x len=%04x\n", ullvdbg("type=%02x req=%02x value=%04x index=%04x len=%04x\n",
ctrl.type, ctrl.req, value, index, len); ctrl.type, ctrl.req, value, index, len);
/* Dispatch any non-standard requests */ /* Dispatch any non-standard requests */
@ -1575,7 +1575,7 @@ static int dm320_ctlrinterrupt(int irq, FAR void *context)
} }
else else
{ {
uvdbg("Pending data on OUT endpoint\n"); ullvdbg("Pending data on OUT endpoint\n");
priv->rxpending = 1; priv->rxpending = 1;
} }
} }
@ -2357,7 +2357,7 @@ void up_usbinitialize(void)
#ifdef CONFIG_DEBUG_USB #ifdef CONFIG_DEBUG_USB
chiprev = dm320_getreg16(DM320_BUSC_REVR); chiprev = dm320_getreg16(DM320_BUSC_REVR);
udbg("DM320 revision : %d.%d\n", chiprev >> 4, chiprev & 0x0f); ulldbg("DM320 revision : %d.%d\n", chiprev >> 4, chiprev & 0x0f);
#endif #endif
/* Enable USB clock & GIO clock */ /* Enable USB clock & GIO clock */

View File

@ -958,7 +958,7 @@ static void lpc214x_reqcomplete(struct lpc214x_ep_s *privep, sint16 result)
int stalled = privep->stalled; int stalled = privep->stalled;
irqstate_t flags; irqstate_t flags;
/* Remove the complete request at the head of the endpoint request list */ /* Remove the completed request at the head of the endpoint request list */
flags = irqsave(); flags = irqsave();
privreq = lpc214x_rqdequeue(privep); privreq = lpc214x_rqdequeue(privep);
@ -1014,8 +1014,8 @@ static int lpc214x_wrrequest(struct lpc214x_ep_s *privep)
return OK; return OK;
} }
uvdbg("len=%d xfrd=%d nullpkt=%d\n", ullvdbg("epphy=%d req=%p: len=%d xfrd=%d nullpkt=%d\n",
privreq->req.len, privreq->req.xfrd, privep->txnullpkt); privep->epphy, privreq, privreq->req.len, privreq->req.xfrd, privep->txnullpkt);
/* Ignore any attempt to send a zero length packet on anything but EP0IN */ /* Ignore any attempt to send a zero length packet on anything but EP0IN */
@ -1090,7 +1090,7 @@ static int lpc214x_wrrequest(struct lpc214x_ep_s *privep)
* then we are finished with the transfer * then we are finished with the transfer
*/ */
if (bytesleft <= 0 && !privep->txnullpkt) if (privreq->req.xfrd >= privreq->req.len && !privep->txnullpkt)
{ {
usbtrace(TRACE_COMPLETE(privep->epphy), privreq->req.xfrd); usbtrace(TRACE_COMPLETE(privep->epphy), privreq->req.xfrd);
privep->txnullpkt = 0; privep->txnullpkt = 0;
@ -1123,7 +1123,7 @@ static int lpc214x_rdrequest(struct lpc214x_ep_s *privep)
return OK; return OK;
} }
uvdbg("len=%d xfrd=%d nullpkt=%d\n", ullvdbg("len=%d xfrd=%d nullpkt=%d\n",
privreq->req.len, privreq->req.xfrd, privep->txnullpkt); privreq->req.len, privreq->req.xfrd, privep->txnullpkt);
/* Ignore any attempt to receive a zero length packet */ /* Ignore any attempt to receive a zero length packet */
@ -1526,7 +1526,7 @@ static inline void lpc214x_ep0setup(struct lpc214x_usbdev_s *priv)
index = GETUINT16(ctrl.index); index = GETUINT16(ctrl.index);
len = GETUINT16(ctrl.len); len = GETUINT16(ctrl.len);
uvdbg("type=%02x req=%02x value=%04x index=%04x len=%04x\n", ullvdbg("type=%02x req=%02x value=%04x index=%04x len=%04x\n",
ctrl.type, ctrl.req, value, index, len); ctrl.type, ctrl.req, value, index, len);
/* Dispatch any non-standard requests */ /* Dispatch any non-standard requests */
@ -1671,7 +1671,7 @@ static inline void lpc214x_ep0setup(struct lpc214x_usbdev_s *priv)
if (((ctrl.type & USB_REQ_RECIPIENT_MASK) == USB_REQ_RECIPIENT_DEVICE) && if (((ctrl.type & USB_REQ_RECIPIENT_MASK) == USB_REQ_RECIPIENT_DEVICE) &&
value == USB_FEATURE_TESTMODE) value == USB_FEATURE_TESTMODE)
{ {
uvdbg("test mode: %d\n", index); ullvdbg("test mode: %d\n", index);
} }
else if ((ctrl.type & USB_REQ_RECIPIENT_MASK) != USB_REQ_RECIPIENT_ENDPOINT) else if ((ctrl.type & USB_REQ_RECIPIENT_MASK) != USB_REQ_RECIPIENT_ENDPOINT)
{ {
@ -2240,7 +2240,7 @@ static int lpc214x_usbinterrupt(int irq, FAR void *context)
} }
else else
{ {
uvdbg("Pending data on OUT endpoint\n"); ullvdbg("Pending data on OUT endpoint\n");
priv->rxpending = 1; priv->rxpending = 1;
} }
} }
@ -2687,7 +2687,7 @@ static int lpc214x_epsubmit(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s
if (!req || !req->callback || !req->buf || !ep) if (!req || !req->callback || !req->buf || !ep)
{ {
usbtrace(TRACE_DEVERROR(LPC214X_TRACEERR_INVALIDPARMS), 0); usbtrace(TRACE_DEVERROR(LPC214X_TRACEERR_INVALIDPARMS), 0);
uvdbg("req=%p callback=%p buf=%p ep=%p\n", req, req->callback, req->buf, ep); ullvdbg("req=%p callback=%p buf=%p ep=%p\n", req, req->callback, req->buf, ep);
return -EINVAL; return -EINVAL;
} }
#endif #endif