Fix inconsistency in USB host tracing definitions

This commit is contained in:
Gregory Nutt 2013-09-19 08:46:33 -06:00
parent db9d3dfce6
commit ac3dfce614
3 changed files with 44 additions and 17 deletions

View File

@ -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).

View File

@ -41,6 +41,7 @@
************************************************************************************/
#include <nuttx/config.h>
#include <nuttx/usb/usbhost_trace.h>
#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

View File

@ -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