x68k.h revision 26f5ec08
1/* $NetBSD: x68k.h,v 1.8 2021/03/22 14:10:06 tsutsui Exp $ */
2/*-------------------------------------------------------------------------
3 * Copyright (c) 1996 Yasushi Yamasaki
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *-----------------------------------------------------------------------*/
26
27/* system */
28#include <stdlib.h>
29#include <stdio.h>
30#include <errno.h>
31#include <signal.h>
32#include <sys/types.h>
33#include <sys/time.h>
34#include <sys/ioctl.h>
35#include <sys/mman.h>
36#include <fcntl.h>
37#include <unistd.h>
38
39/* machine dependent */
40#include <machine/vuid_event.h>
41#include <machine/kbd.h>
42#include <machine/kbio.h>
43#include <machine/grfioctl.h>
44
45/* generic X */
46#include <X11/X.h>
47#include <X11/Xmd.h>
48#define XK_KATAKANA
49#include <X11/keysym.h>
50#define NEED_EVENTS
51#include <X11/Xproto.h>
52
53/* dix */
54#include <dix-config.h>
55#include <misc.h>
56#include <scrnintstr.h>
57#include <screenint.h>
58#include <input.h>
59#include <inputstr.h>
60#include <servermd.h>
61#include <colormap.h>
62#include <colormapst.h>
63
64/* mi */
65#include <mipointer.h>
66
67#include "x68kReg.h"
68#include "mouseEmu3btn.h"
69
70/*
71 * X68k dependent screen record
72 */
73typedef struct _X68kScreenRec {
74    int type;                   /* frame buffer type   */
75    int class;                  /* visual class        */
76    int fd;                     /* file descriptor     */
77    int depth;                  /* depth               */
78    int fb_width;               /* frame buffer width  */
79    int fb_height;              /* frame buffer height */
80    int scr_width;              /* screen width        */
81    int scr_height;             /* screen height       */
82    int dpi;                    /* dots per inch       */
83    uint8_t *fb;                /* frame buffer VA     */
84    FbReg *reg;                 /* control register VA */
85    X68kFbReg x68kreg;          /* control register    */
86    int mapsize;                /* size of mapped memory */
87    ColormapPtr installedMap;   /* installed colormap    */
88} X68kScreenRec;
89
90/*
91 * frame buffer procedures
92 */
93typedef struct _X68kFbProcRec {
94    Bool (*open)(X68kScreenRec *);		 /* open procedure       */
95    Bool (*init)(ScreenPtr, int, char *[]);      /* initialize procedure */
96    void (*close)(X68kScreenRec *);		 /* close procedure      */
97} X68kFbProcRec;
98
99/* frame buffer types */
100#define X68K_FB_NULL    0
101#define X68K_FB_TEXT    1       /* text VRAM frame buffer */
102#define X68K_FB_GRAPHIC 2       /* graphic VRAM frame buffer */
103#if 0
104#define X68K_FB_CIRRUS  3       /* not yet */
105#endif
106#define X68K_FB_TYPES   2
107
108typedef struct _X68kMousePriv {
109    int fd;
110    int bmask;
111    MouseEmu3btn emu3btn;
112} X68kMousePriv, *X68kMousePrivPtr;
113
114typedef struct _X68kKbdPriv {
115    int type;
116    int fd;
117    Leds leds;
118} X68kKbdPriv, *X68kKbdPrivPtr;
119
120/* keyboard types */
121#define X68K_KB_STANDARD 0      /* standard keyboard */
122#define X68K_KB_ASCII    1      /* ascii map keyboard */
123
124#define X68K_MAXEVENTS 32
125
126extern DevPrivateKeyRec x68kScreenPrivateKeyRec;
127#define x68kScreenPrivateKey (&x68kScreenPrivateKeyRec)
128#define x68kSetScreenPrivate(pScreen, v) \
129    dixSetPrivate(&(pScreen)->devPrivates, x68kScreenPrivateKey, (v))
130#define x68kGetScreenPrivate(pScreen) ((X68kScreenRec *) \
131    dixLookupPrivate(&(pScreen)->devPrivates, x68kScreenPrivateKey))
132
133/* in x68kConfig.c */
134X68kScreenRec *x68kGetScreenRec(int);
135X68kScreenRec *x68kGetScreenRecByType(int);
136X68kFbProcRec *x68kGetFbProcRec(int index);
137void x68kRegisterPixmapFormats(ScreenInfo *);
138int x68kConfig(void);
139extern const char *configFilename;
140
141/* x68kFB.c */
142Bool x68kFbCommonOpen(X68kScreenRec *, const char *);
143void x68kFbCommonClose(X68kScreenRec *);
144Bool x68kSaveScreen(ScreenPtr, int);
145
146/* x68kGraph.c */
147Bool x68kGraphOpen(X68kScreenRec *);
148Bool x68kGraphInit(ScreenPtr, int, char *[]);
149void x68kGraphClose(X68kScreenRec *);
150
151/* in x68kIo.c */
152void x68kSigIOHandler(int);
153
154/* in x68kMouse.c */
155int x68kMouseProc(DeviceIntPtr, int);
156Firm_event *x68kMouseGetEvents(int, int *, Bool *);
157void x68kMouseEnqueueEvent(DeviceIntPtr, Firm_event *);
158extern miPointerScreenFuncRec x68kPointerScreenFuncs;
159extern DeviceIntPtr x68kPointerDevice;
160
161/* in x68kKbd.c */
162int x68kKbdProc(DeviceIntPtr, int);
163Firm_event *x68kKbdGetEvents(int, int *, Bool *);
164void x68kKbdEnqueueEvent(DeviceIntPtr, Firm_event *);
165extern X68kKbdPriv x68kKbdPriv;
166extern DeviceIntPtr x68kKeyboardDevice;
167
168/* in x68kKeyMap.c */
169extern KeySymsRec jisKeySyms, asciiKeySyms, *x68kKeySyms;
170
171/* x68kText.c */
172Bool x68kTextOpen(X68kScreenRec *);
173Bool x68kTextInit(ScreenPtr, int, char *[]);
174void x68kTextClose(X68kScreenRec *);
175
176/* EOF x68k.h */
177