102ac6454SAndrew Thompson /* $FreeBSD$ */ 202ac6454SAndrew Thompson /*- 3*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 4718cf2ccSPedro F. Giffuni * 502ac6454SAndrew Thompson * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 602ac6454SAndrew Thompson * 702ac6454SAndrew Thompson * Redistribution and use in source and binary forms, with or without 802ac6454SAndrew Thompson * modification, are permitted provided that the following conditions 902ac6454SAndrew Thompson * are met: 1002ac6454SAndrew Thompson * 1. Redistributions of source code must retain the above copyright 1102ac6454SAndrew Thompson * notice, this list of conditions and the following disclaimer. 1202ac6454SAndrew Thompson * 2. Redistributions in binary form must reproduce the above copyright 1302ac6454SAndrew Thompson * notice, this list of conditions and the following disclaimer in the 1402ac6454SAndrew Thompson * documentation and/or other materials provided with the distribution. 1502ac6454SAndrew Thompson * 1602ac6454SAndrew Thompson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1702ac6454SAndrew Thompson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1802ac6454SAndrew Thompson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1902ac6454SAndrew Thompson * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2002ac6454SAndrew Thompson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2102ac6454SAndrew Thompson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2202ac6454SAndrew Thompson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2302ac6454SAndrew Thompson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2402ac6454SAndrew Thompson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2502ac6454SAndrew Thompson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2602ac6454SAndrew Thompson * SUCH DAMAGE. 2702ac6454SAndrew Thompson */ 2802ac6454SAndrew Thompson 2975973647SAndrew Thompson #ifndef _USB_REQUEST_H_ 3075973647SAndrew Thompson #define _USB_REQUEST_H_ 3102ac6454SAndrew Thompson 32760bc48eSAndrew Thompson struct usb_process; 3302ac6454SAndrew Thompson 34a593f6b8SAndrew Thompson usb_error_t usbd_req_clear_hub_feature(struct usb_device *udev, 3502ac6454SAndrew Thompson struct mtx *mtx, uint16_t sel); 36a593f6b8SAndrew Thompson usb_error_t usbd_req_clear_port_feature(struct usb_device *udev, 3702ac6454SAndrew Thompson struct mtx *mtx, uint8_t port, uint16_t sel); 38a593f6b8SAndrew Thompson usb_error_t usbd_req_get_alt_interface_no(struct usb_device *udev, 3902ac6454SAndrew Thompson struct mtx *mtx, uint8_t *alt_iface_no, 4002ac6454SAndrew Thompson uint8_t iface_index); 41a593f6b8SAndrew Thompson usb_error_t usbd_req_get_config(struct usb_device *udev, struct mtx *mtx, 4202ac6454SAndrew Thompson uint8_t *pconf); 43a593f6b8SAndrew Thompson usb_error_t usbd_req_get_descriptor_ptr(struct usb_device *udev, 44760bc48eSAndrew Thompson struct usb_config_descriptor **ppcd, uint16_t wValue); 45a593f6b8SAndrew Thompson usb_error_t usbd_req_get_config_desc(struct usb_device *udev, struct mtx *mtx, 46760bc48eSAndrew Thompson struct usb_config_descriptor *d, uint8_t conf_index); 47a593f6b8SAndrew Thompson usb_error_t usbd_req_get_config_desc_full(struct usb_device *udev, 48760bc48eSAndrew Thompson struct mtx *mtx, struct usb_config_descriptor **ppcd, 492c79a775SHans Petter Selasky uint8_t conf_index); 50a593f6b8SAndrew Thompson usb_error_t usbd_req_get_desc(struct usb_device *udev, struct mtx *mtx, 5116589beaSAndrew Thompson uint16_t *actlen, void *desc, uint16_t min_len, 5216589beaSAndrew Thompson uint16_t max_len, uint16_t id, uint8_t type, 5316589beaSAndrew Thompson uint8_t index, uint8_t retries); 54a593f6b8SAndrew Thompson usb_error_t usbd_req_get_device_desc(struct usb_device *udev, struct mtx *mtx, 55760bc48eSAndrew Thompson struct usb_device_descriptor *d); 56a593f6b8SAndrew Thompson usb_error_t usbd_req_get_device_status(struct usb_device *udev, 57760bc48eSAndrew Thompson struct mtx *mtx, struct usb_status *st); 58a593f6b8SAndrew Thompson usb_error_t usbd_req_get_hub_descriptor(struct usb_device *udev, 59760bc48eSAndrew Thompson struct mtx *mtx, struct usb_hub_descriptor *hd, 6002ac6454SAndrew Thompson uint8_t nports); 61963169b4SHans Petter Selasky usb_error_t usbd_req_get_ss_hub_descriptor(struct usb_device *udev, 62963169b4SHans Petter Selasky struct mtx *mtx, struct usb_hub_ss_descriptor *hd, 63963169b4SHans Petter Selasky uint8_t nports); 64a593f6b8SAndrew Thompson usb_error_t usbd_req_get_hub_status(struct usb_device *udev, struct mtx *mtx, 65760bc48eSAndrew Thompson struct usb_hub_status *st); 66a593f6b8SAndrew Thompson usb_error_t usbd_req_get_port_status(struct usb_device *udev, struct mtx *mtx, 67760bc48eSAndrew Thompson struct usb_port_status *ps, uint8_t port); 68a593f6b8SAndrew Thompson usb_error_t usbd_req_reset_port(struct usb_device *udev, struct mtx *mtx, 6902ac6454SAndrew Thompson uint8_t port); 70cbb75751SHans Petter Selasky usb_error_t usbd_req_warm_reset_port(struct usb_device *udev, 71cbb75751SHans Petter Selasky struct mtx *mtx, uint8_t port); 72a593f6b8SAndrew Thompson usb_error_t usbd_req_set_address(struct usb_device *udev, struct mtx *mtx, 7302ac6454SAndrew Thompson uint16_t addr); 74a593f6b8SAndrew Thompson usb_error_t usbd_req_set_hub_feature(struct usb_device *udev, struct mtx *mtx, 7502ac6454SAndrew Thompson uint16_t sel); 76a593f6b8SAndrew Thompson usb_error_t usbd_req_set_port_feature(struct usb_device *udev, 7702ac6454SAndrew Thompson struct mtx *mtx, uint8_t port, uint16_t sel); 78963169b4SHans Petter Selasky usb_error_t usbd_setup_device_desc(struct usb_device *udev, struct mtx *mtx); 79a593f6b8SAndrew Thompson usb_error_t usbd_req_re_enumerate(struct usb_device *udev, struct mtx *mtx); 80963169b4SHans Petter Selasky usb_error_t usbd_req_clear_device_feature(struct usb_device *udev, 81963169b4SHans Petter Selasky struct mtx *mtx, uint16_t sel); 82963169b4SHans Petter Selasky usb_error_t usbd_req_set_device_feature(struct usb_device *udev, 83963169b4SHans Petter Selasky struct mtx *mtx, uint16_t sel); 84963169b4SHans Petter Selasky usb_error_t usbd_req_set_hub_u1_timeout(struct usb_device *udev, 85963169b4SHans Petter Selasky struct mtx *mtx, uint8_t port, uint8_t timeout); 86963169b4SHans Petter Selasky usb_error_t usbd_req_set_hub_u2_timeout(struct usb_device *udev, 87963169b4SHans Petter Selasky struct mtx *mtx, uint8_t port, uint8_t timeout); 88963169b4SHans Petter Selasky usb_error_t usbd_req_set_hub_depth(struct usb_device *udev, 89963169b4SHans Petter Selasky struct mtx *mtx, uint16_t depth); 909eb0d702SHans Petter Selasky usb_error_t usbd_req_reset_tt(struct usb_device *udev, struct mtx *mtx, 919eb0d702SHans Petter Selasky uint8_t port); 929eb0d702SHans Petter Selasky usb_error_t usbd_req_clear_tt_buffer(struct usb_device *udev, struct mtx *mtx, 939eb0d702SHans Petter Selasky uint8_t port, uint8_t addr, uint8_t type, uint8_t endpoint); 944131f6fbSHans Petter Selasky usb_error_t usbd_req_set_port_link_state(struct usb_device *udev, 954131f6fbSHans Petter Selasky struct mtx *mtx, uint8_t port, uint8_t link_state); 964563ba7aSHans Petter Selasky usb_error_t usbd_req_set_lpm_info(struct usb_device *udev, struct mtx *mtx, 974563ba7aSHans Petter Selasky uint8_t port, uint8_t besl, uint8_t addr, uint8_t rwe); 9802ac6454SAndrew Thompson 992c79a775SHans Petter Selasky void * usbd_alloc_config_desc(struct usb_device *, uint32_t); 1002c79a775SHans Petter Selasky void usbd_free_config_desc(struct usb_device *, void *); 1012c79a775SHans Petter Selasky 10275973647SAndrew Thompson #endif /* _USB_REQUEST_H_ */ 103