Release 990226.
[wine/gsoc-2012-control.git] / include / aspi.h
blobe19d39098914addb9547b5a3042ce97ec44e1cb2
1 /* ASPI definitions used for both WNASPI16 and WNASPI32 */
3 #if !defined(ASPI_H)
4 #define ASPI_H
6 #pragma pack(1)
8 #define SS_PENDING 0x00
9 #define SS_COMP 0x01
10 #define SS_ABORTED 0x02
11 #define SS_ERR 0x04
12 #define SS_OLD_MANAGE 0xe1
13 #define SS_ILLEGAL_MODE 0xe2
14 #define SS_NO_ASPI 0xe3
15 #define SS_FAILED_INIT 0xe4
16 #define SS_INVALID_HA 0x81
17 #define SS_INVALID_SRB 0xe0
18 #define SS_ASPI_IS_BUSY 0xe5
19 #define SS_BUFFER_TO_BIG 0xe6
21 #define SC_HA_INQUIRY 0x00
22 #define SC_GET_DEV_TYPE 0x01
23 #define SC_EXEC_SCSI_CMD 0x02
24 #define SC_ABORT_SRB 0x03
25 #define SC_RESET_DEV 0x04
28 /* Host adapter status codes */
29 #define HASTAT_OK 0x00
30 #define HASTAT_SEL_TO 0x11
31 #define HASTAT_DO_DU 0x12
32 #define HASTAT_BUS_FREE 0x13
33 #define HASTAT_PHASE_ERR 0x14
35 /* Target status codes */
36 #define STATUS_GOOD 0x00
37 #define STATUS_CHKCOND 0x02
38 #define STATUS_BUSY 0x08
39 #define STATUS_RESCONF 0x18
41 #ifdef linux
43 /* This is a duplicate of the sg_header from /usr/src/linux/include/scsi/sg.h
44 * kernel 2.0.30
45 * This will probably break at some point, but for those who don't have
46 * kernels installed, I think this should still work.
50 struct sg_header
52 int pack_len; /* length of incoming packet <4096 (including header) */
53 int reply_len; /* maximum length <4096 of expected reply */
54 int pack_id; /* id number of packet */
55 int result; /* 0==ok, otherwise refer to errno codes */
56 unsigned int twelve_byte:1; /* Force 12 byte command length for group 6 & 7
57 commands */
58 unsigned int other_flags:31; /* for future use */
59 unsigned char sense_buffer[16]; /* used only by reads */
60 /* command follows then data for command */
63 #define SCSI_OFF sizeof(struct sg_header)
64 #endif
66 #define ASPI_POSTING(prb) (prb->SRB_Flags & 0x1)
68 #define HOST_TO_TARGET(prb) (((prb->SRB_Flags>>3) & 0x3) == 0x2)
69 #define TARGET_TO_HOST(prb) (((prb->SRB_Flags>>3) & 0x3) == 0x1)
70 #define NO_DATA_TRANSFERED(prb) (((prb->SRB_Flags>>3) & 0x3) == 0x3)
72 #define SRB_ENABLE_RESIDUAL_COUNT 0x4
73 #define SRB_EVENT_NOTIFY 0x40 /* Enable ASPI event notification */
75 #define INQUIRY_VENDOR 8
77 #define MUSTEK_SCSI_AREA_AND_WINDOWS 0x04
78 #define MUSTEK_SCSI_READ_SCANNED_DATA 0x08
79 #define MUSTEK_SCSI_GET_IMAGE_STATUS 0x0f
80 #define MUSTEK_SCSI_ADF_AND_BACKTRACE 0x10
81 #define MUSTEK_SCSI_CCD_DISTANCE 0x11
82 #define MUSTEK_SCSI_START_STOP 0x1b
84 #define CMD_TEST_UNIT_READY 0x00
85 #define CMD_REQUEST_SENSE 0x03
86 #define CMD_INQUIRY 0x12
88 /* scanner commands - just for debug */
89 #define CMD_SCAN_GET_DATA_BUFFER_STATUS 0x34
90 #define CMD_SCAN_GET_WINDOW 0x25
91 #define CMD_SCAN_OBJECT_POSITION 0x31
92 #define CMD_SCAN_READ 0x28
93 #define CMD_SCAN_RELEASE_UNIT 0x17
94 #define CMD_SCAN_RESERVE_UNIT 0x16
95 #define CMD_SCAN_SCAN 0x1b
96 #define CMD_SCAN_SEND 0x2a
97 #define CMD_SCAN_CHANGE_DEFINITION 0x40
99 #define INQURIY_CMDLEN 6
100 #define INQURIY_REPLY_LEN 96
101 #define INQUIRY_VENDOR 8
103 #define SENSE_BUFFER(prb) (&prb->CDBByte[prb->SRB_CDBLen])
106 /* Just a container for seeing what devices are open */
107 struct ASPI_DEVICE_INFO {
108 struct ASPI_DEVICE_INFO * next;
109 int fd;
110 int hostId;
111 int target;
112 int lun;
115 typedef struct ASPI_DEVICE_INFO ASPI_DEVICE_INFO;
116 static ASPI_DEVICE_INFO *ASPI_open_devices = NULL;
118 #endif