[1046] | 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 | #if __GNUC__ >=3
|
---|
| 27 | #pragma GCC system_header
|
---|
| 28 | #endif
|
---|
| 29 |
|
---|
| 30 | #ifdef __cplusplus
|
---|
| 31 | extern "C" {
|
---|
| 32 | #endif
|
---|
| 33 |
|
---|
| 34 | #include "ntddk.h"
|
---|
| 35 |
|
---|
| 36 | #define IOCTL_SCSISCAN_CMD \
|
---|
| 37 | CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_CMD_CODE, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
|
---|
| 38 |
|
---|
| 39 | #define IOCTL_SCSISCAN_LOCKDEVICE \
|
---|
| 40 | CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_LOCKDEVICE, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
|
---|
| 41 |
|
---|
| 42 | #define IOCTL_SCSISCAN_SET_TIMEOUT \
|
---|
| 43 | CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_SET_TIMEOUT, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
| 44 |
|
---|
| 45 | #define IOCTL_SCSISCAN_GET_INFO \
|
---|
| 46 | CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_GET_INFO, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
|
---|
| 47 |
|
---|
| 48 | #define IOCTL_SCSISCAN_UNLOCKDEVICE \
|
---|
| 49 | CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_UNLOCKDEVICE, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 | /* SCSISCAN_CMD.SrbFlags constants */
|
---|
| 53 | #define SRB_FLAGS_DISABLE_SYNCH_TRANSFER 0x00000008
|
---|
| 54 | #define SRB_FLAGS_DISABLE_AUTOSENSE 0x00000020
|
---|
| 55 | #define SRB_FLAGS_DATA_IN 0x00000040
|
---|
| 56 | #define SRB_FLAGS_DATA_OUT 0x00000080
|
---|
| 57 | #define SRB_FLAGS_NO_DATA_TRANSFER 0x00000000
|
---|
| 58 |
|
---|
| 59 | /* SCSISCAN_CMD.pSrbStatus constants */
|
---|
| 60 | #define SRB_STATUS_PENDING 0x00
|
---|
| 61 | #define SRB_STATUS_SUCCESS 0x01
|
---|
| 62 | #define SRB_STATUS_ABORTED 0x02
|
---|
| 63 | #define SRB_STATUS_ABORT_FAILED 0x03
|
---|
| 64 | #define SRB_STATUS_ERROR 0x04
|
---|
| 65 | #define SRB_STATUS_BUSY 0x05
|
---|
| 66 | #define SRB_STATUS_INVALID_REQUEST 0x06
|
---|
| 67 | #define SRB_STATUS_INVALID_PATH_ID 0x07
|
---|
| 68 | #define SRB_STATUS_NO_DEVICE 0x08
|
---|
| 69 | #define SRB_STATUS_TIMEOUT 0x09
|
---|
| 70 | #define SRB_STATUS_SELECTION_TIMEOUT 0x0A
|
---|
| 71 | #define SRB_STATUS_COMMAND_TIMEOUT 0x0B
|
---|
| 72 | #define SRB_STATUS_MESSAGE_REJECTED 0x0D
|
---|
| 73 | #define SRB_STATUS_BUS_RESET 0x0E
|
---|
| 74 | #define SRB_STATUS_PARITY_ERROR 0x0F
|
---|
| 75 | #define SRB_STATUS_REQUEST_SENSE_FAILED 0x10
|
---|
| 76 | #define SRB_STATUS_NO_HBA 0x11
|
---|
| 77 | #define SRB_STATUS_DATA_OVERRUN 0x12
|
---|
| 78 | #define SRB_STATUS_UNEXPECTED_BUS_FREE 0x13
|
---|
| 79 | #define SRB_STATUS_PHASE_SEQUENCE_FAILURE 0x14
|
---|
| 80 | #define SRB_STATUS_BAD_SRB_BLOCK_LENGTH 0x15
|
---|
| 81 | #define SRB_STATUS_REQUEST_FLUSHED 0x16
|
---|
| 82 | #define SRB_STATUS_INVALID_LUN 0x20
|
---|
| 83 | #define SRB_STATUS_INVALID_TARGET_ID 0x21
|
---|
| 84 | #define SRB_STATUS_BAD_FUNCTION 0x22
|
---|
| 85 | #define SRB_STATUS_ERROR_RECOVERY 0x23
|
---|
| 86 | #define SRB_STATUS_QUEUE_FROZEN 0x40
|
---|
| 87 | #define SRB_STATUS_AUTOSENSE_VALID 0x80
|
---|
| 88 |
|
---|
| 89 | #define SRB_STATUS(Status) (Status & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN))
|
---|
| 90 |
|
---|
| 91 | typedef struct _SCSISCAN_CMD {
|
---|
| 92 | ULONG Reserved1;
|
---|
| 93 | ULONG Size;
|
---|
| 94 | ULONG SrbFlags;
|
---|
| 95 | UCHAR CdbLength;
|
---|
| 96 | UCHAR SenseLength;
|
---|
| 97 | UCHAR Reserved2;
|
---|
| 98 | UCHAR Reserved3;
|
---|
| 99 | ULONG TransferLength;
|
---|
| 100 | UCHAR Cdb[16];
|
---|
| 101 | PUCHAR pSrbStatus;
|
---|
| 102 | PUCHAR pSenseBuffer;
|
---|
| 103 | } SCSISCAN_CMD, *PSCSISCAN_CMD;
|
---|
| 104 |
|
---|
| 105 | #define MAX_STRING 128
|
---|
| 106 |
|
---|
| 107 | /* SCSISCAN_INFO.Flags constants */
|
---|
| 108 | #define SCSISCAN_RESERVED 0x000
|
---|
| 109 | #define SCSISCAN_CMD_CODE 0x004
|
---|
| 110 | #define SCSISCAN_LOCKDEVICE 0x005
|
---|
| 111 | #define SCSISCAN_UNLOCKDEVICE 0x006
|
---|
| 112 | #define SCSISCAN_SET_TIMEOUT 0x007
|
---|
| 113 | #define SCSISCAN_GET_INFO 0x008
|
---|
| 114 |
|
---|
| 115 | typedef struct _SCSISCAN_INFO {
|
---|
| 116 | ULONG Size;
|
---|
| 117 | ULONG Flags;
|
---|
| 118 | UCHAR PortNumber;
|
---|
| 119 | UCHAR PathId;
|
---|
| 120 | UCHAR TargetId;
|
---|
| 121 | UCHAR Lun;
|
---|
| 122 | UCHAR AdapterName[MAX_STRING];
|
---|
| 123 | ULONG Reserved;
|
---|
| 124 | } SCSISCAN_INFO, *PSCSISCAN_INFO;
|
---|
| 125 |
|
---|
| 126 | #ifdef __cplusplus
|
---|
| 127 | }
|
---|
| 128 | #endif
|
---|
| 129 |
|
---|
| 130 | #endif /* __SCSISCAN_H */
|
---|