Mad the include files idempotent using a consistent macro naming
[wine] / include / aspi.h
1 /* ASPI definitions used for both WNASPI16 and WNASPI32 */
2
3 #ifndef __WINE_ASPI_H
4 #define __WINE_ASPI_H
5
6 #include "windef.h"
7
8 #include "pshpack1.h"
9
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
22
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
28
29
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
36
37 /* Target status codes */
38 #define STATUS_GOOD             0x00
39 #define STATUS_CHKCOND          0x02
40 #define STATUS_BUSY             0x08
41 #define STATUS_RESCONF          0x18
42
43 #ifdef linux
44
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.
49  *
50  */
51
52 struct sg_header
53  {
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 other_flags:31;                  /* for future use */
61   unsigned char sense_buffer[16]; /* used only by reads */
62   /* command follows then data for command */
63  };
64
65 #define SCSI_OFF sizeof(struct sg_header)
66 #endif
67
68 #define ASPI_POSTING(prb) (prb->SRB_Flags & 0x1)
69
70 #define HOST_TO_TARGET(prb) (((prb->SRB_Flags>>3) & 0x3) == 0x2)
71 #define TARGET_TO_HOST(prb) (((prb->SRB_Flags>>3) & 0x3) == 0x1)
72 #define NO_DATA_TRANSFERED(prb) (((prb->SRB_Flags>>3) & 0x3) == 0x3)
73
74 #define SRB_ENABLE_RESIDUAL_COUNT 0x4
75 #define SRB_EVENT_NOTIFY 0x40 /* Enable ASPI event notification */
76
77 #define INQUIRY_VENDOR          8
78
79 #define MUSTEK_SCSI_AREA_AND_WINDOWS 0x04
80 #define MUSTEK_SCSI_READ_SCANNED_DATA 0x08
81 #define MUSTEK_SCSI_GET_IMAGE_STATUS 0x0f
82 #define MUSTEK_SCSI_ADF_AND_BACKTRACE 0x10
83 #define MUSTEK_SCSI_CCD_DISTANCE 0x11
84 #define MUSTEK_SCSI_START_STOP 0x1b
85
86 #define CMD_TEST_UNIT_READY 0x00
87 #define CMD_REQUEST_SENSE 0x03
88 #define CMD_INQUIRY 0x12
89
90 /* scanner commands - just for debug */
91 #define CMD_SCAN_GET_DATA_BUFFER_STATUS 0x34
92 #define CMD_SCAN_GET_WINDOW 0x25
93 #define CMD_SCAN_OBJECT_POSITION 0x31
94 #define CMD_SCAN_READ 0x28
95 #define CMD_SCAN_RELEASE_UNIT 0x17
96 #define CMD_SCAN_RESERVE_UNIT 0x16
97 #define CMD_SCAN_SCAN 0x1b
98 #define CMD_SCAN_SEND 0x2a
99 #define CMD_SCAN_CHANGE_DEFINITION 0x40
100
101 #define INQURIY_CMDLEN 6
102 #define INQURIY_REPLY_LEN 96
103 #define INQUIRY_VENDOR 8
104
105 #define SENSE_BUFFER(prb) (&prb->CDBByte[prb->SRB_CDBLen])
106
107
108 /* Just a container for seeing what devices are open */
109 struct ASPI_DEVICE_INFO {
110     struct ASPI_DEVICE_INFO *   next;
111     int                         fd;
112     int                         hostId;
113     int                         target;
114     int                         lun;
115 };
116
117 typedef struct ASPI_DEVICE_INFO ASPI_DEVICE_INFO;
118 static ASPI_DEVICE_INFO *ASPI_open_devices = NULL;
119
120 #include "poppack.h"
121
122 #endif