summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-04-12 09:33:52 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-04-12 09:33:52 -0600
commitb3b87cc272d39ed9cc28e97f264cd91462a1fd3b (patch)
treed5ef5bc29788e1beef9592955887e95b6a0dbf49
parent891b20aff2fb5e52ff357e6208bb859a99cd7127 (diff)
downloadnuttx-b3b87cc272d39ed9cc28e97f264cd91462a1fd3b.tar.gz
nuttx-b3b87cc272d39ed9cc28e97f264cd91462a1fd3b.tar.bz2
nuttx-b3b87cc272d39ed9cc28e97f264cd91462a1fd3b.zip
STM32 OTGFS Host: Fix a logic error introduced in the last check-in
-rw-r--r--nuttx/arch/arm/src/stm32/Make.defs4
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_otgfshost.c53
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_usbhost.h12
-rw-r--r--nuttx/drivers/usbhost/usbhost_enumerate.c8
-rw-r--r--nuttx/drivers/usbhost/usbhost_trace.c2
5 files changed, 40 insertions, 39 deletions
diff --git a/nuttx/arch/arm/src/stm32/Make.defs b/nuttx/arch/arm/src/stm32/Make.defs
index 41a22a607..68a856c78 100644
--- a/nuttx/arch/arm/src/stm32/Make.defs
+++ b/nuttx/arch/arm/src/stm32/Make.defs
@@ -34,7 +34,7 @@
############################################################################
ifeq ($(CONFIG_ARMV7M_CMNVECTOR),y)
-HEAD_ASRC =
+HEAD_ASRC =
else
HEAD_ASRC = stm32_vectors.S
endif
@@ -90,7 +90,7 @@ CMN_CSRCS += up_copyarmstate.c
endif
endif
-CHIP_ASRCS =
+CHIP_ASRCS =
CHIP_CSRCS = stm32_allocateheap.c stm32_start.c stm32_rcc.c stm32_lse.c
CHIP_CSRCS += stm32_lsi.c stm32_gpio.c stm32_exti_gpio.c stm32_flash.c stm32_irq.c
diff --git a/nuttx/arch/arm/src/stm32/stm32_otgfshost.c b/nuttx/arch/arm/src/stm32/stm32_otgfshost.c
index 0f70a521e..3614a7b02 100644
--- a/nuttx/arch/arm/src/stm32/stm32_otgfshost.c
+++ b/nuttx/arch/arm/src/stm32/stm32_otgfshost.c
@@ -98,7 +98,7 @@
* packets. Depends on CONFIG_DEBUG.
*/
-/* Pre-requistites (partial) */
+/* Pre-requisites (partial) */
#ifndef CONFIG_STM32_SYSCFG
# error "CONFIG_STM32_SYSCFG is required"
@@ -135,6 +135,11 @@
# undef CONFIG_STM32_USBHOST_PKTDUMP
#endif
+#undef HAVE_USB_TRACE 1
+#if defined(CONFIG_USBHOST_TRACE) || (defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_USB))
+# define HAVE_USB_TRACE 1
+#endif
+
/* HCD Setup *******************************************************************/
/* Hardware capabilities */
@@ -719,22 +724,26 @@ static void stm32_chan_configure(FAR struct stm32_usbhost_s *priv, int chidx)
switch (priv->chan[chidx].eptype)
{
case OTGFS_EPTYPE_CTRL:
+ case OTGFS_EPTYPE_BULK:
{
- if (priv->chan[chidx].in)
+#ifdef HAVE_USB_TRACE
+ uint16_t intrace;
+ uint16_t outtrace;
+
+ /* Determine the definitive trace ID to use below */
+
+ if (priv->chan[chidx].eptype == OTGFS_EPTYPE_CTRL)
{
- usbhost_vtrace2(OTGFS_VTRACE2_CHANCONF_CTRL_IN, chidx,
- priv->chan[chidx].epno);
+ intrace = OTGFS_VTRACE2_CHANCONF_CTRL_IN;
+ outtrace = OTGFS_VTRACE2_CHANCONF_CTRL_OUT;
}
else
{
- usbhost_vtrace2(OTGFS_VTRACE2_CHANCONF_CTRL_OUT, chidx,
- priv->chan[chidx].epno);
+ intrace = OTGFS_VTRACE2_CHANCONF_BULK_IN;
+ outtrace = OTGFS_VTRACE2_CHANCONF_BULK_OUT;
}
- }
- break;
+#endif
- case OTGFS_EPTYPE_BULK:
- {
/* Interrupts required for CTRL and BULK endpoints */
regval |= (OTGFS_HCINT_XFRC | OTGFS_HCINT_STALL | OTGFS_HCINT_NAK |
@@ -744,14 +753,12 @@ static void stm32_chan_configure(FAR struct stm32_usbhost_s *priv, int chidx)
if (priv->chan[chidx].in)
{
- usbhost_vtrace2(OTGFS_VTRACE2_CHANCONF_BULK_IN, chidx,
- priv->chan[chidx].epno);
+ usbhost_vtrace2(intrace, chidx, priv->chan[chidx].epno);
regval |= OTGFS_HCINT_BBERR;
}
else
{
- usbhost_vtrace2(OTGFS_VTRACE2_CHANCONF_BULK_OUT, chidx,
- priv->chan[chidx].epno);
+ usbhost_vtrace2(outtrace, chidx, priv->chan[chidx].epno);
regval |= OTGFS_HCINT_NYET;
}
}
@@ -772,11 +779,13 @@ static void stm32_chan_configure(FAR struct stm32_usbhost_s *priv, int chidx)
priv->chan[chidx].epno);
regval |= OTGFS_HCINT_BBERR;
}
+#ifdef HAVE_USB_TRACE
else
{
usbhost_vtrace2(OTGFS_VTRACE2_CHANCONF_INTR_OUT, chidx,
priv->chan[chidx].epno);
}
+#endif
}
break;
@@ -794,11 +803,13 @@ static void stm32_chan_configure(FAR struct stm32_usbhost_s *priv, int chidx)
priv->chan[chidx].epno);
regval |= (OTGFS_HCINT_TXERR | OTGFS_HCINT_BBERR);
}
+#ifdef HAVE_USB_TRACE
else
{
usbhost_vtrace2(OTGFS_VTRACE2_CHANCONF_ISOC_OUT, chidx,
priv->chan[chidx].epno);
}
+#endif
}
break;
}
@@ -1044,16 +1055,9 @@ static void stm32_chan_wakeup(FAR struct stm32_usbhost_s *priv,
if (chan->result != EBUSY && chan->waiter)
{
- if (chan->in)
- {
- usbhost_vtrace2(OTGFS_VTRACE2_CHANWAKEUP_IN, chan->epno,
- chan->result);
- }
- else
- {
- usbhost_vtrace2(OTGFS_VTRACE2_CHANWAKEUP_OUT, chan->epno,
- chan->result);
- }
+ usbhost_vtrace2(chan->in ? OTGFS_VTRACE2_CHANWAKEUP_IN :
+ OTGFS_VTRACE2_CHANWAKEUP_OUT,
+ chan->epno, chan->result);
stm32_givesem(&chan->waitsem);
chan->waiter = false;
@@ -1112,7 +1116,6 @@ static void stm32_transfer_start(FAR struct stm32_usbhost_s *priv, int chidx)
{
npackets = STM32_MAX_PKTCOUNT;
chan->buflen = STM32_MAX_PKTCOUNT * maxpacket;
-
usbhost_trace2(OTGFS_TRACE2_CLIP, chidx, chan->buflen);
}
}
diff --git a/nuttx/arch/arm/src/stm32/stm32_usbhost.h b/nuttx/arch/arm/src/stm32/stm32_usbhost.h
index b3a68cbef..553a0d3ba 100644
--- a/nuttx/arch/arm/src/stm32/stm32_usbhost.h
+++ b/nuttx/arch/arm/src/stm32/stm32_usbhost.h
@@ -172,14 +172,14 @@ extern "C" {
* Enable/disable driving of VBUS 5V output. This function must be provided be
* each platform that implements the STM32 OTG FS host interface
*
- * "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
- * or, if 5 V are available on the application board, a basic power switch, must
- * be added externally to drive the 5 V VBUS line. The external charge pump can
- * be driven by any GPIO output. When the application decides to power on VBUS
- * using the chosen GPIO, it must also set the port power bit in the host port
+ * "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
+ * or, if 5 V are available on the application board, a basic power switch, must
+ * be added externally to drive the 5 V VBUS line. The external charge pump can
+ * be driven by any GPIO output. When the application decides to power on VBUS
+ * using the chosen GPIO, it must also set the port power bit in the host port
* control and status register (PPWR bit in OTG_FS_HPRT).
*
- * "The application uses this field to control power to this port, and the core
+ * "The application uses this field to control power to this port, and the core
* clears this bit on an overcurrent condition."
*
* Input Parameters:
diff --git a/nuttx/drivers/usbhost/usbhost_enumerate.c b/nuttx/drivers/usbhost/usbhost_enumerate.c
index 96ff066aa..1857499ed 100644
--- a/nuttx/drivers/usbhost/usbhost_enumerate.c
+++ b/nuttx/drivers/usbhost/usbhost_enumerate.c
@@ -145,7 +145,7 @@ static inline int usbhost_devdesc(FAR const struct usb_devdesc_s *devdesc,
id->base, id->subclass, id->proto, id->vid, id->pid);
return OK;
}
-
+
/*******************************************************************************
* Name: usbhost_configdesc
*
@@ -193,7 +193,7 @@ static inline int usbhost_configdesc(const uint8_t *configdesc, int cfglen,
* Typically these values are zero meaning that the "real" ID
* information resides in the device descriptor.
*/
-
+
DEBUGASSERT(remaining >= sizeof(struct usb_ifdesc_s));
id->base = ifdesc->classid;
id->subclass = ifdesc->subclass;
@@ -204,7 +204,7 @@ static inline int usbhost_configdesc(const uint8_t *configdesc, int cfglen,
}
/* Increment the address of the next descriptor */
-
+
configdesc += ifdesc->len;
remaining -= ifdesc->len;
}
@@ -510,7 +510,7 @@ int usbhost_enumerate(FAR struct usbhost_driver_s *drvr, uint8_t funcaddr,
* It is not needed further here but it may be needed by the class driver
* during its connection operations.
*/
-
+
DRVR_FREE(drvr, (uint8_t*)ctrlreq);
ctrlreq = NULL;
diff --git a/nuttx/drivers/usbhost/usbhost_trace.c b/nuttx/drivers/usbhost/usbhost_trace.c
index 92dc2c570..d6d1f4dd4 100644
--- a/nuttx/drivers/usbhost/usbhost_trace.c
+++ b/nuttx/drivers/usbhost/usbhost_trace.c
@@ -301,5 +301,3 @@ int usbhost_trdump(void)
return usbhost_trenumerate(usbhost_trsyslog, NULL);
}
#endif /* CONFIG_USBHOST_TRACE */
-
-