usbdev: Use composite devices as universal devices

The enumeration process for composite and non-composite devices
has a lot of duplicate code. Treating the code for composite
devices as universal enumeration code can reduce redundant code.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
This commit is contained in:
zhangyuan21 2023-07-05 09:23:26 +08:00 • committed by archer
parent d55e0cce9c
commit fe6b0619f9
6 changed files with 103 additions and 105 deletions

View file

@ -28,8 +28,6 @@
#include <nuttx/config.h>
#include <nuttx/usb/usbdev.h>
#ifdef CONFIG_USBDEV_COMPOSITE
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@ -142,5 +140,4 @@ int composite_ep0submit(FAR struct usbdevclass_driver_s *driver,
}
#endif
#endif /* CONFIG_USBDEV_COMPOSITE */
#endif /* __INCLUDE_NUTTX_USB_COMPOSITE_H */

View file

@ -182,7 +182,7 @@ struct usbdev_devinfo_s
int epno[5]; /* Array holding the endpoint configuration for this device */
};
#ifdef CONFIG_USBDEV_COMPOSITE
struct usbdevclass_driver_s;
struct composite_devdesc_s
{
#ifdef CONFIG_USBDEV_DUALSPEED
@ -213,7 +213,6 @@ struct composite_devdesc_s
struct usbdev_devinfo_s devinfo;
};
#endif
/* struct usbdev_req_s - describes one i/o request */
@ -315,7 +314,6 @@ struct usbdev_s
/* USB Device Class Implementations *****************************************/
struct usbdevclass_driver_s;
struct usbdevclass_driverops_s
{
CODE int (*bind)(FAR struct usbdevclass_driver_s *driver,