Release 20000227.
[wine.git] / include / aspi.h
blob8a005e8d0e501fb0badac0b5c9d212f812aed554
1 /* ASPI definitions used for both WNASPI16 and WNASPI32 */
3 #ifndef __WINE_ASPI_H
4 #define __WINE_ASPI_H
6 #include "windef.h"
8 #include "pshpack1.h"
10 #define SS_PENDING 0x00
11 #define SS_COMP 0x01
12 #define SS_ABORTED 0x02
13 #define SS_ERR 0x04
14 #define SS_INVALID_HA 0x81
15 #define SS_INVALID_SRB 0xe0
16 #define SS_OLD_MANAGE 0xe1
17 #define SS_ILLEGAL_MODE 0xe2
18 #define SS_NO_ASPI 0xe3
19 #define SS_FAILED_INIT 0xe4
20 #define SS_ASPI_IS_BUSY 0xe5
21 #define SS_BUFFER_TO_BIG 0xe6
23 #define SC_HA_INQUIRY 0x00
24 #define SC_GET_DEV_TYPE 0x01
25 #define SC_EXEC_SCSI_CMD 0x02
26 #define SC_ABORT_SRB 0x03
27 #define SC_RESET_DEV 0x04
30 /* Host adapter status codes */
31 #define HASTAT_OK 0x00
32 #define HASTAT_SEL_TO 0x11
33 #define HASTAT_DO_DU 0x12
34 #define HASTAT_BUS_FREE 0x13
35 #define HASTAT_PHASE_ERR 0x14
37 /* Target status codes */
38 #define STATUS_GOOD 0x00
39 #define STATUS_CHKCOND 0x02
40 #define STATUS_BUSY 0x08
41 #define STATUS_RESCONF 0x18
43 #ifdef linux
45 /* This is a duplicate of the sg_header from /usr/src/linux/include/scsi/sg.h
46 * kernel 2.0.30
47 * This will probably break at some point, but for those who don't have
48 * kernels installed, I think this should still work.
52 struct sg_header
54 int pack_len; /* length of incoming packet <4096 (including header) */
55 int reply_len; /* maximum length <4096 of expected reply */
56 int pack_id; /* id number of packet */
57 int result; /* 0==ok, otherwise refer to errno codes */
58 unsigned int twelve_byte:1; /* Force 12 byte command length for group 6 & 7
59 commands */
60 unsigned int target_status:5; /* [o] scsi status from target */
61 unsigned int host_status:8; /* [o] host status (see "DID" codes) */
62 unsigned int driver_status:8; /* [o] driver status+suggestion */
63 unsigned int other_flags:10; /* unused */
64 unsigned char sense_buffer[16]; /* used only by reads */
65 /* command follows then data for command */
68 #define SCSI_OFF sizeof(struct sg_header)
69 #endif
71 #define ASPI_POSTING(prb) (prb->SRB_Flags & 0x1)
73 #define HOST_TO_TARGET(prb) (((prb->SRB_Flags>>3) & 0x3) == 0x2)
74 #define TARGET_TO_HOST(prb) (((prb->SRB_Flags>>3) & 0x3) == 0x1)
75 #define NO_DATA_TRANSFERED(prb) (((prb->SRB_Flags>>3) & 0x3) == 0x3)
77 #define SRB_ENABLE_RESIDUAL_COUNT 0x4
78 #define SRB_EVENT_NOTIFY 0x40 /* Enable ASPI event notification */
80 #define INQUIRY_VENDOR 8
82 #define MUSTEK_SCSI_AREA_AND_WINDOWS 0x04
83 #define MUSTEK_SCSI_READ_SCANNED_DATA 0x08
84 #define MUSTEK_SCSI_GET_IMAGE_STATUS 0x0f
85 #define MUSTEK_SCSI_ADF_AND_BACKTRACE 0x10
86 #define MUSTEK_SCSI_CCD_DISTANCE 0x11
87 #define MUSTEK_SCSI_START_STOP 0x1b
89 #define CMD_TEST_UNIT_READY 0x00
90 #define CMD_REQUEST_SENSE 0x03
91 #define CMD_INQUIRY 0x12
93 /* scanner commands - just for debug */
94 #define CMD_SCAN_GET_DATA_BUFFER_STATUS 0x34
95 #define CMD_SCAN_GET_WINDOW 0x25
96 #define CMD_SCAN_OBJECT_POSITION 0x31
97 #define CMD_SCAN_READ 0x28
98 #define CMD_SCAN_RELEASE_UNIT 0x17
99 #define CMD_SCAN_RESERVE_UNIT 0x16
100 #define CMD_SCAN_SCAN 0x1b
101 #define CMD_SCAN_SEND 0x2a
102 #define CMD_SCAN_CHANGE_DEFINITION 0x40
104 #define INQURIY_CMDLEN 6
105 #define INQURIY_REPLY_LEN 96
106 #define INQUIRY_VENDOR 8
108 #define SENSE_BUFFER(prb) (&prb->CDBByte[prb->SRB_CDBLen])
111 /* Just a container for seeing what devices are open */
112 struct ASPI_DEVICE_INFO {
113 struct ASPI_DEVICE_INFO * next;
114 int fd;
115 int hostId;
116 int target;
117 int lun;
120 typedef struct ASPI_DEVICE_INFO ASPI_DEVICE_INFO;
122 #include "poppack.h"
124 #endif