1/**
2 *
3 * TODO: description
4 *
5 * This file is a part of USB SCSI CAM for Haiku.
6 * May be used under terms of the MIT License
7 *
8 * Author(s):
9 * 	Siarzhuk Zharski <imker@gmx.li>
10 *
11 *
12 */
13#ifndef _USB_SCSI_H_
14	#define _USB_SCSI_H_
15
16#ifndef _OS_H
17	#include <OS.h>
18#endif //_OS_H
19
20#ifndef _USB_V3_H_
21	#include <USB3.h>
22#endif /* _USB_V3_H_ */
23
24#ifndef _CAM_H
25	#include <CAM.h>
26#endif /*_CAM_H*/
27
28#define MODULE_NAME "usb_scsi"
29
30#define CONTROLLER_SCSI_BUS 0x00 /* Narrow SCSI bus. Use PI_* to alter this*/
31#define MAX_DEVICES_COUNT	0x07 /* simulate Narrow SCSI bus - 8 devices*/
32#define CONTROLLER_SCSI_ID	0x07 /* "controller" SCSI ID */
33#define MAX_LUNS_COUNT		0x08
34
35/* transport protocol definitions - are not bitmasks */
36#define PROTO_NONE		0x00000000
37#define PROTO_BULK_ONLY	0x00000001
38#define PROTO_CB		0x00000002
39#define PROTO_CBI		0x00000003
40
41#define PROTO_VENDOR	0x0000000e
42#define PROTO_MASK		0x0000000f
43
44#define PROTO(__value) ((__value) & PROTO_MASK)
45
46/* command set definitions	- are not bitmasks */
47#define CMDSET_NONE		0x00000000
48#define CMDSET_SCSI		0x00000010
49#define CMDSET_UFI		0x00000020
50#define CMDSET_ATAPI	0x00000030
51#define CMDSET_RBC		0x00000040
52#define CMDSET_QIC157	0x00000050
53
54#define CMDSET_VENDOR	0x000000e0
55#define CMDSET_MASK		0x000000f0
56
57#define CMDSET(__value)((__value) & CMDSET_MASK)
58
59#define HAS_SET(__mask, __flag) \
60					(((__mask) & __flag) == (__flag))
61
62/* fixes - bitmasked */
63#define FIX_NO_GETMAXLUN		0x00000100
64#define FIX_FORCE_RW_TO_6		0x00000200
65#define FIX_NO_TEST_UNIT		0x00000400
66#define FIX_NO_INQUIRY			0x00000800
67#define FIX_TRANS_TEST_UNIT		0x00001000
68#define FIX_NO_PREVENT_MEDIA	0x00002000
69#define FIX_FORCE_MS_TO_10		0x00004000
70#define FIX_FORCE_READ_ONLY		0x00008000
71
72#define FIX_NONE				0x00000000
73#define FIX_MASK				0x000fff00
74
75#define HAS_FIXES(__value, __fix) \
76								HAS_SET((__value), (__fix))
77
78#endif /*_USB_SCSI_H_*/
79
80