]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/MAI/bios_emulator/scitech/include/pmint.h
* Patch by Thomas Frieden, 13 Nov 2002:
[karo-tx-uboot.git] / board / MAI / bios_emulator / scitech / include / pmint.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:  Real mode and 16/32 bit Protected Mode
26 *
27 * Description:  Header file for the interrupt handling extensions to the OS
28 *               Portability Manager Library. These extensions includes
29 *               simplified interrupt handling, allowing all common interrupt
30 *               handlers to be hooked and handled directly with normal C
31 *               functions, both in 16 bit and 32 bit modes. Note however that
32 *               simplified handling does not mean slow performance! All low
33 *               level interrupt handling is done efficiently in assembler
34 *               for speed (well actually necessary to insulate the
35 *               application from the lack of far pointers in 32 bit PM). The
36 *               interrupt handlers currently supported are:
37 *
38 *                   Mouse (0x33 callback)
39 *                   Timer Tick (0x8)
40 *                   Keyboard (0x9 and 0x15)
41 *                   Control C/Break (0x23/0x1B)
42 *                   Critical Error (0x24)
43 *
44 ****************************************************************************/
45
46 #ifndef __PMINT_H
47 #define __PMINT_H
48
49 /*--------------------------- Macros and Typedefs -------------------------*/
50
51 #ifdef __SMX32__
52 /* PC interrupts (Ensure consistent with pme.inc) */
53 #define PM_IRQ0      0x40
54 #define PM_IRQ1      (PM_IRQ0+1)
55 #define PM_IRQ6      (PM_IRQ0+6)
56 #define PM_IRQ14     (PM_IRQ0+14)
57 #endif
58
59 /* Define the different types of interrupt handlers that we support     */
60
61 typedef uint    (PMAPIP PM_criticalHandler)(uint axValue,uint diValue);
62 typedef void    (PMAPIP PM_breakHandler)(uint breakHit);
63 typedef short   (PMAPIP PM_key15Handler)(short scanCode);
64 typedef void    (PMAPIP PM_mouseHandler)(uint event, uint butstate,int x,int y,int mickeyX,int mickeyY);
65
66 /* Create a type for representing far pointers in both 16 and 32 bit
67  * protected mode.
68  */
69
70 #ifdef  PM386
71 typedef struct {
72     long    off;
73     short   sel;
74     } PMFARPTR;
75 #define PMNULL  {0,0}
76 #else
77 typedef void *PMFARPTR;
78 #define PMNULL  NULL
79 #endif
80
81 /*--------------------------- Function Prototypes -------------------------*/
82
83 #ifdef  __cplusplus
84 extern "C" {            /* Use "C" linkage when in C++ mode */
85 #endif
86
87 /* Routine to load save default data segment selector value into a code
88  * segment variable, and another to load the value into the DS register.
89  */
90
91 void    PMAPI PM_loadDS(void);
92 void    PMAPI PM_saveDS(void);
93
94 /* Routine to install a mouse interrupt handling routine. The
95  * mouse handler routine is a normal C function, and the PM library
96  * will take care of passing the correct parameters to the function,
97  * and switching to a local stack.
98  *
99  * Note that you _must_ lock the memory containing the mouse interrupt
100  * handler with the PM_lockPages() function otherwise you may encounter
101  * problems in virtual memory environments.
102  */
103
104 int     PMAPI PM_setMouseHandler(int mask,PM_mouseHandler mh);
105 void    PMAPI PM_restoreMouseHandler(void);
106
107 /* Routine to reset the mouse driver, and re-install the current
108  * mouse interrupt handler if one was currently installed (since the
109  * mouse reset will automatically remove this handler.
110  */
111
112 void    PMAPI PM_resetMouseDriver(int hardReset);
113
114 /* Routine to reset the mouse driver, and re-install the current
115  * mouse interrupt handler if one was currently installed (since the
116  * mouse reset will automatically remove this handler.
117  */
118
119 void    PMAPI PM_resetMouseDriver(int hardReset);
120
121 /* Routines to install and remove timer interrupt handlers.
122  *
123  * Note that you _must_ lock the memory containing the interrupt
124  * handlers with the PM_lockPages() function otherwise you may encounter
125  * problems in virtual memory environments.
126  */
127
128 void    PMAPI PM_setTimerHandler(PM_intHandler ih);
129 void    PMAPI PM_chainPrevTimer(void);
130 void    PMAPI PM_restoreTimerHandler(void);
131
132 /* Routines to install and keyboard interrupt handlers.
133  *
134  * Note that you _must_ lock the memory containing the interrupt
135  * handlers with the PM_lockPages() function otherwise you may encounter
136  * problems in virtual memory environments.
137  */
138
139 void    PMAPI PM_setKeyHandler(PM_intHandler ih);
140 void    PMAPI PM_chainPrevKey(void);
141 void    PMAPI PM_restoreKeyHandler(void);
142
143 /* Routines to hook and unhook the alternate Int 15h keyboard intercept
144  * callout routine. Your event handler will need to return the following:
145  *
146  *  scanCode    - Let the BIOS process scan code (chains to previous handler)
147  *  0           - You have processed the scan code so flush from BIOS
148  *
149  * Note that this is not available under all DOS extenders, but does
150  * work under real mode, DOS4GW and X32-VM. It does not work under the
151  * PowerPack 32 bit DOS extenders. If you figure out how to do it let us know!
152  */
153
154 void    PMAPI PM_setKey15Handler(PM_key15Handler ih);
155 void    PMAPI PM_restoreKey15Handler(void);
156
157 /* Routines to install and remove the control c/break interrupt handlers.
158  * Interrupt handling is performed by the PM/Pro library, and you can call
159  * the supplied routines to test the status of the Ctrl-C and Ctrl-Break
160  * flags. If you pass the value TRUE for 'clearFlag' to these routines,
161  * the internal flags will be reset in order to catch another Ctrl-C or
162  * Ctrl-Break interrupt.
163  */
164
165 void    PMAPI PM_installBreakHandler(void);
166 int     PMAPI PM_ctrlCHit(int clearFlag);
167 int     PMAPI PM_ctrlBreakHit(int clearFlag);
168 void    PMAPI PM_restoreBreakHandler(void);
169
170 /* Routine to install an alternate break handler that will call your
171  * code directly. This is not available under all DOS extenders, but does
172  * work under real mode, DOS4GW and X32-VM. It does not work under the
173  * PowerPack 32 bit DOS extenders. If you figure out how to do it let us know!
174  *
175  * Note that you should either install one or the other, but not both!
176  */
177
178 void    PMAPI PM_installAltBreakHandler(PM_breakHandler bh);
179
180 /* Routines to install and remove the critical error handler. The interrupt
181  * is handled by the PM/Pro library, and the operation will always be failed.
182  * You can check the status of the critical error handler with the
183  * appropriate function. If you pass the value TRUE for 'clearFlag', the
184  * internal flag will be reset ready to catch another critical error.
185  */
186
187 void    PMAPI PM_installCriticalHandler(void);
188 int     PMAPI PM_criticalError(int *axValue, int *diValue, int clearFlag);
189 void    PMAPI PM_restoreCriticalHandler(void);
190
191 /* Routine to install an alternate critical handler that will call your
192  * code directly. This is not available under all DOS extenders, but does
193  * work under real mode, DOS4GW and X32-VM. It does not work under the
194  * PowerPack 32 bit DOS extenders. If you figure out how to do it let us know!
195  *
196  * Note that you should either install one or the other, but not both!
197  */
198
199 void    PMAPI PM_installAltCriticalHandler(PM_criticalHandler);
200
201 /* Functions to manage protected mode only interrupt handlers */
202
203 void    PMAPI PM_getPMvect(int intno, PMFARPTR *isr);
204 void    PMAPI PM_setPMvect(int intno, PM_intHandler ih);
205 void    PMAPI PM_restorePMvect(int intno, PMFARPTR isr);
206
207 #ifdef  __cplusplus
208 }                       /* End of "C" linkage for C++   */
209 #endif
210
211 #endif /* __PMINT_H */