1254159Shselasky/* $FreeBSD: releng/10.3/tools/tools/usbtest/usbtest.h 254159 2013-08-09 20:08:42Z hselasky $ */
2254159Shselasky/*-
3254159Shselasky * Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
4254159Shselasky *
5254159Shselasky * Redistribution and use in source and binary forms, with or without
6254159Shselasky * modification, are permitted provided that the following conditions
7254159Shselasky * are met:
8254159Shselasky * 1. Redistributions of source code must retain the above copyright
9254159Shselasky *    notice, this list of conditions and the following disclaimer.
10254159Shselasky * 2. Redistributions in binary form must reproduce the above copyright
11254159Shselasky *    notice, this list of conditions and the following disclaimer in the
12254159Shselasky *    documentation and/or other materials provided with the distribution.
13254159Shselasky *
14254159Shselasky * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15254159Shselasky * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16254159Shselasky * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17254159Shselasky * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18254159Shselasky * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19254159Shselasky * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20254159Shselasky * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21254159Shselasky * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22254159Shselasky * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23254159Shselasky * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24254159Shselasky * SUCH DAMAGE.
25254159Shselasky */
26254159Shselasky
27254159Shselasky#ifndef _USBTEST_H_
28254159Shselasky#define	_USBTEST_H_
29254159Shselasky
30254159Shselasky#define	USB_DEVICES_MAX		128
31254159Shselasky#define	USB_TS_MAX_LEVELS	8
32254159Shselasky
33254159Shselaskystruct libusb20_device;
34254159Shselasky
35254159Shselaskystruct bps {
36254159Shselasky	uint32_t bytes;
37254159Shselasky	time_t	time;
38254159Shselasky};
39254159Shselasky
40254159Shselaskyextern void usb_get_string_desc_test(uint16_t, uint16_t);
41254159Shselaskyextern void usb_port_reset_test(uint16_t, uint16_t, uint32_t);
42254159Shselaskyextern void usb_set_config_test(uint16_t, uint16_t, uint32_t);
43254159Shselaskyextern void usb_get_descriptor_test(uint16_t, uint16_t, uint32_t);
44254159Shselaskyextern void usb_control_ep_error_test(uint16_t, uint16_t);
45254159Shselaskyextern void usb_set_and_clear_stall_test(uint16_t, uint16_t);
46254159Shselaskyextern void usb_set_alt_interface_test(uint16_t, uint16_t);
47254159Shselasky
48254159Shselaskyextern void usb_suspend_resume_test(uint16_t, uint16_t, uint32_t);
49254159Shselaskyextern void do_bps(const char *, struct bps *, uint32_t len);
50254159Shselaskyextern const char *indent[USB_TS_MAX_LEVELS];
51254159Shselaskyextern void show_host_msc_test(uint8_t, uint16_t, uint16_t, uint32_t);
52254159Shselaskyextern void show_host_modem_test(uint8_t, uint16_t, uint16_t, uint32_t);
53254159Shselaskyextern void show_host_device_selection(uint8_t, uint16_t *, uint16_t *);
54254159Shselaskyextern struct libusb20_device *find_usb_device(uint16_t, uint16_t);
55254159Shselaskyextern void find_usb_endpoints(struct libusb20_device *, uint8_t, uint8_t,
56254159Shselasky    uint8_t, uint8_t, uint8_t *, uint8_t *, uint8_t *, uint8_t);
57254159Shselaskyextern void get_string(char *, int);
58254159Shselaskyextern int get_integer(void);
59254159Shselaskyextern uint8_t usb_ts_show_menu(uint8_t, const char *, const char *,...);
60254159Shselaskyextern int32_t usb_ts_rand_noise(void);
61254159Shselasky
62254159Shselasky#endif				/* _USBTEST_H_ */
63