x68k.h revision 9decb2cd
1/* $NetBSD: x68k.h,v 1.11 2025/06/22 22:32:14 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 108/* keyboard types */ 109#define X68K_KB_STANDARD 0 /* standard keyboard */ 110#define X68K_KB_ASCII 1 /* ascii map keyboard */ 111 112#define X68K_MAXEVENTS 32 113 114extern DevPrivateKeyRec x68kScreenPrivateKeyRec; 115#define x68kScreenPrivateKey (&x68kScreenPrivateKeyRec) 116#define x68kSetScreenPrivate(pScreen, v) \ 117 dixSetPrivate(&(pScreen)->devPrivates, x68kScreenPrivateKey, (v)) 118#define x68kGetScreenPrivate(pScreen) ((X68kScreenRec *) \ 119 dixLookupPrivate(&(pScreen)->devPrivates, x68kScreenPrivateKey)) 120 121/* in x68kConfig.c */ 122X68kScreenRec *x68kGetScreenRec(int); 123X68kScreenRec *x68kGetScreenRecByType(int); 124X68kFbProcRec *x68kGetFbProcRec(int index); 125void x68kRegisterPixmapFormats(ScreenInfo *); 126int x68kGetKbdType(void); 127int x68kConfig(void); 128extern const char *configFilename; 129 130/* x68kFB.c */ 131Bool x68kFbCommonOpen(X68kScreenRec *, const char *); 132void x68kFbCommonClose(X68kScreenRec *); 133Bool x68kSaveScreen(ScreenPtr, int); 134 135/* x68kGraph.c */ 136Bool x68kGraphOpen(X68kScreenRec *); 137Bool x68kGraphInit(ScreenPtr, int, char *[]); 138void x68kGraphClose(X68kScreenRec *); 139 140/* in x68kMouse.c */ 141int x68kMouseProc(DeviceIntPtr, int); 142extern miPointerScreenFuncRec x68kPointerScreenFuncs; 143extern DeviceIntPtr x68kPointerDevice; 144 145/* in x68kKbd.c */ 146int x68kKbdProc(DeviceIntPtr, int); 147extern DeviceIntPtr x68kKeyboardDevice; 148 149/* in x68kKeyMap.c */ 150extern KeySymsRec jisKeySyms, asciiKeySyms, *x68kKeySyms; 151 152/* x68kText.c */ 153Bool x68kTextOpen(X68kScreenRec *); 154Bool x68kTextInit(ScreenPtr, int, char *[]); 155void x68kTextClose(X68kScreenRec *); 156 157/* EOF x68k.h */ 158