diff --git a/arch/arm/src/sama5/sam_usbhost.c b/arch/arm/src/sama5/sam_usbhost.c index 5b3ee84e78b..2a9db446d9b 100644 --- a/arch/arm/src/sama5/sam_usbhost.c +++ b/arch/arm/src/sama5/sam_usbhost.c @@ -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 */ diff --git a/configs/sama5d3x-ek/src/sama5d3x-ek.h b/configs/sama5d3x-ek/src/sama5d3x-ek.h index bfcb272f2a7..8bfddb33707 100644 --- a/configs/sama5d3x-ek/src/sama5d3x-ek.h +++ b/configs/sama5d3x-ek/src/sama5d3x-ek.h @@ -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 diff --git a/drivers/usbhost/Kconfig b/drivers/usbhost/Kconfig index b33bbf88751..b8c23fc0c8f 100644 --- a/drivers/usbhost/Kconfig +++ b/drivers/usbhost/Kconfig @@ -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 \ No newline at end of file