summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/usb_device.h
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2009-04-05 18:19:52 +0000
committerthompsa <thompsa@FreeBSD.org>2009-04-05 18:19:52 +0000
commit5e0713868e18949219adf2ed92a0333d519abe52 (patch)
treeba0c7f2b1fbdf56ffd283a4402c1928dbda4b837 /sys/dev/usb/usb_device.h
parenteb9ff558ad364e6b42bf6773a941fe72b1e93fc7 (diff)
downloadFreeBSD-src-5e0713868e18949219adf2ed92a0333d519abe52.zip
FreeBSD-src-5e0713868e18949219adf2ed92a0333d519abe52.tar.gz
MFp4 //depot/projects/usb@159866
- memory usage reduction by only allocating the required USB pipes and USB interfaces. - cleanup some USB parsing functions to be more flexible. Submitted by: Hans Petter Selasky
Diffstat (limited to 'sys/dev/usb/usb_device.h')
-rw-r--r--sys/dev/usb/usb_device.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/sys/dev/usb/usb_device.h b/sys/dev/usb/usb_device.h
index f72b508..67f7b59 100644
--- a/sys/dev/usb/usb_device.h
+++ b/sys/dev/usb/usb_device.h
@@ -32,6 +32,18 @@ struct usb_device; /* linux compat */
#define USB_DEFAULT_XFER_MAX 2
+/* "usb2_parse_config()" commands */
+
+#define USB_CFG_ALLOC 0
+#define USB_CFG_FREE 1
+#define USB_CFG_INIT 2
+
+/* "usb2_unconfigure()" flags */
+
+#define USB_UNCFG_FLAG_NONE 0x00
+#define USB_UNCFG_FLAG_FREE_SUBDEV 0x01 /* subdevices are freed */
+#define USB_UNCFG_FLAG_FREE_EP0 0x02 /* endpoint zero is freed */
+
struct usb2_clear_stall_msg {
struct usb2_proc_msg hdr;
struct usb2_device *udev;
@@ -103,10 +115,9 @@ struct usb2_device {
struct sx default_sx[2];
struct mtx default_mtx[1];
struct cv default_cv[2];
- struct usb2_interface ifaces[USB_IFACE_MAX];
+ struct usb2_interface *ifaces;
struct usb2_pipe default_pipe; /* Control Endpoint 0 */
- struct cdev *default_dev; /* Control Endpoint 0 device node */
- struct usb2_pipe pipes[USB_EP_MAX];
+ struct usb2_pipe *pipes;
struct usb2_power_save pwr_save;/* power save data */
struct usb2_bus *bus; /* our USB BUS */
@@ -123,6 +134,7 @@ struct usb2_device {
#if USB_HAVE_UGEN
struct usb2_fifo *fifo[USB_FIFO_MAX];
struct usb2_symlink *ugen_symlink; /* our generic symlink */
+ struct cdev *default_dev; /* Control Endpoint 0 device node */
LIST_HEAD(,usb2_fs_privdata) pd_list;
char ugen_name[20]; /* name of ugenX.X device */
#endif
@@ -146,6 +158,8 @@ struct usb2_device {
uint8_t hs_port_no; /* high-speed HUB port number */
uint8_t driver_added_refcount; /* our driver added generation count */
uint8_t power_mode; /* see USB_POWER_XXX */
+ uint8_t ifaces_max; /* number of interfaces present */
+ uint8_t pipes_max; /* number of pipes present */
/* the "flags" field is write-protected by "bus->mtx" */
@@ -184,10 +198,8 @@ usb2_error_t usb2_set_endpoint_stall(struct usb2_device *udev,
struct usb2_pipe *pipe, uint8_t do_stall);
usb2_error_t usb2_suspend_resume(struct usb2_device *udev,
uint8_t do_suspend);
-void usb2_detach_device(struct usb2_device *udev, uint8_t iface_index,
- uint8_t free_subdev);
void usb2_devinfo(struct usb2_device *udev, char *dst_ptr, uint16_t dst_len);
-void usb2_free_device(struct usb2_device *udev);
+void usb2_free_device(struct usb2_device *, uint8_t);
void *usb2_find_descriptor(struct usb2_device *udev, void *id,
uint8_t iface_index, uint8_t type, uint8_t type_mask,
uint8_t subtype, uint8_t subtype_mask);
OpenPOWER on IntegriCloud