📄 fg.c
字号:
#ifndef lintstatic char *sccsid = "@(#)fg.c 4.1 (ULTRIX) 7/2/90";#endif lint/************************************************************************ * * * Copyright (c) 1985, 86, 87 by * * Digital Equipment Corporation, Maynard, MA * * All rights reserved. * * * * This software is furnished under a license and may be used and * * copied only in accordance with the terms of such license and * * with the inclusion of the above copyright notice. This * * software or any other copies thereof may not be provided or * * otherwise made available to any other person. No title to and * * ownership of the software is hereby transferred. * * * * This software is derived from software received from the * * University of California, Berkeley, and from Bell * * Laboratories. Use, duplication, or disclosure is subject to * * restrictions under license agreements with University of * * California and with AT&T. * * * * The information in this software is subject to change without * * notice and should not be construed as a commitment by Digital * * Equipment Corporation. * * * * Digital assumes no responsibility for the use or reliability * * of its software on equipment which is not supplied by Digital. * * * ************************************************************************//*********************************************************************** * * Modification History: * * 06-Mar-90 -- jaw * add missing splx's. * * 01-Feb-90 -- rafiey (Ali Rafieymehr) * Common area (fg_comm_base) was not initialized before being used * in interrupt routine (fgiint). This caused a panic when mouse was * moved while server was coming up. * * 15-Dec-89 -- Alan Frechette * Changes to "ws_display_type" and "ws_display_units". * * 23-Jul-89 -- Randall Brown * In the default case of an ioctl() call, check the return value * from ttioctl() to see if the cmd was invalid. If it was, return * an error. * * 08-May-89 -- rafiey (Ali Rafieymehr) * When going to physical mode (crash dump) the video could be turned * off by the server (screen saver). Therefore we turn the video on. * * 08-May-89 -- rafiey (Ali Rafieymehr) * When going to single user mode, the keys would behave as if the * <Ctrl> was also pressed. We now clear the flags for shift and * control in fgclose routine. * * 08-May-89 -- rafiey (Ali Rafieymehr) * The input interrupt routine (fgiint) was printing error messages when * the event queue was full (in high IPL). These error messages are not * really usefull. The solution is to increase the size of the event * queue (this should be done in the next release). For now there is no * need to print the error messages, therefore the "overflow" print * statements are commented out. * * 12-Jan-89 - jaw * merge Xe changes for FFox drivers * * 28-Dec-88 -- carito (Allen Carito) * Fixed random character patterns appearing while during input * session of fg driver by clearing the display area of the frame * buffer during close point of driver. * * 12-Dec-88 -- carito (Allen Carito) * Fixed the cases where the Keyboard lock LED failed to light and * keyboard bell failed to sound. The fix required FG_PRGKBD ioctl * to output cmdbuf->param1. The code has previously been outputting * cmdbuf->cmd. Also removed fgacc... symbols. * * 23-Nov-88 -- darrell (for Allen Carito) * Update the console cursor positon to track this drivers idea of * the cursor position whenever we move the cursor. * * 11-Nov-88 -- darrell (for Allen Carito) * Cleanup, deleted commented out source code, debugging hooks. * Add LEGSS physical address to be used when running with * memory management disabled. * * 21-Sep-88 -- carito (Allen Carito) * Added VOC table preservation code, fixed TOY macro, added save/restore. * Note, the save/restore does not work properly. It is not clear where * (ie. server(Xgb) or firmware or driver(fg.c). The current sympton is * when the machine is halt the processor properly recovers, the display * does not. For some reason the mouse also becomes inactive. Using * the "It's bettern than nothing!", the save/restore function will be * included anyway. * * 13-Sep-88 -- rafiey (Ali Rafieymehr) * Fixed a bug which was causing the "select" not to work for * alternate console. * * 18-Jan-88 -- rafiey (Ali Rafieymehr) * Created the Firefox driver. * * 02-Sep-88 -- rafiey (Ali Rafieymehr) for Allen Carito and Paul Jensen * Added require changes for the DVT pass2 units. Also made changes * to correct the cursor bug. * **********************************************************************/#if NFG > 0 || defined(BINARY)#include "../data/fg_data.c" /* include external references to data file *//* Talk to Darrell about including fcreg.h here */#include "fcreg.h"/* * Firefox LEGSS register offsets */#define BOOT_ROM 0x00000000 /* Diagnostic/boot rom */#define WEITEK 0x00100000 /* Weitek code memory */#define DRAM 0x00400000 /* Dram */#define I_VRAM 0x00800000 /* I-MODE Vram */#define X_VRAM 0x01800000 /* X-MODE Vram */#define I_PATTERN 0x01900000 /* Pattern_I memory */#define X_PATTERN 0x01904000 /* Pattern_X memory */#define TCHIP 0x01A00000 /* T chip */#define DCHIP 0x01B00000 /* D chip */#define ACHIP 0x01C00000 /* A chip */#define ALPHA 0x01D00000 /* Alpha memory */#define FBIC 0x01FFFFC4 /* Fbic *//* * Firefox LEGSS physical register addresses */#define FG_PHYS_FGBASE 0x3e000000#define FG_PHYS_BOOT_ROM FG_PHYS_FGBASE#define FG_PHYS_WEITEK_CODE FG_PHYS_FGBASE + WEITEK#define FG_PHYS_DRAM FG_PHYS_FGBASE + DRAM #define FG_PHYS_I_VRAM FG_PHYS_FGBASE + I_VRAM #define FG_PHYS_X_VRAM FG_PHYS_FGBASE + X_VRAM #define FG_PHYS_I_PATTERN FG_PHYS_FGBASE + I_PATTERN#define FG_PHYS_X_PATTERN FG_PHYS_FGBASE + X_PATTERN#define FG_PHYS_TCHIP FG_PHYS_FGBASE + TCHIP #define FG_PHYS_DCHIP FG_PHYS_FGBASE + DCHIP #define FG_PHYS_ACHIP FG_PHYS_FGBASE + ACHIP #define FG_PHYS_ALPHA FG_PHYS_FGBASE + ALPHA #define FG_PHYS_FBIC FG_PHYS_FGBASE + FBIC /* * CTSI definitions */#define FG_TABLE_X 1280#define FG_TABLE_Y 974#define FG_TABLE_WIDTH 2048-1280#define FG_TABLE_HEIGHT 25#define FG_CTSITABLE_X 1280#define FG_CTSITABLE_Y 999#define FG_CTSITABLE_WIDTH FG_TABLE_WIDTH#define FG_CTSITABLE_HEIGHT FG_TABLE_HEIGHT#define FG_CTSIDSPLY_X 1280 /* 0 or 1280 */#define FG_CTSIDSPLY_Y 686 /* 0 or 686 */#define FG_CTSIDSPLY_W 768 /* 1280 or 768 */#define FG_CTSIDSPLY_H 286 /* 1024 or 286 *//* * Gvax defintions, note the following defintions must match the * definition of FG_CONSOLE_OFF and FG_SCB_OFF, respectively, * in decwgb_dram.h */#define FG_CONSOLE_OFF 1043456#define FG_CONSOLE (DRAM + FG_CONSOLE_OFF)#define FG_SCB_OFF 753664#define FG_SCB (DRAM + FG_SCB_OFF)/* * Tchip definitions */#define TIMING_TL1_OFF 3#define TIMING_TL2_OFF 7#define TIMING_WIDTH_MASK 7#define TIMING_TL1_MASK 0x78#define TIMING_TL2_MASK 0x3F80#define TIMING_HI_OFF 11#define TIMING_HI_MASK 0x7FF#define TIMING_XBS_MASK 0x7FF/* * Miscellaneous definitions */#define FG_PHYSNEXUS 0x20080000#define SGPRIOR (PZERO-1) /* must be negative */#define FALSE 0#define TRUE 1#define CHAR_S 0xc7#define CHAR_Q 0xc1#define FG_MAJOR 59/* * ULTRIX settings for first open. */#define IFLAGS (EVENP|ECHO|XTABS|CRMOD)/* * Termio flags will be set to these default values in non-termio mode to * provide a backward compatible ULTRIX environment. */#define IFLAG (BRKINT|IGNPAR|ISTRIP|IXON|IXANY|ICRNL)#define OFLAG (OPOST|TAB3|ONLCR)#define LFLAG (ISIG|ICANON|ECHO)#define CFLAG (PARENB|CREAD|CS7|CLOCAL)/* * macro to create a system virtual page number from system virtual adrs */#define VTOP(x) (((int)x & ~0xC0000000) >> PGSHIFT) /* convert address */ /* to system page # *//* * macro to convert system virtual to page table */#define SVTOPTE(v) (&Sysmap[btop((int)(v) & ~VA_SYS)])/* * General macroes */#define FG_BROOK_LOW( addr ) ( 0 | ((addr&0x00FF) << 4) )#define FG_BROOK_HIGH( addr ) ( 1 | ((addr&0xFF00) >> 4) )#define Fixed( num ) ( (int)((float)num * 65536.0) )#define FONT_OFFSET ((MAX_SCREEN_X/CHAR_WIDTH)*CHAR_HEIGHT)#define KBD_INIT_LENGTH sizeof(fg_kbdinitstring)/sizeof(short)#define TOY ((time.tv_sec * 1000) + (time.tv_usec / 1000))/* * Global variables and structures *//* * Physical pointers to LEGSS physical registers */struct achip *fg_phys_achip;struct dchip *fg_phys_dchip;struct tchip *fg_phys_tchip;struct fbic *fg_phys_fbic;struct fc_regs *fg_phys_fcaddr;/* * v_consputc is the switch that is used to redirect the console cnputc to the * virtual console vputc. v_consgetc is the switch that is used to redirect * the console getchar to the virtual console vgetc. */extern (*v_consputc)();extern (*v_consgetc)();/* * Keyboard state */struct fg_keyboard { int shift; /* state variables */ int cntrl; int lock; int hold; char last; /* last character */} fg_keyboard;short fg_divdefaults[15] = { LK_DOWN, /* 0 doesn't exist */ LK_AUTODOWN, LK_AUTODOWN, LK_AUTODOWN, LK_DOWN, LK_UPDOWN, LK_UPDOWN, LK_AUTODOWN, LK_AUTODOWN, LK_AUTODOWN, LK_AUTODOWN, LK_AUTODOWN, LK_AUTODOWN, LK_DOWN, LK_AUTODOWN };short fg_kbdinitstring[] = { /* reset any random keyboard stuff */ LK_AR_ENABLE, /* we want autorepeat by default */ LK_CL_ENABLE, /* keyclick */ 0x84, /* keyclick volume */ LK_KBD_ENABLE, /* the keyboard itself */ LK_BELL_ENABLE, /* keyboard bell */ 0x84, /* bell volume */ LK_LED_DISABLE, /* keyboard leds */ LED_ALL };struct fgcurstab { short x; /* cursor x in screen coords */ short y; /* cursor y in screen coords */ short hot_x; /* offset from hotspot to curs origin */ short hot_y; /* offset from hotspot to curs origin */ union { struct { short pat_x; /* cursor pat ULH x-coord */ short pat_y; /* cursor pat ULH x-coord */ } coords; int position; } XY; } fgcurstab;struct fgcurstabupd fgcurstabupd;typedef struct _fg_commarea { char gvax_code [2048]; unsigned int request_queue [2]; /* interlocked queue of requests */ unsigned int free_queue [2];/* queue of free packets */ unsigned short int size; /* The size of the comunication area */ unsigned char type; /* Global system identification */ unsigned char sub_type; /* Legss subsystem identifier */ unsigned long int HOST_waiting; /* Host waiting for GVAX to set */ unsigned long int GVAX_waiting; unsigned long int GVAX_heartbeat; struct { unsigned char cursor_update; /* need to update cursor */ unsigned char vdac_type;/* LVDAC or Bt461 */ char filler [2]; } HG_flags; struct { unsigned char error; /* Gvax error */ char filler [3]; } GH_flags; struct { unsigned char XY_position; /* load new cursor pos */ unsigned char color; /* load new cursor color */ unsigned char pattern; /* load new cursor pattern */ unsigned char filler; } Lego; unsigned long int XY_position; /* new cursor position */ unsigned short int cursor_red_fg; /* Red cursor foreground */ unsigned short int cursor_green_fg; /* Green cursor foreground */ unsigned short int cursor_blue_fg; /* Blue cursor foreground */ unsigned short int cursor_red_bg; /* Red cursor background */ unsigned short int cursor_green_bg; /* Green cursor background */ unsigned short int cursor_blue_bg; /* Blue cursor background */ unsigned long int cursor_mask [32]; /* The cursor mask. */ unsigned long int cursor_image [32]; /* The cursor image. */ } fg_commarea;struct _fg_commarea *fg_comm_area;int fg_ipl_lo = 1; /* IPL low flag */extern u_short sm_pointer_id; /* id of pointer device (mouse,tablet)-ss.c */u_short fg_mouseon = 0; /* Mouse is enable when 1 */u_short fg_open = 0; /* graphics device is open when 1 */int save_logic[4];u_long fg_fgpixel = -1;u_long fg_bgpixel = 0;/**************************************************************/struct fgctsi *fgctsi;int fg_physmode = 0;int save_cursor[2];int ioctl_array[64];int ioctl_counter = 0;int fbic_exists = 0;int fg_num_planes = 0;int Mixed_up_planes = 0;int fg_lego_p0_mask;int fg_lego_p0;int fg_wc_offset;int fg_Wplanes;int Width = 0;int Height = 0;/**************************************************************/int fgdebug = 0;struct uba_device *fgdinfo[NFG];struct mouse_report last_rep;extern struct mouse_report current_rep; /* now in ss.c */extern struct tty sm_tty; /* now in ss.c */extern struct tty fc_tty[];/* * Definition of the driver for the auto-configuration program. */int fgprobe(), fgattach(), fgvint(), fgaint(), fgiint();u_short fgstd[] = { 0 };struct uba_driver fgdriver = { fgprobe, 0, fgattach, 0, fgstd, "fg", fgdinfo };struct proc *rsel; /* process waiting for select */int fgstart(), fgputc(), fggetc(), ttrstrt();long fg_save(), fg_restore();u_long fg_savebuf[100];int fg_savei;u_long *fg_saveaddr;/* * Keyboard translation and font tables */extern char *q_special[],q_font[];extern u_short q_key[],q_shift_key[];extern u_short fg_font[];extern struct nexus nexus[];/* * Default cursor (plane A and plane B) * */u_long fg_def_cursor[] = { /* plane A */ 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, /* plane B, same as plane A */ 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000fff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, };int num_planes;int mixed_up_planes = -1;int fgred = 255;int fggreen = 255;int fgblue = 255;;/******************************************************************* ** ** ** Routine to see if the graphic device will interrupt. ** ** ** *******************************************************************/extern int ws_display_type;extern int ws_display_units;fgprobe(reg) caddr_t reg;{ register struct nb5_regs *fgaddr = (struct nb5_regs *)fgmem; register struct achip *fgachip; register struct dchip *fgdchip; register struct tchip *fgtchip; if (v_consputc != fgputc) { fgbase = (caddr_t) ((u_long)fgaddr); fgmap.boot_rom = fgbase; fgmap.weitek_code = fgbase + WEITEK; fgmap.dram = fgbase + DRAM; fgmap.achip = fgbase + ACHIP; fgmap.dchip = fgbase + DCHIP; fgmap.tchip = fgbase + TCHIP; fgmap.fbic = fgbase + FBIC; fgmap.i_vram = fgbase + I_VRAM; fgmap.x_vram = fgbase + X_VRAM; fgmap.i_pattern_mem = fgbase + I_PATTERN; fgmap.x_pattern_mem = fgbase + X_PATTERN; fgmap.console = fgbase + FG_CONSOLE; fgmap.scb = fgbase + FG_SCB;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -