diff options
author | thompsa <thompsa@FreeBSD.org> | 2009-04-05 18:19:52 +0000 |
---|---|---|
committer | thompsa <thompsa@FreeBSD.org> | 2009-04-05 18:19:52 +0000 |
commit | 5e0713868e18949219adf2ed92a0333d519abe52 (patch) | |
tree | ba0c7f2b1fbdf56ffd283a4402c1928dbda4b837 /sys/dev/usb/usb_parse.h | |
parent | eb9ff558ad364e6b42bf6773a941fe72b1e93fc7 (diff) | |
download | FreeBSD-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_parse.h')
-rw-r--r-- | sys/dev/usb/usb_parse.h | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/sys/dev/usb/usb_parse.h b/sys/dev/usb/usb_parse.h index a9e6509..b836b57 100644 --- a/sys/dev/usb/usb_parse.h +++ b/sys/dev/usb/usb_parse.h @@ -27,15 +27,28 @@ #ifndef _USB2_PARSE_H_ #define _USB2_PARSE_H_ +/* structures */ + +struct usb2_idesc_parse_state { + struct usb2_descriptor *desc; + uint8_t iface_index; /* current interface index */ + uint8_t iface_no_last; + uint8_t iface_index_alt; /* current alternate setting */ +}; + +/* prototypes */ + struct usb2_descriptor *usb2_desc_foreach(struct usb2_config_descriptor *cd, struct usb2_descriptor *desc); -struct usb2_interface_descriptor *usb2_find_idesc( - struct usb2_config_descriptor *cd, uint8_t iface_index, - uint8_t alt_index); -struct usb2_endpoint_descriptor *usb2_find_edesc( - struct usb2_config_descriptor *cd, uint8_t iface_index, - uint8_t alt_index, uint8_t ep_index); -uint16_t usb2_get_no_endpoints(struct usb2_config_descriptor *cd); -uint16_t usb2_get_no_alts(struct usb2_config_descriptor *cd, uint8_t ifaceno); +struct usb2_interface_descriptor *usb2_idesc_foreach( + struct usb2_config_descriptor *cd, + struct usb2_idesc_parse_state *ps); +struct usb2_endpoint_descriptor *usb2_edesc_foreach( + struct usb2_config_descriptor *cd, + struct usb2_endpoint_descriptor *ped); +uint8_t usb2_get_no_descriptors(struct usb2_config_descriptor *cd, + uint8_t type); +uint8_t usb2_get_no_alts(struct usb2_config_descriptor *cd, + struct usb2_interface_descriptor *id); #endif /* _USB2_PARSE_H_ */ |