diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-09-09 17:27:21 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-09-09 17:27:21 -0600 |
commit | 45ca8863df1720fa2a7362dc8dea97334691a346 (patch) | |
tree | d5f5e9dadaa0698c7b45c0b1582c067193401107 | |
parent | 91becdb75746f65f27d6e87bd8d3d9f926ddbefe (diff) | |
download | nuttx-45ca8863df1720fa2a7362dc8dea97334691a346.tar.gz nuttx-45ca8863df1720fa2a7362dc8dea97334691a346.tar.bz2 nuttx-45ca8863df1720fa2a7362dc8dea97334691a346.zip |
Extent the the USB host trace logic to include verbose debug output
-rwxr-xr-x | nuttx/arch/arm/src/sama5/sam_ehci.c | 91 | ||||
-rw-r--r-- | nuttx/arch/arm/src/sama5/sam_usbhost.c | 44 | ||||
-rw-r--r-- | nuttx/arch/arm/src/sama5/sam_usbhost.h | 47 | ||||
-rw-r--r-- | nuttx/drivers/usbhost/Kconfig | 9 | ||||
-rw-r--r-- | nuttx/drivers/usbhost/usbhost_trace.c | 4 | ||||
-rw-r--r-- | nuttx/include/nuttx/usb/usbhost_trace.h | 20 |
6 files changed, 183 insertions, 32 deletions
diff --git a/nuttx/arch/arm/src/sama5/sam_ehci.c b/nuttx/arch/arm/src/sama5/sam_ehci.c index 8b4e3297e..f63bc0f08 100755 --- a/nuttx/arch/arm/src/sama5/sam_ehci.c +++ b/nuttx/arch/arm/src/sama5/sam_ehci.c @@ -115,6 +115,13 @@ # undef CONFIG_SAMA5_UHPHS_RHPORT1 #endif +/* Simplify DEBUG checks */ + +#ifndef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# undef CONFIG_DEBUG_USB +#endif + /* For now, suppress use of PORTA in any event. I use that for SAM-BA and * would prefer that the board not try to drive VBUS on that port! */ @@ -1821,8 +1828,14 @@ static ssize_t sam_async_transfer(struct sam_rhport_s *rhport, uint32_t regval; int ret; + /* Terse output only if we are tracing */ + +#ifdef CONFIG_USBHOST_TRACE + usbhost_vtrace2(EHCI_VTRACE2_ASYNCXFR, epinfo->epno, buflen); +#else uvdbg("RHport%d EP%d: buffer=%p, buflen=%d, req=%p\n", rhport->rhpndx+1, epinfo->epno, buffer, buflen, req); +#endif DEBUGASSERT(rhport && epinfo); @@ -2155,8 +2168,14 @@ static ssize_t sam_intr_transfer(struct sam_rhport_s *rhport, uint32_t regval; int ret; + /* Terse output only if we are tracing */ + +#ifdef CONFIG_USBHOST_TRACE + usbhost_vtrace2(EHCI_VTRACE2_INTRXFR, epinfo->epno, buflen); +#else uvdbg("RHport%d EP%d: buffer=%p, buflen=%d\n", rhport->rhpndx+1, epinfo->epno, buffer, buflen); +#endif DEBUGASSERT(rhport && epinfo && buffer && buflen > 0); @@ -2367,7 +2386,7 @@ static int sam_qh_ioccheck(struct sam_qh_s *qh, uint32_t **bp, void *arg) /* Is the qTD still active? */ token = sam_swap32(qh->hw.overlay.token); - uvdbg("EP%d TOKEN=%08x\n", epinfo->epno, token); + usbhost_vtrace2(EHCI_VTRACE2_IOCCHECK, epinfo->epno, token); if ((token & QH_TOKEN_ACTIVE) != 0) { @@ -2582,13 +2601,13 @@ static inline void sam_portsc_bottomhalf(void) rhport = &g_ehci.rhport[rhpndx]; portsc = sam_getreg(&HCOR->portsc[rhpndx]); - uvdbg("PORTSC%d: %08x\n", rhpndx + 1, portsc); + usbhost_vtrace2(EHCI_VTRACE2_PORTSC, rhpndx + 1, portsc); /* Handle port connection status change (CSC) events */ if ((portsc & EHCI_PORTSC_CSC) != 0) { - uvdbg("Connect Status Change\n"); + usbhost_vtrace1(EHCI_VTRACE1_PORTSC_CSC, portsc); /* Check current connect status */ @@ -2602,8 +2621,8 @@ static inline void sam_portsc_bottomhalf(void) rhport->connected = true; - uvdbg("RHPort%d connected, pscwait: %d\n", - rhpndx + 1, g_ehci.pscwait); + usbhost_vtrace2(EHCI_VTRACE2_PORTSC_CONNECTED, + rhpndx + 1, g_ehci.pscwait); /* Notify any waiters */ @@ -2615,7 +2634,7 @@ static inline void sam_portsc_bottomhalf(void) } else { - uvdbg("Already connected\n"); + usbhost_vtrace1(EHCI_VTRACE1_PORTSC_CONNALREADY, portsc); } } else @@ -2626,7 +2645,9 @@ static inline void sam_portsc_bottomhalf(void) { /* Yes.. disconnect the device */ - uvdbg("RHport%d disconnected\n", rhpndx+1); + usbhost_vtrace2(EHCI_VTRACE2_PORTSC_DISCONND, + rhpndx+1, g_ehci.pscwait); + rhport->connected = false; rhport->lowspeed = false; @@ -2652,7 +2673,7 @@ static inline void sam_portsc_bottomhalf(void) } else { - uvdbg("Already disconnected\n"); + usbhost_vtrace1(EHCI_VTRACE1_PORTSC_DISCALREADY, portsc); } } } @@ -2700,7 +2721,7 @@ static inline void sam_syserr_bottomhalf(void) static inline void sam_async_advance_bottomhalf(void) { - uvdbg("Async Advance Interrupt\n"); + usbhost_vtrace1(EHCI_VTRACE1_AAINTR, 0); /* REVISIT: Could remove all tagged QH entries here */ } @@ -2750,11 +2771,11 @@ static void sam_ehci_bottomhalf(FAR void *arg) { if ((pending & EHCI_INT_USBERRINT) != 0) { - usbhost_trace1(EHCI_TRACE1_USBERR_INTR, 0); + usbhost_trace1(EHCI_TRACE1_USBERR_INTR, pending); } else { - uvdbg("USB Interrupt (USBINT) Interrupt\n"); + usbhost_vtrace1(EHCI_VTRACE1_USBINTR, pending); } sam_ioc_bottomhalf(); @@ -2857,7 +2878,12 @@ static int sam_ehci_tophalf(int irq, FAR void *context) usbsts = sam_getreg(&HCOR->usbsts); regval = sam_getreg(&HCOR->usbintr); + +#ifdef CONFIG_USBHOST_TRACE + usbhost_vtrace1(EHCI_VTRACE1_TOPHALF, usbsts & regval); +#else ullvdbg("USBSTS: %08x USBINTR: %08x\n", usbsts, regval); +#endif /* Handle all unmasked interrupt sources */ @@ -2975,10 +3001,8 @@ static int sam_wait(FAR struct usbhost_connection_s *conn, */ irqrestore(flags); - - uvdbg("RHPort%d connected: %s\n", - rhpndx + 1, g_ehci.rhport[rhpndx].connected ? "YES" : "NO"); - + usbhost_vtrace2(EHCI_VTRACE2_MONWAKEUP, + rhpndx + 1, g_ehci.rhport[rhpndx].connected); return rhpndx; } } @@ -3026,6 +3050,7 @@ static int sam_enumerate(FAR struct usbhost_connection_s *conn, int rhpndx) struct sam_rhport_s *rhport; volatile uint32_t *regaddr; uint32_t regval; + int ret; DEBUGASSERT(rhpndx >= 0 && rhpndx < SAM_EHCI_NRHPORT); rhport = &g_ehci.rhport[rhpndx]; @@ -3038,7 +3063,7 @@ static int sam_enumerate(FAR struct usbhost_connection_s *conn, int rhpndx) { /* No, return an error */ - uvdbg("Not connected\n"); + usbhost_vtrace1(EHCI_VTRACE1_ENUM_DISCONN, 0); return -ENODEV; } @@ -3242,8 +3267,14 @@ static int sam_enumerate(FAR struct usbhost_connection_s *conn, int rhpndx) * See include/nuttx/usb/usbhost_devaddr.h. */ - uvdbg("Enumerate the device\n"); - return usbhost_enumerate(&g_ehci.rhport[rhpndx].drvr, rhpndx+1, &rhport->class); + usbhost_vtrace2(EHCI_VTRACE2_CLASSENUM, rhpndx+1, rhpndx+1); + ret = usbhost_enumerate(&g_ehci.rhport[rhpndx].drvr, rhpndx+1, &rhport->class); + if (ret < 0) + { + usbhost_trace2(EHCI_TRACE2_CLASSENUM_FAILED, rhpndx+1, -ret); + } + + return ret; } /************************************************************************************ @@ -3390,9 +3421,16 @@ static int sam_epalloc(FAR struct usbhost_driver_s *drvr, */ DEBUGASSERT(drvr && epdesc && ep); + + /* Terse output only if we are tracing */ + +#ifdef CONFIG_USBHOST_TRACE + usbhost_vtrace2(EHCI_VTRACE2_EPALLOC, epdesc->addr, epdesc->xfrtype); +#else uvdbg("EP%d DIR=%s FA=%08x TYPE=%d Interval=%d MaxPacket=%d\n", epdesc->addr, epdesc->in ? "IN" : "OUT", epdesc->funcaddr, epdesc->xfrtype, epdesc->interval, epdesc->mxpacketsize); +#endif /* Allocate a endpoint information structure */ @@ -3665,9 +3703,16 @@ static int sam_ctrlin(FAR struct usbhost_driver_s *drvr, DEBUGASSERT(rhport && req); len = sam_read16(req->len); + + /* Terse output only if we are tracing */ + +#ifdef CONFIG_USBHOST_TRACE + usbhost_vtrace2(EHCI_VTRACE2_CTRLINOUT, rhport->rhpndx + 1, req->req); +#else uvdbg("RHPort%d type: %02x req: %02x value: %02x%02x index: %02x%02x len: %04x\n", rhport->rhpndx + 1, req->type, req->req, req->value[1], req->value[0], req->index[1], req->index[0], len); +#endif /* We must have exclusive access to the EHCI hardware and data structures. */ @@ -4032,7 +4077,7 @@ FAR struct usbhost_connection_s *sam_ehci_initialize(int controller) /* Software Configuration ****************************************************/ - uvdbg("Initializing EHCI Stack\n"); + usbhost_vtrace1(EHCI_VTRACE1_INITIALIZING, 0); /* Initialize the EHCI state data structure */ @@ -4181,20 +4226,20 @@ FAR struct usbhost_connection_s *sam_ehci_initialize(int controller) /* Show the EHCI version */ regval16 = sam_swap16(HCCR->hciversion); - uvdbg("HCIVERSION %x.%02x\n", regval16 >> 8, regval16 & 0xff); + usbhost_vtrace2(EHCI_VTRACE2_HCIVERSION, regval16 >> 8, regval16 & 0xff); /* Verify that the correct number of ports is reported */ regval = sam_getreg(&HCCR->hcsparams); nports = (regval & EHCI_HCSPARAMS_NPORTS_MASK) >> EHCI_HCSPARAMS_NPORTS_SHIFT; - uvdbg("HCSPARAMS=%08x nports=%d\n", regval, nports); + usbhost_vtrace2(EHCI_VTRACE2_HCSPARAMS, nports, regval); DEBUGASSERT(nports == SAM_EHCI_NRHPORT); /* Show the HCCPARAMS register */ regval = sam_getreg(&HCCR->hccparams); - uvdbg("HCCPARAMS=%08x\n", regval); + usbhost_vtrace1(EHCI_VTRACE1_HCCPARAMS, regval); #endif /* Initialize the head of the asynchronous queue/reclamation list. @@ -4363,7 +4408,7 @@ FAR struct usbhost_connection_s *sam_ehci_initialize(int controller) /* Enable interrupts at the interrupt controller */ up_enable_irq(SAM_IRQ_UHPHS); /* enable USB interrupt */ - uvdbg("USB EHCI Initialized\n"); + usbhost_vtrace1(EHCI_VTRACE1_INIITIALIZED, 0); /* Initialize and return the connection interface */ diff --git a/nuttx/arch/arm/src/sama5/sam_usbhost.c b/nuttx/arch/arm/src/sama5/sam_usbhost.c index 2a9db446d..80765f147 100644 --- a/nuttx/arch/arm/src/sama5/sam_usbhost.c +++ b/nuttx/arch/arm/src/sama5/sam_usbhost.c @@ -86,6 +86,12 @@ struct sam_usbhost_trace_s static const struct sam_usbhost_trace_s g_trace1[TRACE1_NSTRINGS] = { +#ifdef CONFIG_SAMA5_OHCI +#ifdef CONFIG_USBHOST_TRACE_VERBOSE +#endif +#endif + +#ifdef CONFIG_SAMA5_EHCI TRENTRY(EHCI_TRACE1_SYSTEMERROR, TR_EHCI, TR_FMT1, "EHCI ERROR: System error: %06x\n"), TRENTRY(EHCI_TRACE1_QTDFOREACH_FAILED, TR_EHCI, TR_FMT1, "EHCI ERROR: sam_qtd_foreach failed: %d\n"), TRENTRY(EHCI_TRACE1_QHALLOC_FAILED, TR_EHCI, TR_FMT1, "EHCI ERROR: Failed to allocate a QH\n"), @@ -101,7 +107,7 @@ static const struct sam_usbhost_trace_s g_trace1[TRACE1_NSTRINGS] = TRENTRY(EHCI_TRACE1_TRANSFER_FAILED, TR_EHCI, TR_FMT1, "EHCI ERROR: Transfer failed %d\n"), TRENTRY(EHCI_TRACE1_QHFOREACH_FAILED, TR_EHCI, TR_FMT1, "EHCI ERROR: sam_qh_foreach failed: %d\n"), TRENTRY(EHCI_TRACE1_SYSERR_INTR, TR_EHCI, TR_FMT1, "EHCI: Host System Error Interrupt\n"), - TRENTRY(EHCI_TRACE1_USBERR_INTR, TR_EHCI, TR_FMT1, "EHCI: USB Error Interrupt (USBERRINT) Interrupt\n"), + TRENTRY(EHCI_TRACE1_USBERR_INTR, TR_EHCI, TR_FMT1, "EHCI: USB Error Interrupt (USBERRINT) Interrupt: %06x\n"), TRENTRY(EHCI_TRACE1_EPALLOC_FAILED, TR_EHCI, TR_FMT1, "EHCI ERROR: Failed to allocate EP info structure\n"), TRENTRY(EHCI_TRACE1_BADXFRTYPE, TR_EHCI, TR_FMT1, "EHCI ERROR: Support for transfer type %d not implemented\n"), TRENTRY(EHCI_TRACE1_HCHALTED_TIMEOUT, TR_EHCI, TR_FMT1, "EHCI ERROR: Timed out waiting for HCHalted. USBSTS: %06x\n"), @@ -111,12 +117,48 @@ static const struct sam_usbhost_trace_s g_trace1[TRACE1_NSTRINGS] = TRENTRY(EHCI_TRACE1_RESET_FAILED, TR_EHCI, TR_FMT1, "EHCI ERROR: sam_reset failed: %d\n"), TRENTRY(EHCI_TRACE1_RUN_FAILED, TR_EHCI, TR_FMT1, "EHCI ERROR: EHCI Failed to run: USBSTS=%08x\n"), TRENTRY(EHCI_TRACE1_IRQATTACH_FAILED, TR_EHCI, TR_FMT1, "EHCI ERROR: Failed to attach IRQ%d\n"), +#ifdef CONFIG_USBHOST_TRACE_VERBOSE + TRENTRY(EHCI_VTRACE1_PORTSC_CSC, TR_EHCI, TR_FMT1, "EHCI Connect Status Change: %06x\n"), + TRENTRY(EHCI_VTRACE1_PORTSC_CONNALREADY, TR_EHCI, TR_FMT1, "EHCI Already connected: %06x\n"), + TRENTRY(EHCI_VTRACE1_PORTSC_DISCALREADY, TR_EHCI, TR_FMT1, "EHCI Already disconnected: %06x\n"), + TRENTRY(EHCI_VTRACE1_TOPHALF, TR_EHCI, TR_FMT1, "EHCI Interrupt: %06x\n"), + TRENTRY(EHCI_VTRACE1_AAINTR, TR_EHCI, TR_FMT1, "EHCI Async Advance Interrupt\n"), + TRENTRY(EHCI_VTRACE1_USBINTR, TR_EHCI, TR_FMT1, "EHCI USB Interrupt (USBINT) Interrupt: %06x\n"), + TRENTRY(EHCI_VTRACE1_ENUM_DISCONN, TR_EHCI, TR_FMT1, "EHCI Enumeration not connected\n"), + TRENTRY(EHCI_VTRACE1_INITIALIZING, TR_EHCI, TR_FMT1, "EHCI Initializing EHCI Stack\n"), + TRENTRY(EHCI_VTRACE1_HCCPARAMS, TR_EHCI, TR_FMT1, "EHCI HCCPARAMS=%06x\n"), + TRENTRY(EHCI_VTRACE1_INIITIALIZED, TR_EHCI, TR_FMT1, "EHCI USB EHCI Initialized\n"), +#endif +#endif }; static const struct sam_usbhost_trace_s g_trace2[TRACE2_NSTRINGS] = { +#ifdef CONFIG_SAMA5_OHCI +#ifdef CONFIG_USBHOST_TRACE_VERBOSE +#endif +#endif + +#ifdef CONFIG_SAMA5_EHCI TRENTRY(EHCI_TRACE2_EPSTALLED, TR_EHCI, TR_FMT2, "EHCI EP%d Stalled: TOKEN=%08x\n"), TRENTRY(EHCI_TRACE2_EPIOERROR, TR_EHCI, TR_FMT2, "EHCI ERROR: EP%d TOKEN=%08x\n"), + TRENTRY(EHCI_TRACE2_CLASSENUM_FAILED, TR_EHCI, TR_FMT2, "EHCI RHport%d usbhost_enumerate() failed: %d\n"), + +#ifdef CONFIG_USBHOST_TRACE_VERBOSE + TRENTRY(EHCI_VTRACE2_ASYNCXFR, TR_EHCI, TR_FMT2, "EHCI Async transfer EP%d buflen=%d\n"), + TRENTRY(EHCI_VTRACE2_INTRXFR, TR_EHCI, TR_FMT2, "EHCI Intr Transfer EP%d buflen=%d\n"), + TRENTRY(EHCI_VTRACE2_IOCCHECK, TR_EHCI, TR_FMT2, "EHCI IOC EP%d TOKEN=%04x\n"), + TRENTRY(EHCI_VTRACE2_PORTSC, TR_EHCI, TR_FMT2, "EHCI PORTSC%d: %04x\n"), + TRENTRY(EHCI_VTRACE2_PORTSC_CONNECTED, TR_EHCI, TR_FMT2, "EHCI RHPort%d connected, pscwait: %d\n"), + TRENTRY(EHCI_VTRACE2_PORTSC_DISCONND, TR_EHCI, TR_FMT2, "EHCI RHport%d disconnected, pscwait: %d\n"), + TRENTRY(EHCI_VTRACE2_MONWAKEUP, TR_EHCI, TR_FMT2, "EHCI RHPort%d connected: %d\n"), + TRENTRY(EHCI_VTRACE2_CLASSENUM, TR_EHCI, TR_FMT2, "EHCI RHPort%d: Enumerate the device, devaddr=%02x\n"), + TRENTRY(EHCI_VTRACE2_EPALLOC, TR_EHCI, TR_FMT2, "EHCI EPALLOC: EP%d TYPE=%d\n"), + TRENTRY(EHCI_VTRACE2_CTRLINOUT, TR_EHCI, TR_FMT2, "EHCI CTRLIN/OUT: RHPort%d req: %02x\n"), + TRENTRY(EHCI_VTRACE2_HCIVERSION, TR_EHCI, TR_FMT2, "EHCI HCIVERSION %x.%02x\n"), + TRENTRY(EHCI_VTRACE2_HCSPARAMS, TR_EHCI, TR_FMT2, "EHCI nports=%d, HCSPARAMS=%06x\n"), +#endif +#endif }; /******************************************************************************************** diff --git a/nuttx/arch/arm/src/sama5/sam_usbhost.h b/nuttx/arch/arm/src/sama5/sam_usbhost.h index f64c94635..2adfa3fd2 100644 --- a/nuttx/arch/arm/src/sama5/sam_usbhost.h +++ b/nuttx/arch/arm/src/sama5/sam_usbhost.h @@ -68,6 +68,12 @@ enum usbhost_trace1codes_e { +#ifdef CONFIG_SAMA5_OHCI +#ifdef CONFIG_USBHOST_TRACE_VERBOSE +#endif +#endif + +#ifdef CONFIG_SAMA5_EHCI EHCI_TRACE1_SYSTEMERROR = 0, /* EHCI ERROR: System error */ EHCI_TRACE1_QTDFOREACH_FAILED, /* EHCI ERROR: sam_qtd_foreach failed */ EHCI_TRACE1_QHALLOC_FAILED, /* EHCI ERROR: Failed to allocate a QH */ @@ -91,13 +97,50 @@ enum usbhost_trace1codes_e EHCI_TRACE1_QTDPOOLALLOC_FAILED, /* EHCI ERROR: Failed to allocate the qTD pool */ EHCI_TRACE1_PERFLALLOC_FAILED, /* EHCI ERROR: Failed to allocate the periodic frame list */ EHCI_TRACE1_RESET_FAILED, /* EHCI ERROR: sam_reset failed */ - EHCI_TRACE1_RUN_FAILED, /* EHCI ERROR: EHCI Failed to run: USBSTS=%08x */ - EHCI_TRACE1_IRQATTACH_FAILED, /* EHCI ERROR: Failed to attach IRQ%d */ + EHCI_TRACE1_RUN_FAILED, /* EHCI ERROR: EHCI Failed to run */ + EHCI_TRACE1_IRQATTACH_FAILED, /* EHCI ERROR: Failed to attach IRQ */ + +#ifdef CONFIG_USBHOST_TRACE_VERBOSE + EHCI_VTRACE1_PORTSC_CSC, /* EHCI Connect Status Change */ + EHCI_VTRACE1_PORTSC_CONNALREADY, /* EHCI Already connected */ + EHCI_VTRACE1_PORTSC_DISCALREADY, /* EHCI Already disconnected */ + EHCI_VTRACE1_TOPHALF, /* EHCI Interrupt top half */ + EHCI_VTRACE1_AAINTR, /* EHCI Async Advance Interrupt */ + EHCI_VTRACE1_USBINTR, /* EHCI USB Interrupt (USBINT) Interrupt */ + EHCI_VTRACE1_ENUM_DISCONN, /* EHCI Enumeration not connected */ + EHCI_VTRACE1_INITIALIZING, /* EHCI Initializing EHCI Stack */ + EHCI_VTRACE1_HCCPARAMS, /* EHCI HCCPARAMS */ + EHCI_VTRACE1_INIITIALIZED, /* EHCI USB EHCI Initialized */ +#endif +#endif __TRACE1_NSTRINGS, +#ifdef CONFIG_SAMA5_OHCI +#ifdef CONFIG_USBHOST_TRACE_VERBOSE +#endif +#endif + +#ifdef CONFIG_SAMA5_EHCI EHCI_TRACE2_EPSTALLED, /* EHCI EP Stalled */ EHCI_TRACE2_EPIOERROR, /* EHCI ERROR: EP TOKEN */ + EHCI_TRACE2_CLASSENUM_FAILED, /* EHCI usbhost_enumerate() failed */ + +#ifdef CONFIG_USBHOST_TRACE_VERBOSE + EHCI_VTRACE2_ASYNCXFR, /* EHCI Async transfer */ + EHCI_VTRACE2_INTRXFR, /* EHCI Interrupt Transfer */ + EHCI_VTRACE2_IOCCHECK, /* EHCI IOC */ + EHCI_VTRACE2_PORTSC, /* EHCI PORTSC */ + EHCI_VTRACE2_PORTSC_CONNECTED, /* EHCI RHPort connected */ + EHCI_VTRACE2_PORTSC_DISCONND, /* EHCI RHport disconnected */ + EHCI_VTRACE2_MONWAKEUP, /* EHCI RHPort connected wakeup */ + EHCI_VTRACE2_CLASSENUM, /* EHCI RHPort CLASS enumeration */ + EHCI_VTRACE2_EPALLOC, /* EHCI EPALLOC */ + EHCI_VTRACE2_CTRLINOUT, /* EHCI CTRLIN/OUT */ + EHCI_VTRACE2_HCIVERSION, /* EHCI HCIVERSION */ + EHCI_VTRACE2_HCSPARAMS, /* EHCI HCSPARAMS */ +#endif +#endif __TRACE2_NSTRINGS }; diff --git a/nuttx/drivers/usbhost/Kconfig b/nuttx/drivers/usbhost/Kconfig index b8c23fc0c..51a432a3d 100644 --- a/nuttx/drivers/usbhost/Kconfig +++ b/nuttx/drivers/usbhost/Kconfig @@ -133,6 +133,11 @@ config USBHOST_TRACE_VERBOSE bool "Enable verbose debug trace" default n ---help--- - Number of verbose trace output if supported by the platform. + Enable verbose trace output if supported by the platform. The + intent is that if USBHOST_TRACE_VERBOSE is not defined, then only + errors, warnings, and critical messages would be logged. If + USBHOST_TRACE_VERBOSE is defined, then general informative trace + information would also be included. + +endif -endif
\ No newline at end of file diff --git a/nuttx/drivers/usbhost/usbhost_trace.c b/nuttx/drivers/usbhost/usbhost_trace.c index cb34d8fd2..92dc2c570 100644 --- a/nuttx/drivers/usbhost/usbhost_trace.c +++ b/nuttx/drivers/usbhost/usbhost_trace.c @@ -72,8 +72,8 @@ #ifdef CONFIG_USBHOST_TRACE static uint32_t g_trace[CONFIG_USBHOST_TRACE_NRECORDS]; -static uint16_t g_head = 0; -static uint16_t g_tail = 0; +static volatile uint16_t g_head = 0; +static volatile uint16_t g_tail = 0; static volatile bool g_disabled = false; #endif diff --git a/nuttx/include/nuttx/usb/usbhost_trace.h b/nuttx/include/nuttx/usb/usbhost_trace.h index 2e5dcd00a..0c8f0132a 100644 --- a/nuttx/include/nuttx/usb/usbhost_trace.h +++ b/nuttx/include/nuttx/usb/usbhost_trace.h @@ -93,13 +93,29 @@ extern "C" { * ****************************************************************************/ -#if defined(CONFIG_USBHOST_TRACE) || \ - (defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_USB)) +#ifndef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# undef CONFIG_DEBUG_USB +#endif + +#if defined(CONFIG_USBHOST_TRACE) || defined(CONFIG_DEBUG_USB) void usbhost_trace1(uint16_t id, uint32_t u23); void usbhost_trace2(uint16_t id, uint8_t u7, uint16_t u16); + +#if defined(CONFIG_USBHOST_TRACE_VERBOSE) || \ + (defined(CONFIG_DEBUG_VERBOSE) && defined(CONFIG_DEBUG_USB)) +# define usbhost_vtrace1(id, u23) usbhost_trace1(id, u23) +# define usbhost_vtrace2(id, u7, u16) usbhost_trace2(id, u7, u16) +#else +# define usbhost_vtrace1(id, u23) +# define usbhost_vtrace2(id, u7, u16) +#endif + #else # define usbhost_trace1(id, u23) # define usbhost_trace2(id, u7, u16) +# define usbhost_vtrace1(id, u23) +# define usbhost_vtrace2(id, u7, u16) #endif /**************************************************************************** |