| 1 | /* $Id: DEVRP.H,v 1.1.1.1 2003/07/02 13:56:58 eleph Exp $ */
|
|---|
| 2 | /*
|
|---|
| 3 | * OS/2 device driver request packet definitions
|
|---|
| 4 | *
|
|---|
| 5 | * (C) 2000-2002 InnoTek Systemberatung GmbH
|
|---|
| 6 | *
|
|---|
| 7 | * This program is free software; you can redistribute it and/or
|
|---|
| 8 | * modify it under the terms of the GNU General Public License as
|
|---|
| 9 | * published by the Free Software Foundation; either version 2 of
|
|---|
| 10 | * the License, or (at your option) any later version.
|
|---|
| 11 | *
|
|---|
| 12 | * This program is distributed in the hope that it will be useful,
|
|---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 15 | * GNU General Public License for more details.
|
|---|
| 16 | *
|
|---|
| 17 | * You should have received a copy of the GNU General Public
|
|---|
| 18 | * License along with this program; if not, write to the Free
|
|---|
| 19 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
|
|---|
| 20 | * USA.
|
|---|
| 21 | *
|
|---|
| 22 | */
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 | // Prevent multiple inclusion
|
|---|
| 26 | #if !defined(DevRP_h)
|
|---|
| 27 | #define DevRP_h 1
|
|---|
| 28 |
|
|---|
| 29 | #if !defined(__WATCOMC__) || !defined(__cplusplus)
|
|---|
| 30 | #error C++ must be used for strict type checking
|
|---|
| 31 | #endif
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 | // Include the fundamental type definitions
|
|---|
| 35 | #include "DevType.h"
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 | // Match OS/2's layout model for structures
|
|---|
| 39 | #pragma pack(1);
|
|---|
| 40 |
|
|---|
| 41 | // Device driver request packet (B=block devices, C=character devices)
|
|---|
| 42 | struct RP
|
|---|
| 43 | {
|
|---|
| 44 | BYTE Length; // Length of request packet
|
|---|
| 45 | BYTE Unit; // Unit code (B)
|
|---|
| 46 | BYTE Command; // Command code
|
|---|
| 47 | WORD16 Status; // Status code
|
|---|
| 48 | BYTE Flags; // Flags
|
|---|
| 49 | BYTE Reserved[3]; // Reserved
|
|---|
| 50 | WORD32 Link; // Link to next request packet in queue
|
|---|
| 51 | };
|
|---|
| 52 |
|
|---|
| 53 | // Request packet 00 (BC): Initialization
|
|---|
| 54 | struct RPInit : public RP
|
|---|
| 55 | {
|
|---|
| 56 | union
|
|---|
| 57 | {
|
|---|
| 58 | struct
|
|---|
| 59 | {
|
|---|
| 60 | BYTE Reserved; // Unused
|
|---|
| 61 | WORD32 DevHlp; // Address of DevHlp entry point
|
|---|
| 62 | WORD32 Args; // Command-line arguments
|
|---|
| 63 | BYTE Drive; // Drive number of first unit (B)
|
|---|
| 64 | } In;
|
|---|
| 65 | struct
|
|---|
| 66 | {
|
|---|
| 67 | BYTE Units; // Number of supported units (B)
|
|---|
| 68 | WORD16 FinalCS; // Offset of last resident code
|
|---|
| 69 | WORD16 FinalDS; // Offset of last resident data
|
|---|
| 70 | WORD32 Bpb; // BIOS parameter block (B)
|
|---|
| 71 | } Out;
|
|---|
| 72 | };
|
|---|
| 73 | };
|
|---|
| 74 |
|
|---|
| 75 | // Request packet 01 (B ): Media check
|
|---|
| 76 | struct RPMediaCheck : public RP
|
|---|
| 77 | {
|
|---|
| 78 | BYTE Media; // Media descriptor
|
|---|
| 79 | BYTE Result; // -1 = Changed, 0 = Unsure, 1 = Unchanged
|
|---|
| 80 | WORD32 PrevVolID; // Pointer to previous volume ID
|
|---|
| 81 | };
|
|---|
| 82 |
|
|---|
| 83 | // Request packet 02 (B ): Build BIOS parameter block
|
|---|
| 84 | struct RPBuildBPB : public RP
|
|---|
| 85 | {
|
|---|
| 86 | BYTE Media; // Media descriptor
|
|---|
| 87 | WORD32 Transfer; // Transfer virtual address
|
|---|
| 88 | WORD32 Bpb; // Pointer to BPB table
|
|---|
| 89 | BYTE Drive; // Drive number
|
|---|
| 90 | };
|
|---|
| 91 |
|
|---|
| 92 | // Request packet 04 (BC): Read
|
|---|
| 93 | // Request packet 08 (BC): Write
|
|---|
| 94 | // Request packet 09 (BC): Write verify
|
|---|
| 95 | struct RPRWV : public RP
|
|---|
| 96 | {
|
|---|
| 97 | BYTE Media; // Media descriptor
|
|---|
| 98 | PHYSICAL Transfer; // Transfer physical address
|
|---|
| 99 | WORD16 Count; // Number of bytes (C) or sectors (B)
|
|---|
| 100 | WORD32 Start; // Starting sector number (B)
|
|---|
| 101 | USHORT FileID; // System file number
|
|---|
| 102 | };
|
|---|
| 103 |
|
|---|
| 104 | // Request packet 05 ( C): Nondestructive read with no wait
|
|---|
| 105 | struct RPReadNoWait : public RP
|
|---|
| 106 | {
|
|---|
| 107 | BYTE Data; // Return character
|
|---|
| 108 | };
|
|---|
| 109 |
|
|---|
| 110 | // Request packet 06 ( C): Input status
|
|---|
| 111 | // Request packet 0A ( C): Output status
|
|---|
| 112 | struct RPIOStatus : public RP
|
|---|
| 113 | {
|
|---|
| 114 | };
|
|---|
| 115 |
|
|---|
| 116 | // Request packet 07 ( C): Input flush
|
|---|
| 117 | // Request packet 0B ( C): Output flush
|
|---|
| 118 | struct RPIOFlush : public RP
|
|---|
| 119 | {
|
|---|
| 120 | };
|
|---|
| 121 |
|
|---|
| 122 | // Request packet 0D (BC): Open
|
|---|
| 123 | // Request packet 0E (BC): Close
|
|---|
| 124 | struct RPOpenClose : public RP
|
|---|
| 125 | {
|
|---|
| 126 | USHORT FileID; // System file number
|
|---|
| 127 | };
|
|---|
| 128 |
|
|---|
| 129 | // Request packet 0F (B ): Removable media check
|
|---|
| 130 | struct RPRemovable : public RP
|
|---|
| 131 | {
|
|---|
| 132 | };
|
|---|
| 133 |
|
|---|
| 134 | // Request packet 10 (BC): IO Control
|
|---|
| 135 | struct RPIOCtl : public RP
|
|---|
| 136 | {
|
|---|
| 137 | BYTE Category; // Category code
|
|---|
| 138 | BYTE Function; // Function code
|
|---|
| 139 | WORD32 ParmPacket; // Parameter packet
|
|---|
| 140 | WORD32 DataPacket; // Data packet
|
|---|
| 141 | USHORT FileID; // System file number
|
|---|
| 142 | WORD16 ParmLength; // Parameter packet length
|
|---|
| 143 | WORD16 DataLength; // Data packet length
|
|---|
| 144 | };
|
|---|
| 145 |
|
|---|
| 146 | // Request packet 11 (B ): Reset media
|
|---|
| 147 | struct RPReset : public RP
|
|---|
| 148 | {
|
|---|
| 149 | };
|
|---|
| 150 |
|
|---|
| 151 | // Request packet 12 (B ): Get logical unit
|
|---|
| 152 | // Request packet 13 (B ): Set logical unit
|
|---|
| 153 | struct RPUnit : public RP
|
|---|
| 154 | {
|
|---|
| 155 | };
|
|---|
| 156 |
|
|---|
| 157 | // Request packet 14 ( C): Deinstall character device driver
|
|---|
| 158 | struct RPDeinstall : public RP
|
|---|
| 159 | {
|
|---|
| 160 | };
|
|---|
| 161 |
|
|---|
| 162 | // Request packet 16 (B ): Count partitionable fixed disks
|
|---|
| 163 | struct RPPartitionable : public RP
|
|---|
| 164 | {
|
|---|
| 165 | BYTE Count; // Number of partitionable fixed disks
|
|---|
| 166 | WORD32 Reserved; // Reserved
|
|---|
| 167 | };
|
|---|
| 168 |
|
|---|
| 169 | // Request packet 17 (B ): Get logical unit mapping of fixed disk
|
|---|
| 170 | struct RPUnitMap : public RP
|
|---|
| 171 | {
|
|---|
| 172 | WORD32 Units; // Bitmap of supported logical units
|
|---|
| 173 | WORD32 Reserved; // Reserved
|
|---|
| 174 | };
|
|---|
| 175 |
|
|---|
| 176 | // Request packet 1C (BC): Notify start or end of system shutdown
|
|---|
| 177 | struct RPShutdown : public RP
|
|---|
| 178 | {
|
|---|
| 179 | BYTE Function; // Shutdown code: 0 = start, 1 = end
|
|---|
| 180 | WORD32 Reserved; // Reserved
|
|---|
| 181 | };
|
|---|
| 182 |
|
|---|
| 183 | // Request packet 1D (B ): Get driver capabilities
|
|---|
| 184 | struct RPDriverCaps : public RP
|
|---|
| 185 | {
|
|---|
| 186 | BYTE Reserved[3]; // Reserved
|
|---|
| 187 | WORD32 DCS; // Pointer to driver capabilities structure
|
|---|
| 188 | WORD32 VCS; // Pointer to volume characteristics structure
|
|---|
| 189 | };
|
|---|
| 190 |
|
|---|
| 191 | // Request packet 1F (BC): Notify end of initialization
|
|---|
| 192 | struct RPInitComplete : public RP
|
|---|
| 193 | {
|
|---|
| 194 | };
|
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 |
|
|---|
| 198 | // RP Result codes
|
|---|
| 199 |
|
|---|
| 200 | #define RPERR 0x8000 // Error
|
|---|
| 201 | #define RPDEV 0x4000 // Device-specific error code
|
|---|
| 202 | #define RPBUSY 0x0200 // Device is busy
|
|---|
| 203 | #define RPDONE 0x0100 // Command complete
|
|---|
| 204 |
|
|---|
| 205 | #define RPERR_PROTECT 0x8000 // Write-protect error
|
|---|
| 206 | #define RPERR_UNIT 0x8001 // Unknown unit
|
|---|
| 207 | #define RPERR_READY 0x8002 // Not ready
|
|---|
| 208 | #define RPERR_COMMAND 0x8003 // Unknown command
|
|---|
| 209 | #define RPERR_CRC 0x8004 // CRC error
|
|---|
| 210 | #define RPERR_LENGTH 0x8005 // Bad request length
|
|---|
| 211 | #define RPERR_SEEK 0x8006 // Seek error
|
|---|
| 212 | #define RPERR_FORMAT 0x8007 // Unknown media
|
|---|
| 213 | #define RPERR_SECTOR 0x8008 // Sector not found
|
|---|
| 214 | #define RPERR_PAPER 0x8009 // Out of paper
|
|---|
| 215 | #define RPERR_WRITE 0x800A // Write fault
|
|---|
| 216 | #define RPERR_READ 0x800B // Read fault
|
|---|
| 217 | #define RPERR_GENERAL 0x800C // General failure
|
|---|
| 218 | #define RPERR_DISK 0x800D // Disk change
|
|---|
| 219 | #define RPERR_MEDIA 0x8010 // Uncertain media
|
|---|
| 220 | #define RPERR_INTERRUPTED 0x8011 // Call interrupted (character)
|
|---|
| 221 | #define RPERR_MONITOR 0x8012 // Monitors unsupported
|
|---|
| 222 | #define RPERR_PARAMETER 0x8013 // Invalid parameter
|
|---|
| 223 | #define RPERR_USE 0x8014 // Device in use
|
|---|
| 224 | #define RPERR_INIT 0x8015 // Non-critical init failure
|
|---|
| 225 |
|
|---|
| 226 |
|
|---|
| 227 | #pragma pack()
|
|---|
| 228 |
|
|---|
| 229 | #endif // DevRP_h
|
|---|