mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-28 02:36:37 +08:00
The USB monitor now works with the stm32f4discover/nsh configuration (but not with the usbnsh configuration)
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5580 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
+17
-3
@@ -406,7 +406,7 @@ config NSH_USBCONDEV
|
|||||||
readable/write-able USB driver such as:
|
readable/write-able USB driver such as:
|
||||||
NSH_USBCONDEV="/dev/ttyACM0".
|
NSH_USBCONDEV="/dev/ttyACM0".
|
||||||
|
|
||||||
config UBSDEV_MINOR
|
config USBDEV_MINOR
|
||||||
int "USB console device minor number"
|
int "USB console device minor number"
|
||||||
default 0
|
default 0
|
||||||
depends on NSH_USBCONSOLE
|
depends on NSH_USBCONSOLE
|
||||||
@@ -414,8 +414,22 @@ config UBSDEV_MINOR
|
|||||||
If there are more than one USB devices, then a USB device
|
If there are more than one USB devices, then a USB device
|
||||||
minor number may also need to be provided. Default: 0
|
minor number may also need to be provided. Default: 0
|
||||||
|
|
||||||
menu "USB Trace Support"
|
comment "USB Trace Support"
|
||||||
|
config NSH_USBDEV_TRACE
|
||||||
|
bool "Enable Builtin USB Trace Support"
|
||||||
|
default n
|
||||||
depends on USBDEV && (DEBUG || USBDEV_TRACE)
|
depends on USBDEV && (DEBUG || USBDEV_TRACE)
|
||||||
|
---help---
|
||||||
|
Enable builtin USB trace support in NSH. If selected, buffered USB
|
||||||
|
trace data will be presented each time a command is provided to NSH.
|
||||||
|
The USB trace data will be sent to the console unless DEBUG set or
|
||||||
|
unless you are using a USB console. In those cases, the trace data
|
||||||
|
will go to the SYSLOG device.
|
||||||
|
|
||||||
|
If not enabled, the USB trace support can be provided by external
|
||||||
|
logic such as apps/system/usbmonitor.
|
||||||
|
|
||||||
|
if NSH_USBDEV_TRACE
|
||||||
|
|
||||||
config NSH_USBDEV_TRACEINIT
|
config NSH_USBDEV_TRACEINIT
|
||||||
bool "Show initialization events"
|
bool "Show initialization events"
|
||||||
@@ -447,7 +461,7 @@ config NSH_USBDEV_TRACEINTERRUPTS
|
|||||||
---help---
|
---help---
|
||||||
Show interrupt-related events
|
Show interrupt-related events
|
||||||
|
|
||||||
endmenu
|
endif
|
||||||
|
|
||||||
config NSH_CONDEV
|
config NSH_CONDEV
|
||||||
bool "Default console device"
|
bool "Default console device"
|
||||||
|
|||||||
@@ -1025,12 +1025,16 @@ NSH-Specific Configuration Settings
|
|||||||
If there are more than one USB devices, then a USB device
|
If there are more than one USB devices, then a USB device
|
||||||
minor number may also need to be provided:
|
minor number may also need to be provided:
|
||||||
|
|
||||||
CONFIG_NSH_UBSDEV_MINOR
|
CONFIG_NSH_USBDEV_MINOR
|
||||||
The minor device number of the USB device. Default: 0
|
The minor device number of the USB device. Default: 0
|
||||||
|
|
||||||
If USB tracing is enabled (CONFIG_USBDEV_TRACE), then NSH will
|
CONFIG_NSH_USBDEV_TRACE
|
||||||
initialize USB tracing as requested by the following. Default:
|
If USB tracing is enabled (CONFIG_USBDEV_TRACE), then NSH can
|
||||||
Only USB errors are traced.
|
be configured to show the buffered USB trace data afer each
|
||||||
|
NSH command:
|
||||||
|
|
||||||
|
If CONFIG_NSH_USBDEV_TRACE is selected, then USB trace data
|
||||||
|
can be filtered as follows. Default: Only USB errors are traced.
|
||||||
|
|
||||||
CONFIG_NSH_USBDEV_TRACEINIT
|
CONFIG_NSH_USBDEV_TRACEINIT
|
||||||
Show initialization events
|
Show initialization events
|
||||||
|
|||||||
+45
-33
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* apps/nshlib/nsh.h
|
* apps/nshlib/nsh.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2013 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -93,7 +93,9 @@
|
|||||||
# elif defined(CONFIG_CDCACM) && defined(CONFIG_CDCACM_CONSOLE)
|
# elif defined(CONFIG_CDCACM) && defined(CONFIG_CDCACM_CONSOLE)
|
||||||
# define HAVE_USB_CONSOLE 1
|
# define HAVE_USB_CONSOLE 1
|
||||||
|
|
||||||
/* Check for other USB console. USB console device must be provided in CONFIG_NSH_CONDEV */
|
/* Check for other USB console. USB console device must be provided in
|
||||||
|
* CONFIG_NSH_CONDEV.
|
||||||
|
*/
|
||||||
|
|
||||||
# elif defined(CONFIG_NSH_USBCONSOLE)
|
# elif defined(CONFIG_NSH_USBCONSOLE)
|
||||||
# define HAVE_USB_CONSOLE 1
|
# define HAVE_USB_CONSOLE 1
|
||||||
@@ -106,8 +108,8 @@
|
|||||||
|
|
||||||
/* The default USB console device minor number is 0*/
|
/* The default USB console device minor number is 0*/
|
||||||
|
|
||||||
# ifndef CONFIG_NSH_UBSDEV_MINOR
|
# ifndef CONFIG_NSH_USBDEV_MINOR
|
||||||
# define CONFIG_NSH_UBSDEV_MINOR 0
|
# define CONFIG_NSH_USBDEV_MINOR 0
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* The default console device is always /dev/console */
|
/* The default console device is always /dev/console */
|
||||||
@@ -118,42 +120,52 @@
|
|||||||
|
|
||||||
/* USB trace settings */
|
/* USB trace settings */
|
||||||
|
|
||||||
#ifdef CONFIG_NSH_USBDEV_TRACEINIT
|
#ifndef CONFIG_USBDEV_TRACE
|
||||||
# define TRACE_INIT_BITS (TRACE_INIT_BIT)
|
# undef CONFIG_NSH_USBDEV_TRACE
|
||||||
#else
|
|
||||||
# define TRACE_INIT_BITS (0)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TRACE_ERROR_BITS (TRACE_DEVERROR_BIT|TRACE_CLSERROR_BIT)
|
#ifdef CONFIG_NSH_USBDEV_TRACE
|
||||||
|
# ifdef CONFIG_NSH_USBDEV_TRACEINIT
|
||||||
|
# define TRACE_INIT_BITS (TRACE_INIT_BIT)
|
||||||
|
# else
|
||||||
|
# define TRACE_INIT_BITS (0)
|
||||||
|
# endif
|
||||||
|
|
||||||
#ifdef CONFIG_NSH_USBDEV_TRACECLASS
|
# define TRACE_ERROR_BITS (TRACE_DEVERROR_BIT|TRACE_CLSERROR_BIT)
|
||||||
# define TRACE_CLASS_BITS (TRACE_CLASS_BIT|TRACE_CLASSAPI_BIT|TRACE_CLASSSTATE_BIT)
|
|
||||||
#else
|
|
||||||
# define TRACE_CLASS_BITS (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_NSH_USBDEV_TRACETRANSFERS
|
# ifdef CONFIG_NSH_USBDEV_TRACECLASS
|
||||||
# define TRACE_TRANSFER_BITS (TRACE_OUTREQQUEUED_BIT|TRACE_INREQQUEUED_BIT|TRACE_READ_BIT|\
|
# define TRACE_CLASS_BITS (TRACE_CLASS_BIT|TRACE_CLASSAPI_BIT|\
|
||||||
TRACE_WRITE_BIT|TRACE_COMPLETE_BIT)
|
TRACE_CLASSSTATE_BIT)
|
||||||
#else
|
# else
|
||||||
# define TRACE_TRANSFER_BITS (0)
|
# define TRACE_CLASS_BITS (0)
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#ifdef CONFIG_NSH_USBDEV_TRACECONTROLLER
|
# ifdef CONFIG_NSH_USBDEV_TRACETRANSFERS
|
||||||
# define TRACE_CONTROLLER_BITS (TRACE_EP_BIT|TRACE_DEV_BIT)
|
# define TRACE_TRANSFER_BITS (TRACE_OUTREQQUEUED_BIT|TRACE_INREQQUEUED_BIT|\
|
||||||
#else
|
TRACE_READ_BIT|TRACE_WRITE_BIT|\
|
||||||
# define TRACE_CONTROLLER_BITS (0)
|
TRACE_COMPLETE_BIT)
|
||||||
#endif
|
# else
|
||||||
|
# define TRACE_TRANSFER_BITS (0)
|
||||||
|
# endif
|
||||||
|
|
||||||
#ifdef CONFIG_NSH_USBDEV_TRACEINTERRUPTS
|
# ifdef CONFIG_NSH_USBDEV_TRACECONTROLLER
|
||||||
# define TRACE_INTERRUPT_BITS (TRACE_INTENTRY_BIT|TRACE_INTDECODE_BIT|TRACE_INTEXIT_BIT)
|
# define TRACE_CONTROLLER_BITS (TRACE_EP_BIT|TRACE_DEV_BIT)
|
||||||
#else
|
# else
|
||||||
# define TRACE_INTERRUPT_BITS (0)
|
# define TRACE_CONTROLLER_BITS (0)
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#define TRACE_BITSET (TRACE_INIT_BITS|TRACE_ERROR_BITS|TRACE_CLASS_BITS|\
|
# ifdef CONFIG_NSH_USBDEV_TRACEINTERRUPTS
|
||||||
TRACE_TRANSFER_BITS|TRACE_CONTROLLER_BITS|TRACE_INTERRUPT_BITS)
|
# define TRACE_INTERRUPT_BITS (TRACE_INTENTRY_BIT|TRACE_INTDECODE_BIT|\
|
||||||
|
TRACE_INTEXIT_BIT)
|
||||||
|
# else
|
||||||
|
# define TRACE_INTERRUPT_BITS (0)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define TRACE_BITSET (TRACE_INIT_BITS|TRACE_ERROR_BITS|\
|
||||||
|
TRACE_CLASS_BITS|TRACE_TRANSFER_BITS|\
|
||||||
|
TRACE_CONTROLLER_BITS|TRACE_INTERRUPT_BITS)
|
||||||
|
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If Telnet is selected for the NSH console, then we must configure
|
/* If Telnet is selected for the NSH console, then we must configure
|
||||||
@@ -515,7 +527,7 @@ void nsh_dumpbuffer(FAR struct nsh_vtbl_s *vtbl, const char *msg,
|
|||||||
|
|
||||||
/* USB debug support */
|
/* USB debug support */
|
||||||
|
|
||||||
#if defined(CONFIG_USBDEV_TRACE) && defined(HAVE_USB_CONSOLE)
|
#if defined(CONFIG_NSH_USBDEV_TRACE) && defined(HAVE_USB_CONSOLE)
|
||||||
void nsh_usbtrace(void);
|
void nsh_usbtrace(void);
|
||||||
#else
|
#else
|
||||||
# define nsh_usbtrace()
|
# define nsh_usbtrace()
|
||||||
|
|||||||
@@ -61,9 +61,15 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
/* Output USB trace data to the console device using printf() unless (1)
|
||||||
|
* debug is enabled, then we want to keep the trace output in sync with the
|
||||||
|
* debug output by using syslog()we are using a USB console. In that case,
|
||||||
|
* we don't want the trace output on the USB console; let's try sending it
|
||||||
|
* a SYSLOG device (hopefully one is set up!)
|
||||||
|
*/
|
||||||
|
|
||||||
#if defined(CONFIG_DEBUG) || defined(CONFIG_NSH_USBCONSOLE)
|
#if defined(CONFIG_DEBUG) || defined(HAVE_USB_CONSOLE)
|
||||||
# define trmessage lowsyslog
|
# define trmessage syslog
|
||||||
#else
|
#else
|
||||||
# define trmessage printf
|
# define trmessage printf
|
||||||
#endif
|
#endif
|
||||||
@@ -92,7 +98,7 @@
|
|||||||
* Name: nsh_tracecallback
|
* Name: nsh_tracecallback
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_USBDEV_TRACE
|
#ifdef CONFIG_NSH_USBDEV_TRACE
|
||||||
static int nsh_tracecallback(struct usbtrace_s *trace, void *arg)
|
static int nsh_tracecallback(struct usbtrace_s *trace, void *arg)
|
||||||
{
|
{
|
||||||
usbtrace_trprintf((trprintf_t)trmessage, trace->event, trace->value);
|
usbtrace_trprintf((trprintf_t)trmessage, trace->event, trace->value);
|
||||||
@@ -119,7 +125,7 @@ int nsh_usbconsole(void)
|
|||||||
|
|
||||||
/* Initialize any USB tracing options that were requested */
|
/* Initialize any USB tracing options that were requested */
|
||||||
|
|
||||||
#ifdef CONFIG_USBDEV_TRACE
|
#ifdef CONFIG_NSH_USBDEV_TRACE
|
||||||
usbtrace_enable(TRACE_BITSET);
|
usbtrace_enable(TRACE_BITSET);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -133,9 +139,9 @@ int nsh_usbconsole(void)
|
|||||||
|
|
||||||
#if defined(CONFIG_PL2303) || defined(CONFIG_CDCACM)
|
#if defined(CONFIG_PL2303) || defined(CONFIG_CDCACM)
|
||||||
#ifdef CONFIG_CDCACM
|
#ifdef CONFIG_CDCACM
|
||||||
ret = cdcacm_initialize(CONFIG_NSH_UBSDEV_MINOR, NULL);
|
ret = cdcacm_initialize(CONFIG_NSH_USBDEV_MINOR, NULL);
|
||||||
#else
|
#else
|
||||||
ret = usbdev_serialinitialize(CONFIG_NSH_UBSDEV_MINOR);
|
ret = usbdev_serialinitialize(CONFIG_NSH_USBDEV_MINOR);
|
||||||
#endif
|
#endif
|
||||||
DEBUGASSERT(ret == OK);
|
DEBUGASSERT(ret == OK);
|
||||||
#endif
|
#endif
|
||||||
@@ -224,6 +230,7 @@ int nsh_usbconsole(void)
|
|||||||
(void)fdopen(0, "r");
|
(void)fdopen(0, "r");
|
||||||
(void)fdopen(1, "a");
|
(void)fdopen(1, "a");
|
||||||
(void)fdopen(2, "a");
|
(void)fdopen(2, "a");
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +240,7 @@ int nsh_usbconsole(void)
|
|||||||
* Name: nsh_usbtrace
|
* Name: nsh_usbtrace
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_USBDEV_TRACE) && defined(HAVE_USB_CONSOLE)
|
#if defined(CONFIG_NSH_USBDEV_TRACE) && defined(HAVE_USB_CONSOLE)
|
||||||
void nsh_usbtrace(void)
|
void nsh_usbtrace(void)
|
||||||
{
|
{
|
||||||
(void)usbtrace_enumerate(nsh_tracecallback, NULL);
|
(void)usbtrace_enumerate(nsh_tracecallback, NULL);
|
||||||
|
|||||||
@@ -16,18 +16,52 @@ config SYSTEM_USBMONITOR
|
|||||||
if SYSTEM_USBMONITOR
|
if SYSTEM_USBMONITOR
|
||||||
|
|
||||||
config SYSTEM_USBMONITOR_STACKSIZE
|
config SYSTEM_USBMONITOR_STACKSIZE
|
||||||
int "USB Monitor Stack Size"
|
int "USB Monitor daemon stack size"
|
||||||
default 2048
|
default 2048
|
||||||
depends on NSH_BUILTIN_APPS
|
|
||||||
---help---
|
---help---
|
||||||
The stack size to use the the USB monitor daemon. Default: 2048
|
The stack size to use the the USB monitor daemon. Default: 2048
|
||||||
|
|
||||||
config SYSTEM_USBMONITOR_PRIORITY
|
config SYSTEM_USBMONITOR_PRIORITY
|
||||||
int "USB Monitor Stack Size"
|
int "USB Monitor daemon priority"
|
||||||
default 50
|
default 50
|
||||||
depends on NSH_BUILTIN_APPS
|
|
||||||
---help---
|
---help---
|
||||||
The priority to use the the USB monitor daemon. Default: 50
|
The priority to use the the USB monitor daemon. Default: 50
|
||||||
|
|
||||||
|
config SYSTEM_USBMONITOR_INTERVAL
|
||||||
|
int "USB Monitor dump frequency"
|
||||||
|
default 2
|
||||||
|
---help---
|
||||||
|
The rate in seconds that the USB monitor will wait before dumping
|
||||||
|
the next set of buffered USB trace data. Default: 2 seconds.
|
||||||
|
|
||||||
|
config SYSTEM_USBMONITOR_TRACEINIT
|
||||||
|
bool "Show initialization events"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Show initialization events
|
||||||
|
|
||||||
|
config SYSTEM_USBMONITOR_TRACECLASS
|
||||||
|
bool "Show class driver events"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Show class driver events
|
||||||
|
|
||||||
|
config SYSTEM_USBMONITOR_TRACETRANSFERS
|
||||||
|
bool "Show data transfer events"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Show data transfer events
|
||||||
|
|
||||||
|
config SYSTEM_USBMONITOR_TRACECONTROLLER
|
||||||
|
bool "Show controller events"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Show controller events
|
||||||
|
|
||||||
|
config SYSTEM_USBMONITOR_TRACEINTERRUPTS
|
||||||
|
bool "Show interrupt-related events"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Show interrupt-related events
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* apps/system/free/free.c
|
* apps/system/usbmonitor/usbmonitor.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -57,6 +57,60 @@
|
|||||||
|
|
||||||
#define USBMON_PREFIX "USB Monitor: "
|
#define USBMON_PREFIX "USB Monitor: "
|
||||||
|
|
||||||
|
/* Configuration ************************************************************/
|
||||||
|
|
||||||
|
#ifndef CONFIG_SYSTEM_USBMONITOR_STACKSIZE
|
||||||
|
# define CONFIG_SYSTEM_USBMONITOR_STACKSIZE 2048
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_SYSTEM_USBMONITOR_PRIORITY
|
||||||
|
# define CONFIG_SYSTEM_USBMONITOR_PRIORITY 50
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_SYSTEM_USBMONITOR_INTERVAL
|
||||||
|
# define CONFIG_SYSTEM_USBMONITOR_INTERVAL 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SYSTEM_USBMONITOR_TRACEINIT
|
||||||
|
# define TRACE_INIT_BITS (TRACE_INIT_BIT)
|
||||||
|
#else
|
||||||
|
# define TRACE_INIT_BITS (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define TRACE_ERROR_BITS (TRACE_DEVERROR_BIT|TRACE_CLSERROR_BIT)
|
||||||
|
|
||||||
|
#ifdef CONFIG_SYSTEM_USBMONITOR_TRACECLASS
|
||||||
|
# define TRACE_CLASS_BITS (TRACE_CLASS_BIT|TRACE_CLASSAPI_BIT|\
|
||||||
|
TRACE_CLASSSTATE_BIT)
|
||||||
|
#else
|
||||||
|
# define TRACE_CLASS_BITS (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SYSTEM_USBMONITOR_TRACETRANSFERS
|
||||||
|
# define TRACE_TRANSFER_BITS (TRACE_OUTREQQUEUED_BIT|TRACE_INREQQUEUED_BIT|\
|
||||||
|
TRACE_READ_BIT|TRACE_WRITE_BIT|\
|
||||||
|
TRACE_COMPLETE_BIT)
|
||||||
|
#else
|
||||||
|
# define TRACE_TRANSFER_BITS (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SYSTEM_USBMONITOR_TRACECONTROLLER
|
||||||
|
# define TRACE_CONTROLLER_BITS (TRACE_EP_BIT|TRACE_DEV_BIT)
|
||||||
|
#else
|
||||||
|
# define TRACE_CONTROLLER_BITS (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SYSTEM_USBMONITOR_TRACEINTERRUPTS
|
||||||
|
# define TRACE_INTERRUPT_BITS (TRACE_INTENTRY_BIT|TRACE_INTDECODE_BIT|\
|
||||||
|
TRACE_INTEXIT_BIT)
|
||||||
|
#else
|
||||||
|
# define TRACE_INTERRUPT_BITS (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define TRACE_BITSET (TRACE_INIT_BITS|TRACE_ERROR_BITS|\
|
||||||
|
TRACE_CLASS_BITS|TRACE_TRANSFER_BITS|\
|
||||||
|
TRACE_CONTROLLER_BITS|TRACE_INTERRUPT_BITS)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Types
|
* Private Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -92,7 +146,7 @@ static int usbmonitor_daemon(int argc, char **argv)
|
|||||||
|
|
||||||
while (!g_usbmonitor.stop)
|
while (!g_usbmonitor.stop)
|
||||||
{
|
{
|
||||||
sleep(2);
|
sleep(CONFIG_SYSTEM_USBMONITOR_INTERVAL);
|
||||||
(void)usbtrace_enumerate(usbmonitor_tracecallback, NULL);
|
(void)usbtrace_enumerate(usbmonitor_tracecallback, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,6 +174,12 @@ int usbmonitor_start(int argc, char **argv)
|
|||||||
|
|
||||||
/* No.. start it now */
|
/* No.. start it now */
|
||||||
|
|
||||||
|
/* First, initialize any USB tracing options that were requested */
|
||||||
|
|
||||||
|
usbtrace_enable(TRACE_BITSET);
|
||||||
|
|
||||||
|
/* Then start the USB monitoring daemon */
|
||||||
|
|
||||||
g_usbmonitor.started = true;
|
g_usbmonitor.started = true;
|
||||||
g_usbmonitor.stop = false;
|
g_usbmonitor.stop = false;
|
||||||
|
|
||||||
@@ -144,7 +204,8 @@ int usbmonitor_start(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
syslog(USBMON_PREFIX "Running: %d\n", g_usbmonitor.pid);
|
syslog(USBMON_PREFIX "%s: %d\n",
|
||||||
|
g_usbmonitor.stop ? "Stopping" : "Running", g_usbmonitor.pid);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,9 +215,16 @@ int usbmonitor_stop(int argc, char **argv)
|
|||||||
|
|
||||||
if (g_usbmonitor.started)
|
if (g_usbmonitor.started)
|
||||||
{
|
{
|
||||||
|
/* Stop the USB monitor. The next time the monitor wakes up,
|
||||||
|
* it will see the the stop indication and will exist.
|
||||||
|
*/
|
||||||
|
|
||||||
syslog(USBMON_PREFIX "Stopping: %d\n", g_usbmonitor.pid);
|
syslog(USBMON_PREFIX "Stopping: %d\n", g_usbmonitor.pid);
|
||||||
g_usbmonitor.stop = true;
|
g_usbmonitor.stop = true;
|
||||||
return 0;
|
|
||||||
|
/* We may as well disable tracing since there is no listener */
|
||||||
|
|
||||||
|
usbtrace_enable(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
syslog(USBMON_PREFIX "Stopped: %d\n", g_usbmonitor.pid);
|
syslog(USBMON_PREFIX "Stopped: %d\n", g_usbmonitor.pid);
|
||||||
|
|||||||
@@ -1287,19 +1287,29 @@ Where <subdir> is one of the following:
|
|||||||
you can still use certain kinds of debug output (see include/debug.h, all
|
you can still use certain kinds of debug output (see include/debug.h, all
|
||||||
of the interfaces based on lowsyslog will work in this configuration).
|
of the interfaces based on lowsyslog will work in this configuration).
|
||||||
|
|
||||||
|
- But don't enable USB debug output! Since USB is console is used for
|
||||||
|
USB debug output and you are using a USB console, there will be
|
||||||
|
infinite loops and deadlocks: Debug output generates USB debug
|
||||||
|
output which generatates USB debug output, etc. If you want USB
|
||||||
|
debug output, you should consider enabling USB trace
|
||||||
|
(CONFIG_USBDEV_TRACE) and perhaps the USB monitor (CONFIG_SYSTEM_USBMONITOR).
|
||||||
|
|
||||||
|
See the usbnsh configuration below for more information on configuring
|
||||||
|
USB trace output and the USB monitor.
|
||||||
|
|
||||||
10. USB OTG FS Host Support. The following changes will enable support for
|
10. USB OTG FS Host Support. The following changes will enable support for
|
||||||
a USB host on the STM32F4Discovery, including support for a mass storage
|
a USB host on the STM32F4Discovery, including support for a mass storage
|
||||||
class driver:
|
class driver:
|
||||||
|
|
||||||
CONFIG_USBDEV=n - Make sure tht USB device support is disabled
|
CONFIG_USBDEV=n : Make sure tht USB device support is disabled
|
||||||
CONFIG_USBHOST=y - Enable USB host support
|
CONFIG_USBHOST=y : Enable USB host support
|
||||||
CONFIG_STM32_OTGFS=y - Enable the STM32 USB OTG FS block
|
CONFIG_STM32_OTGFS=y : Enable the STM32 USB OTG FS block
|
||||||
CONFIG_STM32_SYSCFG=y - Needed for all USB OTF FS support
|
CONFIG_STM32_SYSCFG=y : Needed for all USB OTF FS support
|
||||||
CONFIG_SCHED_WORKQUEUE=y - Worker thread support is required for the mass
|
CONFIG_SCHED_WORKQUEUE=y : Worker thread support is required for the mass
|
||||||
storage class driver.
|
storage class driver.
|
||||||
CONFIG_NSH_ARCHINIT=y - Architecture specific USB initialization
|
CONFIG_NSH_ARCHINIT=y : Architecture specific USB initialization
|
||||||
is needed for NSH
|
is needed for NSH
|
||||||
CONFIG_FS_FAT=y - Needed by the USB host mass storage class.
|
CONFIG_FS_FAT=y : Needed by the USB host mass storage class.
|
||||||
|
|
||||||
With those changes, you can use NSH with a FLASH pen driver as shown
|
With those changes, you can use NSH with a FLASH pen driver as shown
|
||||||
belong. Here NSH is started with nothing in the USB host slot:
|
belong. Here NSH is started with nothing in the USB host slot:
|
||||||
@@ -1466,7 +1476,6 @@ Where <subdir> is one of the following:
|
|||||||
STANDBY mode. This used of the RTC alarm could conflict with other uses of
|
STANDBY mode. This used of the RTC alarm could conflict with other uses of
|
||||||
the RTC alarm in your application.
|
the RTC alarm in your application.
|
||||||
|
|
||||||
|
|
||||||
posix_spawn:
|
posix_spawn:
|
||||||
------------
|
------------
|
||||||
This configuration directory, performs a simple test os the posix_spawn
|
This configuration directory, performs a simple test os the posix_spawn
|
||||||
@@ -1538,15 +1547,18 @@ Where <subdir> is one of the following:
|
|||||||
|
|
||||||
CONFIG_USBDEV_TRACE=y : Enable USB trace feature
|
CONFIG_USBDEV_TRACE=y : Enable USB trace feature
|
||||||
CONFIG_USBDEV_TRACE_NRECORDS=128 : Buffer 128 records in memory
|
CONFIG_USBDEV_TRACE_NRECORDS=128 : Buffer 128 records in memory
|
||||||
CONFIG_SYSTEM_USBMONITOR=y : Start the USB monitor daemon
|
CONFIG_NSH_USBDEV_TRACE=n : No builtin tracing from NSH
|
||||||
|
CONFIG_NSH_ARCHINIT=y : Automatically start the USB monitor
|
||||||
|
CONFIG_SYSTEM_USBMONITOR=y : Enable the USB monitor daemon
|
||||||
CONFIG_SYSTEM_USBMONITOR_STACKSIZE=2048 : USB monitor daemon stack size
|
CONFIG_SYSTEM_USBMONITOR_STACKSIZE=2048 : USB monitor daemon stack size
|
||||||
CONFIG_SYSTEM_USBMONITOR_PRIORITY=50 : USB monitor daemon priority
|
CONFIG_SYSTEM_USBMONITOR_PRIORITY=50 : USB monitor daemon priority
|
||||||
|
CONFIG_SYSTEM_USBMONITOR_INTERVAL=2 : Dump trace data every 2 seconds
|
||||||
|
|
||||||
CONFIG_NSH_USBDEV_TRACEINIT=y : Enable TRACE output
|
CONFIG_SYSTEM_USBMONITOR_TRACEINIT=y : Enable TRACE output
|
||||||
CONFIG_NSH_USBDEV_TRACECLASS=y
|
CONFIG_SYSTEM_USBMONITOR_TRACECLASS=y
|
||||||
CONFIG_NSH_USBDEV_TRACETRANSFERS=y
|
CONFIG_SYSTEM_USBMONITOR_TRACETRANSFERS=y
|
||||||
CONFIG_NSH_USBDEV_TRACECONTROLLER=y
|
CONFIG_SYSTEM_USBMONITOR_TRACECONTROLLER=y
|
||||||
CONFIG_NSH_USBDEV_TRACEINTERRUPTS=y
|
CONFIG_SYSTEM_USBMONITOR_TRACEINTERRUPTS=y
|
||||||
|
|
||||||
5. By default, this project assumes that you are *NOT* using the DFU
|
5. By default, this project assumes that you are *NOT* using the DFU
|
||||||
bootloader.
|
bootloader.
|
||||||
|
|||||||
@@ -168,8 +168,10 @@ static inline int syslog_takesem(void)
|
|||||||
|
|
||||||
static inline void syslog_givesem(void)
|
static inline void syslog_givesem(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_DEBUG
|
||||||
pid_t me = getpid();
|
pid_t me = getpid();
|
||||||
DEBUGASSERT(g_sysdev.sl_holder == me);
|
DEBUGASSERT(g_sysdev.sl_holder == me);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Relinquish the semaphore */
|
/* Relinquish the semaphore */
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,6 @@
|
|||||||
|
|
||||||
static void syslogstream_putc(FAR struct lib_outstream_s *this, int ch)
|
static void syslogstream_putc(FAR struct lib_outstream_s *this, int ch)
|
||||||
{
|
{
|
||||||
int errcode;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Try writing until the write was successful or until an irrecoverable
|
/* Try writing until the write was successful or until an irrecoverable
|
||||||
|
|||||||
Reference in New Issue
Block a user