diff options
Diffstat (limited to 'nuttx/arch/arm')
-rw-r--r-- | nuttx/arch/arm/src/dm320/dm320_usbdev.c | 41 | ||||
-rw-r--r-- | nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c | 41 |
2 files changed, 36 insertions, 46 deletions
diff --git a/nuttx/arch/arm/src/dm320/dm320_usbdev.c b/nuttx/arch/arm/src/dm320/dm320_usbdev.c index c585c3fe9..0076f0067 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; } /******************************************************************************* diff --git a/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c b/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c index 71c30596d..e23da86cc 100644 --- a/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c +++ b/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c @@ -1136,34 +1136,29 @@ static int lpc214x_rdrequest(struct lpc214x_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 = lpc214x_epread(privep->epphy, buf, privep->ep.maxpacket); - if (nbytesread < 0) - { - usbtrace(TRACE_DEVERROR(LPC214X_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 = lpc214x_epread(privep->epphy, buf, privep->ep.maxpacket); + if (nbytesread < 0) + { + usbtrace(TRACE_DEVERROR(LPC214X_TRACEERR_EPREAD), nbytesread); + return ERROR; + } - privreq->req.xfrd += nbytesread; - if (privreq->req.xfrd >= privreq->req.len || nbytesread < privep->ep.maxpacket) - { - usbtrace(TRACE_COMPLETE(privep->epphy), privreq->req.xfrd); - lpc214x_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.xfrd >= privreq->req.len || nbytesread < privep->ep.maxpacket) + { + usbtrace(TRACE_COMPLETE(privep->epphy), privreq->req.xfrd); + lpc214x_reqcomplete(privep, OK); } - return OK; /* Won't get here */ + return OK; } /******************************************************************************* |