summaryrefslogtreecommitdiffstats
path: root/private/os2/inc/os2dev.h
blob: bdff650265f320edcd59525020221d8a991b6a3a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
/**************************************************************************\
*
* Module Name: BSEDEV.H
*
* OS/2 Structures and constants for use with DosDevIOCtl
*
* Copyright (c) 1989-1990, Microsoft Corporation.  All rights reserved.
*
\**************************************************************************/

#define BSEDEV_INCLUDED

/* Input and Output Control Categories */

#define IOCTL_ASYNC     0x0001
#define IOCTL_SCR_AND_PTRDRAW   0x0003
#define IOCTL_KEYBOARD      0x0004
#define IOCTL_PRINTER       0x0005
#define IOCTL_LIGHTPEN      0x0006
#define IOCTL_POINTINGDEVICE    0x0007
#define IOCTL_DISK      0x0008
#define IOCTL_PHYSICALDISK  0x0009
#define IOCTL_MONITOR       0x000A
#define IOCTL_GENERAL       0x000B

/* Serial-Device Control */

#define ASYNC_SETBAUDRATE   0x0041
#define ASYNC_SETLINECTRL   0x0042
#define ASYNC_TRANSMITIMM   0x0044
#define ASYNC_SETBREAKOFF   0x0045
#define ASYNC_SETMODEMCTRL  0x0046
#define ASYNC_SETBREAKON    0x004B
#define ASYNC_STOPTRANSMIT  0x0047
#define ASYNC_STARTTRANSMIT 0x0048
#define ASYNC_SETDCBINFO    0x0053
#define ASYNC_GETBAUDRATE   0x0061
#define ASYNC_GETLINECTRL   0x0062
#define ASYNC_GETCOMMSTATUS 0x0064
#define ASYNC_GETLINESTATUS 0x0065
#define ASYNC_GETMODEMOUTPUT    0x0066
#define ASYNC_GETMODEMINPUT 0x0067
#define ASYNC_GETINQUECOUNT 0x0068
#define ASYNC_GETOUTQUECOUNT    0x0069
#define ASYNC_GETCOMMERROR  0x006D
#define ASYNC_GETCOMMEVENT  0x0072
#define ASYNC_GETDCBINFO    0x0073

/* Screen/Pointer-Draw Control */

#define SCR_ALLOCLDT        0x0070
#define SCR_DEALLOCLDT      0x0071
#define PTR_GETPTRDRAWADDRESS   0x0072
#define SCR_ALLOCLDTOFF     0x0075

/* Keyboard Control */

#define KBD_SETTRANSTABLE   0x0050
#define KBD_SETINPUTMODE    0x0051
#define KBD_SETINTERIMFLAG  0x0052
#define KBD_SETSHIFTSTATE   0x0053
#define KBD_SETTYPAMATICRATE    0x0054
#define KBD_SETFGNDSCREENGRP    0x0055
#define KBD_SETSESMGRHOTKEY 0x0056
#define KBD_SETFOCUS        0x0057
#define KBD_SETKCB          0x0058
#define KBD_SETNLS          0x005C
#define KBD_CREATE          0x005D
#define KBD_DESTROY         0x005E
#define KBD_GETINPUTMODE    0x0071
#define KBD_GETINTERIMFLAG  0x0072
#define KBD_GETSHIFTSTATE   0x0073
#define KBD_READCHAR        0x0074
#define KBD_PEEKCHAR        0x0075
#define KBD_GETSESMGRHOTKEY 0x0076
#define KBD_GETKEYBDTYPE    0x0077
#define KBD_GETCODEPAGEID   0x0078
#define KBD_XLATESCAN       0x0079
#if PMNT
#define KBD_GETHARDWAREID   0x007A  // Called by InitKeyboard(), PMWIN
#define KBD_GETCPANDCOUNTRY 0x007B  // Called by InitKeyboard(), PMWIN
                                    // (the name is my invention - PatrickQ)
#endif

/* Printer Control */

#define PRT_SETFRAMECTL     0x0042
#define PRT_SETINFINITERETRY    0x0044
#define PRT_INITPRINTER     0x0046
#define PRT_ACTIVATEFONT    0x0048
#define PRT_GETFRAMECTL     0x0062
#define PRT_GETINFINITERETRY    0x0064
#define PRT_GETPRINTERSTATUS    0x0066
#define PRT_QUERYACTIVEFONT 0x0069
#define PRT_VERIFYFONT      0x006A

/* Pointing-Device (Mouse) Control */

#define MOU_ALLOWPTRDRAW    0x0050
#define MOU_UPDATEDISPLAYMODE   0x0051
#define MOU_SCREENSWITCH    0x0052
#define MOU_SETSCALEFACTORS 0x0053
#define MOU_SETEVENTMASK    0x0054
#define MOU_SETHOTKEYBUTTON 0x0055
#define MOU_SETPTRSHAPE     0x0056
#define MOU_DRAWPTR     0x0057
#define MOU_REMOVEPTR       0x0058
#define MOU_SETPTRPOS       0x0059
#define MOU_SETPROTDRAWADDRESS  0x005A
#define MOU_SETREALDRAWADDRESS  0x005B
#define MOU_SETMOUSTATUS    0x005C
#define MOU_DISPLAYMODECHANGE   0x005D
#define MOU_GETBUTTONCOUNT  0x0060
#define MOU_GETMICKEYCOUNT  0x0061
#define MOU_GETMOUSTATUS    0x0062
#define MOU_READEVENTQUE    0x0063
#define MOU_GETQUESTATUS    0x0064
#define MOU_GETEVENTMASK    0x0065
#define MOU_GETSCALEFACTORS 0x0066
#define MOU_GETPTRPOS       0x0067
#define MOU_GETPTRSHAPE     0x0068
#define MOU_GETHOTKEYBUTTON 0x0069
#define MOU_VER         0x006A

/* Disk/Diskette Control */

#define DSK_LOCKDRIVE       0x0000
#define DSK_UNLOCKDRIVE     0x0001
#define DSK_REDETERMINEMEDIA    0x0002
#define DSK_SETLOGICALMAP   0x0003
#define DSK_BLOCKREMOVABLE  0x0020
#define DSK_GETLOGICALMAP   0x0021
#define DSK_SETDEVICEPARAMS 0x0043
#define DSK_WRITETRACK      0x0044
#define DSK_FORMATVERIFY    0x0045
#define DSK_GETDEVICEPARAMS 0x0063
#define DSK_READTRACK       0x0064
#define DSK_VERIFYTRACK     0x0065

/* Physical-Disk Control */

#define PDSK_LOCKPHYSDRIVE      0x0000
#define PDSK_UNLOCKPHYSDRIVE        0x0001
#define PDSK_WRITEPHYSTRACK     0x0044
#define PDSK_GETPHYSDEVICEPARAMS    0x0063
#define PDSK_READPHYSTRACK      0x0064
#define PDSK_VERIFYPHYSTRACK        0x0065

/* Character-Monitor Control */

#define MON_REGISTERMONITOR 0x0040

/* General Device Control */

#define DEV_FLUSHINPUT      0x0001
#define DEV_FLUSHOUTPUT     0x0002
#define DEV_QUERYMONSUPPORT 0x0060


/* ASYNC_GETCOMMERROR, ASYNC_SETBREAKOFF, ASYNC_SETBREAKON,
 * ASYNC_SETMODEMCTRL
 */

#define RX_QUE_OVERRUN      0x0001
#define RX_HARDWARE_OVERRUN 0x0002
#define PARITY_ERROR        0x0004
#define FRAMING_ERROR       0x0008

/* ASYNC_GETCOMMEVENT */

#define CHAR_RECEIVED   0x0001
#define LAST_CHAR_SENT  0x0004
#define CTS_CHANGED 0x0008
#define DSR_CHANGED 0x0010
#define DCD_CHANGED 0x0020
#define BREAK_DETECTED  0x0040
#define ERROR_OCCURRED  0x0080
#define RI_DETECTED 0x0100

/* ASYNC_GETCOMMSTATUS */

#define TX_WAITING_FOR_CTS      0x0001
#define TX_WAITING_FOR_DSR      0x0002
#define TX_WAITING_FOR_DCD      0x0004
#define TX_WAITING_FOR_XON      0x0008
#define TX_WAITING_TO_SEND_XON      0x0010
#define TX_WAITING_WHILE_BREAK_ON   0x0020
#define TX_WAITING_TO_SEND_IMM      0x0040
#define RX_WAITING_FOR_DSR      0x0080

/* ASYNC_GETLINESTATUS */

#define WRITE_REQUEST_QUEUED    0x0001
#define DATA_IN_TX_QUE      0x0002
#define HARDWARE_TRANSMITTING   0x0004
#define CHAR_READY_TO_SEND_IMM  0x0008
#define WAITING_TO_SEND_XON 0x0010
#define WAITING_TO_SEND_XOFF    0x0020

/* ASYNC_GETMODEMINPUT */

#define CTS_ON  0x10
#define DSR_ON  0x20
#define RI_ON   0x40
#define DCD_ON  0x80

/* DSK_SETDEVICEPARAMS */

#define BUILD_BPB_FROM_MEDIUM   0x00
#define REPLACE_BPB_FOR_DEVICE  0x01
#define REPLACE_BPB_FOR_MEDIUM  0x02

/* KBD_GETINPUTMODE, KBD_PEEKCHAR, KBD_SETINPUTMODE*/

#define ASCII_MODE  0x00
#define BINARY_MODE 0x80

/* KBD_GETINTERIMFLAG */

#define CONVERSION_REQUEST  0x20
#define INTERIM_CHAR        0x80

/* KBD_GETSESMGRHOTKEY */

#define HOTKEY_MAX_COUNT    0x0000
#define HOTKEY_CURRENT_COUNT    0x0001

/* KBD_PEEKCHAR */

#define KBD_DATA_RECEIVED   0x0001
#define KBD_DATA_BINARY     0x8000

/* KBD_READCHAR */

#define KBD_READ_WAIT   0x0000
#define KBD_READ_NOWAIT 0x8000

/* KBD_SETINPUTMODE */

#define SHIFT_REPORT_MODE  0x01

#ifndef INCL_MOU

#define MOUSE_MOTION            0x0001
#define MOUSE_MOTION_WITH_BN1_DOWN  0x0002
#define MOUSE_BN1_DOWN          0x0004
#define MOUSE_MOTION_WITH_BN2_DOWN  0x0008
#define MOUSE_BN2_DOWN          0x0010
#define MOUSE_MOTION_WITH_BN3_DOWN  0x0020
#define MOUSE_BN3_DOWN          0x0040

#define MHK_BUTTON1 0x0001
#define MHK_BUTTON2 0x0002
#define MHK_BUTTON3 0x0004

#ifndef MOU_NOWAIT
#define MOU_NOWAIT  0x0000
#endif
#ifndef MOU_WAIT
#define MOU_WAIT    0x0001
#endif

#endif /* #ifndef INCL_MOU */

/* MOU_GETHOTKEYBUTTON, MOU_SETHOTKEYBUTTON */

#define MHK_NO_HOTKEY   0x0000

/* MOU_GETMOUSTATUS */

#define MOUSE_QUEUEBUSY     0x0001
#define MOUSE_BLOCKREAD     0x0002
#define MOUSE_FLUSH     0x0004
#define MOUSE_UNSUPPORTED_MODE  0x0008
#define MOUSE_DISABLED      0x0100
#define MOUSE_MICKEYS       0x0200

/* PRT_GETPRINTERSTATUS */

#define PRINTER_TIMEOUT     0x0001
#define PRINTER_IO_ERROR    0x0008
#define PRINTER_SELECTED    0x0010
#define PRINTER_OUT_OF_PAPER    0x0020
#define PRINTER_ACKNOWLEDGED    0x0040
#define PRINTER_NOT_BUSY    0x0080

/* fbCtlHndShake */

#define MODE_DTR_CONTROL    0x01
#define MODE_DTR_HANDSHAKE  0x02
#define MODE_CTS_HANDSHAKE  0x08
#define MODE_DSR_HANDSHAKE  0x10
#define MODE_DCD_HANDSHAKE  0x20
#define MODE_DSR_SENSITIVITY    0x40

/* fbFlowReplace */

#define MODE_AUTO_TRANSMIT  0x01
#define MODE_AUTO_RECEIVE   0x02
#define MODE_ERROR_CHAR     0x04
#define MODE_NULL_STRIPPING 0x08
#define MODE_BREAK_CHAR     0x10
#define MODE_RTS_CONTROL    0x40
#define MODE_RTS_HANDSHAKE  0x80
#define MODE_TRANSMIT_TOGGLE    0xC0

/* fbTimeout */

#define MODE_NO_WRITE_TIMEOUT       0x01
#define MODE_READ_TIMEOUT       0x02
#define MODE_WAIT_READ_TIMEOUT      0x04
#define MODE_NOWAIT_READ_TIMEOUT    0x06

#pragma pack(1)

typedef struct _DCBINFO {   /* dcbinf */
    USHORT usWriteTimeout;
    USHORT usReadTimeout;
    BYTE   fbCtlHndShake;
    BYTE   fbFlowReplace;
    BYTE   fbTimeout;
    BYTE   bErrorReplacementChar;
    BYTE   bBreakReplacementChar;
    BYTE   bXONChar;
    BYTE   bXOFFChar;
} DCBINFO, *PDCBINFO;

typedef struct _TRACKLAYOUT {   /* trckl */
    BYTE   bCommand;
    USHORT usHead;
    USHORT usCylinder;
    USHORT usFirstSector;
    USHORT cSectors;
    struct {
        USHORT usSectorNumber;
        USHORT usSectorSize;
    } TrackTable[1];
} TRACKLAYOUT, *PTRACKLAYOUT;

#define DEVTYPE_48TPI   0x0000
#define DEVTYPE_96TPI   0x0001
#define DEVTYPE_35  0x0002
#define DEVTYPE_8SD 0x0003
#define DEVTYPE_8DD 0x0004
#define DEVTYPE_FIXED   0x0005
#define DEVTYPE_TAPE    0x0006
#define DEVTYPE_UNKNOWN 0x0007

typedef struct _BIOSPARAMETERBLOCK {    /* bspblk */
    USHORT usBytesPerSector;
    BYTE   bSectorsPerCluster;
    USHORT usReservedSectors;
    BYTE   cFATs;
    USHORT cRootEntries;
    USHORT cSectors;
    BYTE   bMedia;
    USHORT usSectorsPerFAT;
    USHORT usSectorsPerTrack;
    USHORT cHeads;
    ULONG  cHiddenSectors;
    ULONG  cLargeSectors;
    BYTE   abReserved[6];
    USHORT cCylinders;
    BYTE   bDeviceType;
    USHORT fsDeviceAttr;
} BIOSPARAMETERBLOCK, *PBIOSPARAMETERBLOCK;

typedef struct _SCREENGROUP {   /* scrgrp */
    USHORT idScreenGrp;
    USHORT fTerminate;
} SCREENGROUP, *PSCREENGROUP;

typedef struct _FRAME {     /* frm */
    BYTE bCharsPerLine;
    BYTE bLinesPerInch;
} FRAME, *PFRAME;

typedef struct _KBDTYPE {   /* kbdtyp */
    USHORT usType;
    USHORT reserved1;
    USHORT reserved2;
} KBDTYPE, *PKBDTYPE;

typedef struct _LINECONTROL {   /* lnctl */
    BYTE bDataBits;
    BYTE bParity;
    BYTE bStopBits;
    BYTE fTransBreak;
} LINECONTROL, *PLINECONTROL;

/* MODEMSTATUS.fbModemOn, ASYNC_GETMODEMOUTPUT */

#define DTR_ON  0x01
#define RTS_ON  0x02

/* MODEMSTATUS.fbModemOff */

#define DTR_OFF  0xFE
#define RTS_OFF  0xFD

typedef struct _MODEMSTATUS {   /* mdmst */
    BYTE fbModemOn;
    BYTE fbModemOff;
} MODEMSTATUS, *PMODEMSTATUS;

typedef struct _TRACKFORMAT {   /* trckfmt */
    BYTE bCommand;
    USHORT usHead;
    USHORT usCylinder;
    USHORT usReserved;
    USHORT cSectors;
    struct {
        BYTE bCylinder;
        BYTE bHead;
        BYTE idSector;
        BYTE bBytesSector;
    } FormatTable[1];
} TRACKFORMAT, *PTRACKFORMAT;

typedef struct _RXQUEUE {   /* rxq */
    USHORT cch;
    USHORT cb;
} RXQUEUE, *PRXQUEUE;

typedef struct _DEVICEPARAMETERBLOCK {  /* dvpblck */
    USHORT reserved1;
    USHORT cCylinders;
    USHORT cHeads;
    USHORT cSectorsPerTrack;
    USHORT reserved2;
    USHORT reserved3;
    USHORT reserved4;
    USHORT reserved5;
} DEVICEPARAMETERBLOCK, *PDEVICEPARAMETERBLOCK;

#ifndef PFN
typedef int (*PFN)();
#endif

typedef struct _PTRDRAWFUNCTION {   /* ptrdfnc */
    USHORT usReturnCode;
    PFN pfnDraw;
    CHAR* pchDataSeg;
} PTRDRAWFUNCTION, *PPTRDRAWFUNCTION;

typedef struct _PTRDRAWADDRESS {    /* ptrdaddr */
    USHORT reserved;
    PTRDRAWFUNCTION ptrdfnc;
} PTRDRAWADDRESS, *PPTRDRAWADDRESS;

typedef struct _SHIFTSTATE {    /* shftst */
    USHORT fsState;
    BYTE   fNLS;
} SHIFTSTATE, *PSHIFTSTATE;

/* HOTKEY.fsHotKey/SHIFTSTATE.fsState */

//#define RIGHTSHIFT  0x0001
//#define LEFTSHIFT   0x0002
//#define CONTROL     0x0004
//#define ALT     0x0008
//#define SCROLLLOCK_ON   0x0010
//#define NUMLOCK_ON  0x0020
//#define CAPSLOCK_ON 0x0040
//#define INSERT_ON   0x0080
//#define LEFTCONTROL 0x0100
//#define LEFTALT     0x0200
//#define RIGHTCONTROL    0x0400
//#define RIGHTALT    0x0800
//#define SCROLLLOCK  0x1000
//#define NUMLOCK     0x2000
//#define CAPSLOCK    0x4000
//#define SYSREQ      0x8000

typedef struct _HOTKEY {    /* htky */
    USHORT fsHotKey;
    UCHAR  uchScancodeMake;
    UCHAR  uchScancodeBreak;
    USHORT idHotKey;
} HOTKEY, *PHOTKEY;

typedef struct _MONITORPOSITION {   /* mnpos */
    USHORT fPosition;
    USHORT index;
    ULONG  pbInBuf;
    USHORT offOutBuf;
} MONITORPOSITION, *PMONITORPOSITION;

typedef struct _RATEDELAY { /* rtdly */
    USHORT usDelay;
    USHORT usRate;
} RATEDELAY, *PRATEDELAY;

typedef struct _CODEPAGEINFO {  /* cpi */
    PBYTE pbTransTable;
    USHORT idCodePage;
    USHORT idTable;
} CODEPAGEINFO, *PCODEPAGEINFO;

typedef struct _CPID {  /* cpid */
    USHORT idCodePage;
    USHORT Reserved;
} CPID, *PCPID;

typedef struct _LDTADDRINFO {   /* ldtaddr */
    PULONG pulPhysAddr;
    USHORT cb;
} LDTADDRINFO, *PLDTADDRINFO;

typedef struct _PTRDRAWDATA {   /* ptrdd */
    USHORT cb;
    USHORT usConfig;
    USHORT usFlag;
} PTRDRAWDATA, *PPTRDRAWDATA;

typedef struct _FONTINFO {
    USHORT idCodePage;
    USHORT idFont;
} FONTINFO, *PFONTINFO;

#pragma pack()