1 tsi 3.9 /* $XFree86: xc/programs/Xserver/hw/sunLynx/sun.h,v 3.8tsi Exp $ */
|
2 dawes 3.3
|
3 dawes 1.1 /* This is sun.h modified for LynxOS */
4
|
5 tsi 3.9 /*
|
6 dawes 1.1 * Copyright (c) 1987 by the Regents of the University of California
7 *
8 * Permission to use, copy, modify, and distribute this
9 * software and its documentation for any purpose and without
10 * fee is hereby granted, provided that the above copyright
11 * notice appear in all copies. The University of California
12 * makes no representations about the suitability of this
13 * software for any purpose. It is provided "as is" without
14 * express or implied warranty.
15 */
16
17 #ifndef _SUN_H_
18 #define _SUN_H_
19
20 /* X headers */
|
21 tsi 3.9 #include <X11/Xos.h>
|
22 dawes 1.1 #undef index /* don't mangle silly Sun structure member names */
|
23 tsi 3.9 #include <X11/X.h>
24 #include <X11/Xproto.h>
|
25 dawes 1.1
26 /* general system headers */
27 #ifndef NOSTDHDRS
28 # include <stdlib.h>
29 #else
30 # include <malloc.h>
31 extern char *getenv();
32 #endif
33
34 /* system headers common to both SunOS and Solaris */
35 #include <sys/param.h>
36 #include <sys/file.h>
37 #ifndef Lynx
38 # include <sys/filio.h>
39 #else
40 # include <sys/termio.h> /* include this before ioctl.h ... */
41 #endif
42 #include <sys/ioctl.h>
43 #include <sys/resource.h>
44
45 #ifdef SVR4
46 dawes 1.1 # ifdef X_POSIX_C_SOURCE
47 # define _POSIX_C_SOURCE X_POSIX_C_SOURCE
48 # include <signal.h>
49 # undef _POSIX_C_SOURCE
50 # else
51 # define _POSIX_SOURCE
52 # include <signal.h>
53 # undef _POSIX_SOURCE
54 # endif
55 #endif
56
57 #include <fcntl.h>
58
59 #ifndef __bsdi__
|
60 dawes 3.2 # if !defined(__NetBSD__) && !defined(__OpenBSD__)
|
61 dawes 1.1 # ifndef Lynx
62 # ifndef i386
63 # include <poll.h>
64 # else
65 # include <sys/poll.h>
66 # endif
67 # endif
68 # endif
69 #else
70 # include <unistd.h>
71 #endif
72
73 #include <errno.h>
74 #include <memory.h>
75
76 /*
77 * Sun specific headers Sun moved in Solaris, and are different for NetBSD.
78 *
79 * Even if only needed by one source file, I have put them here
80 * to simplify finding them...
81 */
82 dawes 1.1 #ifdef SVR4
83 # include <sys/fbio.h>
84 # include <sys/kbd.h>
85 # include <sys/kbio.h>
86 # include <sys/msio.h>
87 # include <sys/vuid_event.h>
88 # include <sys/memreg.h>
89 # include <stropts.h>
90 # define usleep(usec) poll((struct pollfd *) 0, (size_t) 0, usec / 1000)
91 #else
|
92 dawes 3.2 # if !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(Lynx)
|
93 dawes 1.1 # include <sun/fbio.h>
94 # include <sundev/kbd.h>
95 # include <sundev/kbio.h>
96 # include <sundev/msio.h>
97 # include <sundev/vuid_event.h>
98 # include <pixrect/pixrect.h>
99 # include <pixrect/memreg.h>
100 extern int ioctl();
101 extern int getrlimit();
102 extern int setrlimit();
103 extern int getpagesize();
104 # else
|
105 dawes 3.2 # if defined (__NetBSD__) || defined (__OpenBSD__)
|
106 dawes 1.1 # include <machine/fbio.h>
107 # include <machine/kbd.h>
108 # include <machine/kbio.h>
109 # include <machine/vuid_event.h>
110 # endif
111 # ifdef __bsdi__
112 # include <sys/fbio.h>
113 # include </sys/sparc/dev/kbd.h>
114 # include </sys/sparc/dev/kbio.h>
115 # include </sys/sparc/dev/vuid_event.h>
116 # endif
117 # ifdef Lynx
118 # ifndef __P
119 # define __P(x) x
120 # endif
121 # include <signal.h>
|
122 dawes 3.1 # ifdef PATCHED_CONSOLE
123 # include <kbio.h>
124 # include <kbd.h>
125 # else
126 # define KB_SUN2 2 /* type 2 keyboard */
127 # define KB_SUN3 3 /* type 3 keyboard */
128 # define KB_SUN4 4 /* type 4 keyboard */
|
129 hohndel 3.4 # define KIOCSLED TIOCLED
130 # define LED_NUM_LOCK NUM_LOCK
131 # define LED_SCROLL_LOCK SCROL_LOCK
132 # define LED_CAPS_LOCK CAPS_LOCK
133 # define LED_COMPOSE COMPOSE_LED
|
134 dawes 3.1 # endif
|
135 dawes 1.1 # include <smem.h>
136 # include "fbio.h"
137 # include "vuid_event.h"
138 # define FBIORESET _IO('F', 29)
139 # endif
140 # endif
141 #endif
142 extern int gettimeofday();
143
144 /*
145 * Server specific headers
146 */
147 #include "misc.h"
148 #undef abs /* don't munge function prototypes in headers, sigh */
149 #include "scrnintstr.h"
150 #ifdef NEED_EVENTS
151 # include "inputstr.h"
152 #endif
153 #include "input.h"
154 #include "colormapst.h"
155 #include "colormap.h"
156 dawes 1.1 #include "cursorstr.h"
157 #include "cursor.h"
158 #include "dixstruct.h"
159 #include "dix.h"
160 #include "opaque.h"
161 #include "resource.h"
162 #include "servermd.h"
163 #include "windowstr.h"
164
165 /*
166 * ddx specific headers
167 */
168 #ifndef PSZ
169 #define PSZ 8
170 #endif
171
|
172 hohndel 3.5 #include "mi/mibstore.h"
|
173 dawes 1.1 #include "mi/mipointer.h"
174
175 extern int monitorResolution;
176
177
178 /* Frame buffer devices */
179 #ifdef SVR4
180 # define CGTWO0DEV "/dev/fbs/cgtwo0"
181 # define CGTWO1DEV "/dev/fbs/cgtwo1"
182 # define CGTWO2DEV "/dev/fbs/cgtwo2"
183 # define CGTWO3DEV "/dev/fbs/cgtwo3"
184 # define CGTHREE0DEV "/dev/fbs/cgthree0"
185 # define CGTHREE1DEV "/dev/fbs/cgthree1"
186 # define CGTHREE2DEV "/dev/fbs/cgthree2"
187 # define CGTHREE3DEV "/dev/fbs/cgthree3"
188 # define CGFOUR0DEV "/dev/fbs/cgfour0"
189 # define CGSIX0DEV "/dev/fbs/cgsix0"
190 # define CGSIX1DEV "/dev/fbs/cgsix1"
191 # define CGSIX2DEV "/dev/fbs/cgsix2"
192 # define CGSIX3DEV "/dev/fbs/cgsix3"
193 # define BWTWO0DEV "/dev/fbs/bwtwo0"
194 dawes 1.1 # define BWTWO1DEV "/dev/fbs/bwtwo1"
195 # define BWTWO2DEV "/dev/fbs/bwtwo2"
196 # define BWTWO3DEV "/dev/fbs/bwtwo3"
197 # define CGEIGHT0DEV "/dev/fbs/cgeight0"
198 #else
199 # define CGTWO0DEV "/dev/cgtwo0"
200 # define CGTWO1DEV "/dev/cgtwo1"
201 # define CGTWO2DEV "/dev/cgtwo2"
202 # define CGTWO3DEV "/dev/cgtwo3"
203 # define CGTHREE0DEV "/dev/cgthree0"
204 # define CGTHREE1DEV "/dev/cgthree1"
205 # define CGTHREE2DEV "/dev/cgthree2"
206 # define CGTHREE3DEV "/dev/cgthree3"
207 # define CGFOUR0DEV "/dev/cgfour0"
208 # define CGSIX0DEV "/dev/cgsix0"
209 # define CGSIX1DEV "/dev/cgsix1"
210 # define CGSIX2DEV "/dev/cgsix2"
211 # define CGSIX3DEV "/dev/cgsix3"
212 # define BWTWO0DEV "/dev/bwtwo0"
213 # define BWTWO1DEV "/dev/bwtwo1"
214 # define BWTWO2DEV "/dev/bwtwo2"
215 dawes 1.1 # define BWTWO3DEV "/dev/bwtwo3"
216 # define CGEIGHT0DEV "/dev/cgeight0"
217 #endif
218
219 /*
220 * MAXEVENTS is the maximum number of events the mouse and keyboard functions
221 * will read on a given call to their GetEvents vectors.
222 */
223 #ifndef Lynx
224 #define MAXEVENTS 32
225 #else
226 /* currently our mouse stuff is pretty naive, so we need a lot of events */
227 #define MAXEVENTS 256
228 #endif
229
230 /*
231 * Data private to any sun keyboard.
232 */
233 typedef struct {
234 int fd;
235 int type; /* Type of keyboard */
236 dawes 1.1 int layout; /* The layout of the keyboard */
237 int click; /* kbd click save state */
238 Leds leds; /* last known LED state */
239 } sunKbdPrivRec, *sunKbdPrivPtr;
240
241 extern sunKbdPrivRec sunKbdPriv;
242
243 /*
244 * Data private to any sun pointer device.
245 */
246 typedef struct {
247 int fd;
248 int bmask; /* last known button state */
249 } sunPtrPrivRec, *sunPtrPrivPtr;
250
251 extern sunPtrPrivRec sunPtrPriv;
252
253 typedef struct {
254 BYTE key;
255 CARD8 modifiers;
256 } SunModmapRec;
257 dawes 1.1
258 typedef struct {
259 int width, height;
260 Bool has_cursor;
261 CursorPtr pCursor; /* current cursor */
262 } sunCursorRec, *sunCursorPtr;
263
264 typedef struct {
265 ColormapPtr installedMap;
266 CloseScreenProcPtr CloseScreen;
267 void (*UpdateColormap)();
268 sunCursorRec hardwareCursor;
269 Bool hasHardwareCursor;
270 } sunScreenRec, *sunScreenPtr;
271
272 #define GetScreenPrivate(s) ((sunScreenPtr) ((s)->devPrivates[sunScreenIndex].ptr))
273 #define SetupScreen(s) sunScreenPtr pPrivate = GetScreenPrivate(s)
274
275 typedef struct {
276 #ifndef Lynx
277 unsigned char* fb; /* Frame buffer itself */
278 dawes 1.1 #else
279 unsigned char* fbuf; /* Frame buffer itself */
280 void* ramdac; /* Color LookUp table */
281 void* fb; /* GX FB control registers:
282 * sunGX.c relies on this name
283 */
284 void* tec; /* GX TEC registers */
285 void* thc; /* GX THC registers */
286 void* fhc; /* GX FHC registers */
287 #endif
288 int fd; /* frame buffer for ioctl()s, */
289 struct fbtype info; /* Frame buffer characteristics */
290 void (*EnterLeave)();/* screen switch */
291 unsigned char* fbPriv; /* fbattr stuff, for the real type */
292 } fbFd;
293
294 typedef Bool (*sunFbInitProc)(
295 int /* screen */,
296 ScreenPtr /* pScreen */,
297 int /* argc */,
298 char** /* argv */
299 dawes 1.1 );
300
301 typedef struct {
302 sunFbInitProc init; /* init procedure for this fb */
303 char* name; /* /usr/include/fbio names */
304 } sunFbDataRec;
305
306 #ifdef XKB
307 extern Bool noXkbExtension;
308 #endif
309
310 extern Bool sunAutoRepeatHandlersInstalled;
311 extern long sunAutoRepeatInitiate;
312 extern long sunAutoRepeatDelay;
313 extern sunFbDataRec sunFbData[];
314 extern fbFd sunFbs[];
315 extern Bool sunSwapLkeys;
316 extern Bool sunFlipPixels;
317 extern Bool sunActiveZaphod;
318 extern Bool sunFbInfo;
319 extern Bool sunCG4Frob;
320 dawes 1.1 extern Bool sunNoGX;
321 extern int sunScreenIndex;
322 extern int* sunProtected;
323
324 extern Bool sunCursorInitialize(
325 ScreenPtr /* pScreen */
326 );
327
328 extern void sunDisableCursor(
329 ScreenPtr /* pScreen */
330 );
331
332 extern int sunChangeKbdTranslation(
333 int /* fd */,
334 Bool /* makeTranslated */
335 );
336
337 extern void sunNonBlockConsoleOff(
338 #if defined(SVR4) || defined(CSRG_BASED) || defined(Lynx)
339 void
340 #else
341 dawes 1.1 char* /* arg */
342 #endif
343 );
344
345 extern void sunEnqueueEvents(
346 void
347 );
348
349 extern void sunEnqueueKbdEvents(
350 void
351 );
352
353 extern void sunEnqueueMseEvents(
354 void
355 );
356
357 extern int sunGXInit(
358 ScreenPtr /* pScreen */,
359 fbFd* /* fb */
360 );
361
362 dawes 1.1 extern Bool sunSaveScreen(
363 ScreenPtr /* pScreen */,
364 int /* on */
365 );
366
367 extern Bool sunScreenInit(
368 ScreenPtr /* pScreen */
369 );
370
371 extern pointer sunMemoryMap(
372 size_t /* len */,
373 off_t /* off */,
374 int /* fd */
375 #ifdef Lynx
376 , char * /* name */
377 #endif
378 );
379
380 extern Bool sunScreenAllocate(
381 ScreenPtr /* pScreen */
382 );
383 dawes 1.1
384 extern Bool sunInitCommon(
385 int /* scrn */,
386 ScreenPtr /* pScrn */,
387 off_t /* offset */,
388 Bool (* /* init1 */)(),
389 void (* /* init2 */)(),
390 Bool (* /* cr_cm */)(),
391 Bool (* /* save */)(),
392 int /* fb_off */
393 );
394
395 extern Firm_event* sunKbdGetEvents(
396 int /* fd */,
397 Bool /* on */,
398 int* /* pNumEvents */,
399 Bool* /* pAgain */
400 );
401
402 extern Firm_event* sunMouseGetEvents(
403 int /* fd */,
404 dawes 1.1 Bool /* on */,
405 int* /* pNumEvents */,
406 Bool* /* pAgain */
407 );
408
409 extern void sunKbdEnqueueEvent(
410 DeviceIntPtr /* device */,
411 Firm_event* /* fe */
412 );
413
414 extern void sunMouseEnqueueEvent(
415 DeviceIntPtr /* device */,
416 Firm_event* /* fe */
417 );
418
419 extern int sunKbdProc(
420 DeviceIntPtr /* pKeyboard */,
421 int /* what */
422 );
423
424 extern int sunMouseProc(
425 dawes 1.1 DeviceIntPtr /* pMouse */,
426 int /* what */
427 );
428
429 extern void sunKbdWait(
430 void
431 );
432
|
433 tsi 3.9 /*
|
434 dawes 1.1 * TVTOMILLI(tv)
435 * Given a struct timeval, convert its time into milliseconds...
436 */
437 #define TVTOMILLI(tv) (((tv).tv_usec/1000)+((tv).tv_sec*1000))
438
439 extern Bool sunCfbSetupScreen(
440 ScreenPtr /* pScreen */,
441 pointer /* pbits */, /* pointer to screen bitmap */
442 int /* xsize */, /* in pixels */
443 int /* ysize */,
444 int /* dpix */, /* dots per inch */
445 int /* dpiy */, /* dots per inch */
446 int /* width */, /* pixel width of frame buffer */
447 int /* bpp */ /* bits per pixel of root */
448 );
449
450 extern Bool sunCfbFinishScreenInit(
451 ScreenPtr /* pScreen */,
452 pointer /* pbits */, /* pointer to screen bitmap */
453 int /* xsize */, /* in pixels */
454 int /* ysize */,
455 dawes 1.1 int /* dpix */, /* dots per inch */
456 int /* dpiy */, /* dots per inch */
457 int /* width */, /* pixel width of frame buffer */
458 int /* bpp */ /* bits per pixel of root */
459 );
460
461 extern Bool sunCfbScreenInit(
462 ScreenPtr /* pScreen */,
463 pointer /* pbits */, /* pointer to screen bitmap */
464 int /* xsize */, /* in pixels */
465 int /* ysize */,
466 int /* dpix */, /* dots per inch */
467 int /* dpiy */, /* dots per inch */
468 int /* width */, /* pixel width of frame buffer */
469 int /* bpp */ /* bits per pixel of root */
470 );
471
472 extern void sunInstallColormap(
473 ColormapPtr /* cmap */
474 );
475
476 dawes 1.1 extern void sunUninstallColormap(
477 ColormapPtr /* cmap */
478 );
479
480 extern int sunListInstalledColormaps(
481 ScreenPtr /* pScreen */,
482 Colormap* /* pCmapList */
483 );
484
485 #endif
|