diff --git a/ChangeLog b/ChangeLog
index ad7b19395a..d56d12d02a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -516,5 +516,8 @@
larger then the endpoint's max packet (DM320 driver also fixed, untested)
* Added logic to the USB device interface: A bit is needed to force the driver to
to terminate an IN transfer with a short packet (zero-length if necessary).
+ * Fix an error in the NXP LPC214x USB device driver that was causing corruption of
+ the request queue (M320 driver also fixed, untested)
+
diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html
index b0c04ea922..cf95485381 100644
--- a/Documentation/NuttX.html
+++ b/Documentation/NuttX.html
@@ -8,7 +8,7 @@
NuttX RTOS
- Last Updated: October 25, 2008
+ Last Updated: October 27, 2008
|
@@ -1146,6 +1146,8 @@ nuttx-0.3.17 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
larger then the endpoint's max packet (DM320 driver also fixed, untested)
* Added logic to the USB device interface: A bit is needed to force the driver to
to terminate an IN transfer with a short packet (zero-length if necessary).
+ * Fix an error in the NXP LPC214x USB device driver that was causing corruption of
+ the request queue (M320 driver also fixed, untested)
pascal-0.1.3 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
diff --git a/arch/arm/src/dm320/dm320_usbdev.c b/arch/arm/src/dm320/dm320_usbdev.c
index 46cbb654ac..c585c3fe97 100644
--- a/arch/arm/src/dm320/dm320_usbdev.c
+++ b/arch/arm/src/dm320/dm320_usbdev.c
@@ -886,7 +886,7 @@ static void dm320_reqcomplete(struct dm320_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 = dm320_rqdequeue(privep);
@@ -1003,7 +1003,7 @@ static int dm320_wrrequest(struct dm320_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;
@@ -1214,8 +1214,8 @@ static inline void dm320_ep0setup(struct dm320_usbdev_s *priv)
value = GETUINT16(ctrl.value);
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 */
@@ -1575,7 +1575,7 @@ static int dm320_ctlrinterrupt(int irq, FAR void *context)
}
else
{
- uvdbg("Pending data on OUT endpoint\n");
+ ullvdbg("Pending data on OUT endpoint\n");
priv->rxpending = 1;
}
}
@@ -2357,7 +2357,7 @@ void up_usbinitialize(void)
#ifdef CONFIG_DEBUG_USB
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
/* Enable USB clock & GIO clock */
diff --git a/arch/arm/src/lpc214x/lpc214x_usbdev.c b/arch/arm/src/lpc214x/lpc214x_usbdev.c
index cb220cc1bb..71c30596d2 100644
--- a/arch/arm/src/lpc214x/lpc214x_usbdev.c
+++ b/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