arch/arm/src/lpc17xx/lpc17_usbdev.c: Fix loss of RX initiatives. USB bulk endpoints are double buffered on LPC17xx MCUs. This means that up to two packets might be received on an OUT endpoint that can not be handled immediately if the receive request queue is empty. Thus, rxpending must be a counter not a boolean flag.

This commit is contained in:
Michael Jung 2018-05-20 12:42:30 -06:00 committed by Gregory Nutt
parent cce5d017b4
commit fe44948ea4

View File

@ -349,7 +349,7 @@ struct lpc17_usbdev_s
uint8_t selfpowered:1; /* 1: Device is self powered */
uint8_t paddrset:1; /* 1: Peripheral addr has been set */
uint8_t attached:1; /* 1: Host attached */
uint8_t rxpending:1; /* 1: RX pending */
uint8_t rxpending:2; /* 2: RX pending */
uint32_t softprio; /* Bitset of high priority interrupts */
uint32_t epavail; /* Bitset of available endpoints */
#ifdef CONFIG_LPC17_USBDEV_FRAME_INTERRUPT
@ -2326,7 +2326,8 @@ static int lpc17_usbinterrupt(int irq, FAR void *context, FAR void *arg)
else
{
uinfo("Pending data on OUT endpoint\n");
priv->rxpending = 1;
DEBUGASSERT(priv->rxpending < 3);
priv->rxpending++;
}
}
}
@ -2862,10 +2863,10 @@ static int lpc17_epsubmit(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *r
/* This there a incoming data pending the availability of a request? */
if (priv->rxpending)
if (priv->rxpendinig > 0)
{
ret = lpc17_rdrequest(privep);
priv->rxpending = 0;
priv->rxpending--;
}
}