184d30d9dStsutsui/* $NetBSD: x68k.h,v 1.3 2020/11/05 16:06:08 tsutsui Exp $ */
2706f2543Smrg/*-------------------------------------------------------------------------
3706f2543Smrg * Copyright (c) 1996 Yasushi Yamasaki
4706f2543Smrg * All rights reserved.
5706f2543Smrg *
6706f2543Smrg * Redistribution and use in source and binary forms, with or without
7706f2543Smrg * modification, are permitted provided that the following conditions
8706f2543Smrg * are met:
9706f2543Smrg * 1. Redistributions of source code must retain the above copyright
10706f2543Smrg *    notice, this list of conditions and the following disclaimer.
11706f2543Smrg * 2. Redistributions in binary form must reproduce the above copyright
12706f2543Smrg *    notice, this list of conditions and the following disclaimer in the
13706f2543Smrg *    documentation and/or other materials provided with the distribution.
14706f2543Smrg *
15706f2543Smrg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16706f2543Smrg * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17706f2543Smrg * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18706f2543Smrg * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19706f2543Smrg * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20706f2543Smrg * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21706f2543Smrg * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22706f2543Smrg * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23706f2543Smrg * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24706f2543Smrg * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25706f2543Smrg *-----------------------------------------------------------------------*/
26706f2543Smrg
27706f2543Smrg/* system */
28706f2543Smrg#include <stdlib.h>
29706f2543Smrg#include <stdio.h>
30706f2543Smrg#include <errno.h>
31706f2543Smrg#include <signal.h>
32706f2543Smrg#include <sys/types.h>
33706f2543Smrg#include <sys/time.h>
34706f2543Smrg#include <sys/ioctl.h>
35706f2543Smrg#include <sys/mman.h>
36706f2543Smrg#include <fcntl.h>
37706f2543Smrg#include <unistd.h>
38706f2543Smrg
39706f2543Smrg/* machine dependent */
40706f2543Smrg#include <machine/vuid_event.h>
41706f2543Smrg#include <machine/kbd.h>
42706f2543Smrg#include <machine/kbio.h>
43706f2543Smrg#include <machine/grfioctl.h>
44706f2543Smrg
45706f2543Smrg/* generic X */
4684d30d9dStsutsui#include <X11/X.h>
4784d30d9dStsutsui#include <X11/Xmd.h>
48706f2543Smrg#define XK_KATAKANA
4984d30d9dStsutsui#include <X11/keysym.h>
50706f2543Smrg#define NEED_EVENTS
5184d30d9dStsutsui#include <X11/Xproto.h>
52706f2543Smrg
53706f2543Smrg/* dix */
54706f2543Smrg#include <misc.h>
55706f2543Smrg#include <scrnintstr.h>
56706f2543Smrg#include <screenint.h>
57706f2543Smrg#include <input.h>
58706f2543Smrg#include <inputstr.h>
59706f2543Smrg#include <servermd.h>
60706f2543Smrg#include <colormap.h>
61706f2543Smrg#include <colormapst.h>
62706f2543Smrg
63706f2543Smrg/* mi */
64706f2543Smrg#include <mipointer.h>
65706f2543Smrg
66706f2543Smrg#include "x68kReg.h"
67706f2543Smrg
68706f2543Smrg/*
69706f2543Smrg * X68k dependent screen record
70706f2543Smrg */
71706f2543Smrgtypedef struct _X68kScreenRec {
72706f2543Smrg    int type;                   /* frame buffer type   */
73706f2543Smrg    int class;                  /* visual class        */
74706f2543Smrg    int fd;                     /* file descriptor     */
75706f2543Smrg    int depth;                  /* depth               */
76706f2543Smrg    int fb_width;               /* frame buffer width  */
77706f2543Smrg    int fb_height;              /* frame buffer height */
78706f2543Smrg    int scr_width;              /* screen width        */
79706f2543Smrg    int scr_height;             /* screen height       */
80706f2543Smrg    int dpi;                    /* dots per inch       */
81706f2543Smrg    uint8_t *fb;                /* frame buffer VA     */
8284d30d9dStsutsui    FbReg *reg;                 /* control register VA */
83706f2543Smrg    X68kFbReg x68kreg;          /* control register    */
84706f2543Smrg    int mapsize;                /* size of mapped memory */
85706f2543Smrg    ColormapPtr installedMap;   /* installed colormap    */
86706f2543Smrg} X68kScreenRec;
87706f2543Smrg
88706f2543Smrg/*
89706f2543Smrg * frame buffer procedures
90706f2543Smrg */
91706f2543Smrgtypedef struct _X68kFbProcRec {
92706f2543Smrg    Bool (*open)(X68kScreenRec *);		 /* open procedure       */
93706f2543Smrg    Bool (*init)(int, ScreenPtr, int, char *[]); /* initialize procedure */
94706f2543Smrg    void (*close)(X68kScreenRec *);		 /* close procedure      */
95706f2543Smrg} X68kFbProcRec;
96706f2543Smrg
97706f2543Smrg/* frame buffer types */
98706f2543Smrg#define X68K_FB_NULL    0
99706f2543Smrg#define X68K_FB_TEXT    1       /* text VRAM frame buffer */
100706f2543Smrg#define X68K_FB_GRAPHIC 2       /* graphic VRAM frame buffer */
101706f2543Smrg#if 0
102706f2543Smrg#define X68K_FB_CIRRUS  3       /* not yet */
103706f2543Smrg#endif
104706f2543Smrg#define X68K_FB_TYPES   2
105706f2543Smrg
106706f2543Smrgtypedef struct _X68kMousePriv {
107706f2543Smrg    int fd;
108706f2543Smrg    int bmask;
109706f2543Smrg} X68kMousePriv, *X68kMousePrivPtr;
110706f2543Smrg
111706f2543Smrgtypedef struct _X68kKbdPriv {
112706f2543Smrg    int type;
113706f2543Smrg    int fd;
114706f2543Smrg    Leds leds;
115706f2543Smrg} X68kKbdPriv, *X68kKbdPrivPtr;
116706f2543Smrg
117706f2543Smrg/* keyboard types */
118706f2543Smrg#define X68K_KB_STANDARD 0      /* standard keyboard */
119706f2543Smrg#define X68K_KB_ASCII    1      /* ascii map keyboard */
120706f2543Smrg
121706f2543Smrg#define MAXEVENTS 32
122706f2543Smrg
123706f2543Smrgextern DevPrivateKeyRec x68kScreenPrivateKeyRec;
124706f2543Smrg#define x68kScreenPrivateKey (&x68kScreenPrivateKeyRec)
125706f2543Smrg#define x68kSetScreenPrivate(pScreen, v) \
126706f2543Smrg    dixSetPrivate(&(pScreen)->devPrivates, x68kScreenPrivateKey, (v))
127706f2543Smrg#define x68kGetScreenPrivate(pScreen) ((X68kScreenRec *) \
128706f2543Smrg    dixLookupPrivate(&(pScreen)->devPrivates, x68kScreenPrivateKey))
129706f2543Smrg
130706f2543Smrg/* in x68kConfig.c */
131706f2543SmrgX68kScreenRec *x68kGetScreenRec(int);
132706f2543SmrgX68kScreenRec *x68kGetScreenRecByType(int);
133706f2543SmrgX68kFbProcRec *x68kGetFbProcRec(int index);
134706f2543Smrgvoid x68kRegisterPixmapFormats(ScreenInfo *);
135706f2543Smrgint x68kConfig(void);
136706f2543Smrgextern const char *configFilename;
137706f2543Smrg
138706f2543Smrg/* x68kFB.c */
139706f2543SmrgBool x68kFbCommonOpen(X68kScreenRec *, const char *);
140706f2543Smrgvoid x68kFbCommonClose(X68kScreenRec *);
141706f2543SmrgBool x68kSaveScreen(ScreenPtr, int);
142706f2543Smrg
143706f2543Smrg/* x68kGraph.c */
144706f2543SmrgBool x68kGraphOpen(X68kScreenRec *);
145706f2543SmrgBool x68kGraphInit(int, ScreenPtr, int, char *[]);
146706f2543Smrgvoid x68kGraphClose(X68kScreenRec *);
147706f2543Smrg
148706f2543Smrg/* in x68kInit.c */
149706f2543Smrgextern EventList *x68kEvents;
150706f2543Smrg
151706f2543Smrg/* in x68kIo.c */
152706f2543Smrgvoid x68kSigIOHandler(int);
153706f2543Smrg
154706f2543Smrg/* in x68kMouse.c */
155706f2543Smrgint x68kMouseProc(DeviceIntPtr, int);
156706f2543SmrgFirm_event *x68kMouseGetEvents(int, int *, Bool *);
157706f2543Smrgvoid x68kMouseEnqueueEvent(DeviceIntPtr, Firm_event *);
158706f2543Smrgextern miPointerScreenFuncRec x68kPointerScreenFuncs;
159706f2543Smrgextern DeviceIntPtr x68kPointerDevice;
160706f2543Smrg
161706f2543Smrg/* in x68kKbd.c */
162706f2543Smrgint x68kKbdProc(DeviceIntPtr, int);
163706f2543SmrgFirm_event *x68kKbdGetEvents(int, int *, Bool *);
164706f2543Smrgvoid x68kKbdEnqueueEvent(DeviceIntPtr, Firm_event *);
165706f2543Smrgextern X68kKbdPriv x68kKbdPriv;
166706f2543Smrgextern DeviceIntPtr x68kKeyboardDevice;
167706f2543Smrg
168706f2543Smrg/* in x68kKeyMap.c */
169706f2543Smrgextern KeySymsRec jisKeySyms, asciiKeySyms, *x68kKeySyms;
170706f2543Smrg
171706f2543Smrg/* x68kText.c */
172706f2543SmrgBool x68kTextOpen(X68kScreenRec *);
173706f2543SmrgBool x68kTextInit(int, ScreenPtr, int, char *[]);
174706f2543Smrgvoid x68kTextClose(X68kScreenRec *);
175706f2543Smrg
176706f2543Smrg/* EOF x68k.h */
177