xref: /freebsd/tools/tools/usbtest/usb_msc_test.h (revision 2a63c3be158216222d89a073dcbd6a72ee4aab5a)
1 /*-
2  * Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23  * SUCH DAMAGE.
24  */
25 
26 #ifndef _USB_MSC_TEST_H_
27 #define	_USB_MSC_TEST_H_
28 
29 enum {
30 	USB_MSC_IO_MODE_READ_ONLY,
31 	USB_MSC_IO_MODE_WRITE_ONCE_READ_ONLY,
32 	USB_MSC_IO_MODE_WRITE_ONLY,
33 	USB_MSC_IO_MODE_READ_WRITE,
34 	USB_MSC_IO_MODE_MAX,
35 };
36 
37 enum {
38 	USB_MSC_IO_PATTERN_FIXED,
39 	USB_MSC_IO_PATTERN_RANDOM,
40 	USB_MSC_IO_PATTERN_PRESERVE,
41 	USB_MSC_IO_PATTERN_MAX,
42 };
43 
44 enum {
45 	USB_MSC_IO_SIZE_RANDOM,
46 	USB_MSC_IO_SIZE_INCREASING,
47 	USB_MSC_IO_SIZE_FIXED_1BLK,
48 	USB_MSC_IO_SIZE_FIXED_2BLK,
49 	USB_MSC_IO_SIZE_FIXED_4BLK,
50 	USB_MSC_IO_SIZE_FIXED_8BLK,
51 	USB_MSC_IO_SIZE_FIXED_16BLK,
52 	USB_MSC_IO_SIZE_FIXED_32BLK,
53 	USB_MSC_IO_SIZE_FIXED_64BLK,
54 	USB_MSC_IO_SIZE_FIXED_128BLK,
55 	USB_MSC_IO_SIZE_FIXED_256BLK,
56 	USB_MSC_IO_SIZE_FIXED_512BLK,
57 	USB_MSC_IO_SIZE_FIXED_1024BLK,
58 	USB_MSC_IO_SIZE_MAX,
59 };
60 
61 enum {
62 	USB_MSC_IO_DELAY_NONE,
63 	USB_MSC_IO_DELAY_RANDOM_10MS,
64 	USB_MSC_IO_DELAY_RANDOM_100MS,
65 	USB_MSC_IO_DELAY_FIXED_10MS,
66 	USB_MSC_IO_DELAY_FIXED_100MS,
67 	USB_MSC_IO_DELAY_MAX,
68 };
69 
70 enum {
71 	USB_MSC_IO_OFF_START_OF_DISK,
72 	USB_MSC_IO_OFF_RANDOM,
73 	USB_MSC_IO_OFF_MAX,
74 };
75 
76 enum {
77 	USB_MSC_IO_AREA_COMPLETE,
78 	USB_MSC_IO_AREA_1MB,
79 	USB_MSC_IO_AREA_16MB,
80 	USB_MSC_IO_AREA_256MB,
81 	USB_MSC_IO_AREA_MAX,
82 };
83 
84 enum {
85 	USB_MSC_IO_LUN_0,
86 	USB_MSC_IO_LUN_1,
87 	USB_MSC_IO_LUN_2,
88 	USB_MSC_IO_LUN_3,
89 	USB_MSC_IO_LUN_MAX,
90 };
91 
92 struct usb_msc_params {
93 
94 	uint32_t duration;
95 	uint32_t max_errors;
96 
97 	/* See "USB_MSC_XXX" enums */
98 
99 	uint8_t	io_mode;
100 	uint8_t	io_size;
101 	uint8_t	io_delay;
102 	uint8_t	io_offset;
103 	uint8_t	io_area;
104 	uint8_t	io_pattern;
105 	uint8_t	io_lun;
106 
107 	/* booleans */
108 	uint8_t	try_invalid_scsi_command;
109 	uint8_t	try_invalid_wrapper_block;
110 	uint8_t	try_invalid_max_packet_size;
111 	uint8_t try_shorter_wrapper_block;
112 	uint8_t	try_last_lba;
113 	uint8_t	try_abort_data_write;
114 	uint8_t try_sense_on_error;
115 	uint8_t try_all_lun;
116 
117 	uint8_t	done;
118 };
119 
120 #endif					/* _USB_MSC_TEST_H_ */
121