summaryrefslogtreecommitdiffstats
path: root/nuttx/arch/arm/src/dm320
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2008-10-27 22:45:55 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2008-10-27 22:45:55 +0000
commitfdad240792e395b7df8309ea6cd7e4e476589979 (patch)
tree880ba85f514775519ed187246c10ae83ff44b6fe /nuttx/arch/arm/src/dm320
parent8c2ac2fa562f5fa1b16e89d230efc9de0d4c5f47 (diff)
Fix read failures when OUT req size > maxpacket
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@1086 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/arch/arm/src/dm320')
-rw-r--r--nuttx/arch/arm/src/dm320/dm320_usbdev.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/nuttx/arch/arm/src/dm320/dm320_usbdev.c b/nuttx/arch/arm/src/dm320/dm320_usbdev.c
index c585c3fe97..0076f0067b 100644
--- a/nuttx/arch/arm/src/dm320/dm320_usbdev.c
+++ b/nuttx/arch/arm/src/dm320/dm320_usbdev.c
@@ -1039,34 +1039,29 @@ static int dm320_rdrequest(struct dm320_ep_s *privep)
}
usbtrace(TRACE_READ(privep->epphy), privreq->req.xfrd);
- for (;;)
- {
- /* Receive the next packet if (1) there are more bytes to be receive, or
- * (2) the last packet was exactly maxpacketsize.
- */
- buf = privreq->req.buf + privreq->req.xfrd;
- nbytesread = dm320_epread(privep->epphy, buf, privep->ep.maxpacket);
- if (nbytesread < 0)
- {
- usbtrace(TRACE_DEVERROR(DM320_TRACEERR_EPREAD), nbytesread);
- return ERROR;
- }
+ /* Receive the next packet */
- /* If the receive buffer is full or if the last packet was not full
- * then we are finished with the transfer.
- */
+ buf = privreq->req.buf + privreq->req.xfrd;
+ nbytesread = dm320_epread(privep->epphy, buf, privep->ep.maxpacket);
+ if (nbytesread < 0)
+ {
+ usbtrace(TRACE_DEVERROR(DM320_TRACEERR_EPREAD), nbytesread);
+ return ERROR;
+ }
- privreq->req.xfrd += nbytesread;
- if (privreq->req.len < privreq->req.xfrd || nbytesread < privep->ep.maxpacket)
- {
- usbtrace(TRACE_COMPLETE(privep->epphy), privreq->req.xfrd);
- dm320_reqcomplete(privep, OK);
- return OK;
- }
+ /* If the receive buffer is full or if the last packet was not full
+ * then we are finished with the transfer.
+ */
+
+ privreq->req.xfrd += nbytesread;
+ if (privreq->req.len < privreq->req.xfrd || nbytesread < privep->ep.maxpacket)
+ {
+ usbtrace(TRACE_COMPLETE(privep->epphy), privreq->req.xfrd);
+ dm320_reqcomplete(privep, OK);
}
- return OK; /* Won't get here */
+ return OK;
}
/*******************************************************************************