/* vi: set sw=4 ts=4: */ /* * KON2 - Kanji ON Console - * Copyright (C) 1992-1996 Takashi MANABE (manabe@papilio.tutics.tut.ac.jp) * * CCE - Console Chinese Environment - * Copyright (C) 1998-2003 Rui He (rhe@3eti.com) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ /* vga.h -- definitions used in video drivers */ #ifndef __CCE_VGA_H__ #define __CCE_VGA_H__ #define INPUT_YGAP (4) /*(7) */ #define INPUT_HEIGHT (fontheight + 2*INPUT_YGAP) #define INPUT_YPOS (dispInfo.gydim - dispInfo.input + (dispInfo.input-fontheight)/2) #if defined(linux) #define GRAPH_BASE 0xA0000 #elif defined(__FreeBSD__) #define VIDMODE_TO_IOCTL(mode) ((mode) >= M_VESA_BASE ? \ _IO('V', (mode)-M_VESA_BASE) : _IO('S', mode)) #if (__FreeBSD__ <= 3) #define GRAPH_BASE 0x0 #else #define GRAPH_BASE 0xA0000 #endif #else /* works for LynxOS, NetBSD, OpenBSD etc */ #define GRAPH_BASE 0xA0000 #endif #define VGASEQ_ADDR 0x3C4 #define VGASEQ_DATA 0x3C5 #define VGASEQ_CNT 5 #define VGACRT_ADDR 0x3D4 #define VGACRT_DATA 0x3D5 #define CGACRT_ADDR 0x3D4 #define CGACRT_DATA 0x3D5 #define VGACRT_CNT 25 #define CGACRT_CNT 25 #define VGAGRP_ADDR 0x3CE #define VGAGRP_DATA 0x3CF #define VGAGRP_CNT 9 #define VGAATTR_A_O 0x3C0 #define VGAATTR_DATA 0x3C1 #define VGAATTR_CNT 21 #define EGAATTR_CNT 20 #define FONT_SIZE 0x2000 #define VGA_FONT_SIZE 128 #define VGA_FONT_HEIGHT 16 #define VGAPAL_OADR 0x3C8 #define VGAPAL_IADR 0x3C7 #define VGAPAL_DATA 0x3C9 #define VGAMISC_IN 0x3CC #define VGAMISC_OUT 0x3C2 #define MAX_PELS 16 struct vgaRegs { u_char crt[VGACRT_CNT], att[VGAATTR_CNT], gra[VGAGRP_CNT], seq[VGASEQ_CNT], mis; }; struct pelRegs { u_char red[MAX_PELS], grn[MAX_PELS], blu[MAX_PELS]; }; extern u_char red8[], green8[], blue8[]; extern u_short red16[], green16[], blue16[]; static inline void VgaResetMode(void) { PortOutw(0x0F01, VGAGRP_ADDR); /* 0x0F->EnableSetReset */ PortOutw(0x2003, VGAGRP_ADDR); /* 0x20->Rotate/LogicOp (NOP, 0) */ PortOutw(0xFF08, VGAGRP_ADDR); /* bitmask 0xFF->0x08 */ PortOutw(0x0005, VGAGRP_ADDR); /* reset to graphics mode 0 */ } void VgaSetStartAddress(void); void VgaClearAll(int color); void VgaClearInput(int color); extern u_short red16[], green16[], blue16[]; extern VideoInfo VgaInfo, VgaS3Info, VgaFBInfo, GGIInfo, SDLInfo; extern VideoInfo *InitVideoInfo(char *display); extern void InitDispInfo(void); extern void CheckSuidRoot(void); extern void CCEInputDrawIcon(int x, u_char *bitmap, int width, int height, int fg, int bg); extern void CCEInputWput(int encoding, int x, u_char ch1, u_char ch2, int fg, int bg); extern void CCEInputSput(int x, u_char ch, int fg, int bg); extern void CCEWput(int encoding, int x, int y, u_char ch1, u_char ch2, int fg, int bg); extern void CCESput(int x, int y, u_char ch, int fg, int bg); extern void CCEClear(int action, int color); extern void CCECursor(CursorInfo *ci); extern u_char *gramMem; extern int gramFile; /* for /dev/mem File */ extern u_int writeAddr; extern bool kanjiCursor; extern u_char cursorTop, cursorBtm; extern void VgaOpDraw(u_char *code, u_char fc, u_char bc, int width, int height); extern void VgaOpCursor(CursorInfo *ci, int xpos, int ypos); extern void VgaOpClear(int y, int height, int color); #define SAVE_FONT 1 #define RESTORE_FONT 2 extern void VgaOpFont(u_char *font, int size, int op); extern int VgaOpMapVidMem(void); extern void VgaOpUnmapVidMem(void); #endif /* __CCE_VGA_H__ */