USB monitor extended so that it can also be used with USB host trace data

This commit is contained in:
Gregory Nutt 2013-09-09 15:02:33 -06:00
parent fbd5ab0758
commit 3ba64b0cfe
3 changed files with 41 additions and 7 deletions

View File

@ -62,6 +62,10 @@
#define TRENTRY(id,ehci,fmt1,string) {string}
#ifndef NULL
# define NULL ((FAR void *)0)
#endif
/********************************************************************************************
* Private Types
********************************************************************************************/
@ -139,15 +143,25 @@ static const struct sam_usbhost_trace_s g_trace2[TRACE2_NSTRINGS] =
FAR const char *usbhost_trformat1(uint16_t id)
{
int ndx = TRACE1_INDEX(id);
DEBUGASSERT(ndx < TRACE1_NSTRINGS);
return g_trace1[ndx].string;
if (ndx < TRACE1_NSTRINGS)
{
return g_trace1[ndx].string;
}
return NULL;
}
FAR const char *usbhost_trformat2(uint16_t id)
{
int ndx = TRACE2_INDEX(id);
DEBUGASSERT(ndx < TRACE2_NSTRINGS);
return g_trace2[ndx].string;
if (ndx < TRACE2_NSTRINGS)
{
return g_trace2[ndx].string;
}
return NULL;
}
#endif /* CONFIG_USBHOST_TRACE || CONFIG_DEBUG && CONFIG_DEBUG_USB */

View File

@ -172,8 +172,19 @@
/* Check if we should enable the USB monitor before starting NSH */
#if !defined(HAVE_USBDEV) || !defined(CONFIG_USBDEV_TRACE) || \
!defined(CONFIG_SYSTEM_USBMONITOR)
#ifndef CONFIG_SYSTEM_USBMONITOR
# undef HAVE_USBMONITOR
#endif
#ifndef HAVE_USBDEV
# undef CONFIG_USBDEV_TRACE
#endif
#ifndef HAVE_USBHOST
# undef CONFIG_USBHOST_TRACE
#endif
#if !defined(CONFIG_USBDEV_TRACE) && !defined(CONFIG_USBHOST_TRACE)
# undef HAVE_USBMONITOR
#endif

View File

@ -121,9 +121,18 @@ config USBHOST_TRACE
Enables USB tracing for debug. Only supported for the HCD and,
further, no supported by all HCD implementations.
if USBHOST_TRACE
config USBHOST_TRACE_NRECORDS
int "Number of trace entries to remember"
default 128
depends on USBHOST_TRACE
---help---
Number of trace entries to remember.
config USBHOST_TRACE_VERBOSE
bool "Enable verbose debug trace"
default n
---help---
Number of verbose trace output if supported by the platform.
endif