summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-11-02 20:09:25 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-11-02 20:09:25 +0000
commit8d1bd5791805998ea041b7bf6ea7c8e18c7713b5 (patch)
treeeb276b8b34e0f529c346392bfa7b4591f10c2249
parenta10f5f927dee2b3c6ed9e30559af9a8f8c0e9e74 (diff)
downloadnuttx-8d1bd5791805998ea041b7bf6ea7c8e18c7713b5.tar.gz
nuttx-8d1bd5791805998ea041b7bf6ea7c8e18c7713b5.tar.bz2
nuttx-8d1bd5791805998ea041b7bf6ea7c8e18c7713b5.zip
Fix case where both RX and TX enabled
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2210 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_usbdev.c86
1 files changed, 18 insertions, 68 deletions
diff --git a/nuttx/arch/arm/src/stm32/stm32_usbdev.c b/nuttx/arch/arm/src/stm32/stm32_usbdev.c
index 9059acc04..38f30cb30 100644
--- a/nuttx/arch/arm/src/stm32/stm32_usbdev.c
+++ b/nuttx/arch/arm/src/stm32/stm32_usbdev.c
@@ -436,7 +436,7 @@ static int stm32_rdrequest(struct stm32_usbdev_s *priv,
/* Interrupt level processing ***********************************************/
-static int stm32_dispatchrequest(struct stm32_usbdev_s *priv);
+static void stm32_dispatchrequest(struct stm32_usbdev_s *priv);
static void stm32_epdone(struct stm32_usbdev_s *priv, ubyte epno);
static void stm32_setdevaddr(struct stm32_usbdev_s *priv, ubyte value);
static void stm32_ep0setup(struct stm32_usbdev_s *priv);
@@ -1400,9 +1400,9 @@ static void stm32_cancelrequests(struct stm32_ep_s *privep)
* Name: stm32_dispatchrequest
****************************************************************************/
-static int stm32_dispatchrequest(struct stm32_usbdev_s *priv)
+static void stm32_dispatchrequest(struct stm32_usbdev_s *priv)
{
- int ret = OK;
+ int ret;
usbtrace(TRACE_INTDECODE(STM32_TRACEINTID_DISPATCH), 0);
if (priv && priv->driver)
@@ -1418,7 +1418,6 @@ static int stm32_dispatchrequest(struct stm32_usbdev_s *priv)
priv->devstate = DEVSTATE_STALLED;
}
}
- return ret;
}
/****************************************************************************
@@ -1572,15 +1571,8 @@ static void stm32_ep0setup(struct stm32_usbdev_s *priv)
/* Let the class implementation handle all non-standar requests */
- if (stm32_dispatchrequest(priv) == OK)
- {
- /* stm32_dispatchrequest will return OK if the class implementation
- * handled the request and will request a stall if the class
- * implementation failed to handle the request.
- */
-
- handled = TRUE;
- }
+ stm32_dispatchrequest(priv);
+ handled = TRUE;
}
/* Handle standard request. Pick off the things of interest to the
@@ -1704,15 +1696,8 @@ static void stm32_ep0setup(struct stm32_usbdev_s *priv)
* endpoint recipient)
*/
- if (stm32_dispatchrequest(priv) == OK)
- {
- /* stm32_dispatchrequest will return OK if the class implementation
- * handled the request and will request a stall if the class
- * implementation failed to handle the request.
- */
-
- handled = TRUE;
- }
+ stm32_dispatchrequest(priv);
+ handled = TRUE;
}
else
{
@@ -1755,15 +1740,8 @@ static void stm32_ep0setup(struct stm32_usbdev_s *priv)
{
/* The class driver handles all recipients except recipient=endpoint */
- if (stm32_dispatchrequest(priv) == OK)
- {
- /* stm32_dispatchrequest will return OK if the class implementation
- * handled the request and will request a stall if the class
- * implementation failed to handle the request.
- */
-
- handled = TRUE;
- }
+ stm32_dispatchrequest(priv);
+ handled = TRUE;
}
else
{
@@ -1828,15 +1806,8 @@ static void stm32_ep0setup(struct stm32_usbdev_s *priv)
{
/* The request seems valid... let the class implementation handle it */
- if (stm32_dispatchrequest(priv) == OK)
- {
- /* stm32_dispatchrequest will return OK if the class implementation
- * handled the request and will request a stall if the class
- * implementation failed to handle the request.
- */
-
- handled = TRUE;
- }
+ stm32_dispatchrequest(priv);
+ handled = TRUE;
}
else
{
@@ -1860,15 +1831,8 @@ static void stm32_ep0setup(struct stm32_usbdev_s *priv)
{
/* The request seems valid... let the class implementation handle it */
- if (stm32_dispatchrequest(priv) == OK)
- {
- /* stm32_dispatchrequest will return OK if the class implementation
- * handled the request and will request a stall if the class
- * implementation failed to handle the request.
- */
-
- handled = TRUE;
- }
+ stm32_dispatchrequest(priv);
+ handled = TRUE;
}
else
{
@@ -1892,15 +1856,8 @@ static void stm32_ep0setup(struct stm32_usbdev_s *priv)
{
/* The request seems valid... let the class implementation handle it */
- if (stm32_dispatchrequest(priv) == OK)
- {
- /* stm32_dispatchrequest will return OK if the class implementation
- * handled the request and will request a stall if the class
- * implementation failed to handle the request.
- */
-
- handled = TRUE;
- }
+ stm32_dispatchrequest(priv);
+ handled = TRUE;
}
else
{
@@ -1927,15 +1884,8 @@ static void stm32_ep0setup(struct stm32_usbdev_s *priv)
/* Let the class implementation handle the request */
usbtrace(TRACE_INTDECODE(STM32_TRACEINTID_GETSETIF), priv->ctrl.type);
- if (stm32_dispatchrequest(priv) == OK)
- {
- /* stm32_dispatchrequest will return OK if the class implementation
- * handled the request and will request a stall if the class
- * implementation failed to handle the request.
- */
-
- handled = TRUE;
- }
+ stm32_dispatchrequest(priv);
+ handled = TRUE;
}
break;
@@ -1966,7 +1916,7 @@ static void stm32_ep0setup(struct stm32_usbdev_s *priv)
* must be sent (may be a zero length packet).
* 2. The request was successfully handled by the class implementation. In
* case, the EP0 IN response has already been queued and the local variable
- * 'handled' will be set to TRUE;
+ * 'handled' will be set to TRUE and devstate != DEVSTATE_STALLED;
* 3. An error was detected in either the above logic or by the class implementation
* logic. In either case, priv->state will be set DEVSTATE_STALLED
* to indicate this case.