| 1 | /* $Id: DEVRP.H 187 2001-06-20 17:10:08Z sandervl $ */
|
|---|
| 2 |
|
|---|
| 3 | /************************************************************************\
|
|---|
| 4 | ** **
|
|---|
| 5 | ** OS/2(r) Physical Device Driver Libraries **
|
|---|
| 6 | ** for Watcom C/C++ 10 **
|
|---|
| 7 | ** **
|
|---|
| 8 | ** COPYRIGHT: **
|
|---|
| 9 | ** **
|
|---|
| 10 | ** (C) Copyright Advanced Gravis Computer Technology Ltd 1994. **
|
|---|
| 11 | ** All Rights Reserved. **
|
|---|
| 12 | ** **
|
|---|
| 13 | ** DISCLAIMER OF WARRANTIES: **
|
|---|
| 14 | ** **
|
|---|
| 15 | ** The following [enclosed] code is provided to you "AS IS", **
|
|---|
| 16 | ** without warranty of any kind. You have a royalty-free right to **
|
|---|
| 17 | ** use, modify, reproduce and distribute the following code (and/or **
|
|---|
| 18 | ** any modified version) provided that you agree that Advanced **
|
|---|
| 19 | ** Gravis has no warranty obligations and shall not be liable for **
|
|---|
| 20 | ** any damages arising out of your use of this code, even if they **
|
|---|
| 21 | ** have been advised of the possibility of such damages. This **
|
|---|
| 22 | ** Copyright statement and Disclaimer of Warranties may not be **
|
|---|
| 23 | ** removed. **
|
|---|
| 24 | ** **
|
|---|
| 25 | \************************************************************************/
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 | // DevRP.h
|
|---|
| 29 | //
|
|---|
| 30 | // Type definitions for OS/2 2.x physical device driver request packets.
|
|---|
| 31 | //
|
|---|
| 32 | // History:
|
|---|
| 33 | //
|
|---|
| 34 | // Sep 30, 94 David Bollo Initial version
|
|---|
| 35 | // Jan 22, 97 Sander van Leeuwen Changed far pointers to WORD32
|
|---|
| 36 |
|
|---|
| 37 | // Prevent multiple inclusion
|
|---|
| 38 | #if !defined(DevRP_h)
|
|---|
| 39 | #define DevRP_h 1
|
|---|
| 40 |
|
|---|
| 41 | #if !defined(__WATCOMC__) || !defined(__cplusplus)
|
|---|
| 42 | #error C++ must be used for strict type checking
|
|---|
| 43 | #endif
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 | // Include the fundamental type definitions
|
|---|
| 47 | #include "DevType.h"
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 | // Device driver request packet (B=block devices, C=character devices)
|
|---|
| 51 | struct RP
|
|---|
| 52 | {
|
|---|
| 53 | BYTE Length; // Length of request packet
|
|---|
| 54 | BYTE Unit; // Unit code (B)
|
|---|
| 55 | BYTE Command; // Command code
|
|---|
| 56 | WORD16 Status; // Status code
|
|---|
| 57 | BYTE Flags; // Flags
|
|---|
| 58 | BYTE Reserved[3]; // Reserved
|
|---|
| 59 | WORD32 Link; // Link to next request packet in queue
|
|---|
| 60 | };
|
|---|
| 61 |
|
|---|
| 62 | // Request packet 00 (BC): Initialization
|
|---|
| 63 | struct RPInit : public RP
|
|---|
| 64 | {
|
|---|
| 65 | union
|
|---|
| 66 | {
|
|---|
| 67 | struct
|
|---|
| 68 | {
|
|---|
| 69 | BYTE Reserved; // Unused
|
|---|
| 70 | WORD32 DevHlp; // Address of DevHlp entry point
|
|---|
| 71 | WORD32 Args; // Command-line arguments
|
|---|
| 72 | BYTE Drive; // Drive number of first unit (B)
|
|---|
| 73 | } In;
|
|---|
| 74 | struct
|
|---|
| 75 | {
|
|---|
| 76 | BYTE Units; // Number of supported units (B)
|
|---|
| 77 | WORD16 FinalCS; // Offset of last resident code
|
|---|
| 78 | WORD16 FinalDS; // Offset of last resident data
|
|---|
| 79 | WORD32 Bpb; // BIOS parameter block (B)
|
|---|
| 80 | } Out;
|
|---|
| 81 | };
|
|---|
| 82 | };
|
|---|
| 83 |
|
|---|
| 84 | // Request packet 01 (B ): Media check
|
|---|
| 85 | struct RPMediaCheck : public RP
|
|---|
| 86 | {
|
|---|
| 87 | BYTE Media; // Media descriptor
|
|---|
| 88 | BYTE Result; // -1 = Changed, 0 = Unsure, 1 = Unchanged
|
|---|
| 89 | WORD32 PrevVolID; // Pointer to previous volume ID
|
|---|
| 90 | };
|
|---|
| 91 |
|
|---|
| 92 | // Request packet 02 (B ): Build BIOS parameter block
|
|---|
| 93 | struct RPBuildBPB : public RP
|
|---|
| 94 | {
|
|---|
| 95 | BYTE Media; // Media descriptor
|
|---|
| 96 | WORD32 Transfer; // Transfer virtual address
|
|---|
| 97 | WORD32 Bpb; // Pointer to BPB table
|
|---|
| 98 | BYTE Drive; // Drive number
|
|---|
| 99 | };
|
|---|
| 100 |
|
|---|
| 101 | // Request packet 04 (BC): Read
|
|---|
| 102 | // Request packet 08 (BC): Write
|
|---|
| 103 | // Request packet 09 (BC): Write verify
|
|---|
| 104 | struct RPRWV : public RP
|
|---|
| 105 | {
|
|---|
| 106 | BYTE Media; // Media descriptor
|
|---|
| 107 | PHYSICAL Transfer; // Transfer physical address
|
|---|
| 108 | WORD16 Count; // Number of bytes (C) or sectors (B)
|
|---|
| 109 | WORD32 Start; // Starting sector number (B)
|
|---|
| 110 | USHORT FileID; // System file number
|
|---|
| 111 | };
|
|---|
| 112 |
|
|---|
| 113 | // Request packet 05 ( C): Nondestructive read with no wait
|
|---|
| 114 | struct RPReadNoWait : public RP
|
|---|
| 115 | {
|
|---|
| 116 | BYTE Data; // Return character
|
|---|
| 117 | };
|
|---|
| 118 |
|
|---|
| 119 | // Request packet 06 ( C): Input status
|
|---|
| 120 | // Request packet 0A ( C): Output status
|
|---|
| 121 | struct RPIOStatus : public RP
|
|---|
| 122 | {
|
|---|
| 123 | };
|
|---|
| 124 |
|
|---|
| 125 | // Request packet 07 ( C): Input flush
|
|---|
| 126 | // Request packet 0B ( C): Output flush
|
|---|
| 127 | struct RPIOFlush : public RP
|
|---|
| 128 | {
|
|---|
| 129 | };
|
|---|
| 130 |
|
|---|
| 131 | // Request packet 0D (BC): Open
|
|---|
| 132 | // Request packet 0E (BC): Close
|
|---|
| 133 | struct RPOpenClose : public RP
|
|---|
| 134 | {
|
|---|
| 135 | USHORT FileID; // System file number
|
|---|
| 136 | };
|
|---|
| 137 |
|
|---|
| 138 | // Request packet 0F (B ): Removable media check
|
|---|
| 139 | struct RPRemovable : public RP
|
|---|
| 140 | {
|
|---|
| 141 | };
|
|---|
| 142 |
|
|---|
| 143 | // Request packet 10 (BC): IO Control
|
|---|
| 144 | struct RPIOCtl : public RP
|
|---|
| 145 | {
|
|---|
| 146 | BYTE Category; // Category code
|
|---|
| 147 | BYTE Function; // Function code
|
|---|
| 148 | WORD32 ParmPacket; // Parameter packet
|
|---|
| 149 | WORD32 DataPacket; // Data packet
|
|---|
| 150 | USHORT FileID; // System file number
|
|---|
| 151 | WORD16 ParmLength; // Parameter packet length
|
|---|
| 152 | WORD16 DataLength; // Data packet length
|
|---|
| 153 | };
|
|---|
| 154 |
|
|---|
| 155 | // Request packet 11 (B ): Reset media
|
|---|
| 156 | struct RPReset : public RP
|
|---|
| 157 | {
|
|---|
| 158 | };
|
|---|
| 159 |
|
|---|
| 160 | // Request packet 12 (B ): Get logical unit
|
|---|
| 161 | // Request packet 13 (B ): Set logical unit
|
|---|
| 162 | struct RPUnit : public RP
|
|---|
| 163 | {
|
|---|
| 164 | };
|
|---|
| 165 |
|
|---|
| 166 | // Request packet 14 ( C): Deinstall character device driver
|
|---|
| 167 | struct RPDeinstall : public RP
|
|---|
| 168 | {
|
|---|
| 169 | };
|
|---|
| 170 |
|
|---|
| 171 | // Request packet 16 (B ): Count partitionable fixed disks
|
|---|
| 172 | struct RPPartitionable : public RP
|
|---|
| 173 | {
|
|---|
| 174 | BYTE Count; // Number of partitionable fixed disks
|
|---|
| 175 | WORD32 Reserved; // Reserved
|
|---|
| 176 | };
|
|---|
| 177 |
|
|---|
| 178 | // Request packet 17 (B ): Get logical unit mapping of fixed disk
|
|---|
| 179 | struct RPUnitMap : public RP
|
|---|
| 180 | {
|
|---|
| 181 | WORD32 Units; // Bitmap of supported logical units
|
|---|
| 182 | WORD32 Reserved; // Reserved
|
|---|
| 183 | };
|
|---|
| 184 |
|
|---|
| 185 | // Request packet 1C (BC): Notify start or end of system shutdown
|
|---|
| 186 | struct RPShutdown : public RP
|
|---|
| 187 | {
|
|---|
| 188 | BYTE Function; // Shutdown code: 0 = start, 1 = end
|
|---|
| 189 | WORD32 Reserved; // Reserved
|
|---|
| 190 | };
|
|---|
| 191 |
|
|---|
| 192 | // Request packet 1D (B ): Get driver capabilities
|
|---|
| 193 | struct RPDriverCaps : public RP
|
|---|
| 194 | {
|
|---|
| 195 | BYTE Reserved[3]; // Reserved
|
|---|
| 196 | WORD32 DCS; // Pointer to driver capabilities structure
|
|---|
| 197 | WORD32 VCS; // Pointer to volume characteristics structure
|
|---|
| 198 | };
|
|---|
| 199 |
|
|---|
| 200 | // Request packet 1F (BC): Notify end of initialization
|
|---|
| 201 | struct RPInitComplete : public RP
|
|---|
| 202 | {
|
|---|
| 203 | };
|
|---|
| 204 |
|
|---|
| 205 |
|
|---|
| 206 |
|
|---|
| 207 | // RP Result codes
|
|---|
| 208 |
|
|---|
| 209 | #define RPERR 0x8000 // Error
|
|---|
| 210 | #define RPDEV 0x4000 // Device-specific error code
|
|---|
| 211 | #define RPBUSY 0x0200 // Device is busy
|
|---|
| 212 | #define RPDONE 0x0100 // Command complete
|
|---|
| 213 |
|
|---|
| 214 | #define RPERR_PROTECT 0x8000 // Write-protect error
|
|---|
| 215 | #define RPERR_UNIT 0x8001 // Unknown unit
|
|---|
| 216 | #define RPERR_READY 0x8002 // Not ready
|
|---|
| 217 | #define RPERR_COMMAND 0x8003 // Unknown command
|
|---|
| 218 | #define RPERR_CRC 0x8004 // CRC error
|
|---|
| 219 | #define RPERR_LENGTH 0x8005 // Bad request length
|
|---|
| 220 | #define RPERR_SEEK 0x8006 // Seek error
|
|---|
| 221 | #define RPERR_FORMAT 0x8007 // Unknown media
|
|---|
| 222 | #define RPERR_SECTOR 0x8008 // Sector not found
|
|---|
| 223 | #define RPERR_PAPER 0x8009 // Out of paper
|
|---|
| 224 | #define RPERR_WRITE 0x800A // Write fault
|
|---|
| 225 | #define RPERR_READ 0x800B // Read fault
|
|---|
| 226 | #define RPERR_GENERAL 0x800C // General failure
|
|---|
| 227 | #define RPERR_DISK 0x800D // Disk change
|
|---|
| 228 | #define RPERR_MEDIA 0x8010 // Uncertain media
|
|---|
| 229 | #define RPERR_INTERRUPTED 0x8011 // Call interrupted (character)
|
|---|
| 230 | #define RPERR_MONITOR 0x8012 // Monitors unsupported
|
|---|
| 231 | #define RPERR_PARAMETER 0x8013 // Invalid parameter
|
|---|
| 232 | #define RPERR_USE 0x8014 // Device in use
|
|---|
| 233 | #define RPERR_INIT 0x8015 // Non-critical init failure
|
|---|
| 234 |
|
|---|
| 235 |
|
|---|
| 236 |
|
|---|
| 237 | #endif // DevRP_h
|
|---|