From e45c64051366a3ca07d269452e02fa153831c251 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 27 Oct 2008 16:39:15 +0000 Subject: 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 --- nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'nuttx/arch/arm/src/lpc214x') diff --git a/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c b/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c index cb220cc1b..71c30596d 100644 --- a/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c +++ b/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c @@ -958,7 +958,7 @@ static void lpc214x_reqcomplete(struct lpc214x_ep_s *privep, sint16 result) int stalled = privep->stalled; 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(); privreq = lpc214x_rqdequeue(privep); @@ -1014,8 +1014,8 @@ static int lpc214x_wrrequest(struct lpc214x_ep_s *privep) return OK; } - uvdbg("len=%d xfrd=%d nullpkt=%d\n", - privreq->req.len, privreq->req.xfrd, privep->txnullpkt); + ullvdbg("epphy=%d req=%p: len=%d xfrd=%d nullpkt=%d\n", + privep->epphy, privreq, privreq->req.len, privreq->req.xfrd, privep->txnullpkt); /* 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 */ - if (bytesleft <= 0 && !privep->txnullpkt) + if (privreq->req.xfrd >= privreq->req.len && !privep->txnullpkt) { usbtrace(TRACE_COMPLETE(privep->epphy), privreq->req.xfrd); privep->txnullpkt = 0; @@ -1123,8 +1123,8 @@ static int lpc214x_rdrequest(struct lpc214x_ep_s *privep) return OK; } - uvdbg("len=%d xfrd=%d nullpkt=%d\n", - privreq->req.len, privreq->req.xfrd, privep->txnullpkt); + ullvdbg("len=%d xfrd=%d nullpkt=%d\n", + privreq->req.len, privreq->req.xfrd, privep->txnullpkt); /* Ignore any attempt to receive a zero length packet */ @@ -1526,8 +1526,8 @@ static inline void lpc214x_ep0setup(struct lpc214x_usbdev_s *priv) index = GETUINT16(ctrl.index); len = GETUINT16(ctrl.len); - uvdbg("type=%02x req=%02x value=%04x index=%04x len=%04x\n", - ctrl.type, ctrl.req, value, index, len); + ullvdbg("type=%02x req=%02x value=%04x index=%04x len=%04x\n", + ctrl.type, ctrl.req, value, index, len); /* 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) && 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) { @@ -2240,7 +2240,7 @@ static int lpc214x_usbinterrupt(int irq, FAR void *context) } else { - uvdbg("Pending data on OUT endpoint\n"); + ullvdbg("Pending data on OUT endpoint\n"); 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) { 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; } #endif -- cgit v1.2.3