From owner-p4-projects@FreeBSD.ORG Mon Dec 17 15:54:07 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3B23916A469; Mon, 17 Dec 2007 15:54:07 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B540216A418 for ; Mon, 17 Dec 2007 15:54:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id AE54213C4CE for ; Mon, 17 Dec 2007 15:54:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lBHFs6kJ076651 for ; Mon, 17 Dec 2007 15:54:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lBHFs6gB076648 for perforce@freebsd.org; Mon, 17 Dec 2007 15:54:06 GMT (envelope-from hselasky@FreeBSD.org) Date: Mon, 17 Dec 2007 15:54:06 GMT Message-Id: <200712171554.lBHFs6gB076648@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 131102 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2007 15:54:07 -0000 http://perforce.freebsd.org/chv.cgi?CH=131102 Change 131102 by hselasky@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);