x68k.h revision 1fca83cb
1/* $NetBSD: x68k.h,v 1.6 2020/11/03 15:52:57 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 <misc.h> 55#include <scrnintstr.h> 56#include <screenint.h> 57#include <input.h> 58#include <inputstr.h> 59#include <servermd.h> 60#include <colormap.h> 61#include <colormapst.h> 62 63/* mi */ 64#include <mipointer.h> 65 66#include "x68kReg.h" 67 68/* 69 * X68k dependent screen record 70 */ 71typedef struct _X68kScreenRec { 72 int type; /* frame buffer type */ 73 int class; /* visual class */ 74 int fd; /* file descriptor */ 75 int depth; /* depth */ 76 int fb_width; /* frame buffer width */ 77 int fb_height; /* frame buffer height */ 78 int scr_width; /* screen width */ 79 int scr_height; /* screen height */ 80 int dpi; /* dots per inch */ 81 uint8_t *fb; /* frame buffer VA */ 82 FbReg *reg; /* control register VA */ 83 X68kFbReg x68kreg; /* control register */ 84 int mapsize; /* size of mapped memory */ 85 ColormapPtr installedMap; /* installed colormap */ 86} X68kScreenRec; 87 88/* 89 * frame buffer procedures 90 */ 91typedef struct _X68kFbProcRec { 92 Bool (*open)(X68kScreenRec *); /* open procedure */ 93 Bool (*init)(ScreenPtr, int, char *[]); /* initialize procedure */ 94 void (*close)(X68kScreenRec *); /* close procedure */ 95} X68kFbProcRec; 96 97/* frame buffer types */ 98#define X68K_FB_NULL 0 99#define X68K_FB_TEXT 1 /* text VRAM frame buffer */ 100#define X68K_FB_GRAPHIC 2 /* graphic VRAM frame buffer */ 101#if 0 102#define X68K_FB_CIRRUS 3 /* not yet */ 103#endif 104#define X68K_FB_TYPES 2 105 106typedef struct _X68kMousePriv { 107 int fd; 108 int bmask; 109} X68kMousePriv, *X68kMousePrivPtr; 110 111typedef struct _X68kKbdPriv { 112 int type; 113 int fd; 114 Leds leds; 115} X68kKbdPriv, *X68kKbdPrivPtr; 116 117/* keyboard types */ 118#define X68K_KB_STANDARD 0 /* standard keyboard */ 119#define X68K_KB_ASCII 1 /* ascii map keyboard */ 120 121#define X68K_MAXEVENTS 32 122 123extern DevPrivateKeyRec x68kScreenPrivateKeyRec; 124#define x68kScreenPrivateKey (&x68kScreenPrivateKeyRec) 125#define x68kSetScreenPrivate(pScreen, v) \ 126 dixSetPrivate(&(pScreen)->devPrivates, x68kScreenPrivateKey, (v)) 127#define x68kGetScreenPrivate(pScreen) ((X68kScreenRec *) \ 128 dixLookupPrivate(&(pScreen)->devPrivates, x68kScreenPrivateKey)) 129 130/* in x68kConfig.c */ 131X68kScreenRec *x68kGetScreenRec(int); 132X68kScreenRec *x68kGetScreenRecByType(int); 133X68kFbProcRec *x68kGetFbProcRec(int index); 134void x68kRegisterPixmapFormats(ScreenInfo *); 135int x68kConfig(void); 136extern const char *configFilename; 137 138/* x68kFB.c */ 139Bool x68kFbCommonOpen(X68kScreenRec *, const char *); 140void x68kFbCommonClose(X68kScreenRec *); 141Bool x68kSaveScreen(ScreenPtr, int); 142 143/* x68kGraph.c */ 144Bool x68kGraphOpen(X68kScreenRec *); 145Bool x68kGraphInit(ScreenPtr, int, char *[]); 146void x68kGraphClose(X68kScreenRec *); 147 148/* in x68kIo.c */ 149void x68kSigIOHandler(int); 150 151/* in x68kMouse.c */ 152int x68kMouseProc(DeviceIntPtr, int); 153Firm_event *x68kMouseGetEvents(int, int *, Bool *); 154void x68kMouseEnqueueEvent(DeviceIntPtr, Firm_event *); 155extern miPointerScreenFuncRec x68kPointerScreenFuncs; 156extern DeviceIntPtr x68kPointerDevice; 157 158/* in x68kKbd.c */ 159int x68kKbdProc(DeviceIntPtr, int); 160Firm_event *x68kKbdGetEvents(int, int *, Bool *); 161void x68kKbdEnqueueEvent(DeviceIntPtr, Firm_event *); 162extern X68kKbdPriv x68kKbdPriv; 163extern DeviceIntPtr x68kKeyboardDevice; 164 165/* in x68kKeyMap.c */ 166extern KeySymsRec jisKeySyms, asciiKeySyms, *x68kKeySyms; 167 168/* x68kText.c */ 169Bool x68kTextOpen(X68kScreenRec *); 170Bool x68kTextInit(ScreenPtr, int, char *[]); 171void x68kTextClose(X68kScreenRec *); 172 173/* EOF x68k.h */ 174