mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 10:03:34 +08:00
A little more work (but not much progress) on the PIC32 USB device driver
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4440 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
@@ -41,12 +41,14 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <nuttx/usb/usbdev_trace.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
/* Prerequisites */
|
||||
|
||||
@@ -68,6 +70,44 @@
|
||||
# define CONFIG_EXAMPLES_CDCACM_DEVMINOR 0
|
||||
#endif
|
||||
|
||||
/* Trace Configuration ******************************************************/
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_CDCACM_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_EXAMPLES_CDCACM_TRACECLASS
|
||||
# define TRACE_CLASS_BITS (TRACE_CLASS_BIT|TRACE_CLASSAPI_BIT|TRACE_CLASSSTATE_BIT)
|
||||
#else
|
||||
# define TRACE_CLASS_BITS (0)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_CDCACM_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_EXAMPLES_CDCACM_TRACECONTROLLER
|
||||
# define TRACE_CONTROLLER_BITS (TRACE_EP_BIT|TRACE_DEV_BIT)
|
||||
#else
|
||||
# define TRACE_CONTROLLER_BITS (0)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_CDCACM_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)
|
||||
|
||||
/* Debug ********************************************************************/
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
|
||||
@@ -81,7 +81,6 @@ struct cdcacm_state_s g_cdcacm;
|
||||
|
||||
int sercon_main(int argc, char *argv[])
|
||||
{
|
||||
FAR void *handle;
|
||||
int ret;
|
||||
|
||||
/* Check if there is a non-NULL USB mass storage device handle (meaning that the
|
||||
@@ -94,7 +93,13 @@ int sercon_main(int argc, char *argv[])
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* Initialize the USB serial driver */
|
||||
/* Then, in any event, enable trace data collection as configured BEFORE
|
||||
* enabling the CDC/ACM device.
|
||||
*/
|
||||
|
||||
usbtrace_enable(TRACE_BITSET);
|
||||
|
||||
/* Initialize the USB CDC/ACM serial driver */
|
||||
|
||||
message("sercon: Registering CDC/ACM serial driver\n");
|
||||
ret = cdcacm_initialize(CONFIG_EXAMPLES_CDCACM_DEVMINOR, &g_cdcacm.handle);
|
||||
@@ -127,6 +132,12 @@ int serdis_main(int argc, char *argv[])
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* Then, in any event, disable trace data collection as configured BEFORE
|
||||
* enabling the CDC/ACM device.
|
||||
*/
|
||||
|
||||
usbtrace_enable(0);
|
||||
|
||||
/* Then disconnect the device and uninitialize the USB mass storage driver */
|
||||
|
||||
cdcacm_uninitialize(g_cdcacm.handle);
|
||||
|
||||
Reference in New Issue
Block a user