/[pearpc]/src/system/osapi/win32/aspi-win32.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /src/system/osapi/win32/aspi-win32.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (hide annotations)
Wed Sep 5 17:11:21 2007 UTC (16 years, 7 months ago) by dpavlin
File MIME type: text/plain
File size: 12740 byte(s)
import upstream CVS
1 dpavlin 1 //
2     // aspi-win32.h
3     //
4     // This file was copied from the bochs IA-32 emulator project.
5     // Original comment:
6     // > This file was copied from cdrecord 1.9 under libscg/scg/aspi-win32.h.
7     // > The only modification is related to use of the PACKED keyword.
8     //
9     // Changes since bochs:
10     //
11     // Moved ASPI function declarations into this header file (Alex, dajudge@t-online.de)
12     //
13    
14     #ifndef __ASPI_WIN32_H_
15     #define __ASPI_WIN32_H_
16    
17     #include <windows.h>
18    
19     #ifndef PACKED
20     // It seems that VC++ has no PACKED keyword but Cygwin does. We can just
21     // define PACKED to be empty if it's not already defined by the system
22     // headers.
23     #define PACKED /* empty */
24     #endif
25    
26     /***************************************************************************
27     ** SCSI MISCELLANEOUS EQUATES
28     ***************************************************************************/
29     #define SENSE_LEN 14 /* Default sense buffer length */
30     #define SRB_DIR_SCSI 0x00 /* Direction determined by SCSI */
31     #define SRB_POSTING 0x01 /* Enable ASPI posting */
32     #define SRB_ENABLE_RESIDUAL_COUNT 0x04 /* Enable residual byte count */
33     /* reporting */
34     #define SRB_DIR_IN 0x08 /* Transfer from SCSI target to */
35     /* host */
36     #define SRB_DIR_OUT 0x10 /* Transfer from host to SCSI */
37     /* target */
38     #define SRB_EVENT_NOTIFY 0x40 /* Enable ASPI event notification */
39     #define RESIDUAL_COUNT_SUPPORTED 0x02 /* Extended buffer flag */
40     #define MAX_SRB_TIMEOUT 1080001u /* 30 hour maximum timeout in sec */
41     #define DEFAULT_SRB_TIMEOUT 1080001u /* use max.timeout by default */
42    
43     /***************************************************************************
44     ** ASPI command definitions
45     ***************************************************************************/
46     #define SC_HA_INQUIRY 0x00 /* Host adapter inquiry */
47     #define SC_GET_DEV_TYPE 0x01 /* Get device type */
48     #define SC_EXEC_SCSI_CMD 0x02 /* Execute SCSI command */
49     #define SC_ABORT_SRB 0x03 /* Abort an SRB */
50     #define SC_RESET_DEV 0x04 /* SCSI bus device reset */
51     #define SC_SET_HA_PARMS 0x05 /* Set HA parameters */
52     #define SC_GET_DISK_INFO 0x06 /* Get Disk */
53     #define SC_RESCAN_SCSI_BUS 0x07 /* Rebuild SCSI device map */
54     #define SC_GETSET_TIMEOUTS 0x08 /* Get/Set target timeouts */
55    
56    
57     /***************************************************************************
58     ** SRB Status
59     ***************************************************************************/
60     #define SS_PENDING 0x00 /* SRB being processed */
61     #define SS_COMP 0x01 /* SRB completed without error */
62     #define SS_ABORTED 0x02 /* SRB aborted */
63     #define SS_ABORT_FAIL 0x03 /* Unable to abort SRB */
64     #define SS_ERR 0x04 /* SRB completed with error */
65     #define SS_INVALID_CMD 0x80 /* Invalid ASPI command */
66     #define SS_INVALID_HA 0x81 /* Invalid host adapter number */
67     #define SS_NO_DEVICE 0x82 /* SCSI device not installed */
68     #define SS_INVALID_SRB 0xE0 /* Invalid parameter set in SRB */
69     #define SS_OLD_MANAGER 0xE1 /* ASPI manager doesn't support */
70     /* windows */
71     #define SS_BUFFER_ALIGN 0xE1 /* Buffer not aligned (replaces */
72     /* SS_OLD_MANAGER in Win32) */
73     #define SS_ILLEGAL_MODE 0xE2 /* Unsupported Windows mode */
74     #define SS_NO_ASPI 0xE3 /* No ASPI managers */
75     #define SS_FAILED_INIT 0xE4 /* ASPI for windows failed init */
76     #define SS_ASPI_IS_BUSY 0xE5 /* No resources available to */
77     /* execute command */
78     #define SS_BUFFER_TO_BIG 0xE6 /* Buffer size too big to handle */
79     #define SS_BUFFER_TOO_BIG 0xE6 /* Correct spelling of 'too' */
80     #define SS_MISMATCHED_COMPONENTS 0xE7 /* The DLLs/EXEs of ASPI don't */
81     /* version check */
82     #define SS_NO_ADAPTERS 0xE8 /* No host adapters to manager */
83     #define SS_INSUFFICIENT_RESOURCES 0xE9 /* Couldn't allocate resources */
84     /* needed to init */
85     #define SS_ASPI_IS_SHUTDOWN 0xEA /* Call came to ASPI after */
86     /* PROCESS_DETACH */
87     #define SS_BAD_INSTALL 0xEB /* The DLL or other components */
88     /* are installed wrong */
89    
90     /***************************************************************************
91     ** Host Adapter Status
92     ***************************************************************************/
93     #define HASTAT_OK 0x00 /* No error detected by HA */
94     #define HASTAT_SEL_TO 0x11 /* Selection Timeout */
95     #define HASTAT_DO_DU 0x12 /* Data overrun/data underrun */
96     #define HASTAT_BUS_FREE 0x13 /* Unexpected bus free */
97     #define HASTAT_PHASE_ERR 0x14 /* Target bus phase sequence */
98     #define HASTAT_TIMEOUT 0x09 /* Timed out while SRB was */
99     /* waiting to be processed */
100     #define HASTAT_COMMAND_TIMEOUT 0x0B /* Adapter timed out while */
101     /* processing SRB */
102     #define HASTAT_MESSAGE_REJECT 0x0D /* While processing the SRB, the */
103     /* adapter received a MESSAGE */
104     #define HASTAT_BUS_RESET 0x0E /* A bus reset was detected */
105     #define HASTAT_PARITY_ERROR 0x0F /* A parity error was detected */
106     #define HASTAT_REQUEST_SENSE_FAILED 0x10 /* The adapter failed in issuing */
107    
108     /***************************************************************************
109     ** SRB - HOST ADAPTER INQUIRIY - SC_HA_INQUIRY (0)
110     ***************************************************************************/
111     typedef struct {
112     BYTE SRB_Cmd; /* 00/000 ASPI command code == SC_HA_INQUIRY */
113     BYTE SRB_Status; /* 01/001 ASPI command status byte */
114     BYTE SRB_HaId; /* 02/002 ASPI host adapter number */
115     BYTE SRB_Flags; /* 03/003 ASPI request flags */
116     DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */
117     BYTE HA_Count; /* 08/008 Number of host adapters present */
118     BYTE HA_SCSI_ID; /* 09/009 SCSI ID of host adapter */
119     BYTE HA_ManagerId[16]; /* 0a/010 String describing the manager */
120     BYTE HA_Identifier[16]; /* 1a/026 String describing the host adapter */
121     BYTE HA_Unique[16]; /* 2a/042 Host Adapter Unique parameters */
122     WORD HA_Rsvd1; /* 3a/058 Reserved, must = 0 */
123     } PACKED SRB_HAInquiry, *PSRB_HAInquiry, FAR *LPSRB_HAInquiry;
124    
125    
126     /***************************************************************************
127     ** SRB - GET DEVICE TYPE - SC_GET_DEV_TYPE (1)
128     ***************************************************************************/
129     typedef struct
130     {
131     BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_GET_DEV_TYPE */
132     BYTE SRB_Status; /* 01/001 ASPI command status byte */
133     BYTE SRB_HaId; /* 02/002 ASPI host adapter number */
134     BYTE SRB_Flags; /* 03/003 Reserved, must = 0 */
135     DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */
136     BYTE SRB_Target; /* 08/008 Target's SCSI ID */
137     BYTE SRB_Lun; /* 09/009 Target's LUN number */
138     BYTE SRB_DeviceType; /* 0a/010 Target's peripheral device type */
139     BYTE SRB_Rsvd1; /* 0b/011 Reserved, must = 0 */
140     } PACKED SRB_GDEVBlock, *PSRB_GDEVBlock, FAR *LPSRB_GDEVBlock;
141    
142    
143     /***************************************************************************
144     ** SRB - EXECUTE SCSI COMMAND - SC_EXEC_SCSI_CMD (2)
145     ***************************************************************************/
146     typedef struct
147     {
148     BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_EXEC_SCSI_CMD */
149     BYTE SRB_Status; /* 01/001 ASPI command status byte */
150     BYTE SRB_HaId; /* 02/002 ASPI host adapter number */
151     BYTE SRB_Flags; /* 03/003 Reserved, must = 0 */
152     DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */
153     BYTE SRB_Target; /* 08/008 Target's SCSI ID */
154     BYTE SRB_Lun; /* 09/009 Target's LUN */
155     WORD SRB_Rsvd1; /* 0a/010 Reserved for alignment */
156     DWORD SRB_BufLen; /* 0c/012 Data Allocation Length */
157     BYTE FAR *SRB_BufPointer; /* 10/016 Data Buffer Pointer */
158     BYTE SRB_SenseLen; /* 14/020 Sense Allocation Length */
159     BYTE SRB_CDBLen; /* 15/021 CDB Length */
160     BYTE SRB_HaStat; /* 16/022 Host Adapter Status */
161     BYTE SRB_TargStat; /* 17/023 Target Status */
162     VOID FAR *SRB_PostProc; /* 18/024 Post routine */
163     BYTE SRB_Rsvd2[20]; /* 1c/028 Reserved, must = 0 */
164     BYTE CDBByte[16]; /* 30/048 SCSI CDB */
165     BYTE SenseArea[SENSE_LEN+2]; /* 40/064 Request Sense buffer */
166     } PACKED SRB_ExecSCSICmd, *PSRB_ExecSCSICmd, FAR *LPSRB_ExecSCSICmd;
167    
168    
169     typedef struct
170     {
171     BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_ABORT_SRB */
172     BYTE SRB_Status; /* 01/001 ASPI command status byte */
173     BYTE SRB_HaId; /* 02/002 ASPI host adapter number */
174     BYTE SRB_Flags; /* 03/003 Reserved, must = 0 */
175     DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */
176     void *SRB_ToAbort; /* 08/008 Pointer to SRB to abort */
177     } PACKED SRB_Abort, *PSRB_Abort, FAR *LPSRB_Abort;
178    
179    
180     /***************************************************************************
181     ** SRB - BUS DEVICE RESET - SC_RESET_DEV (4)
182     ***************************************************************************/
183     typedef struct
184     {
185     BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_RESET_DEV */
186     BYTE SRB_Status; /* 01/001 ASPI command status byte */
187     BYTE SRB_HaId; /* 02/002 ASPI host adapter number */
188     DWORD SRB_Flags; /* 04/004 Reserved */
189     BYTE SRB_Target; /* 08/008 Target's SCSI ID */
190     BYTE SRB_Lun; /* 09/009 Target's LUN number */
191     BYTE SRB_Rsvd1[12]; /* 0A/010 Reserved for alignment */
192     BYTE SRB_HaStat; /* 16/022 Host Adapter Status */
193     BYTE SRB_TargStat; /* 17/023 Target Status */
194     VOID FAR *SRB_PostProc; /* 18/024 Post routine */
195     BYTE SRB_Rsvd2[36]; /* 1C/028 Reserved, must = 0 */
196     } SRB_BusDeviceReset, *PSRB_BusDeviceReset, FAR *LPSRB_BusDeviceReset;
197    
198     typedef struct tag_ASPI32BUFF
199     {
200     PBYTE AB_BufPointer;
201     DWORD AB_BufLen;
202     DWORD AB_ZeroFill;
203     DWORD AB_Reserved;
204     } PACKED ASPI32BUFF, *PASPI32BUFF, FAR *LPASPI32BUFF;
205    
206     typedef struct
207     {
208     BYTE SRB_Cmd;
209     BYTE SRB_Status;
210     BYTE SRB_HaId;
211     BYTE SRB_Flags;
212     DWORD SRB_Hdr_Rsvd;
213     } SRB, *PSRB, FAR *LPSRB;
214    
215     /***************************************************************************
216     ** ASPI function declarations
217     ***************************************************************************/
218     DWORD (*GetASPI32SupportInfo)(void);
219     DWORD (*SendASPI32Command)(LPSRB);
220     BOOL (*GetASPI32Buffer)(PASPI32BUFF);
221     BOOL (*FreeASPI32Buffer)(PASPI32BUFF);
222     BOOL (*TranslateASPI32Address)(PDWORD,PDWORD);
223     DWORD (*GetASPI32DLLVersion)(void);
224    
225     #endif

  ViewVC Help
Powered by ViewVC 1.1.26