1184610Salfred/* $FreeBSD$ */ 2184610Salfred/*- 3184610Salfred * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 4184610Salfred * 5184610Salfred * Redistribution and use in source and binary forms, with or without 6184610Salfred * modification, are permitted provided that the following conditions 7184610Salfred * are met: 8184610Salfred * 1. Redistributions of source code must retain the above copyright 9184610Salfred * notice, this list of conditions and the following disclaimer. 10184610Salfred * 2. Redistributions in binary form must reproduce the above copyright 11184610Salfred * notice, this list of conditions and the following disclaimer in the 12184610Salfred * documentation and/or other materials provided with the distribution. 13184610Salfred * 14184610Salfred * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15184610Salfred * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16184610Salfred * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17184610Salfred * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18184610Salfred * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19184610Salfred * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20184610Salfred * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21184610Salfred * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22184610Salfred * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23184610Salfred * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24184610Salfred * SUCH DAMAGE. 25184610Salfred */ 26184610Salfred 27194230Sthompsa#ifndef _USB_REQUEST_H_ 28194230Sthompsa#define _USB_REQUEST_H_ 29184610Salfred 30192984Sthompsastruct usb_process; 31188411Sthompsa 32194228Sthompsausb_error_t usbd_req_clear_hub_feature(struct usb_device *udev, 33185948Sthompsa struct mtx *mtx, uint16_t sel); 34194228Sthompsausb_error_t usbd_req_clear_port_feature(struct usb_device *udev, 35185948Sthompsa struct mtx *mtx, uint8_t port, uint16_t sel); 36194228Sthompsausb_error_t usbd_req_get_alt_interface_no(struct usb_device *udev, 37185948Sthompsa struct mtx *mtx, uint8_t *alt_iface_no, 38185948Sthompsa uint8_t iface_index); 39194228Sthompsausb_error_t usbd_req_get_config(struct usb_device *udev, struct mtx *mtx, 40185948Sthompsa uint8_t *pconf); 41194228Sthompsausb_error_t usbd_req_get_descriptor_ptr(struct usb_device *udev, 42192984Sthompsa struct usb_config_descriptor **ppcd, uint16_t wValue); 43194228Sthompsausb_error_t usbd_req_get_config_desc(struct usb_device *udev, struct mtx *mtx, 44192984Sthompsa struct usb_config_descriptor *d, uint8_t conf_index); 45194228Sthompsausb_error_t usbd_req_get_config_desc_full(struct usb_device *udev, 46192984Sthompsa struct mtx *mtx, struct usb_config_descriptor **ppcd, 47250207Shselasky uint8_t conf_index); 48194228Sthompsausb_error_t usbd_req_get_desc(struct usb_device *udev, struct mtx *mtx, 49188985Sthompsa uint16_t *actlen, void *desc, uint16_t min_len, 50188985Sthompsa uint16_t max_len, uint16_t id, uint8_t type, 51188985Sthompsa uint8_t index, uint8_t retries); 52194228Sthompsausb_error_t usbd_req_get_device_desc(struct usb_device *udev, struct mtx *mtx, 53192984Sthompsa struct usb_device_descriptor *d); 54194228Sthompsausb_error_t usbd_req_get_device_status(struct usb_device *udev, 55192984Sthompsa struct mtx *mtx, struct usb_status *st); 56194228Sthompsausb_error_t usbd_req_get_hub_descriptor(struct usb_device *udev, 57192984Sthompsa struct mtx *mtx, struct usb_hub_descriptor *hd, 58185948Sthompsa uint8_t nports); 59213435Shselaskyusb_error_t usbd_req_get_ss_hub_descriptor(struct usb_device *udev, 60213435Shselasky struct mtx *mtx, struct usb_hub_ss_descriptor *hd, 61213435Shselasky uint8_t nports); 62194228Sthompsausb_error_t usbd_req_get_hub_status(struct usb_device *udev, struct mtx *mtx, 63192984Sthompsa struct usb_hub_status *st); 64194228Sthompsausb_error_t usbd_req_get_port_status(struct usb_device *udev, struct mtx *mtx, 65192984Sthompsa struct usb_port_status *ps, uint8_t port); 66194228Sthompsausb_error_t usbd_req_reset_port(struct usb_device *udev, struct mtx *mtx, 67185948Sthompsa uint8_t port); 68214804Shselaskyusb_error_t usbd_req_warm_reset_port(struct usb_device *udev, 69214804Shselasky struct mtx *mtx, uint8_t port); 70194228Sthompsausb_error_t usbd_req_set_address(struct usb_device *udev, struct mtx *mtx, 71185948Sthompsa uint16_t addr); 72194228Sthompsausb_error_t usbd_req_set_hub_feature(struct usb_device *udev, struct mtx *mtx, 73185948Sthompsa uint16_t sel); 74194228Sthompsausb_error_t usbd_req_set_port_feature(struct usb_device *udev, 75185948Sthompsa struct mtx *mtx, uint8_t port, uint16_t sel); 76213435Shselaskyusb_error_t usbd_setup_device_desc(struct usb_device *udev, struct mtx *mtx); 77194228Sthompsausb_error_t usbd_req_re_enumerate(struct usb_device *udev, struct mtx *mtx); 78213435Shselaskyusb_error_t usbd_req_clear_device_feature(struct usb_device *udev, 79213435Shselasky struct mtx *mtx, uint16_t sel); 80213435Shselaskyusb_error_t usbd_req_set_device_feature(struct usb_device *udev, 81213435Shselasky struct mtx *mtx, uint16_t sel); 82213435Shselaskyusb_error_t usbd_req_set_hub_u1_timeout(struct usb_device *udev, 83213435Shselasky struct mtx *mtx, uint8_t port, uint8_t timeout); 84213435Shselaskyusb_error_t usbd_req_set_hub_u2_timeout(struct usb_device *udev, 85213435Shselasky struct mtx *mtx, uint8_t port, uint8_t timeout); 86213435Shselaskyusb_error_t usbd_req_set_hub_depth(struct usb_device *udev, 87213435Shselasky struct mtx *mtx, uint16_t depth); 88222786Shselaskyusb_error_t usbd_req_reset_tt(struct usb_device *udev, struct mtx *mtx, 89222786Shselasky uint8_t port); 90222786Shselaskyusb_error_t usbd_req_clear_tt_buffer(struct usb_device *udev, struct mtx *mtx, 91222786Shselasky uint8_t port, uint8_t addr, uint8_t type, uint8_t endpoint); 92230032Shselaskyusb_error_t usbd_req_set_port_link_state(struct usb_device *udev, 93230032Shselasky struct mtx *mtx, uint8_t port, uint8_t link_state); 94233771Shselaskyusb_error_t usbd_req_set_lpm_info(struct usb_device *udev, struct mtx *mtx, 95233771Shselasky uint8_t port, uint8_t besl, uint8_t addr, uint8_t rwe); 96184610Salfred 97250207Shselaskyvoid * usbd_alloc_config_desc(struct usb_device *, uint32_t); 98250207Shselaskyvoid usbd_free_config_desc(struct usb_device *, void *); 99250207Shselasky 100194230Sthompsa#endif /* _USB_REQUEST_H_ */ 101