mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-06 16:08:53 +08:00
Extend CDC/ACM driver so that can be connected/disconnected under software control; Add new NSH commands sercon and serdis that will connect and disconnect the CDC/ACM serial device
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4436 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
@@ -344,7 +344,7 @@ EXTERN void board_cdcuninitialize(FAR struct usbdevclass_driver_s *classdev);
|
||||
*
|
||||
* Input Parameter:
|
||||
* minor - Device minor number. E.g., minor 0 would correspond to
|
||||
* /dev/ttyUSB0.
|
||||
* /dev/ttyACM0.
|
||||
* classdev - The location to return the CDC serial class' device
|
||||
* instance.
|
||||
*
|
||||
@@ -364,7 +364,10 @@ int cdcacm_classobject(int minor, FAR struct usbdevclass_driver_s **classdev);
|
||||
* Register USB serial port (and USB serial console if so configured).
|
||||
*
|
||||
* Input Parameter:
|
||||
* Device minor number. E.g., minor 0 would correspond to /dev/ttyUSB0.
|
||||
* minor - Device minor number. E.g., minor 0 would correspond to
|
||||
* /dev/ttyACM0.
|
||||
* handle - An optional opaque reference to the CDC/ACM class object that
|
||||
* may subsequently be used with cdcacm_uninitialize().
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) means that the driver was successfully registered. On any
|
||||
@@ -373,17 +376,27 @@ int cdcacm_classobject(int minor, FAR struct usbdevclass_driver_s **classdev);
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(CONFIG_USBDEV_COMPOSITE) || !defined(CONFIG_CDCACM_COMPOSITE)
|
||||
EXTERN int cdcacm_initialize(int minor);
|
||||
EXTERN int cdcacm_initialize(int minor, FAR void **handle);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cdcacm_uninitialize
|
||||
*
|
||||
* Description:
|
||||
* Un-initialize the USB storage class driver
|
||||
* Un-initialize the USB storage class driver. This function is used
|
||||
* internally by the USB composite driver to unitialized the CDC/ACM
|
||||
* driver. This same interface is available (with an untyped input
|
||||
* parameter) when the CDC/ACM driver is used standalone.
|
||||
*
|
||||
* Input Parameters:
|
||||
* handle - The handle returned by a previous call to cdcacm_configure().
|
||||
* There is one parameter, it differs in typing depending upon whether the
|
||||
* CDC/ACM driver is an internal part of a composite device, or a standalone
|
||||
* USB driver:
|
||||
*
|
||||
* classdev - The class object returned by board_cdcclassobject() or
|
||||
* cdcacm_classobject()
|
||||
* handle - The opaque handle represetning the class object returned by
|
||||
* a previous call to cdcacm_initialize().
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
@@ -392,6 +405,8 @@ EXTERN int cdcacm_initialize(int minor);
|
||||
|
||||
#if defined(CONFIG_USBDEV_COMPOSITE) && defined(CONFIG_CDCACM_COMPOSITE)
|
||||
EXTERN void cdcacm_uninitialize(FAR struct usbdevclass_driver_s *classdev);
|
||||
#else
|
||||
EXTERN void cdcacm_uninitialize(FAR void *handle);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
|
||||
@@ -215,13 +215,14 @@
|
||||
#define USBSER_TRACEERR_SETUPNOTCONNECTED 0x0019
|
||||
#define USBSER_TRACEERR_SUBMITFAIL 0x001a
|
||||
#define USBSER_TRACEERR_UARTREGISTER 0x001b
|
||||
#define USBSER_TRACEERR_UNSUPPORTEDCTRLREQ 0x001c
|
||||
#define USBSER_TRACEERR_UNSUPPORTEDCLASSREQ 0x001d
|
||||
#define USBSER_TRACEERR_UNSUPPORTEDSTDREQ 0x001e
|
||||
#define USBSER_TRACEERR_UNSUPPORTEDTYPE 0x001f
|
||||
#define USBSER_TRACEERR_WRALLOCREQ 0x0020
|
||||
#define USBSER_TRACEERR_WRSHUTDOWN 0x0021
|
||||
#define USBSER_TRACEERR_WRUNEXPECTED 0x0022
|
||||
#define USBSER_TRACEERR_UARTUNREGISTER 0x001c
|
||||
#define USBSER_TRACEERR_UNSUPPORTEDCTRLREQ 0x001d
|
||||
#define USBSER_TRACEERR_UNSUPPORTEDCLASSREQ 0x001e
|
||||
#define USBSER_TRACEERR_UNSUPPORTEDSTDREQ 0x001f
|
||||
#define USBSER_TRACEERR_UNSUPPORTEDTYPE 0x0020
|
||||
#define USBSER_TRACEERR_WRALLOCREQ 0x0021
|
||||
#define USBSER_TRACEERR_WRSHUTDOWN 0x0022
|
||||
#define USBSER_TRACEERR_WRUNEXPECTED 0x0023
|
||||
|
||||
/* USB Storage driver class events ******************************************/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user