⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fb.c

📁 早期freebsd实现
💻 C
📖 第 1 页 / 共 2 页
字号:
/*- * Copyright (c) 1992, 1993 *	The Regents of the University of California.  All rights reserved. * * This code is derived from software contributed to Berkeley by * Ralph Campbell and Rick Macklem. * * 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. * 3. All advertising materials mentioning features or use of this software *    must display the following acknowledgement: *	This product includes software developed by the University of *	California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors *    may be used to endorse or promote products derived from this software *    without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. * *	@(#)fb.c	8.1 (Berkeley) 6/10/93 *//*  *  devGraphics.c -- * *     	This file contains machine-dependent routines for the graphics device. * *	Copyright (C) 1989 Digital Equipment Corporation. *	Permission to use, copy, modify, and distribute this software and *	its documentation for any purpose and without fee is hereby granted, *	provided that the above copyright notice appears in all copies.   *	Digital Equipment Corporation makes no representations about the *	suitability of this software for any purpose.  It is provided "as is" *	without express or implied warranty. * * from: $Header: /sprite/src/kernel/dev/ds3100.md/RCS/devGraphics.c, *	v 9.2 90/02/13 22:16:24 shirriff Exp $ SPRITE (DECWRL)"; *//* * This file has all the routines common to the various frame buffer drivers * including a generic ioctl routine. The pmax_fb structure is passed into the * routines and has device specifics stored in it. * The LK201 keycode mapping routine is also here along with initialization * functions for the keyboard and mouse. */#include <sys/param.h>#include <sys/systm.h>#include <sys/ioctl.h>#include <sys/tty.h>#include <sys/time.h>#include <sys/kernel.h>#include <sys/ioctl.h>#include <sys/file.h>#include <sys/vnode.h>#include <sys/errno.h>#include <sys/proc.h>#include <sys/mman.h>#include <sys/syslog.h>#include <vm/vm.h>#include <miscfs/specfs/specdev.h>#include <machine/machConst.h>#include <machine/pmioctl.h>#include <pmax/dev/device.h>#include <pmax/dev/font.c>#include <pmax/dev/fbreg.h>#include <pmax/stand/dec_prom.h>#include <pmax/pmax/cons.h>#include <pmax/pmax/pmaxtype.h>#include <dc.h>#include <scc.h>#include <dtop.h>void fbKbdEvent(), fbMouseEvent(), fbMouseButtons(), fbScroll();void fbBlitc(), fbPutc();extern int pmax_boardtype;extern struct consdev cn_tab;#if NDC > 0#include <machine/dc7085cons.h>extern int dcGetc(), dcparam();extern void dcPutc();#endif#if NDTOP > 0#include <pmax/dev/dtopreg.h>extern void dtopKBDPutc();#endif#if NSCC > 0#include <pmax/dev/sccreg.h>extern int sccGetc(), sccparam();extern void sccPutc();#endif/* * The default cursor. */u_short defCursor[32] = { /* plane A */ 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF,	      0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF,/* plane B */ 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF,              0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x00FF};/* * Font mask bits used by fbBlitc(). */static unsigned int fontmaskBits[16] = {	0x00000000,	0x00000001,	0x00000100,	0x00000101,	0x00010000,	0x00010001,	0x00010100,	0x00010101,	0x01000000,	0x01000001,	0x01000100,	0x01000101,	0x01010000,	0x01010001,	0x01010100,	0x01010101};/* * Ascii values of command keys. */#define KBD_TAB		'\t'#define KBD_DEL		127#define KBD_RET		'\r'/* *  Define "hardware-independent" codes for the control, shift, meta and *  function keys.  Codes start after the last 7-bit ASCII code (127) *  and are assigned in an arbitrary order. */#define KBD_NOKEY	128#define KBD_F1		201#define KBD_F2		202#define KBD_F3		203#define KBD_F4		204#define KBD_F5		205#define KBD_F6		206#define KBD_F7		207#define KBD_F8		208#define KBD_F9		209#define KBD_F10		210#define KBD_F11		211#define KBD_F12		212#define KBD_F13		213#define KBD_F14		214#define KBD_HELP	215#define KBD_DO		216#define KBD_F17		217#define KBD_F18		218#define KBD_F19		219#define KBD_F20		220#define KBD_FIND	221#define KBD_INSERT	222#define KBD_REMOVE	223#define KBD_SELECT	224#define KBD_PREVIOUS	225#define KBD_NEXT	226#define KBD_KP_ENTER	227#define KBD_KP_F1	228#define KBD_KP_F2	229#define KBD_KP_F3	230#define KBD_KP_F4	231#define KBD_LEFT	232#define KBD_RIGHT	233#define KBD_DOWN	234#define KBD_UP		235#define KBD_CONTROL	236#define KBD_SHIFT	237#define KBD_CAPSLOCK	238#define KBD_ALTERNATE	239/* * Keyboard to Ascii, unshifted. */static unsigned char unshiftedAscii[] = {/*  0 */ KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,/*  4 */ KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,/*  8 */ KBD_NOKEY,	KBD_NOKEY,	KBD_NOKE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KBD_NOKEY,/* bc */ KBD_DEL,	KBD_RET,	KBD_TAB,	'`',/* c0 */ '1',		'q',		'a',		'z',/* c4 */ KBD_NOKEY,	'2',		'w',		's',/* c8 */ 'x',		'<',		KBD_NOKEY,	'3',/* cc */ 'e',		'd',		'c',		KBD_NOKEY,/* d0 */ '4',		'r',		'f',		'v',/* d4 */ ' ',		KBD_NOKEY,	'5',		't',/* d8 */ 'g',		'b',		KBD_NOKEY,	'6',/* dc */ 'y',		'h',		'n',		KBD_NOKEY,/* e0 */ '7',		'u',		'j',		'm',/* e4 */ KBD_NOKEY,	'8',		'i',		'k',/* e8 */ ',',		KBD_NOKEY,	'9',		'o',/* ec */ 'l',		'.',		KBD_NOKEY,	'0',/* f0 */ 'p',		KBD_NOKEY,	';',		'/',/* f4 */ KBD_NOKEY,	'=',		']',		'\\',/* f8 */ KBD_NOKEY,	'-',		'[',		'\'',/* fc */ KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,};/* * Keyboard to Ascii, shifted. */static unsigned char shiftedAscii[] = {/*  0 */ KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,/*  4 */ KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,/*  8 */ KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,/*  c */ KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,/* 10 */ KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,/* 14 */ KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,/* 18 */ KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,/* 1c */ KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,/* 20 */ KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,/* 24 */ KBD_NOKEY,	KBD_NOKEY,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NOKEY,/* 7c */ KBD_HELP,	KBD_DO,		KBD_NOKEY,	KBD_NOKEY,/* 80 */ KBD_F17,	KBD_F18,	KBD_F19,	KBD_F20,/* 84 */ KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,/* 88 */ KBD_NOKEY,	KBD_NOKEY,	KBD_FIND,	KBD_INSERT,/* 8c */ KBD_REMOVE,	KBD_SELECT,	KBD_PREVIOUS,	KBD_NEXT,/* 90 */ KBD_NOKEY,	KBD_NOKEY,	'0',		KBD_NOKEY,/* 94 */ '.',		KBD_KP_ENTER,	'1',		'2',/* 98 */ '3',		'4',		'5',		'6',/* 9c */ ',',		'7',		'8',		'9',/* a0 */ '-',		KBD_KP_F1,	KBD_KP_F2,	KBD_KP_F3,/* a4 */ KBD_KP_F4,	KBD_NOKEY,	KBD_NOKEY,	KBD_LEFT,/* a8 */ KBD_RIGHT,	KBD_DOWN, 	KBD_UP,		KBD_NOKEY,/* ac */ KBD_NOKEY,	KBD_NOKEY,	KBD_SHIFT,	KBD_CONTROL,/* b0 */ KBD_CAPSLOCK,	KBD_ALTERNATE,	KBD_NOKEY,	KBD_NOKEY,/* b4 */ KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,/* b8 */ KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,/* bc */ KBD_DEL,	KBD_RET,	KBD_TAB,	'~',/* c0 */ '!',		'q',		'a',		'z',/* c4 */ KBD_NOKEY,	'@',		'w',		's',/* c8 */ 'x',		'>',		KBD_NOKEY,	'#',/* cc */ 'e',		'd',		'c',		KBD_NOKEY,/* d0 */ '$',		'r',		'f',		'v',/* d4 */ ' ',		KBD_NOKEY,	'%',		't',/* d8 */ 'g',		'b',		KBD_NOKEY,	'^',/* dc */ 'y',		'h',		'n',		KBD_NOKEY,/* e0 */ '&',		'u',		'j',		'm',/* e4 */ KBD_NOKEY,	'*',		'i',		'k',/* e8 */ '<',		KBD_NOKEY,	'(',		'o',/* ec */ 'l',		'>',		KBD_NOKEY,	')',/* f0 */ 'p',		KBD_NOKEY,	':',		'?',/* f4 */ KBD_NOKEY,	'+',		'}',		'|',/* f8 */ KBD_NOKEY,	'_',		'{',		'"',/* fc */ KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,	KBD_NOKEY,};/*  * Keyboard initialization string. */static u_char kbdInitString[] = {	LK_LED_ENABLE, LED_ALL,		/* show we are resetting keyboard */	LK_DEFAULTS,	LK_CMD_MODE(LK_AUTODOWN, 1), 	LK_CMD_MODE(LK_AUTODOWN, 2), 	LK_CMD_MODE(LK_AUTODOWN, 3), 	LK_CMD_MODE(LK_DOWN, 4),	/* could also be LK_AUTODOWN */	LK_CMD_MODE(LK_UPDOWN, 5),   	LK_CMD_MODE(LK_UPDOWN, 6),   	LK_CMD_MODE(LK_AUTODOWN, 7), 	LK_CMD_MODE(LK_AUTODOWN, 8), 	LK_CMD_MODE(LK_AUTODOWN, 9), 	LK_CMD_MODE(LK_AUTODOWN, 10), 	LK_CMD_MODE(LK_AUTODOWN, 11), 	LK_CMD_MODE(LK_AUTODOWN, 12), 	LK_CMD_MODE(LK_DOWN, 13), 	LK_CMD_MODE(LK_AUTODOWN, 14),	LK_AR_ENABLE,			/* we want autorepeat by default */	LK_CL_ENABLE, 0x83,		/* keyclick, volume */	LK_KBD_ENABLE,			/* the keyboard itself */	LK_BELL_ENABLE, 0x83,		/* keyboard bell, volume */	LK_LED_DISABLE, LED_ALL,	/* clear keyboard leds */};/* *---------------------------------------------------------------------- * * fbKbdEvent -- * *	Process a received character. * * Results: *	None. * * Side effects: *	Events added to the queue. * *---------------------------------------------------------------------- */voidfbKbdEvent(ch, fp)	int ch;	register struct pmax_fb *fp;{	register pmEvent *eventPtr;	int i;	if (!fp->GraphicsOpen)		return;	/*	 * See if there is room in the queue.	 */	i = PM_EVROUND(fp->fbu->scrInfo.qe.eTail + 1);	if (i == fp->fbu->scrInfo.qe.eHead)		return;	/*	 * Add the event to the queue.	 */	eventPtr = &fp->fbu->events[fp->fbu->scrInfo.qe.eTail];	eventPtr->type = BUTTON_RAW_TYPE;	eventPtr->device = KEYBOARD_DEVICE;	eventPtr->x = fp->fbu->scrInfo.mouse.x;	eventPtr->y = fp->fbu->scrInfo.mouse.y;	eventPtr->time = TO_MS(time);	eventPtr->key = ch;	fp->fbu->scrInfo.qe.eTail = i;	selwakeup(&fp->selp);}/* *---------------------------------------------------------------------- * * fbMouseEvent -- * *	Process a mouse event. * * Results: *	None. * * Side effects: *	An event is added to the event queue. * *---------------------------------------------------------------------- */voidfbMouseEvent(newRepPtr, fp) 	register MouseReport *newRepPtr;	register struct pmax_fb *fp;{	unsigned milliSec;	int i;	pmEvent *eventPtr;	if (!fp->GraphicsOpen)		return;	milliSec = TO_MS(time);	/*	 * Check to see if we have to accelerate the mouse	 */	if (fp->fbu->scrInfo.mscale >= 0) {		if (newRepPtr->dx >= fp->fbu->scrInfo.mthreshold) {			newRepPtr->dx +=				(newRepPtr->dx - fp->fbu->scrInfo.mthreshold) *				fp->fbu->scrInfo.mscale;		}		if (newRepPtr->dy >= fp->fbu->scrInfo.mthreshold) {			newRepPtr->dy +=				(newRepPtr->dy - fp->fbu->scrInfo.mthreshold) *				fp->fbu->scrInfo.mscale;		}	}	/*	 * Update mouse position	 */	if (newRepPtr->state & MOUSE_X_SIGN) {		fp->fbu->scrInfo.mouse.x += newRepPtr->dx;		if (fp->fbu->scrInfo.mouse.x > fp->fbu->scrInfo.max_cur_x)			fp->fbu->scrInfo.mouse.x = fp->fbu->scrInfo.max_cur_x;	} else {		fp->fbu->scrInfo.mouse.x -= newRepPtr->dx;		if (fp->fbu->scrInfo.mouse.x < fp->fbu->scrInfo.min_cur_x)			fp->fbu->scrInfo.mouse.x = fp->fbu->scrInfo.min_cur_x;	}	if (newRepPtr->state & MOUSE_Y_SIGN) {		fp->fbu->scrInfo.mouse.y -= newRepPtr->dy;		if (fp->fbu->scrInfo.mouse.y < fp->fbu->scrInfo.min_cur_y)			fp->fbu->scrInfo.mouse.y = fp->fbu->scrInfo.min_cur_y;	} else {		fp->fbu->scrInfo.mouse.y += newRepPtr->dy;		if (fp->fbu->scrInfo.mouse.y > fp->fbu->scrInfo.max_cur_y)			fp->fbu->scrInfo.mouse.y = fp->fbu->scrInfo.max_cur_y;	}	/*	 * Move the hardware cursor.	 */	(*fp->posCursor)(fp->fbu->scrInfo.mouse.x, fp->fbu->scrInfo.mouse.y);	/*	 * Store the motion event in the motion buffer.	 */	fp->fbu->tcs[fp->fbu->scrInfo.qe.tcNext].time = milliSec;	fp->fbu->tcs[fp->fbu->scrInfo.qe.tcNext].x = fp->fbu->scrInfo.mouse.x;	fp->fbu->tcs[fp->fbu->scrInfo.qe.tcNext].y = fp->fbu->scrInfo.mouse.y;	if (++fp->fbu->scrInfo.qe.tcNext >= MOTION_BUFFER_SIZE)		fp->fbu->scrInfo.qe.tcNext = 0;	if (fp->fbu->scrInfo.mouse.y < fp->fbu->scrInfo.mbox.bottom &&	    fp->fbu->scrInfo.mouse.y >=  fp->fbu->scrInfo.mbox.top &&	    fp->fbu->scrInfo.mouse.x < fp->fbu->scrInfo.mbox.right &&	    fp->fbu->scrInfo.mouse.x >=  fp->fbu->scrInfo.mbox.left)		return;	fp->fbu->scrInfo.mbox.bottom = 0;	if (PM_EVROUND(fp->fbu->scrInfo.qe.eTail + 1) == fp->fbu->scrInfo.qe.eHead)		return;	i = PM_EVROUND(fp->fbu->scrInfo.qe.eTail - 1);	if ((fp->fbu->scrInfo.qe.eTail != fp->fbu->scrInfo.qe.eHead) && 	    (i != fp->fbu->scrInfo.qe.eHead)) {		pmEvent *eventPtr;		eventPtr = &fp->fbu->events[i];		if (eventPtr->type == MOTION_TYPE) {			eventPtr->x = fp->fbu->scrInfo.mouse.x;			eventPtr->y = fp->fbu->scrInfo.mouse.y;			eventPtr->time = milliSec;			eventPtr->device = MOUSE_DEVICE;			return;		}	}	/*	 * Put event into queue and wakeup any waiters.	 */	eventPtr = &fp->fbu->events[fp->fbu->scrInfo.qe.eTail];	eventPtr->type = MOTION_TYPE;	eventPtr->time = milliSec;	eventPtr->x = fp->fbu->scrInfo.mouse.x;	eventPtr->y = fp->fbu->scrInfo.mouse.y;	eventPtr->device = MOUSE_DEVICE;	fp->fbu->scrInfo.qe.eTail = PM_EVROUND(fp->fbu->scrInfo.qe.eTail + 1);	selwakeup(&fp->selp);}/* *---------------------------------------------------------------------- * * fbMouseButtons -- * *	Process mouse buttons. * * Results: *	None. * * Side effects: *	None. * *---------------------------------------------------------------------- */voidfbMouseButtons(newRepPtr, fp)	MouseReport *newRepPtr;	register struct pmax_fb *fp;{	static char temp, oldSwitch, newSwitch;	int i, j;	pmEvent *eventPtr;	static MouseReport lastRep;	if (!fp->GraphicsOpen)		return;	newSwitch = newRepPtr->state & 0x07;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -