summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-10-25 14:40:01 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-10-25 14:40:01 +0000
commit89b3d89c8ff69d5dffcc0359220b3fe12a91be58 (patch)
treec7282cd8d18ea89c307af77266c1b439b7633eae
parent5f737db4e495ebc1da1ac40b02836b529db77abe (diff)
downloadnuttx-89b3d89c8ff69d5dffcc0359220b3fe12a91be58.tar.gz
nuttx-89b3d89c8ff69d5dffcc0359220b3fe12a91be58.tar.bz2
nuttx-89b3d89c8ff69d5dffcc0359220b3fe12a91be58.zip
Fix to handle requests larger than maxpacket
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1076 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/arch/arm/src/dm320/dm320_usbdev.c9
-rw-r--r--nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c9
2 files changed, 12 insertions, 6 deletions
diff --git a/nuttx/arch/arm/src/dm320/dm320_usbdev.c b/nuttx/arch/arm/src/dm320/dm320_usbdev.c
index 1411a4412..46cbb654a 100644
--- a/nuttx/arch/arm/src/dm320/dm320_usbdev.c
+++ b/nuttx/arch/arm/src/dm320/dm320_usbdev.c
@@ -970,15 +970,18 @@ static int dm320_wrrequest(struct dm320_ep_s *privep)
* bytes to send.
*/
+ privep->txnullpkt = 0;
if (bytesleft > privep->ep.maxpacket)
{
nbytes = privep->ep.maxpacket;
- privep->txnullpkt = 0;
}
else
{
nbytes = bytesleft;
- privep->txnullpkt = (bytesleft == privep->ep.maxpacket);
+ if ((privreq->req.flags & USBDEV_REQFLAGS_NULLPKT) != 0)
+ {
+ privep->txnullpkt = (bytesleft == privep->ep.maxpacket);
+ }
}
/* Send the largest number of bytes that we can in this packet */
@@ -1000,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 (bytesleft <= 0 && !privep->txnullpkt)
{
usbtrace(TRACE_COMPLETE(privep->epphy), privreq->req.xfrd);
privep->txnullpkt = 0;
diff --git a/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c b/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c
index de0a5ec0c..cb220cc1b 100644
--- a/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c
+++ b/nuttx/arch/arm/src/lpc214x/lpc214x_usbdev.c
@@ -1062,15 +1062,18 @@ static int lpc214x_wrrequest(struct lpc214x_ep_s *privep)
* bytes to send.
*/
+ privep->txnullpkt = 0;
if (bytesleft > privep->ep.maxpacket)
{
nbytes = privep->ep.maxpacket;
- privep->txnullpkt = 0;
}
else
{
nbytes = bytesleft;
- privep->txnullpkt = (bytesleft == privep->ep.maxpacket);
+ if ((privreq->req.flags & USBDEV_REQFLAGS_NULLPKT) != 0)
+ {
+ privep->txnullpkt = (bytesleft == privep->ep.maxpacket);
+ }
}
/* Send the largest number of bytes that we can in this packet */
@@ -1087,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 (bytesleft <= 0 && !privep->txnullpkt)
{
usbtrace(TRACE_COMPLETE(privep->epphy), privreq->req.xfrd);
privep->txnullpkt = 0;