?? qd.c
字號(hào):
#ifndef lintstatic char *sccsid = "@(#)qd.c 4.1 (ULTRIX) 7/2/90";#endif lint/************************************************************************* ** Copyright (c) 1985-1988 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. ** ** 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. ** **************************************************************************//* * qd.c * * Modification history * * QDSS workstation driver * * 15-Dec-89 -- Alan Frechette * Changes to "ws_display_type" and "ws_display_units". * * 15-Aug-89 -- carito (Allen Carito) * Changed qdwrite to check for graphic device first then console or * alternate console. This fixes the blank screens on GPX's only. * The fix does have an impact to any other workstation driver. * * 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. * * 23-May-89 -- darrell * Removed the v_ prefix from umaddr and globally defined cpup - as * part of the new cpusw. * * 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 qdclose routine. * * 08-May-89 -- rafiey (Ali Rafieymehr) * * The input interrupt routine (qdiint) 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. * * 16-Feb-89 - Mark Parenti * * Remove xinfo and xoutput. They were xos remnants. * * 17-Aug-88 - Ali Rafieymehr * * Fixed a bug in wait_status() routine. We were not waiting long enough * for the vertical sync. status bit to be set. * * 5-Aug-88 - Tim Burke * * Return the 2 character sequence 0377, 0377 upon receipt of a valid * 0377 character only when PARMRK is set under the termio line disc. * * 14-July-88 - Vasudev K. Bhandarkar * * Changed TOY from 16 bits to 32 bits. X11 server needs 32-bits * of detail associated with event time stamps. * * 4-Mar-88 - Mary Larson * Took out change that left vertical sync on. This caused process * based X's to crash the machine when closing and then reopening * the device. * * 1-Dec-87 - Tim Burke * * Added support for both System V termio(7) and POSIX termios(7). These * changes also include support for 8-bit canonical processing. Changes * involve: * * - Default settings on first open depend on mode of open. For termio * opens the defaults are "RAW" style, while non-termio opens default * to the traditional "cooked" style. * - The driver now represents its terminal attributes and special * characters in the POSIX termios data structure. This contrasts the * original approach of storing attributes and special chars in the * t_flags, ltchars and tchars. * - Addition of LPASS8 to local mode word for 8-bit canonical support. * * 28-Sep-87 - Ali Rafieymehr * Fixed a bug in qddint() routine. The bug was discovered on CVAX. * Incorrect logic was used when taking an entry from the request queue. * * 12-Oct-87 - Tim Burke * Modified driver to provide 8-bit support to the console port. To do * this characters are defined in the remainder of the first 15 rows of * off screen memory as well as in next 15 rows. * * 2-Aug-87 - Fred Canter * Use TANDEM mode on qconsole for flow control of writes to * /dev/console. * * 12-Jun-87 - Tim Burke * * Added full TERMIO functionality to terminal subsystem. * Changed open routine to setup propper default settings if the line * is not being used as a graphics device. Added defines of defaults. * * * 14-May-87 - Fred Canter * Changed default state of kernel_loop to on. * * 21-Apr-87 - Brian Stevens * Xos support * * 16-Apr-87 - Fred Canter (for Brian Stevens) * Multi-head GPX changes. * * 19-Mar-87 - Fred Canter (for Brian Stevens) * Added X in the kernel support. * * 16-Dec-86 - Brian Stevens * * added support so "select" could be called on tty type device * fixed rlogin bug * * 30-Oct-86 - Brian Stevens * * Removed the mprintf for "unexpected interrupts" * * 26-Aug-86 - rsp (Ricky Palmer) * * Cleaned up devioctl code to (1) zero out devget structure * upon entry and (2) use strlen instead of fixed storage * for bcopy's. * * 21-Jul-86 - Ram Rao * allowed cursor rectangle to hang (partially) off the * top and left of screen * * 11-Jul-86 - ricky palmer * * Added adpt and nexus fields to DEVIOCGET code. * * 02-July-86 - Brian Stevens * * added support for console writing to second QDSS display * * 20-May-86 - ricky palmer * * Added new DEVIOCGET ioctl request code. V2.0 * * 16-Apr-86 -- darrell * badaddr is now called via the macro BADADDR * * 14-Apr-86 -- afd * Changed UMEMmap to QMEMmap and umem to qmem. * * v_console() is now refered to as v_consputc, and there is a * corresponding v_consgetc() (defined in /sys/vax/conf.c). * * Added "qdgetc()" routine for console read. Needed to read * user's answer to the "root device?" prompt with a generic kernel. * * 19-Mar-86 -- pmk * Change DELAY to 20000, because microdelay now in real microsec. * * 18-mar-86 -- jaw br/cvec changed to NOT use registers. * * 11 mar 86 darrell replaced percpu with cpusw, and removed all but * one global reference * 19 feb 86 bstevens no report of motion event on puck/stylus button action * 18 feb 86 bstevens put in cursor box support for tablets * 18-Mar-86 -- jaw add routines to cpu switch for nexus/unibus addreses * also got rid of some globals like nexnum. * ka8800 cleanup. * 06 dec 85 longo added LK-201 error reporting for graphics device ops * 03 dec 85 longo made qddint() clear active bit on error * 02 dec 85 longo fixed up some crocks in the error messages * 25 nov 85 longo added error handling to DMA ISR and single user locking * 19 nov 85 longo eliminated "set_defaults()" by breaking out sub-calls. * Changed init_shared to do real init of scroll struct * 12 nov 85 longo fixed bug in open that broke alternate console re-direct * 11 nov 85 longo changed "_vs_eventqueue" references to "qdinput" * 08 nov 85 longo improved select service for read/write select wakeup. * Also set ISR's to ipl4 to allow the interval timer in. * 04 nov 85 longo fixed bugs in mouse button reporting and dma request stuff * 30 oct 85 longo DMA to/from user space is in place * 14 oct 85 longo added kernel msg redirect and QD_RDCURSOR ioctl * 03 oct 85 longo added support for multiple QDSS's * 02 oct 85 longo added color map loading services in qdioctl() & qdaint() * 30 sep 85 longo added DMA interrupt services * 18 sep 85 longo added scroll services to "qdaint()" adder intrpt service * and put in supporting ioctl's * 04 sep 85 longo initial implementation of DMA is working * 17 aug 85 longo added support for the QDSS to be system console * 05 aug 85 longo now using qfont (QVSS & QDSS) as linked object * 12 jun 85 longo added mouse event loading to "qdiint()" * 31 may 85 longo put live interrupts into the probe() routine * 30 may 85 longo event queue shared memory implementation is now alive * 29 may 85 longo LK-201 input is now interrupt driven * 25 apr 85 longo MAPDEVICE works * 14 mar 85 longo created * * todo: fix rlogin bug in console stuff * cat -u console redirection * check error return from strategy routine * verify TOY time stuff (what format?) * look at system based macro implementation of VTOP * */#include "../data/qd_data.c" /* include external references to data file */#define QDSSMAJOR 42 /* QDSS major device number */extern int ws_display_type;extern int ws_display_units;extern struct cpusw *cpup; /* pointer to cpusw entry */int QDlast_DMAtype; /* type of the last DMA operation *//*---------------------------------------------------------------------* macro to get system time. Used to time stamp event queue entries */#define TOY ((time.tv_sec * 1000) + (time.tv_usec / 1000))/*--------------------------------------------------------------------------* the "ioconf.c" program, built and used by auto config, externally refers* to definitions below. */ int qdprobe(); int qdattach(); int qddint(); /* DMA gate array intrpt service */ int qdaint(); /* Dragon ADDER intrpt service */ int qdiint(); u_short qdstd[] = { 0 }; struct uba_driver qddriver = { /* externally referenced: ioconf.c */ qdprobe, /* device probe entry */ 0, /* no slave device */ qdattach, /* device attach entry */ 0, /* no "fill csr/ba to start" */ qdstd, /* device addresses */ "qd", /* device name string */ qdinfo /* ptr to QDSS's uba_device struct */ };/*-------------------* general defines */#define QDPRIOR (PZERO-1) /* must be negative */#define FALSE 0#define TRUE ~FALSE#define BAD -1#define GOOD 0/*-----------------------------------------------------------------------* macro to create a system virtual page number from system virtual adrs */#define VTOP(x) (((int)x & ~0xC0000000) >> PGSHIFT) /* convert qmem adrs */ /* to system page # *//*------------------------------------------------------------------* QDSS register address offsets from start of QDSS address space */#define QDSIZE (52 * 1024) /* size of entire QDSS foot print */#define TMPSIZE (16 * 1024) /* template RAM is 8k SHORT WORDS */#define TMPSTART 0x8000 /* offset of template RAM from base adrs */#define REGSIZE (5 * 512) /* regs touch 2.5k (5 pages) of addr space */#define REGSTART 0xC000 /* offset of reg pages from base adrs */#define ADDER (REGSTART+0x000)#define DGA (REGSTART+0x200)#define DUART (REGSTART+0x400)#define MEMCSR (REGSTART+0x800)#define CLRSIZE (3 * 512) /* color map size */#define CLRSTART (REGSTART+0xA00) /* color map start offset from base */ /* 0x0C00 really */#define RED (CLRSTART+0x000)#define BLUE (CLRSTART+0x200)#define GREEN (CLRSTART+0x400)/*---------------------------------------------------------------* values used in mapping QDSS hardware into the Q memory space */#define CHUNK (64 * 1024)#define QMEMSIZE (1024 * 1024 * 4) /* 4 meg *//*----------------------------------------------------------------------* QDSS minor device numbers. The *real* minor device numbers are in* the bottom two bits of the major/minor device spec. Bits 2 and up are* used to specify the QDSS device number (ie: which one?) */#define CONS 0#define ALTCONS 1#define GRAPHIC 2/*----------------------------------------------* console cursor bitmap (block cursor type) */ short cons_cursor[32] = { /* white block cursor */ /* A */ 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, /* B */ 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF };/*-------------------------------------* constants used in font operations *//* Originaly this was CHARS 95 */#define CHARS 190 /* # of chars in the font */#define CHAR_HEIGHT 15 /* char height in pixels */#define CHAR_WIDTH 8 /* char width in pixels*/#define FONT_WIDTH (CHAR_WIDTH * CHARS) /* font width in pixels */#define ROWS CHAR_HEIGHT#define FONT_X 0 /* font's off screen adrs */#define FONT_Y (2048 - CHAR_HEIGHT) /* Offset to second row characters */#define FONT_OFFSET ((MAX_SCREEN_X/CHAR_WIDTH)*CHAR_HEIGHT) extern char q_font[]; /* reference font object code */ extern u_short q_key[]; /* reference key xlation tables */ extern u_short q_shift_key[]; extern char *q_special[];/*--------------------------------------------------* definitions for cursor acceleration reporting */#define ACC_OFF 0x01 /* acceleration is inactive *//*--------------------------------------------------------------------------* v_consputc is the switch that is used to redirect the console cnputc() to* the virtual console qdputc().* v_consgetc is the switch that is used to redirect the console getchar() to* the virtual console qdgetc().*/ extern (*v_consputc)(); int qdputc(); /* used to direct kernel console output */ extern (*v_consgetc)(); int qdgetc(); /* used to read kernel console input */ int qdstart(); /* used to direct /dev/console output *//*------------------------------------------------------------------------* LK-201 state storage for input console keyboard conversion to ASCII */ struct q_keyboard { int shift; /* state variables */ int cntrl; int lock; int lastcode; /* last keycode typed */ unsigned kup[8]; /* bits for each keycode*/ unsigned dkeys[8]; /* down/up mode keys */ char last; /* last character */ } q_keyboard;/*--------------------------------------------------* 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)/******************************************************************************************************************************************************************************************************* DRIVER FUNCTIONS START HERE:******************************************************************************************************************************************************************************************************//*********************************************************************** qdcons_init()... init QDSS as console (before probe routine)**********************************************************************/qdcons_init(){ register u_int unit; int *ptep; /* page table entry pointer */ caddr_t phys_adr; /* physical QDSS base adrs */ u_int mapix; /* index into QMEMmap[] array */ u_short *qdaddr; /* address of QDSS IO page CSR */ u_short *devptr; /* vitual device space */#define QDSSCSR 0x1F00 unit = 0;/*------------------------------------------------------* Map the Q-bus memory space into the system memory. */ ubaaccess(((*cpup->umaddr)(0)), QMEMmap[0], cpup->pc_umsize, PG_V | PG_KW); ubaaccess(((*cpup->udevaddr)(0)), QMEMmap[0]+btop(cpup->pc_umsize), DEVSPACESIZE ,PG_V|PG_KW);/*---------------------------------------------------------------------* map the QDSS into the Qbus memory (which is now in system space) */ devptr = (u_short *)((char *)qmem[0]+cpup->pc_umsize); qdaddr = (u_short *)((u_int)devptr + ubdevreg(QDSSCSR)); if (BADADDR(qdaddr, sizeof(short))) return(0); /*--------------------------------------------------- * tell QDSS which Q memory address base to decode */ mapix = (int) VTOP(QMEMSIZE - CHUNK); ptep = (int *) QMEMmap[0] + mapix; phys_adr = (caddr_t) (((int)*ptep & 0x001FFFFF) << PGSHIFT); *qdaddr = (u_short) ((int)phys_adr >> 16); qdflags[unit].config = *(u_short *)qdaddr;/*----------------------------------------------------------------------* load qdmap struct with the virtual addresses of the QDSS elements */ qdbase[unit] = (caddr_t) (qmem[0] + QMEMSIZE - CHUNK); qdmap[unit].template = qdbase[unit] + TMPSTART;
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -