From be72c31d8d36f4d0b0db4053918137d80cd5d8f5 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 19 Sep 2013 08:46:33 -0600 Subject: Fix inconsistency in USB host tracing definitions --- nuttx/ChangeLog | 4 ++++ nuttx/arch/arm/src/sama5/sam_usbhost.h | 24 ++++++++++++++---------- nuttx/include/nuttx/usb/usbhost_trace.h | 33 ++++++++++++++++++++++++++------- 3 files changed, 44 insertions(+), 17 deletions(-) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 67e007695..e555daa5f 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -5590,4 +5590,8 @@ prototype. This was cause compile time warnings (2013-9-17). * configs/sama5d3x-ek/src/sam_ostest.c: Add OS test support for the FPU test (2013-9-18). + * arch/arm/src/sama5/sam_usbhost.h and include/nuttx/usb/usbhost_trace.h + Correct some inconsistencies in the way that USB configuration + settings are used. This caused compilation errors in SAMA5 OHCI + when USB debug was ON but USB host tracing was off (2013-9-19). diff --git a/nuttx/arch/arm/src/sama5/sam_usbhost.h b/nuttx/arch/arm/src/sama5/sam_usbhost.h index 74928a6a0..79e4c6c85 100644 --- a/nuttx/arch/arm/src/sama5/sam_usbhost.h +++ b/nuttx/arch/arm/src/sama5/sam_usbhost.h @@ -41,6 +41,7 @@ ************************************************************************************/ #include +#include #ifdef CONFIG_USBHOST @@ -66,6 +67,7 @@ * Public Types ************************************************************************************/ +#ifdef HAVE_USBHOST_TRACE enum usbhost_trace1codes_e { __TRACE1_BASEVALUE = 0, /* This will force the first value to be 1 */ @@ -79,7 +81,7 @@ enum usbhost_trace1codes_e OHCI_TRACE1_TDALLOC_FAILED, /* OHCI ERROR: Failed to allocate TD */ OHCI_TRACE1_IRQATTACH, /* OHCI ERROR: Failed to attach IRQ */ -#ifdef CONFIG_USBHOST_TRACE_VERBOSE +#ifdef HAVE_USBHOST_TRACE_VERBOSE OHCI_VTRACE1_PHYSED, /* OHCI physed */ OHCI_VTRACE1_VIRTED, /* OHCI ed */ OHCI_VTRACE1_CSC, /* OHCI Connect Status Change */ @@ -123,7 +125,7 @@ enum usbhost_trace1codes_e 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 +#ifdef HAVE_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 */ @@ -146,7 +148,7 @@ enum usbhost_trace1codes_e OHCI_TRACE2_EDENQUEUE_FAILED, /* OHCI ERROR: Failed to queue ED for transfer type */ OHCI_TRACE2_CLASSENUM_FAILED, /* OHCI usbhost_enumerate() failed */ -#ifdef CONFIG_USBHOST_TRACE_VERBOSE +#ifdef HAVE_USBHOST_TRACE_VERBOSE OHCI_VTRACE2_INTERVAL, /* OHCI interval */ OHCI_VTRACE2_MININTERVAL, /* OHCI MIN interval/offset */ OHCI_VTRACE2_RHPORTST, /* OHCI RHPORTST */ @@ -168,7 +170,7 @@ enum usbhost_trace1codes_e EHCI_TRACE2_EPIOERROR, /* EHCI ERROR: EP TOKEN */ EHCI_TRACE2_CLASSENUM_FAILED, /* EHCI usbhost_enumerate() failed */ -#ifdef CONFIG_USBHOST_TRACE_VERBOSE +#ifdef HAVE_USBHOST_TRACE_VERBOSE EHCI_VTRACE2_ASYNCXFR, /* EHCI Async transfer */ EHCI_VTRACE2_INTRXFR, /* EHCI Interrupt Transfer */ EHCI_VTRACE2_IOCCHECK, /* EHCI IOC */ @@ -187,13 +189,15 @@ enum usbhost_trace1codes_e __TRACE2_NSTRINGS /* Total number of enumeration values */ }; -#define TRACE1_FIRST ((int)__TRACE1_BASEVALUE + 1) -#define TRACE1_INDEX(id) ((int)(id) - TRACE1_FIRST) -#define TRACE1_NSTRINGS TRACE1_INDEX(__TRACE1_NSTRINGS) +# define TRACE1_FIRST ((int)__TRACE1_BASEVALUE + 1) +# define TRACE1_INDEX(id) ((int)(id) - TRACE1_FIRST) +# define TRACE1_NSTRINGS TRACE1_INDEX(__TRACE1_NSTRINGS) -#define TRACE2_FIRST ((int)__TRACE1_NSTRINGS + 1) -#define TRACE2_INDEX(id) ((int)(id) - TRACE2_FIRST) -#define TRACE2_NSTRINGS TRACE2_INDEX(__TRACE2_NSTRINGS) +# define TRACE2_FIRST ((int)__TRACE1_NSTRINGS + 1) +# define TRACE2_INDEX(id) ((int)(id) - TRACE2_FIRST) +# define TRACE2_NSTRINGS TRACE2_INDEX(__TRACE2_NSTRINGS) + +#endif /************************************************************************************ * Public Data diff --git a/nuttx/include/nuttx/usb/usbhost_trace.h b/nuttx/include/nuttx/usb/usbhost_trace.h index 0c8f0132a..c2b3b89e5 100644 --- a/nuttx/include/nuttx/usb/usbhost_trace.h +++ b/nuttx/include/nuttx/usb/usbhost_trace.h @@ -45,6 +45,27 @@ /**************************************************************************** * Pre-processor definitions ****************************************************************************/ +/* Configuration ************************************************************/ +/* Debug/Trace-related definitions */ + +#ifndef CONFIG_DEBUG +# undef CONFIG_DEBUG_USB +# undef CONFIG_DEBUG_VERBOSE +#endif + +#ifndef CONFIG_USBHOST_TRACE +# undef CONFIG_USBHOST_TRACE_VERBOSE +#endif + +/* Trace support is needed if either USB host tracing or USB debug output is enabled */ + +#if defined(CONFIG_USBHOST_TRACE) || defined(CONFIG_DEBUG_USB) +# define HAVE_USBHOST_TRACE +# if defined(CONFIG_USBHOST_TRACE_VERBOSE) || defined(CONFIG_DEBUG_VERBOSE) +# define HAVE_USBHOST_TRACE_VERBOSE +# endif +#endif + /* Event encoding/decoding macros *******************************************/ #define TRACE_ENCODE1(id,u23) (((uint32_t)(id) & 0x1ff) << 23 | \ @@ -98,12 +119,11 @@ extern "C" { # undef CONFIG_DEBUG_USB #endif -#if defined(CONFIG_USBHOST_TRACE) || defined(CONFIG_DEBUG_USB) +#ifdef HAVE_USBHOST_TRACE 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)) +#ifdef HAVE_USBHOST_TRACE_VERBOSE # define usbhost_vtrace1(id, u23) usbhost_trace1(id, u23) # define usbhost_vtrace2(id, u7, u16) usbhost_trace2(id, u7, u16) #else @@ -129,7 +149,7 @@ void usbhost_trace2(uint16_t id, uint8_t u7, uint16_t u16); * ****************************************************************************/ -#if defined(CONFIG_USBHOST_TRACE) +#ifdef CONFIG_USBHOST_TRACE int usbhost_trenumerate(usbhost_trcallback_t callback, FAR void *arg); #else # define usbhost_trenumerate(callback,arg) @@ -146,7 +166,7 @@ int usbhost_trenumerate(usbhost_trcallback_t callback, FAR void *arg); * ****************************************************************************/ -#if defined(CONFIG_USBHOST_TRACE) +#ifdef CONFIG_USBHOST_TRACE int usbhost_trdump(void); #else # define usbhost_trdump(void) @@ -165,8 +185,7 @@ int usbhost_trdump(void); * ****************************************************************************/ -#if defined(CONFIG_USBHOST_TRACE) || \ - (defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_USB)) +#ifdef HAVE_USBHOST_TRACE FAR const char *usbhost_trformat1(uint16_t id); FAR const char *usbhost_trformat2(uint16_t id); #endif -- cgit v1.2.3