diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-03-20 10:56:30 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-03-20 10:56:30 -0600 |
commit | f8c6f5c5181f02eeb969c501ef0b5fef363a2fb1 (patch) | |
tree | 67f5f710b13ac0d5524e366866763e2b1b106e8f /nuttx/arch/z16 | |
parent | 35392d553c92ad96c944800bbb50defb4ca66f13 (diff) | |
download | nuttx-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/z16')
-rw-r--r-- | nuttx/arch/z16/src/common/up_assert.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/nuttx/arch/z16/src/common/up_assert.c b/nuttx/arch/z16/src/common/up_assert.c index 454df8023..bc63f9b6c 100644 --- a/nuttx/arch/z16/src/common/up_assert.c +++ b/nuttx/arch/z16/src/common/up_assert.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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,8 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> +#include <nuttx/usb/usbdev_trace.h> + #include <arch/board/board.h> #include "chip/chip.h" @@ -53,8 +55,13 @@ #include "up_internal.h" /**************************************************************************** - * Definitions + * Pre-processor 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 +108,18 @@ static void _up_assert(int errorcode) /* noreturn_function */ } /**************************************************************************** + * 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 ****************************************************************************/ @@ -138,5 +157,12 @@ void up_assert(void) up_stackdump(); up_registerdump(); - _up_assert(EXIT_FAILURE); + +#ifdef CONFIG_ARCH_USBDUMP + /* Dump USB trace data */ + + (void)usbtrace_enumerate(assert_tracecallback, NULL); +#endif + + _up_assert(EXIT_FAILURE); } |