]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/MAI/bios_emulator/scitech/include/pm_help.h
* Patch by Thomas Frieden, 13 Nov 2002:
[karo-tx-uboot.git] / board / MAI / bios_emulator / scitech / include / pm_help.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:  Win32, OS/2
26 *
27 * Description:  Include file for the SciTech Portability Manager 32-bit
28 *               helper VxD for Windows 9x for and the 16-bit ring 0
29 *               helper device driver for OS/2.
30 *
31 *               This file documents all the public services used by the
32 *               SciTech Portability Manager library and SciTech Nucleus
33 *               loader library.
34 *
35 ****************************************************************************/
36
37 #ifndef __PMHELP_H
38 #define __PMHELP_H
39
40 /* Include version information */
41
42 #include "sdd/sddver.h"
43 #define PMHELP_Major            SDD_RELEASE_MAJOR
44 #define PMHELP_Minor            SDD_RELEASE_MINOR
45 #define PMHELP_VERSION          ((PMHELP_Major << 8) | PMHELP_Minor)
46
47 #ifdef  __OS2__
48
49 /****************************************************************************
50 * Public OS/2 Support functions
51 ****************************************************************************/
52
53 #include "scitech.h"
54 #include "nucleus/graphics.h"
55
56 /* Name of device driver */
57
58 #define PMHELP_NAME                 (PSZ)"sddhelp$"
59
60 /* Main IOCTL function to talk to device driver */
61
62 #define PMHELP_IOCTL                0x0080
63
64 /* Macro definition for defining IOCTL function control codes for the SDDHELP
65  * device driver for OS/2. Similar to that used for the DOS/Win32 version.
66  */
67
68 #define PMHELP_CTL_CODE(name,value) \
69     PMHELP_##name = value
70
71 typedef enum {
72     /* Version function used by all drivers */
73     PMHELP_CTL_CODE(GETVER                      ,0x0001),
74     PMHELP_CTL_CODE(MAPPHYS                     ,0x0002),
75     PMHELP_CTL_CODE(ALLOCLOCKED                 ,0x0003),
76     PMHELP_CTL_CODE(FREELOCKED                  ,0x0004),
77     PMHELP_CTL_CODE(GETGDT32                    ,0x0005),
78     PMHELP_CTL_CODE(MALLOCSHARED                ,0x0007),
79     PMHELP_CTL_CODE(FREESHARED                  ,0x0008),
80     PMHELP_CTL_CODE(MAPTOPROCESS                ,0x0009),
81     PMHELP_CTL_CODE(FREEPHYS                    ,0x000A),
82     PMHELP_CTL_CODE(FLUSHTLB                    ,0x000B),
83     PMHELP_CTL_CODE(SAVECR4                     ,0x000C),
84     PMHELP_CTL_CODE(RESTORECR4                  ,0x000D),
85     PMHELP_CTL_CODE(READMSR                     ,0x000E),
86     PMHELP_CTL_CODE(WRITEMSR                    ,0x000F),
87     PMHELP_CTL_CODE(GETPHYSICALADDR             ,0x0010),
88     PMHELP_CTL_CODE(GETPHYSICALADDRRANGE        ,0x0011),
89     PMHELP_CTL_CODE(LOCKPAGES                   ,0x0012),
90     PMHELP_CTL_CODE(UNLOCKPAGES                 ,0x0013),
91     PMHELP_CTL_CODE(GETSHAREDEXP                ,0x0042),
92     PMHELP_CTL_CODE(SETSHAREDEXP                ,0x0043),
93     PMHELP_CTL_CODE(GETSTACKSWITCHRTN           ,0x0044),
94     PMHELP_CTL_CODE(GETBUILDNO                  ,0x0050),
95     } PMHELP_ctlCodes;
96
97 #else
98
99 /****************************************************************************
100 * Public DOS/Windows Support functions
101 ****************************************************************************/
102
103 #ifdef  DEVICE_MAIN
104 #include <vtoolsc.h>
105 #define PMHELP_Init_Order   (VDD_INIT_ORDER-1)
106 #define RETURN_LONGS(n)     *p->dioc_bytesret = (n) * sizeof(ulong)
107 #endif  /* DEVICE_MAIN */
108 #include "scitech.h"
109 #include "nucleus/graphics.h"
110
111 /* We connect to the SDDHELP.VXD module if it is staticly loaded (as part
112  * of SciTech Display Doctor), otherwise we dynamically load the PMHELP.VXD
113  * public helper VxD.
114  */
115
116 #define PMHELP_DeviceID         0x0000
117 #define SDDHELP_DeviceID        0x3DF8
118 #define VXDLDR_DeviceID         0x0027
119 #define SDDHELP_MODULE          "SDDHELP"
120 #define SDDHELP_NAME            "SDDHELP.VXD"
121 #define PMHELP_MODULE           "PMHELP"
122 #define PMHELP_NAME             "PMHELP.VXD"
123 #define PMHELP_DDBNAME          "pmhelp  "
124 #define SDDHELP_MODULE_PATH     "\\\\.\\" SDDHELP_MODULE
125 #define PMHELP_MODULE_PATH      "\\\\.\\" PMHELP_MODULE
126 #define PMHELP_VXD_PATH         "\\\\.\\" PMHELP_NAME
127
128 /* Macro definition for defining IOCTL function control codes for the PMHELP
129  * device drivers for Windows 9x and NT. This macro is basically derived from
130  * the CTL_CODE macro in the Windows 2000 DDK, but we hard code it here to
131  * avoid having to #include any of the Windows 2000 DDK header files. We also
132  * define both a 16-bit and 32-bit version of the control code within the same
133  * macro to simplify future additions.
134  *
135  * Essentially the Win32 macro would normally expand to the following:
136  *
137  *  CTL_CODE(FILE_DEVICE_VIDEO,0x800+value,METHOD_BUFFERED,FILE_ANY_ACCESS)
138  */
139
140 #define PMHELP_CTL_CODE(name,value)                                             \
141     PMHELP_##name = value,                                                      \
142     PMHELP_##name##32 = ((0x23 << 16) | (0 << 14) | ((0x800+value) << 2) | (0))
143
144 typedef enum {
145     /* Include all the control codes. We keep them in a separate header
146      * file so we can include them in multiple places to make this
147      * more versatile.
148      */
149     #include "pm_wctl.h"
150     } PMHELP_ctlCodes;
151
152 /* For real mode VxD calls, we put the function number into the high
153  * order word of EAX, and a value of 0x4FFF in AX. This allows our
154  * VxD handler which is set up to handle Int 10's to recognise a native
155  * PMHELP API call from a real mode DOS program.
156  */
157
158 #ifdef  REALMODE
159 #define API_NUM(num)    (((ulong)(num) << 16) | 0x4FFF)
160 #else
161 #define API_NUM(num)    (num)
162 #endif
163
164 #endif  /* !__OS2__ */
165
166 #endif  /* __PMHELP_H */
167