PERFORCE change 131102 for review

Hans Petter Selasky hselasky at FreeBSD.org
Mon Dec 17 07:54:07 PST 2007


http://perforce.freebsd.org/chv.cgi?CH=131102

Change 131102 by hselasky at hselasky_laptop001 on 2007/12/17 15:53:47

	
	This commit is device side related.
	
	This commit adds support for automatic endpoint resolving.
	This is due to the fact the USB device side hardware puts limits
	on how the endpoints can be used. The implemented algorithm will
	try to find out how the endpoints can be used at best given an
	USB device configuration. The implemented algorithm does not
	require a lot of CPU nor memory and does not try alot of
	different combinations. 

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/usb_subr.h#78 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/usb_subr.h#78 (text+ko) ====

@@ -99,6 +99,7 @@
 struct usbd_clone;
 struct usbd_config;
 struct usbd_device;
+struct usbd_hw_ep_profile;
 struct usbd_interface;
 struct usbd_memory_info;
 struct usbd_std_root_transfer;
@@ -119,7 +120,7 @@
 
 typedef void (usbd_std_root_transfer_func_t)(struct usbd_xfer *, struct usbd_std_root_transfer *);
 
-typedef void (usbd_temp_get_desc_t)(struct usbd_device *udev, struct mtx *mtx, usb_device_request_t *req, const void **data, uint16_t *pLen);
+typedef struct usbd_hw_ep_profile * (usbd_get_hw_ep_profile_t)(struct usbd_device *udev, uint8_t ep_addr);
 
 /* USB modes */
 
@@ -156,7 +157,6 @@
 	uint8_t	bInterfaceNumber;
 	uint8_t	bAlternateSetting;
 	uint8_t	bConfigurationValue;
-	uint8_t	bEpToIface[USB_MAX_ENDPOINTS];
 	usbd_status_t err;
 };
 
@@ -165,6 +165,7 @@
 	void    (*do_poll) (struct usbd_bus *);
 	void    (*xfer_setup) (struct usbd_setup_params *parm);
 	void    (*xfer_unsetup) (struct usbd_xfer *xfer);
+	usbd_get_hw_ep_profile_t *get_hw_ep_profile;
 };
 
 struct usbd_pipe_methods {
@@ -275,6 +276,38 @@
 	usbd_status_t err;
 };
 
+struct usbd_hw_ep_profile {
+	uint16_t max_frame_size;
+	uint8_t is_simplex:1;
+	uint8_t is_multi_buffer:1;
+	uint8_t support_bulk:1;
+	uint8_t support_control:1;
+	uint8_t support_interrupt:1;
+	uint8_t support_isochronous:1;
+	uint8_t support_in:1;
+	uint8_t support_out:1;
+};
+
+struct usbd_sw_ep_scratch {
+	const struct usbd_hw_ep_profile *pf;
+	uint16_t max_frame_size;
+	uint8_t hw_endpoint_out;
+	uint8_t hw_endpoint_in;
+	uint8_t needs_ep_type;
+	uint8_t needs_in:1;
+	uint8_t needs_out:1;
+};
+
+struct usbd_hw_ep_scratch {
+	struct usbd_sw_ep_scratch ep[USB_MAX_ENDPOINTS];
+	struct usbd_sw_ep_scratch *ep_max;
+	usb_config_descriptor_t *cd;
+	struct usbd_device *udev;
+	usbd_get_hw_ep_profile_t *get_hw_ep_profile;
+	uint8_t bmOutAlloc[(USB_MAX_ENDPOINTS+15)/16];
+	uint8_t bmInAlloc[(USB_MAX_ENDPOINTS+15)/16];
+};
+
 struct usbd_dma_tag {
 	bus_dma_tag_t tag;
 	uint32_t align;
@@ -397,7 +430,6 @@
 	struct usb_device *linux_dev;
 	struct usbd_xfer *default_xfer[1];
 	void   *usb_template_ptr;
-	usbd_temp_get_desc_t *usb_temp_get_desc;
 
 	uint16_t refcount;
 #define	USB_DEV_REFCOUNT_MAX 0xffff
@@ -440,6 +472,7 @@
 	uint8_t	product[64];		/* product string */
 
 	union {
+		struct usbd_hw_ep_scratch hw_ep_scratch[1];
 		struct usbd_temp_setup temp_setup[1];
 		uint8_t	data[128];
 	}	scratch[1];
@@ -849,8 +882,7 @@
 
 /* prototypes from usb_template.c */
 
-const void *usbd_temp_get_device_desc(struct usbd_device *udev);
-const void *usbd_temp_get_config_desc(struct usbd_device *udev, uint8_t index);
+void usbd_temp_get_desc(struct usbd_device *udev, usb_device_request_t *req, const void **pPtr, uint16_t *pLen);
 usbd_status_t usbd_temp_setup(struct usbd_device *udev, const struct usb_temp_device_desc *tdd);
 void	usbd_temp_unsetup(struct usbd_device *udev);
 


More information about the p4-projects mailing list