summaryrefslogtreecommitdiff
path: root/nuttx/drivers
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-10-28 01:18:37 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-10-28 01:18:37 +0000
commitf8c80edc454ccbce3679b0e16b1ead6f2312e9cb (patch)
treedfce448d9fe2950c18bb302bd55594a16b99efd4 /nuttx/drivers
parent31126f8134ee755a5f8934a2a4dc2125e8edc73f (diff)
downloadpx4-nuttx-f8c80edc454ccbce3679b0e16b1ead6f2312e9cb.tar.gz
px4-nuttx-f8c80edc454ccbce3679b0e16b1ead6f2312e9cb.tar.bz2
px4-nuttx-f8c80edc454ccbce3679b0e16b1ead6f2312e9cb.zip
Integrate USB tracing
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1091 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers')
-rw-r--r--nuttx/drivers/usbdev/usbdev_trace.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/nuttx/drivers/usbdev/usbdev_trace.c b/nuttx/drivers/usbdev/usbdev_trace.c
index 810500f27..d55828183 100644
--- a/nuttx/drivers/usbdev/usbdev_trace.c
+++ b/nuttx/drivers/usbdev/usbdev_trace.c
@@ -143,7 +143,7 @@ void usbtrace(uint16 event, uint16 value)
if ((g_maskedidset & TRACE_ID2BIT(event)) != 0)
{
#ifdef CONFIG_USBDEV_TRACE
- /* Yes... save the new trace data at the nead */
+ /* Yes... save the new trace data at the head */
g_trace[g_head].event = event;
g_trace[g_tail].event = value;
@@ -354,16 +354,17 @@ void usbtrace(uint16 event, uint16 value)
#ifdef CONFIG_USBDEV_TRACE
int usbtrace_enumerate(trace_callback_t callback, void *arg)
{
- uint16 ndx = g_tail;
+ uint16 ndx;
+ uint32 idset;
int ret = OK;
/* Temporarily disable tracing */
- usbtrace_enable(FALSE);
+ idset = usbtrace_enable(0);
/* Visit every entry, starting with the tail */
- while (g_tail != g_head)
+ for (ndx = g_tail; ndx != g_head; )
{
/* Call the user provided callback */
@@ -383,6 +384,13 @@ int usbtrace_enumerate(trace_callback_t callback, void *arg)
}
}
+ /* Discard the trace data after it has been reported */
+
+ g_tail = g_head;
+
+ /* Restore tracing state */
+
+ (void)usbtrace_enable(idset);
return ret;
}
#endif /* CONFIG_USBDEV_TRACE */