1 | /*
|
---|
2 | * scsiscan.h
|
---|
3 | *
|
---|
4 | * SCSI scanner driver interface
|
---|
5 | *
|
---|
6 | * This file is part of the w32api package.
|
---|
7 | *
|
---|
8 | * Contributors:
|
---|
9 | * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
|
---|
10 | *
|
---|
11 | * THIS SOFTWARE IS NOT COPYRIGHTED
|
---|
12 | *
|
---|
13 | * This source code is offered for use in the public domain. You may
|
---|
14 | * use, modify or distribute it freely.
|
---|
15 | *
|
---|
16 | * This code is distributed in the hope that it will be useful but
|
---|
17 | * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
---|
18 | * DISCLAIMED. This includes but is not limited to warranties of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
---|
20 | *
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef __SCSISCAN_H
|
---|
24 | #define __SCSISCAN_H
|
---|
25 |
|
---|
26 | #ifdef __cplusplus
|
---|
27 | extern "C" {
|
---|
28 | #endif
|
---|
29 |
|
---|
30 | #define IOCTL_SCSISCAN_CMD \
|
---|
31 | CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_CMD_CODE, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
|
---|
32 |
|
---|
33 | #define IOCTL_SCSISCAN_LOCKDEVICE \
|
---|
34 | CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_LOCKDEVICE, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
|
---|
35 |
|
---|
36 | #define IOCTL_SCSISCAN_SET_TIMEOUT \
|
---|
37 | CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_SET_TIMEOUT, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
38 |
|
---|
39 | #define IOCTL_SCSISCAN_GET_INFO \
|
---|
40 | CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_GET_INFO, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
|
---|
41 |
|
---|
42 | #define IOCTL_SCSISCAN_UNLOCKDEVICE \
|
---|
43 | CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_UNLOCKDEVICE, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
|
---|
44 |
|
---|
45 |
|
---|
46 | /* SCSISCAN_CMD.SrbFlags constants */
|
---|
47 | #define SRB_FLAGS_DISABLE_SYNCH_TRANSFER 0x00000008
|
---|
48 | #define SRB_FLAGS_DISABLE_AUTOSENSE 0x00000020
|
---|
49 | #define SRB_FLAGS_DATA_IN 0x00000040
|
---|
50 | #define SRB_FLAGS_DATA_OUT 0x00000080
|
---|
51 | #define SRB_FLAGS_NO_DATA_TRANSFER 0x00000000
|
---|
52 |
|
---|
53 | /* SCSISCAN_CMD.pSrbStatus constants */
|
---|
54 | #define SRB_STATUS_PENDING 0x00
|
---|
55 | #define SRB_STATUS_SUCCESS 0x01
|
---|
56 | #define SRB_STATUS_ABORTED 0x02
|
---|
57 | #define SRB_STATUS_ABORT_FAILED 0x03
|
---|
58 | #define SRB_STATUS_ERROR 0x04
|
---|
59 | #define SRB_STATUS_BUSY 0x05
|
---|
60 | #define SRB_STATUS_INVALID_REQUEST 0x06
|
---|
61 | #define SRB_STATUS_INVALID_PATH_ID 0x07
|
---|
62 | #define SRB_STATUS_NO_DEVICE 0x08
|
---|
63 | #define SRB_STATUS_TIMEOUT 0x09
|
---|
64 | #define SRB_STATUS_SELECTION_TIMEOUT 0x0A
|
---|
65 | #define SRB_STATUS_COMMAND_TIMEOUT 0x0B
|
---|
66 | #define SRB_STATUS_MESSAGE_REJECTED 0x0D
|
---|
67 | #define SRB_STATUS_BUS_RESET 0x0E
|
---|
68 | #define SRB_STATUS_PARITY_ERROR 0x0F
|
---|
69 | #define SRB_STATUS_REQUEST_SENSE_FAILED 0x10
|
---|
70 | #define SRB_STATUS_NO_HBA 0x11
|
---|
71 | #define SRB_STATUS_DATA_OVERRUN 0x12
|
---|
72 | #define SRB_STATUS_UNEXPECTED_BUS_FREE 0x13
|
---|
73 | #define SRB_STATUS_PHASE_SEQUENCE_FAILURE 0x14
|
---|
74 | #define SRB_STATUS_BAD_SRB_BLOCK_LENGTH 0x15
|
---|
75 | #define SRB_STATUS_REQUEST_FLUSHED 0x16
|
---|
76 | #define SRB_STATUS_INVALID_LUN 0x20
|
---|
77 | #define SRB_STATUS_INVALID_TARGET_ID 0x21
|
---|
78 | #define SRB_STATUS_BAD_FUNCTION 0x22
|
---|
79 | #define SRB_STATUS_ERROR_RECOVERY 0x23
|
---|
80 | #define SRB_STATUS_QUEUE_FROZEN 0x40
|
---|
81 | #define SRB_STATUS_AUTOSENSE_VALID 0x80
|
---|
82 |
|
---|
83 | #define SRB_STATUS(Status) (Status & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN))
|
---|
84 |
|
---|
85 | typedef struct _SCSISCAN_CMD {
|
---|
86 | ULONG Reserved1;
|
---|
87 | ULONG Size;
|
---|
88 | ULONG SrbFlags;
|
---|
89 | UCHAR CdbLength;
|
---|
90 | UCHAR SenseLength;
|
---|
91 | UCHAR Reserved2;
|
---|
92 | UCHAR Reserved3;
|
---|
93 | ULONG TransferLength;
|
---|
94 | UCHAR Cdb[16];
|
---|
95 | PUCHAR pSrbStatus;
|
---|
96 | PUCHAR pSenseBuffer;
|
---|
97 | } SCSISCAN_CMD, *PSCSISCAN_CMD;
|
---|
98 |
|
---|
99 | #define MAX_STRING 128
|
---|
100 |
|
---|
101 | /* SCSISCAN_INFO.Flags constants */
|
---|
102 | #define SCSISCAN_RESERVED 0x000
|
---|
103 | #define SCSISCAN_CMD_CODE 0x004
|
---|
104 | #define SCSISCAN_LOCKDEVICE 0x005
|
---|
105 | #define SCSISCAN_UNLOCKDEVICE 0x006
|
---|
106 | #define SCSISCAN_SET_TIMEOUT 0x007
|
---|
107 | #define SCSISCAN_GET_INFO 0x008
|
---|
108 |
|
---|
109 | typedef struct _SCSISCAN_INFO {
|
---|
110 | ULONG Size;
|
---|
111 | ULONG Flags;
|
---|
112 | UCHAR PortNumber;
|
---|
113 | UCHAR PathId;
|
---|
114 | UCHAR TargetId;
|
---|
115 | UCHAR Lun;
|
---|
116 | UCHAR AdapterName[MAX_STRING];
|
---|
117 | ULONG Reserved;
|
---|
118 | } SCSISCAN_INFO, *PSCSISCAN_INFO;
|
---|
119 |
|
---|
120 | #ifdef __cplusplus
|
---|
121 | }
|
---|
122 | #endif
|
---|
123 |
|
---|
124 | #endif /* __SCSISCAN_H */
|
---|