1
/* $Xorg: sun.h,v 1.3 2000/08/17 19:48:36 cpqbld Exp $ */
3
/* This is sun.h modified for LynxOS */
6
* Copyright (c) 1987 by the Regents of the University of California
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.
16
/* $XFree86: xc/programs/Xserver/hw/sunLynx/sun.h,v 3.7 2001/07/25 15:05:02 dawes Exp $ */
23
#undef index /* don't mangle silly Sun structure member names */
27
/* general system headers */
32
extern char *getenv();
35
/* system headers common to both SunOS and Solaris */
36
#include <sys/param.h>
39
# include <sys/filio.h>
41
# include <sys/termio.h> /* include this before ioctl.h ... */
43
#include <sys/ioctl.h>
44
#include <sys/resource.h>
47
# ifdef X_POSIX_C_SOURCE
48
# define _POSIX_C_SOURCE X_POSIX_C_SOURCE
50
# undef _POSIX_C_SOURCE
52
# define _POSIX_SOURCE
61
# if !defined(__NetBSD__) && !defined(__OpenBSD__)
66
# include <sys/poll.h>
78
* Sun specific headers Sun moved in Solaris, and are different for NetBSD.
80
* Even if only needed by one source file, I have put them here
81
* to simplify finding them...
84
# include <sys/fbio.h>
86
# include <sys/kbio.h>
87
# include <sys/msio.h>
88
# include <sys/vuid_event.h>
89
# include <sys/memreg.h>
91
# define usleep(usec) poll((struct pollfd *) 0, (size_t) 0, usec / 1000)
93
# if !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(Lynx)
94
# include <sun/fbio.h>
95
# include <sundev/kbd.h>
96
# include <sundev/kbio.h>
97
# include <sundev/msio.h>
98
# include <sundev/vuid_event.h>
99
# include <pixrect/pixrect.h>
100
# include <pixrect/memreg.h>
102
extern int getrlimit();
103
extern int setrlimit();
104
extern int getpagesize();
106
# if defined (__NetBSD__) || defined (__OpenBSD__)
107
# include <machine/fbio.h>
108
# include <machine/kbd.h>
109
# include <machine/kbio.h>
110
# include <machine/vuid_event.h>
113
# include <sys/fbio.h>
114
# include </sys/sparc/dev/kbd.h>
115
# include </sys/sparc/dev/kbio.h>
116
# include </sys/sparc/dev/vuid_event.h>
123
# ifdef PATCHED_CONSOLE
127
# define KB_SUN2 2 /* type 2 keyboard */
128
# define KB_SUN3 3 /* type 3 keyboard */
129
# define KB_SUN4 4 /* type 4 keyboard */
130
# define KIOCSLED TIOCLED
131
# define LED_NUM_LOCK NUM_LOCK
132
# define LED_SCROLL_LOCK SCROL_LOCK
133
# define LED_CAPS_LOCK CAPS_LOCK
134
# define LED_COMPOSE COMPOSE_LED
138
# include "vuid_event.h"
139
# define FBIORESET _IO('F', 29)
143
extern int gettimeofday();
146
* Server specific headers
149
#undef abs /* don't munge function prototypes in headers, sigh */
150
#include "scrnintstr.h"
152
# include "inputstr.h"
155
#include "colormapst.h"
156
#include "colormap.h"
157
#include "cursorstr.h"
159
#include "dixstruct.h"
162
#include "resource.h"
163
#include "servermd.h"
164
#include "windowstr.h"
167
* ddx specific headers
173
#include "mi/mibstore.h"
174
#include "mi/mipointer.h"
176
extern int monitorResolution;
179
/* Frame buffer devices */
181
# define CGTWO0DEV "/dev/fbs/cgtwo0"
182
# define CGTWO1DEV "/dev/fbs/cgtwo1"
183
# define CGTWO2DEV "/dev/fbs/cgtwo2"
184
# define CGTWO3DEV "/dev/fbs/cgtwo3"
185
# define CGTHREE0DEV "/dev/fbs/cgthree0"
186
# define CGTHREE1DEV "/dev/fbs/cgthree1"
187
# define CGTHREE2DEV "/dev/fbs/cgthree2"
188
# define CGTHREE3DEV "/dev/fbs/cgthree3"
189
# define CGFOUR0DEV "/dev/fbs/cgfour0"
190
# define CGSIX0DEV "/dev/fbs/cgsix0"
191
# define CGSIX1DEV "/dev/fbs/cgsix1"
192
# define CGSIX2DEV "/dev/fbs/cgsix2"
193
# define CGSIX3DEV "/dev/fbs/cgsix3"
194
# define BWTWO0DEV "/dev/fbs/bwtwo0"
195
# define BWTWO1DEV "/dev/fbs/bwtwo1"
196
# define BWTWO2DEV "/dev/fbs/bwtwo2"
197
# define BWTWO3DEV "/dev/fbs/bwtwo3"
198
# define CGEIGHT0DEV "/dev/fbs/cgeight0"
200
# define CGTWO0DEV "/dev/cgtwo0"
201
# define CGTWO1DEV "/dev/cgtwo1"
202
# define CGTWO2DEV "/dev/cgtwo2"
203
# define CGTWO3DEV "/dev/cgtwo3"
204
# define CGTHREE0DEV "/dev/cgthree0"
205
# define CGTHREE1DEV "/dev/cgthree1"
206
# define CGTHREE2DEV "/dev/cgthree2"
207
# define CGTHREE3DEV "/dev/cgthree3"
208
# define CGFOUR0DEV "/dev/cgfour0"
209
# define CGSIX0DEV "/dev/cgsix0"
210
# define CGSIX1DEV "/dev/cgsix1"
211
# define CGSIX2DEV "/dev/cgsix2"
212
# define CGSIX3DEV "/dev/cgsix3"
213
# define BWTWO0DEV "/dev/bwtwo0"
214
# define BWTWO1DEV "/dev/bwtwo1"
215
# define BWTWO2DEV "/dev/bwtwo2"
216
# define BWTWO3DEV "/dev/bwtwo3"
217
# define CGEIGHT0DEV "/dev/cgeight0"
221
* MAXEVENTS is the maximum number of events the mouse and keyboard functions
222
* will read on a given call to their GetEvents vectors.
227
/* currently our mouse stuff is pretty naive, so we need a lot of events */
228
#define MAXEVENTS 256
232
* Data private to any sun keyboard.
236
int type; /* Type of keyboard */
237
int layout; /* The layout of the keyboard */
238
int click; /* kbd click save state */
239
Leds leds; /* last known LED state */
240
} sunKbdPrivRec, *sunKbdPrivPtr;
242
extern sunKbdPrivRec sunKbdPriv;
245
* Data private to any sun pointer device.
249
int bmask; /* last known button state */
250
} sunPtrPrivRec, *sunPtrPrivPtr;
252
extern sunPtrPrivRec sunPtrPriv;
262
CursorPtr pCursor; /* current cursor */
263
} sunCursorRec, *sunCursorPtr;
266
ColormapPtr installedMap;
267
CloseScreenProcPtr CloseScreen;
268
void (*UpdateColormap)();
269
sunCursorRec hardwareCursor;
270
Bool hasHardwareCursor;
271
} sunScreenRec, *sunScreenPtr;
273
#define GetScreenPrivate(s) ((sunScreenPtr) ((s)->devPrivates[sunScreenIndex].ptr))
274
#define SetupScreen(s) sunScreenPtr pPrivate = GetScreenPrivate(s)
278
unsigned char* fb; /* Frame buffer itself */
280
unsigned char* fbuf; /* Frame buffer itself */
281
void* ramdac; /* Color LookUp table */
282
void* fb; /* GX FB control registers:
283
* sunGX.c relies on this name
285
void* tec; /* GX TEC registers */
286
void* thc; /* GX THC registers */
287
void* fhc; /* GX FHC registers */
289
int fd; /* frame buffer for ioctl()s, */
290
struct fbtype info; /* Frame buffer characteristics */
291
void (*EnterLeave)();/* screen switch */
292
unsigned char* fbPriv; /* fbattr stuff, for the real type */
295
typedef Bool (*sunFbInitProc)(
296
#if NeedFunctionPrototypes
298
ScreenPtr /* pScreen */,
305
sunFbInitProc init; /* init procedure for this fb */
306
char* name; /* /usr/include/fbio names */
310
extern Bool noXkbExtension;
313
extern Bool sunAutoRepeatHandlersInstalled;
314
extern long sunAutoRepeatInitiate;
315
extern long sunAutoRepeatDelay;
316
extern sunFbDataRec sunFbData[];
317
extern fbFd sunFbs[];
318
extern Bool sunSwapLkeys;
319
extern Bool sunFlipPixels;
320
extern Bool sunActiveZaphod;
321
extern Bool sunFbInfo;
322
extern Bool sunCG4Frob;
324
extern int sunScreenIndex;
325
extern int* sunProtected;
327
extern Bool sunCursorInitialize(
328
#if NeedFunctionPrototypes
329
ScreenPtr /* pScreen */
333
extern void sunDisableCursor(
334
#if NeedFunctionPrototypes
335
ScreenPtr /* pScreen */
339
extern int sunChangeKbdTranslation(
340
#if NeedFunctionPrototypes
342
Bool /* makeTranslated */
346
extern void sunNonBlockConsoleOff(
347
#if NeedFunctionPrototypes
348
#if defined(SVR4) || defined(CSRG_BASED) || defined(Lynx)
356
extern void sunEnqueueEvents(
357
#if NeedFunctionPrototypes
362
extern void sunEnqueueKbdEvents(
363
#if NeedFunctionPrototypes
368
extern void sunEnqueueMseEvents(
369
#if NeedFunctionPrototypes
374
extern int sunGXInit(
375
#if NeedFunctionPrototypes
376
ScreenPtr /* pScreen */,
381
extern Bool sunSaveScreen(
382
#if NeedFunctionPrototypes
383
ScreenPtr /* pScreen */,
388
extern Bool sunScreenInit(
389
#if NeedFunctionPrototypes
390
ScreenPtr /* pScreen */
394
extern pointer sunMemoryMap(
395
#if NeedFunctionPrototypes
405
extern Bool sunScreenAllocate(
406
#if NeedFunctionPrototypes
407
ScreenPtr /* pScreen */
411
extern Bool sunInitCommon(
412
#if NeedFunctionPrototypes
414
ScreenPtr /* pScrn */,
416
Bool (* /* init1 */)(),
417
void (* /* init2 */)(),
418
Bool (* /* cr_cm */)(),
419
Bool (* /* save */)(),
424
extern Firm_event* sunKbdGetEvents(
425
#if NeedFunctionPrototypes
428
int* /* pNumEvents */,
433
extern Firm_event* sunMouseGetEvents(
434
#if NeedFunctionPrototypes
437
int* /* pNumEvents */,
442
extern void sunKbdEnqueueEvent(
443
#if NeedFunctionPrototypes
444
DeviceIntPtr /* device */,
449
extern void sunMouseEnqueueEvent(
450
#if NeedFunctionPrototypes
451
DeviceIntPtr /* device */,
456
extern int sunKbdProc(
457
#if NeedFunctionPrototypes
458
DeviceIntPtr /* pKeyboard */,
463
extern int sunMouseProc(
464
#if NeedFunctionPrototypes
465
DeviceIntPtr /* pMouse */,
470
extern void sunKbdWait(
471
#if NeedFunctionPrototypes
478
* Given a struct timeval, convert its time into milliseconds...
480
#define TVTOMILLI(tv) (((tv).tv_usec/1000)+((tv).tv_sec*1000))
482
extern Bool sunCfbSetupScreen(
483
#if NeedFunctionPrototypes
484
ScreenPtr /* pScreen */,
485
pointer /* pbits */, /* pointer to screen bitmap */
486
int /* xsize */, /* in pixels */
488
int /* dpix */, /* dots per inch */
489
int /* dpiy */, /* dots per inch */
490
int /* width */, /* pixel width of frame buffer */
491
int /* bpp */ /* bits per pixel of root */
495
extern Bool sunCfbFinishScreenInit(
496
#if NeedFunctionPrototypes
497
ScreenPtr /* pScreen */,
498
pointer /* pbits */, /* pointer to screen bitmap */
499
int /* xsize */, /* in pixels */
501
int /* dpix */, /* dots per inch */
502
int /* dpiy */, /* dots per inch */
503
int /* width */, /* pixel width of frame buffer */
504
int /* bpp */ /* bits per pixel of root */
508
extern Bool sunCfbScreenInit(
509
#if NeedFunctionPrototypes
510
ScreenPtr /* pScreen */,
511
pointer /* pbits */, /* pointer to screen bitmap */
512
int /* xsize */, /* in pixels */
514
int /* dpix */, /* dots per inch */
515
int /* dpiy */, /* dots per inch */
516
int /* width */, /* pixel width of frame buffer */
517
int /* bpp */ /* bits per pixel of root */
521
extern void sunInstallColormap(
522
#if NeedFunctionPrototypes
523
ColormapPtr /* cmap */
527
extern void sunUninstallColormap(
528
#if NeedFunctionPrototypes
529
ColormapPtr /* cmap */
533
extern int sunListInstalledColormaps(
534
#if NeedFunctionPrototypes
535
ScreenPtr /* pScreen */,
536
Colormap* /* pCmapList */