xref: /freebsd/sys/dev/usb/usb_request.h (revision 4563ba7a0dc301f40d35f7c7c3bad825d4b4fa10)
102ac6454SAndrew Thompson /* $FreeBSD$ */
202ac6454SAndrew Thompson /*-
302ac6454SAndrew Thompson  * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
402ac6454SAndrew Thompson  *
502ac6454SAndrew Thompson  * Redistribution and use in source and binary forms, with or without
602ac6454SAndrew Thompson  * modification, are permitted provided that the following conditions
702ac6454SAndrew Thompson  * are met:
802ac6454SAndrew Thompson  * 1. Redistributions of source code must retain the above copyright
902ac6454SAndrew Thompson  *    notice, this list of conditions and the following disclaimer.
1002ac6454SAndrew Thompson  * 2. Redistributions in binary form must reproduce the above copyright
1102ac6454SAndrew Thompson  *    notice, this list of conditions and the following disclaimer in the
1202ac6454SAndrew Thompson  *    documentation and/or other materials provided with the distribution.
1302ac6454SAndrew Thompson  *
1402ac6454SAndrew Thompson  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1502ac6454SAndrew Thompson  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1602ac6454SAndrew Thompson  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1702ac6454SAndrew Thompson  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1802ac6454SAndrew Thompson  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1902ac6454SAndrew Thompson  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2002ac6454SAndrew Thompson  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2102ac6454SAndrew Thompson  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2202ac6454SAndrew Thompson  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2302ac6454SAndrew Thompson  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2402ac6454SAndrew Thompson  * SUCH DAMAGE.
2502ac6454SAndrew Thompson  */
2602ac6454SAndrew Thompson 
2775973647SAndrew Thompson #ifndef _USB_REQUEST_H_
2875973647SAndrew Thompson #define	_USB_REQUEST_H_
2902ac6454SAndrew Thompson 
30760bc48eSAndrew Thompson struct usb_process;
3102ac6454SAndrew Thompson 
32a593f6b8SAndrew Thompson usb_error_t usbd_req_clear_hub_feature(struct usb_device *udev,
3302ac6454SAndrew Thompson 		    struct mtx *mtx, uint16_t sel);
34a593f6b8SAndrew Thompson usb_error_t usbd_req_clear_port_feature(struct usb_device *udev,
3502ac6454SAndrew Thompson 		    struct mtx *mtx, uint8_t port, uint16_t sel);
36a593f6b8SAndrew Thompson usb_error_t usbd_req_get_alt_interface_no(struct usb_device *udev,
3702ac6454SAndrew Thompson 		    struct mtx *mtx, uint8_t *alt_iface_no,
3802ac6454SAndrew Thompson 		    uint8_t iface_index);
39a593f6b8SAndrew Thompson usb_error_t usbd_req_get_config(struct usb_device *udev, struct mtx *mtx,
4002ac6454SAndrew Thompson 		    uint8_t *pconf);
41a593f6b8SAndrew Thompson usb_error_t usbd_req_get_descriptor_ptr(struct usb_device *udev,
42760bc48eSAndrew Thompson 		    struct usb_config_descriptor **ppcd, uint16_t wValue);
43a593f6b8SAndrew Thompson usb_error_t usbd_req_get_config_desc(struct usb_device *udev, struct mtx *mtx,
44760bc48eSAndrew Thompson 		    struct usb_config_descriptor *d, uint8_t conf_index);
45a593f6b8SAndrew Thompson usb_error_t usbd_req_get_config_desc_full(struct usb_device *udev,
46760bc48eSAndrew Thompson 		    struct mtx *mtx, struct usb_config_descriptor **ppcd,
4702ac6454SAndrew Thompson 		    struct malloc_type *mtype, uint8_t conf_index);
48a593f6b8SAndrew Thompson usb_error_t usbd_req_get_desc(struct usb_device *udev, struct mtx *mtx,
4916589beaSAndrew Thompson 		    uint16_t *actlen, void *desc, uint16_t min_len,
5016589beaSAndrew Thompson 		    uint16_t max_len, uint16_t id, uint8_t type,
5116589beaSAndrew Thompson 		    uint8_t index, uint8_t retries);
52a593f6b8SAndrew Thompson usb_error_t usbd_req_get_device_desc(struct usb_device *udev, struct mtx *mtx,
53760bc48eSAndrew Thompson 		    struct usb_device_descriptor *d);
54a593f6b8SAndrew Thompson usb_error_t usbd_req_get_device_status(struct usb_device *udev,
55760bc48eSAndrew Thompson 		    struct mtx *mtx, struct usb_status *st);
56a593f6b8SAndrew Thompson usb_error_t usbd_req_get_hub_descriptor(struct usb_device *udev,
57760bc48eSAndrew Thompson 		    struct mtx *mtx, struct usb_hub_descriptor *hd,
5802ac6454SAndrew Thompson 		    uint8_t nports);
59963169b4SHans Petter Selasky usb_error_t usbd_req_get_ss_hub_descriptor(struct usb_device *udev,
60963169b4SHans Petter Selasky 		    struct mtx *mtx, struct usb_hub_ss_descriptor *hd,
61963169b4SHans Petter Selasky 		    uint8_t nports);
62a593f6b8SAndrew Thompson usb_error_t usbd_req_get_hub_status(struct usb_device *udev, struct mtx *mtx,
63760bc48eSAndrew Thompson 		    struct usb_hub_status *st);
64a593f6b8SAndrew Thompson usb_error_t usbd_req_get_port_status(struct usb_device *udev, struct mtx *mtx,
65760bc48eSAndrew Thompson 		    struct usb_port_status *ps, uint8_t port);
66a593f6b8SAndrew Thompson usb_error_t usbd_req_reset_port(struct usb_device *udev, struct mtx *mtx,
6702ac6454SAndrew Thompson 		    uint8_t port);
68cbb75751SHans Petter Selasky usb_error_t usbd_req_warm_reset_port(struct usb_device *udev,
69cbb75751SHans Petter Selasky 		    struct mtx *mtx, uint8_t port);
70a593f6b8SAndrew Thompson usb_error_t usbd_req_set_address(struct usb_device *udev, struct mtx *mtx,
7102ac6454SAndrew Thompson 		    uint16_t addr);
72a593f6b8SAndrew Thompson usb_error_t usbd_req_set_hub_feature(struct usb_device *udev, struct mtx *mtx,
7302ac6454SAndrew Thompson 		    uint16_t sel);
74a593f6b8SAndrew Thompson usb_error_t usbd_req_set_port_feature(struct usb_device *udev,
7502ac6454SAndrew Thompson 		    struct mtx *mtx, uint8_t port, uint16_t sel);
76963169b4SHans Petter Selasky usb_error_t usbd_setup_device_desc(struct usb_device *udev, struct mtx *mtx);
77a593f6b8SAndrew Thompson usb_error_t usbd_req_re_enumerate(struct usb_device *udev, struct mtx *mtx);
78963169b4SHans Petter Selasky usb_error_t usbd_req_clear_device_feature(struct usb_device *udev,
79963169b4SHans Petter Selasky 		    struct mtx *mtx, uint16_t sel);
80963169b4SHans Petter Selasky usb_error_t usbd_req_set_device_feature(struct usb_device *udev,
81963169b4SHans Petter Selasky 		    struct mtx *mtx, uint16_t sel);
82963169b4SHans Petter Selasky usb_error_t usbd_req_set_hub_u1_timeout(struct usb_device *udev,
83963169b4SHans Petter Selasky 		    struct mtx *mtx, uint8_t port, uint8_t timeout);
84963169b4SHans Petter Selasky usb_error_t usbd_req_set_hub_u2_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_depth(struct usb_device *udev,
87963169b4SHans Petter Selasky 		    struct mtx *mtx, uint16_t depth);
889eb0d702SHans Petter Selasky usb_error_t usbd_req_reset_tt(struct usb_device *udev, struct mtx *mtx,
899eb0d702SHans Petter Selasky 		    uint8_t port);
909eb0d702SHans Petter Selasky usb_error_t usbd_req_clear_tt_buffer(struct usb_device *udev, struct mtx *mtx,
919eb0d702SHans Petter Selasky 		    uint8_t port, uint8_t addr, uint8_t type, uint8_t endpoint);
924131f6fbSHans Petter Selasky usb_error_t usbd_req_set_port_link_state(struct usb_device *udev,
934131f6fbSHans Petter Selasky 		    struct mtx *mtx, uint8_t port, uint8_t link_state);
94*4563ba7aSHans Petter Selasky usb_error_t usbd_req_set_lpm_info(struct usb_device *udev, struct mtx *mtx,
95*4563ba7aSHans Petter Selasky 		    uint8_t port, uint8_t besl, uint8_t addr, uint8_t rwe);
9602ac6454SAndrew Thompson 
9775973647SAndrew Thompson #endif					/* _USB_REQUEST_H_ */
98