Should not returned queued read requests on a reset
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2294 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
6c5d05074a
commit
1e85cbd2b0
@ -418,6 +418,7 @@ static int stm32_wrrequest(struct stm32_usbdev_s *priv,
|
|||||||
struct stm32_ep_s *privep);
|
struct stm32_ep_s *privep);
|
||||||
static int stm32_rdrequest(struct stm32_usbdev_s *priv,
|
static int stm32_rdrequest(struct stm32_usbdev_s *priv,
|
||||||
struct stm32_ep_s *privep);
|
struct stm32_ep_s *privep);
|
||||||
|
static void stm32_cancelrequests(struct stm32_ep_s *privep, int status);
|
||||||
|
|
||||||
/* Interrupt level processing ***********************************************/
|
/* Interrupt level processing ***********************************************/
|
||||||
|
|
||||||
@ -1368,13 +1369,13 @@ static int stm32_rdrequest(struct stm32_usbdev_s *priv, struct stm32_ep_s *prive
|
|||||||
* Name: stm32_cancelrequests
|
* Name: stm32_cancelrequests
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void stm32_cancelrequests(struct stm32_ep_s *privep)
|
static void stm32_cancelrequests(struct stm32_ep_s *privep, int status)
|
||||||
{
|
{
|
||||||
while (!stm32_rqempty(privep))
|
while (!stm32_rqempty(privep))
|
||||||
{
|
{
|
||||||
usbtrace(TRACE_COMPLETE(USB_EPNO(privep->ep.eplog)),
|
usbtrace(TRACE_COMPLETE(USB_EPNO(privep->ep.eplog)),
|
||||||
(stm32_rqpeek(privep))->req.xfrd);
|
(stm32_rqpeek(privep))->req.xfrd);
|
||||||
stm32_reqcomplete(privep, -ESHUTDOWN);
|
stm32_reqcomplete(privep, status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2225,12 +2226,10 @@ static int stm32_lpinterrupt(int irq, void *context)
|
|||||||
|
|
||||||
if ((istr & USB_ISTR_RESET) != 0)
|
if ((istr & USB_ISTR_RESET) != 0)
|
||||||
{
|
{
|
||||||
/* Wakeup interrupt received. Clear the WKUP interrupt status. The cause of
|
/* Reset interrupt received. Clear the RESET interrupt status. */
|
||||||
* the wakeup is indicated in the FNR register
|
|
||||||
*/
|
|
||||||
|
|
||||||
stm32_putreg(~USB_ISTR_RESET, STM32_USB_ISTR);
|
stm32_putreg(~USB_ISTR_RESET, STM32_USB_ISTR);
|
||||||
usbtrace(TRACE_INTDECODE(STM32_TRACEINTID_RESET), stm32_getreg(STM32_USB_FNR));
|
usbtrace(TRACE_INTDECODE(STM32_TRACEINTID_RESET), istr);
|
||||||
|
|
||||||
/* Restore our power-up state and exit now because istr is no longer
|
/* Restore our power-up state and exit now because istr is no longer
|
||||||
* valid.
|
* valid.
|
||||||
@ -2246,10 +2245,12 @@ static int stm32_lpinterrupt(int irq, void *context)
|
|||||||
|
|
||||||
if ((istr & USB_ISTR_WKUP & priv->imask) != 0)
|
if ((istr & USB_ISTR_WKUP & priv->imask) != 0)
|
||||||
{
|
{
|
||||||
/* Wakeup interrupt received. Clear the WKUP interrupt status. */
|
/* Wakeup interrupt received. Clear the WKUP interrupt status. The
|
||||||
|
* cause of the resume is indicated in the FNR register
|
||||||
|
*/
|
||||||
|
|
||||||
stm32_putreg(~USB_ISTR_WKUP, STM32_USB_ISTR);
|
stm32_putreg(~USB_ISTR_WKUP, STM32_USB_ISTR);
|
||||||
usbtrace(TRACE_INTDECODE(STM32_TRACEINTID_WKUP), 0);
|
usbtrace(TRACE_INTDECODE(STM32_TRACEINTID_WKUP), stm32_getreg(STM32_USB_FNR));
|
||||||
|
|
||||||
/* Perform the wakeup action */
|
/* Perform the wakeup action */
|
||||||
|
|
||||||
@ -2689,7 +2690,7 @@ static int stm32_epdisable(struct usbdev_ep_s *ep)
|
|||||||
/* Cancel any ongoing activity */
|
/* Cancel any ongoing activity */
|
||||||
|
|
||||||
flags = irqsave();
|
flags = irqsave();
|
||||||
stm32_cancelrequests(privep);
|
stm32_cancelrequests(privep, -ESHUTDOWN);
|
||||||
|
|
||||||
/* Disable TX; disable RX */
|
/* Disable TX; disable RX */
|
||||||
|
|
||||||
@ -2877,7 +2878,7 @@ static int stm32_epcancel(struct usbdev_ep_s *ep, struct usbdev_req_s *req)
|
|||||||
priv = privep->dev;
|
priv = privep->dev;
|
||||||
|
|
||||||
flags = irqsave();
|
flags = irqsave();
|
||||||
stm32_cancelrequests(privep);
|
stm32_cancelrequests(privep, -ESHUTDOWN);
|
||||||
irqrestore(flags);
|
irqrestore(flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -3226,9 +3227,12 @@ static void stm32_reset(struct stm32_usbdev_s *priv)
|
|||||||
{
|
{
|
||||||
struct stm32_ep_s *privep = &priv->eplist[epno];
|
struct stm32_ep_s *privep = &priv->eplist[epno];
|
||||||
|
|
||||||
/* Cancel any queue requests */
|
/* Cancel any queued write requests */
|
||||||
|
|
||||||
stm32_cancelrequests(privep);
|
if (USB_ISEPIN(privep->ep.eplog))
|
||||||
|
{
|
||||||
|
stm32_cancelrequests(privep, -EPIPE);
|
||||||
|
}
|
||||||
|
|
||||||
/* Reset endpoint status */
|
/* Reset endpoint status */
|
||||||
|
|
||||||
|
@ -2544,12 +2544,12 @@ void *usbstrg_workerthread(void *arg)
|
|||||||
usbstrg_resetconfig(priv);
|
usbstrg_resetconfig(priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These events require that a new configuration be established */
|
/* These events require that a new configuration be established */
|
||||||
|
|
||||||
if ((eventset & (USBSTRG_EVENT_CFGCHANGE|USBSTRG_EVENT_IFCHANGE)) != 0)
|
if ((eventset & (USBSTRG_EVENT_CFGCHANGE|USBSTRG_EVENT_IFCHANGE)) != 0)
|
||||||
{
|
{
|
||||||
usbstrg_setconfig(priv, priv->thvalue);
|
usbstrg_setconfig(priv, priv->thvalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These events required that we send a deferred EP0 setup response */
|
/* These events required that we send a deferred EP0 setup response */
|
||||||
|
|
||||||
|
@ -1073,7 +1073,7 @@ static void usbstrg_lununinitialize(struct usbstrg_lun_s *lun)
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Set the device configuration by allocating and configuring endpoints and
|
* Set the device configuration by allocating and configuring endpoints and
|
||||||
* by allocating and queue read and write requests.
|
* by allocating and queuing read and write requests.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -1101,7 +1101,7 @@ int usbstrg_setconfig(FAR struct usbstrg_dev_s *priv, ubyte config)
|
|||||||
/* Already configured -- Do nothing */
|
/* Already configured -- Do nothing */
|
||||||
|
|
||||||
usbtrace(TRACE_CLSERROR(USBSTRG_TRACEERR_ALREADYCONFIGURED), 0);
|
usbtrace(TRACE_CLSERROR(USBSTRG_TRACEERR_ALREADYCONFIGURED), 0);
|
||||||
return 0;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Discard the previous configuration data */
|
/* Discard the previous configuration data */
|
||||||
@ -1113,7 +1113,7 @@ int usbstrg_setconfig(FAR struct usbstrg_dev_s *priv, ubyte config)
|
|||||||
if (config == USBSTRG_CONFIGIDNONE)
|
if (config == USBSTRG_CONFIGIDNONE)
|
||||||
{
|
{
|
||||||
usbtrace(TRACE_CLSERROR(USBSTRG_TRACEERR_CONFIGNONE), 0);
|
usbtrace(TRACE_CLSERROR(USBSTRG_TRACEERR_CONFIGNONE), 0);
|
||||||
return 0;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We only accept one configuration */
|
/* We only accept one configuration */
|
||||||
|
Loading…
Reference in New Issue
Block a user