Import upstream u-boot 1.1.4
[u-boot.git] / board / MAI / bios_emulator / scitech / src / pm / os2 / mon.h
1 /****************************************************************************
2 *
3 *                   SciTech OS Portability Manager Library
4 *
5 *  ========================================================================
6 *
7 *    The contents of this file are subject to the SciTech MGL Public
8 *    License Version 1.0 (the "License"); you may not use this file
9 *    except in compliance with the License. You may obtain a copy of
10 *    the License at http://www.scitechsoft.com/mgl-license.txt
11 *
12 *    Software distributed under the License is distributed on an
13 *    "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
14 *    implied. See the License for the specific language governing
15 *    rights and limitations under the License.
16 *
17 *    The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc.
18 *
19 *    The Initial Developer of the Original Code is SciTech Software, Inc.
20 *    All Rights Reserved.
21 *
22 *  ========================================================================
23 *
24 * Language:     ANSI C
25 * Environment:  32-bit OS/2
26 *
27 * Description:  Include file to include all OS/2 keyboard monitor stuff.
28 *
29 ****************************************************************************/
30
31 /* Monitors stuff */
32
33 #define MONITOR_DEFAULT 0x0000
34 #define MONITOR_BEGIN        1
35 #define MONITOR_END          2
36
37 typedef SHANDLE   HMONITOR;
38 typedef HMONITOR *PHMONITOR;
39
40 typedef struct _KEYPACKET {
41   USHORT  MonFlagWord;
42   UCHAR   XlatedChar;
43   UCHAR   XlatedScan;
44   UCHAR   DBCSStatus;
45   UCHAR   DBCSShift;
46
47   union
48   {
49     USHORT  ShiftState;
50     USHORT  LayerIndex;
51   } u;
52
53   ULONG   Milliseconds;
54   USHORT  KbdDDFlagWord;
55 } KEYPACKET;
56
57 typedef struct _MLNPACKET {
58   USHORT  MonFlagWord;
59   USHORT  IOCTL;
60   USHORT  CPId;
61   USHORT  CPIndex;
62   ULONG   Reserved;
63   USHORT  KbdDDFlagWord;
64 } MLNPACKET;
65
66 /* DBCSStatus */
67
68 #define SF_SHIFTS              1  /* If set to 1, shift status returned without a character */
69 #define SF_NOTCHAR             2  /* 0 - Scan code is a character */
70                                   /* 1 - Scan code is not a character; */
71                                   /*     instead it is an extended key code from the keyboard. */
72 #define SF_IMMEDIATE          32  /* If set to 1, immediate conversion requested */
73 #define SF_TYPEMASK          192  /* Has the following values: */
74                                   /* 00 - Undefined */
75                                   /* 01 - Final character; interim character flag is turned off */
76                                   /* 10 - Interim character */
77                                   /* 11 - Final character; interim character flag is turned on. */
78 /* MonFlagWord */
79
80 #define MF_OPEN                1  /* open */
81 #define MF_CLOSE               2  /* close */
82 #define MF_FLUSH               4  /* is flush packet */
83
84 /* KbdDDFlagWord */
85
86 #define KF_NOTSQPACKET      1024  /* Don't put this packet in SQ buffer */
87 #define KF_ACCENTEDKEY       512  /* Key was translated using previous accent. */
88 #define KF_MULTIMAKE         256  /* Key was repeated make of a toggle key. */
89 #define KF_SECONDARYKEY      128  /* Previous scan code was the E0 prefix code. */
90 #define KF_KEYBREAK           64  /* This is the break of the key. */
91 #define KF_KEYTYPEMASK        63  /* Isolates the Key Type field of DDFlags. */
92 #define KF_UNDEFKEY           63  /* Key packet is undefined */
93 #define KF_SYSREQKEY          23  /* This key packet is the SysReq key (4990) */
94 #define KF_PRINTFLUSHKEY      22  /* This packet is Ct-Alt-PrtScr */
95 #define KF_PSPRINTECHOKEY     21  /* This packet is Ctl-P */
96 #define KF_PRINTECHOKEY       20  /* This packet is Ctl-PrtScr */
97 #define KF_PRTSCRKEY          19  /* This packet is PrtScr */
98 #define KF_PSBREAKKEY         18  /* This packet is Ctl-C */
99 #define KF_BREAKKEY           17  /* This packet is Ctl-Break */
100 #define KF_ACCENTKEY          16  /* This packet is an accent key */
101 #define KF_XRORPNOT           13  /* This packet is a Read or Peek Notification Pct. */
102 #define KF_MLNOTIFICATION     14  /* packet is a Multi-Layer NLS packet */
103 #define KF_HOTKEYPACKET       12  /* This packet is the hot key. */
104 #define KF_BADKEYCOMBO        11  /* Accent/char combo undefined, beep only. */
105 #define KF_WAKEUPKEY          10  /* This packet is one following PAUSEKEY */
106 #define KF_PSPAUSEKEY          9  /* This packet is Ctl-S */
107 #define KF_PAUSEKEY            8  /* This packet is Ctl-Numlock or PAUSE */
108 #define KF_SHIFTMASK           7  /* Key is a shift Key */
109 #define KF_DUMPKEY             6  /* This packet is Ctl-Numlock-NumLock */
110 #define KF_REBOOTKEY           5  /* This packet is Ctl-Alt-Del */
111 #define KF_RESENDCODE          4  /* This packet is resend code from controller */
112 #define KF_OVERRUNCODE         3  /* This packet is overrun code from controller */
113 #define KF_SECPREFIXCODE       2  /* This packet is E0/E1 scan code */
114 #define KF_ACKCODE             1  /* This packet is ack code from keyboard */
115
116
117 typedef struct _MONBUF {
118   USHORT    cb;
119   KEYPACKET Buffer;
120   BYTE      Reserved[20];
121 } MONBUF;
122
123 #define RS_SYSREG      32768  /* Bit 15  SysReq key down */
124 #define RS_CAPSLOCK    16384  /* Bit 14  Caps Lock key down */
125 #define RS_NUMLOCK      8192  /* Bit 13  NumLock key down */
126 #define RS_SCROLLLOCK   4096  /* Bit 12  Scroll Lock key down */
127 #define RS_RALT         2048  /* Bit 11  Right Alt key down */
128 #define RS_RCONTROL     1024  /* Bit 10  Right Ctrl key down */
129 #define RS_LALT          512  /* Bit  9  Left Alt key down */
130 #define RS_LCONTROL      256  /* Bit  8  Left Ctrl key down */
131 #define RS_INSERT        128  /* Bit  7  Insert on */
132 #define RS_CAPS           64  /* Bit  6  Caps Lock on */
133 #define RS_NUM            32  /* Bit  5  NumLock on */
134 #define RS_SCROLL         16  /* Bit  4  Scroll Lock on */
135 #define RS_ALT             8  /* Bit  3  Either Alt key down */
136 #define RS_CONTROL         4  /* Bit  2  Either Ctrl key down */
137 #define RS_LSHIFT          2  /* Bit  1  Left Shift key down */
138 #define RS_RSHIFT          1  /* Bit  0  Right Shift key down */
139
140
141 #define CS_RCONTROL     91    /* Right Control */
142 #define CS_LSHIFT       42    /* Left Shift */
143 #define CS_RSHIFT       54    /* Right Shift */
144 #define CS_LALT         56    /* Left Alt */
145 #define CS_RALT         94    /* Right Alt */
146
147
148 /* DosMon* prototypes */
149 #ifdef __EMX__
150     #define  APIRET16        USHORT
151     #define  APIENTRY16
152 #else
153     #define  DosMonOpen      DOS16MONOPEN
154     #define  DosMonClose     DOS16MONCLOSE
155     #define  DosMonReg       DOS16MONREG
156     #define  DosMonRead      DOS16MONREAD
157     #define  DosMonWrite     DOS16MONWRITE
158     #define  DosGetInfoSeg   DOS16GETINFOSEG
159 #endif
160
161 APIRET16 APIENTRY16 DosMonOpen   (PSZ pszDevName, PHMONITOR phmon);
162 APIRET16 APIENTRY16 DosMonClose  (HMONITOR hmon);
163 APIRET16 APIENTRY16 DosMonReg    (HMONITOR hmon, MONBUF *pbInBuf, /*MONBUF*/ULONG *pbOutBuf, USHORT fPosition, USHORT usIndex);
164 APIRET16 APIENTRY16 DosMonRead   (PBYTE pbInBuf, USHORT fWait, PBYTE pbDataBuf, PUSHORT pcbData);
165 APIRET16 APIENTRY16 DosMonWrite  (PBYTE pbOutBuf, PBYTE pbDataBuf, USHORT cbData);