summaryrefslogtreecommitdiff
path: root/nuttx/arch/sh
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-03-20 10:56:30 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-03-20 10:56:30 -0600
commitf8c6f5c5181f02eeb969c501ef0b5fef363a2fb1 (patch)
tree67f5f710b13ac0d5524e366866763e2b1b106e8f /nuttx/arch/sh
parent35392d553c92ad96c944800bbb50defb4ca66f13 (diff)
downloadnuttx-f8c6f5c5181f02eeb969c501ef0b5fef363a2fb1.tar.gz
nuttx-f8c6f5c5181f02eeb969c501ef0b5fef363a2fb1.tar.bz2
nuttx-f8c6f5c5181f02eeb969c501ef0b5fef363a2fb1.zip
Add option to dump buffered USB trace data on an assertion
Diffstat (limited to 'nuttx/arch/sh')
-rw-r--r--nuttx/arch/sh/src/common/up_assert.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/nuttx/arch/sh/src/common/up_assert.c b/nuttx/arch/sh/src/common/up_assert.c
index 372282804..12f177e8f 100644
--- a/nuttx/arch/sh/src/common/up_assert.c
+++ b/nuttx/arch/sh/src/common/up_assert.c
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/sh/src/common/up_assert.c
*
- * Copyright (C) 2008-2009, 2012-2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009, 2012-2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -46,6 +46,9 @@
#include <nuttx/irq.h>
#include <nuttx/arch.h>
+#include <nuttx/usb/usbdev_trace.h>
+
+#include <nuttx/usb/usbdev_trace.h>
#include "up_arch.h"
#include "os_internal.h"
@@ -54,6 +57,11 @@
/****************************************************************************
* Definitions
****************************************************************************/
+/* USB trace dumping */
+
+#ifndef CONFIG_USBDEV_TRACE
+# undef CONFIG_ARCH_USBDUMP
+#endif
/* Output debug info if stack dump is selected -- even if
* debug is not selected.
@@ -101,6 +109,18 @@ static void _up_assert(int errorcode)
}
/****************************************************************************
+ * Name: assert_tracecallback
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_USBDUMP
+static int assert_tracecallback(struct usbtrace_s *trace, void *arg)
+{
+ usbtrace_trprintf((trprintf_t)lowsyslog, trace->event, trace->value);
+ return 0;
+}
+#endif
+
+/****************************************************************************
* Public Functions
****************************************************************************/
@@ -125,5 +145,12 @@ void up_assert(const uint8_t *filename, int lineno)
#endif
up_dumpstate();
+
+#ifdef CONFIG_ARCH_USBDUMP
+ /* Dump USB trace data */
+
+ (void)usbtrace_enumerate(assert_tracecallback, NULL);
+#endif
+
_up_assert(EXIT_FAILURE);
}