------------------------------------------------------------------------------ XD88/10 X11.R5 X server patch set This set of patches implements an "cfb" based X11 R5 X server for the Tektronix XD88/10 Graphics Workstation machine. As it stands today, the server seems pretty solid. I have run the x11perf suite and Xlib (version-7.0) tests suites without server crashes... nor memory "leaks". This set of patches is intended to be applied against X11R5 patch level 26 plus the XD88/Motorola base patches from Kaveh R. Ghazi (ghazi@caip.rutgers.edu). To use this patch, start with the X11R5 base code and apply patch/fixes 1-26 (which are available via anonymous ftp on export.x.org). Then apply the XD88/Motorola patch set from Kaveh R. Ghazi (ghazi@caip.rutgers.edu) file on top of those. You do this by cd'ing to the source tree (the directory containing mit and contrib) and typing: patch -p -s < ThisFile (note: You can use patch-2.1 available via anonymous ftp from prep.ai.mit.edu or other gnu sites) Regards and good luck, Steve Jensen =========================================== E-Mail: Stephen.P.Jensen@tek.com US Mail: Stephen P. Jensen Digital Television Television Systems Division Tektronix, Inc. P.O. Box 500, M/S 58-100 Beaverton, OR 97077 Office Phone: (503) 627-3267 ============================================================================== ---------------------------------- NOTICE ------------------------------------ ============================================================================== PLEASE NOTE: I will be supplying the XD88/10 "cfb based Xserver" code to the X Consortium soon as a patch to X11.R5. It is imperative to note that this code base for the XD88/10 X server is not as fast nor as well tested as the XD88/10 product. Also please note that this "sample" Xserver will not operate with the XD88/20/30/35 series graphics systems, as the graphics system architecture of these machines is -totally- different from the XD88/10. The performance level of this "sample - cfb" based Xserver may be too slow for some users and I cannot use the XD88/10 graphics hardware system to its fullest, as that would release proprietary graphics system designs. ( --> Please don't ask! :-) ) WARNING: This XD88/10 X11.R5 "sample" Xserver is not supported by Tektronix, Inc. or anyone for that matter. This "porting" work was performed by Steve Jensen (Stephen.P.Jensen@tek.com). Use of the X11.R5 "sample" software may void other warrantees for the use of your XD88 product. The X11.R5 "sample" software is provided as is. Improper installation or errors in the X11.R5 software could cause loss of disk files and loss of user data. Tektronix, Inc. disclaims all warranties with regard to this software, including all implied warranties of merchantability and fitness, in no event shall Tektronix, Inc. be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of this software. ============================================================================== New directories and files from this patch set: mkdir mit/server/ddx/tek/blackbird new files: blackbird/ Berklib.c Imakefile mkdir mit/server/ddx/tek/redwing new files: redwing/ Imakefile asmLockLib.s display.h displayCallLib.c keyboard.h streamsif.c strmux.h strxdev.h new file from: /usr/include/X11/JUSkeysym mit/include/JUSkeysym.h new file from: /usr/include/X11/TEKkeysym mit/include/TEKkeysym.h new file: mit/server/ddx/tek: colordb.c new file: mit/server/ddx/tek: lmalloc.c new file: mit/server/ddx/tek: pegxtestext1dd.c ------------------------------------------------------------------------------ diff -r -c XD88-patchlevel-26-mit/Imakefile XD8810-mit/Imakefile *** XD88-patchlevel-26-mit/Imakefile Sat Jul 27 11:13:38 1991 --- XD8810-mit/Imakefile Thu Feb 3 16:20:41 1994 *************** *** 7,13 **** --- 7,17 ---- CHECKFN = $(CHECKFNSRC)/checkfn #if BuildServer + #ifndef XD88Architecture SERVERDIRSTOMAKE = server rgb + #else /* XD88Architecture */ + SERVERDIRSTOMAKE = server + #endif /* XD88Architecture */ #endif SUBDIRS = config include lib extensions fonts $(SERVERDIRSTOMAKE) \ clients demos util man diff -r -c XD88-patchlevel-26-mit/config/xd88.cf XD8810-mit/config/xd88.cf *** XD88-patchlevel-26-mit/config/xd88.cf Fri Jan 28 17:03:24 1994 --- XD8810-mit/config/xd88.cf Mon Feb 7 16:00:23 1994 *************** *** 1,5 **** --- 1,8 ---- /* * Tektronix XD88 UTekV 3.2e X11R5 port by Kaveh Ghazi 8/24/93. + * + * Tektronix XD88/10 X server X11R5 port by Steve Jensen Feb-94. + * ( Stephen.P.Jensen@tek.com ) */ #define OSName Tektronix XD88 UTekV 3.2e #define OSMajorVersion 3 *************** *** 12,30 **** #define Malloc0ReturnsNull YES #define LnCmd ln -s #define HasSockets YES ! #define BuildServer NO /* The server still needs to be ported. */ #define XdmServersType ws /* XD88 has an R4 Xserver (with -auth) */ #define MotifBC YES #define UseCCMakeDepend YES #if HasGcc #define OptimizedCDebugFlags /* -O2 */ /* gcc-2.4.5 is available. */ #else #define OptimizedCDebugFlags /* -O */ /* You can use -O if you want. */ #endif /* The bundled Green Hills cc bombs on PEX, but we can build it with gcc. */ #define BuildPex HasGcc #define DefaultUserPath $(BINDIR):/bin:/usr/bin #define DefaultSystemPath $(BINDIR):/etc:/usr/etc:/bin:/usr/bin --- 15,61 ---- #define Malloc0ReturnsNull YES #define LnCmd ln -s #define HasSockets YES ! #define BuildServer YES #define XdmServersType ws /* XD88 has an R4 Xserver (with -auth) */ #define MotifBC YES #define UseCCMakeDepend YES + #define BuildFontServer NO /* needs to be ported... yet */ + #if HasGcc #define OptimizedCDebugFlags /* -O2 */ /* gcc-2.4.5 is available. */ #else #define OptimizedCDebugFlags /* -O */ /* You can use -O if you want. */ #endif + /* + * Various debug flags: + */ + /* #define DefaultCDebugFlags -g */ + /* #define LibraryCDebugFlags -g */ + /* #define PexCDebugFlags -g */ + /* #define ServerCDebugFlags -g */ + /* The bundled Green Hills cc bombs on PEX, but we can build it with gcc. */ #define BuildPex HasGcc #define DefaultUserPath $(BINDIR):/bin:/usr/bin #define DefaultSystemPath $(BINDIR):/etc:/usr/etc:/bin:/usr/bin + + /* + * XD88/10 X11.R5 Server definitions: + */ + #define XtekServer YES + #define BuildFonts YES + #define HasNdbm NO + #define HasVoidSignalReturn NO /* not POSIX signals */ + #define FontFilters BDFTOSNFFILT SHELLPATH + #define PrimaryScreenResolution 95 + + /* a test... */ + /* #define ServerCCOptions -O */ /* causes problems */ + + #define ServerOSDefines -DXD8810 -DFAST_CONSTANT_OFFSET_MODE + + .DIRECTORIES: /* Turn off directory search for RCS */ + diff -r -c XD88-patchlevel-26-mit/include/Imakefile XD8810-mit/include/Imakefile *** XD88-patchlevel-26-mit/include/Imakefile Wed Jul 17 13:11:44 1991 --- XD8810-mit/include/Imakefile Sat Jan 29 21:11:46 1994 *************** *** 19,24 **** --- 19,26 ---- Xprotostr.h \ ap_keysym.h \ keysym.h \ + TEKkeysym.h \ + JUSkeysym.h \ keysymdef.h all:: diff -r -c XD88-patchlevel-26-mit/server/Imakefile XD8810-mit/server/Imakefile *** XD88-patchlevel-26-mit/server/Imakefile Fri Jan 28 13:35:26 1994 --- XD8810-mit/server/Imakefile Sat Jan 29 21:25:32 1994 *************** *** 46,52 **** --- 46,56 ---- #if SystemV4 && X386Server SYSLIBS = -lm /usr/ucblib/libucb.a #else + #ifdef XD88Architecture + SYSLIBS = -lm + #else /* XD88Architecture */ SYSLIBS = -lm -ldbm + #endif /* XD88Architecture */ #endif CBRT = ddx/mi/cbrt.o *************** *** 273,282 **** --- 277,295 ---- XCOMM XCOMM Tektronix server XCOMM + #ifdef XD88Architecture + SUBDIRS0 = CFBSubdirs ddx/tek ddx/tek/redwing ddx/tek/blackbird + TEKDIRS = $(SUBDIRS0) $(DEPDIRS) + TEKOBJS = ddx/tek/pegInit.o ddx/tek/lmalloc.o + TEKLIBS = ddx/tek/libtek.a CFBLibs \ + ddx/tek/blackbird/libBerk.a \ + ddx/tek/redwing/libBMWdsp.a ddx/tek/libtek.a + #else /* XD88Architecture */ SUBDIRS0 = CFBSubdirs ddx/tek TEKDIRS = $(SUBDIRS0) $(DEPDIRS) TEKOBJS = ddx/tek/pegInit.o TEKLIBS = ddx/tek/libtek.a CFBLibs + #endif /* XD88Architecture */ TEKSYSLIBS = $(CBRT) $(SYSLIBS) ServerTarget(Xtek,$(TEKDIRS),$(TEKOBJS),$(TEKLIBS),$(TEKSYSLIBS)) diff -r -c XD88-patchlevel-26-mit/server/ddx/cfb/cfbteblt8.c XD8810-mit/server/ddx/cfb/cfbteblt8.c *** XD88-patchlevel-26-mit/server/ddx/cfb/cfbteblt8.c Wed Apr 10 08:41:43 1991 --- XD8810-mit/server/ddx/cfb/cfbteblt8.c Sat Jan 29 20:17:58 1994 *************** *** 276,282 **** --- 276,286 ---- #define StorePixels(o,p) dst[o] = p #define Loop dst += widthDst; #else + #if defined(UTEK) || defined(UTEKV) + #define StorePixels(o,p) *dst = (p); dst++ + #else /* UTEK || UTEKV */ #define StorePixels(o,p) *dst++ = (p) + #endif /* UTEK || UTEKV */ #define Loop dst += widthLeft; #endif diff -r -c XD88-patchlevel-26-mit/server/ddx/tek/Imakefile XD8810-mit/server/ddx/tek/Imakefile *** XD88-patchlevel-26-mit/server/ddx/tek/Imakefile Tue Jul 16 19:52:21 1991 --- XD8810-mit/server/ddx/tek/Imakefile Sat Jan 29 20:23:10 1994 *************** *** 1,6 **** --- 1,8 ---- XCOMM $XConsortium: Imakefile,v 1.4 91/07/16 22:52:20 gildea Exp $ #include + #ifndef XD88Architecture + SRCS = \ keymap_xtl.c \ pegEvent.c \ *************** *** 17,37 **** svc68k.o \ pegKbd.o ! INCLUDES = -I. -I../mfb -I../mi -I../../include -I$(INCLUDESRC) LINTLIBS = ../../dix/llib-ldix.ln ../../os/llib-los.ln \ ../mfb/llib-lmfb.ln ../mi/llib-lmi.ln ../cfb/llib-lcfb.ln NormalLibraryObjectRule() all:: $(OFILES) lintlib: NormalLibraryTarget(tek,$(OBJS)) NormalLintTarget($(SRCS)) svc68k.o: svc68k.s as -I/usr/include -M -68020 svc68k.s -o svc68k.o saber_src: #load $(CFLAGS) $(SRCS) --- 19,79 ---- svc68k.o \ pegKbd.o ! INCLUDES = -I. -I../mfb -I../mi -I../../include -I$(INCLUDESRC) -I../ LINTLIBS = ../../dix/llib-ldix.ln ../../os/llib-los.ln \ ../mfb/llib-lmfb.ln ../mi/llib-lmi.ln ../cfb/llib-lcfb.ln + #else /* XD88Architecture */ + + SRCS = pegEvent.c \ + pegKbd.c \ + pegIo.c \ + keymap_xtl.c \ + pegInit.c \ + colordb.c \ + pegxtestext1dd.c \ + lmalloc.c + + OFILES = pegInit.o + + OBJS = pegEvent.o \ + pegKbd.o \ + pegIo.o \ + keymap_xtl.o \ + pegInit.o \ + colordb.o \ + pegxtestext1dd.o \ + lmalloc.o + + INCLUDES = -I. -I../mfb -I../mi -I../../include -I$(INCLUDESRC) -I../ + + LINTLIBS = ../../../dix/llib-ldix.ln ../../../os/4.2bsd/llib-los.ln \ + ../../mfb/llib-lmfb.ln ../../mi/llib-lmi.ln ../../cfb/llib-lcfb.ln + + #endif /* XD88Architecture */ + + NormalLibraryObjectRule() all:: $(OFILES) + tek:: all + lintlib: NormalLibraryTarget(tek,$(OBJS)) NormalLintTarget($(SRCS)) + #ifdef M4300Architecture svc68k.o: svc68k.s as -I/usr/include -M -68020 svc68k.s -o svc68k.o + #endif /* M4300Architecture */ + + saber_src: + #load $(CFLAGS) $(SRCS) + + DependTarget() + saber_src: #load $(CFLAGS) $(SRCS) diff -r -c XD88-patchlevel-26-mit/server/ddx/tek/debug.h XD8810-mit/server/ddx/tek/debug.h *** XD88-patchlevel-26-mit/server/ddx/tek/debug.h Thu Oct 12 14:31:28 1989 --- XD8810-mit/server/ddx/tek/debug.h Sat Jan 29 20:25:06 1994 *************** *** 1,3 **** --- 1,4 ---- + /* $Header: debug.h,v 1.2 91/03/07 15:02:58 steveje Exp $ */ #ifdef XDEBUG #define debug(x) printf x #else diff -r -c XD88-patchlevel-26-mit/server/ddx/tek/keymap_xtl.c XD8810-mit/server/ddx/tek/keymap_xtl.c *** XD88-patchlevel-26-mit/server/ddx/tek/keymap_xtl.c Tue Oct 3 17:10:04 1989 --- XD8810-mit/server/ddx/tek/keymap_xtl.c Sat Jan 29 21:14:55 1994 *************** *** 1,26 **** /*********************************************************** ! Copyright 1987 by Tektronix, Beaverton, Oregon, ! and the Massachusetts Institute of Technology, Cambridge, Massachusetts. ! ! All Rights Reserved ! ! 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 appear in all copies and that ! both that copyright notice and this permission notice appear in ! supporting documentation, and that the names of Tektronix or MIT not be ! used in advertising or publicity pertaining to distribution of the ! software without specific, written prior permission. ! ! TEKTRONIX DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ! ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ! DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ! ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, ! WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ! ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ! SOFTWARE. - ******************************************************************/ /* * NAME * keymap_xtl.c -- Keycode to Keysym mappings. --- 1,34 ---- /*********************************************************** ! * Copyright 1987, 1988, 1989, 1990, 1991 by Tektronix, Beaverton, Oregon, ! * and the Massachusetts Institute of Technology, Cambridge, Massachusetts. ! * ! * All Rights Reserved ! * NOTICE: ! * ! * THIS PROGRAM IS NOT A SUPPORTED TEKTRONIX PRODUCT, AND IS ! * NOT GUARANTEED TO BE FREE OF ERRORS. THERE IS NO WARRANTY ! * EXPRESSED OR IMPLIED, AND TEKTRONIX ASSUMES NO LIABILITY FOR ! * DAMAGES RESULTING FROM IT'S USE. ! * ! * ! * 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 appear in all copies and that ! * both that copyright notice and this permission notice appear in ! * supporting documentation, and that the names of Tektronix or MIT not be ! * used in advertising or publicity pertaining to distribution of the ! * software without specific, written prior permission. ! * ! * TEKTRONIX DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ! * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ! * TEKTRONIX BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ! * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, ! * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ! * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ! * SOFTWARE. ! * ! */ /* * NAME * keymap_xtl.c -- Keycode to Keysym mappings. *************** *** 33,52 **** */ #ifndef LINT #ifdef RCS_ID ! static char *rcsid= "$Header: keymap_xtl.c,v 1.2 89/10/03 20:09:59 keith Exp $"; ! #endif RCS_ID ! #endif LINT #include "X.h" #include "Xmd.h" /* for CARD8 */ #include "input.h" #include "keynames_xtl.h" #include "keysym.h" - #ifdef NOTDEF #include "TEKkeysym.h" - #else - #include "DECkeysym.h" - #endif /* --- 41,56 ---- */ #ifndef LINT #ifdef RCS_ID ! static char *rcsid= "$Header: keymap_xtl.c,v 1.3 91/03/07 15:03:06 steveje Exp $"; ! #endif /* RCS_ID */ ! #endif /* LINT */ #include "X.h" #include "Xmd.h" /* for CARD8 */ #include "input.h" #include "keynames_xtl.h" #include "keysym.h" #include "TEKkeysym.h" /* *************** *** 80,88 **** ModMap[PhysKeyToKeyCode(KEY_ShiftL) ] = ShiftMask; ModMap[PhysKeyToKeyCode(KEY_ShiftR) ] = ShiftMask; ModMap[PhysKeyToKeyCode(KEY_Ctrl) ] = ControlMask; ! /* this entry is deleted now now that compose is implemented */ /* ModMap[PhysKeyToKeyCode(KEY_Compose) ] = Mod1Mask; */ ! ModMap[PhysKeyToKeyCode(KEY_Menu) ] = Mod1Mask; map = (KeySym *)Xalloc( sizeof(KeySym) * (MAP_LENGTH * GDS_GLYPHS_PER_KEY)); pKeySyms->minKeyCode = MIN_GDS_KEYCODE; --- 84,92 ---- ModMap[PhysKeyToKeyCode(KEY_ShiftL) ] = ShiftMask; ModMap[PhysKeyToKeyCode(KEY_ShiftR) ] = ShiftMask; ModMap[PhysKeyToKeyCode(KEY_Ctrl) ] = ControlMask; ! /* this entry is deleted now that compose is implemented */ /* ModMap[PhysKeyToKeyCode(KEY_Compose) ] = Mod1Mask; */ ! ModMap[PhysKeyToKeyCode(KEY_Tek) ] = Mod1Mask; map = (KeySym *)Xalloc( sizeof(KeySym) * (MAP_LENGTH * GDS_GLYPHS_PER_KEY)); pKeySyms->minKeyCode = MIN_GDS_KEYCODE; *************** *** 102,110 **** map[INDEX(PhysKeyToKeyCode(KEY_ShiftR))] = XK_Shift_R; map[INDEX(PhysKeyToKeyCode(KEY_Ctrl) )] = XK_Control_L; - #ifdef TekXK_Tek map[INDEX(PhysKeyToKeyCode(KEY_SErase))] = TekXK_SErase; - #endif map[INDEX(PhysKeyToKeyCode(KEY_Break) )] = XK_Break; map[INDEX(PhysKeyToKeyCode(KEY_BackSpace))] = XK_BackSpace; --- 106,112 ---- *************** *** 213,225 **** map[INDEX(PhysKeyToKeyCode(KEY_F7))] = XK_F7; map[INDEX(PhysKeyToKeyCode(KEY_F8))] = XK_F8; ! #ifdef TekXK_Tek ! map[INDEX(PhysKeyToKeyCode(KEY_Dialog))] = TekXK_Dialog; ! map[INDEX(PhysKeyToKeyCode(KEY_Setup) )] = TekXK_Setup; ! map[INDEX(PhysKeyToKeyCode(KEY_Copy) )] = TekXK_Copy; ! #endif ! map[INDEX(PhysKeyToKeyCode(KEY_Menu) )] = XK_Meta_L; ! /* must use Meta, because xterm converts Menu to an escape sequence */ map[INDEX(PhysKeyToKeyCode(KEY_Cursor_R))] = XK_Right; map[INDEX(PhysKeyToKeyCode(KEY_Cursor_U))] = XK_Up; --- 215,225 ---- map[INDEX(PhysKeyToKeyCode(KEY_F7))] = XK_F7; map[INDEX(PhysKeyToKeyCode(KEY_F8))] = XK_F8; ! map[INDEX(PhysKeyToKeyCode(KEY_Dialog)) ] = XK_F10; ! map[INDEX(PhysKeyToKeyCode(KEY_Dialog))+1] = TekXK_Dialog; ! map[INDEX(PhysKeyToKeyCode(KEY_Setup) ) ] = TekXK_Setup; ! map[INDEX(PhysKeyToKeyCode(KEY_Copy) ) ] = TekXK_Copy; ! map[INDEX(PhysKeyToKeyCode(KEY_Menu) ) ] = XK_Menu; map[INDEX(PhysKeyToKeyCode(KEY_Cursor_R))] = XK_Right; map[INDEX(PhysKeyToKeyCode(KEY_Cursor_U))] = XK_Up; *************** *** 229,242 **** map[INDEX(PhysKeyToKeyCode(KEY_Help) )] = XK_Help; map[INDEX(PhysKeyToKeyCode(KEY_Do) )] = XK_Execute; map[INDEX(PhysKeyToKeyCode(KEY_Compose))] = XK_Multi_key; ! #ifdef TekXK_Tek ! map[INDEX(PhysKeyToKeyCode(KEY_Tek) )] = TekXK_Tek; ! #endif ! map[INDEX(PhysKeyToKeyCode(KEY_Find) )] = XK_Find; map[INDEX(PhysKeyToKeyCode(KEY_Insert) )] = XK_Insert; map[INDEX(PhysKeyToKeyCode(KEY_Remove) )] = DXK_Remove; /* DEC's value */ ! map[INDEX(PhysKeyToKeyCode(KEY_Select) )] = XK_Select; map[INDEX(PhysKeyToKeyCode(KEY_Previous))] = XK_Prior; map[INDEX(PhysKeyToKeyCode(KEY_Next) )] = XK_Next; --- 229,242 ---- map[INDEX(PhysKeyToKeyCode(KEY_Help) )] = XK_Help; map[INDEX(PhysKeyToKeyCode(KEY_Do) )] = XK_Execute; map[INDEX(PhysKeyToKeyCode(KEY_Compose))] = XK_Multi_key; ! map[INDEX(PhysKeyToKeyCode(KEY_Tek) )] = XK_Meta_R; ! map[INDEX(PhysKeyToKeyCode(KEY_Find) )] = XK_Home; ! map[INDEX(PhysKeyToKeyCode(KEY_Find)) +1] = XK_Find; map[INDEX(PhysKeyToKeyCode(KEY_Insert) )] = XK_Insert; map[INDEX(PhysKeyToKeyCode(KEY_Remove) )] = DXK_Remove; /* DEC's value */ ! map[INDEX(PhysKeyToKeyCode(KEY_Select) )] = XK_End; ! map[INDEX(PhysKeyToKeyCode(KEY_Select))+1] = XK_Select; map[INDEX(PhysKeyToKeyCode(KEY_Previous))] = XK_Prior; map[INDEX(PhysKeyToKeyCode(KEY_Next) )] = XK_Next; *************** *** 245,256 **** map[INDEX(PhysKeyToKeyCode(KEY_PF3))] = XK_KP_F3; map[INDEX(PhysKeyToKeyCode(KEY_PF4))] = XK_KP_F4; ! #ifdef TekXK_Tek ! map[INDEX(PhysKeyToKeyCode(KEY_Hold) )] = TekXK_Hold; ! map[INDEX(PhysKeyToKeyCode(KEY_GErase))] = TekXK_GErase; ! map[INDEX(PhysKeyToKeyCode(KEY_DErase))] = TekXK_DErase; ! #endif ! map[INDEX(PhysKeyToKeyCode(KEY_Cancel))] = XK_Cancel; map[INDEX(PhysKeyToKeyCode(KEY_Greater) )] = XK_less; map[INDEX(PhysKeyToKeyCode(KEY_Greater))+1] = XK_greater; --- 245,255 ---- map[INDEX(PhysKeyToKeyCode(KEY_PF3))] = XK_KP_F3; map[INDEX(PhysKeyToKeyCode(KEY_PF4))] = XK_KP_F4; ! map[INDEX(PhysKeyToKeyCode(KEY_Hold) )] = TekXK_Hold; ! map[INDEX(PhysKeyToKeyCode(KEY_GErase) )] = TekXK_GErase; ! map[INDEX(PhysKeyToKeyCode(KEY_DErase) )] = TekXK_DErase; ! map[INDEX(PhysKeyToKeyCode(KEY_Cancel) )] = XK_F9; ! map[INDEX(PhysKeyToKeyCode(KEY_Cancel))+1] = XK_Cancel; map[INDEX(PhysKeyToKeyCode(KEY_Greater) )] = XK_less; map[INDEX(PhysKeyToKeyCode(KEY_Greater))+1] = XK_greater; diff -r -c XD88-patchlevel-26-mit/server/ddx/tek/keynames_xtl.h XD8810-mit/server/ddx/tek/keynames_xtl.h *** XD88-patchlevel-26-mit/server/ddx/tek/keynames_xtl.h Tue Oct 3 17:13:27 1989 --- XD8810-mit/server/ddx/tek/keynames_xtl.h Sat Jan 29 21:05:01 1994 *************** *** 1,26 **** /*********************************************************** ! Copyright 1987 by Tektronix, Beaverton, Oregon, ! and the Massachusetts Institute of Technology, Cambridge, Massachusetts. ! ! All Rights Reserved ! ! 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 appear in all copies and that ! both that copyright notice and this permission notice appear in ! supporting documentation, and that the names of Tektronix or MIT not be ! used in advertising or publicity pertaining to distribution of the ! software without specific, written prior permission. ! ! TEKTRONIX DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ! ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ! DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ! ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, ! WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ! ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ! SOFTWARE. - ******************************************************************/ /* * NAME * keynames_xtl.h -- Macros for each XTL key raw value. --- 1,36 ---- + /* $Header: keynames_xtl.h,v 1.2 91/03/07 15:03:09 steveje Exp $ */ /*********************************************************** ! * Copyright 1987, 1988, 1989, 1990, 1991 by Tektronix, Beaverton, Oregon, ! * and the Massachusetts Institute of Technology, Cambridge, Massachusetts. ! * ! * All Rights Reserved ! * ! * NOTICE: ! * ! * THIS PROGRAM IS NOT A SUPPORTED TEKTRONIX PRODUCT, AND IS ! * NOT GUARANTEED TO BE FREE OF ERRORS. THERE IS NO WARRANTY ! * EXPRESSED OR IMPLIED, AND TEKTRONIX ASSUMES NO LIABILITY FOR ! * DAMAGES RESULTING FROM IT'S USE. ! * ! * ! * 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 appear in all copies and that ! * both that copyright notice and this permission notice appear in ! * supporting documentation, and that the names of Tektronix or MIT not be ! * used in advertising or publicity pertaining to distribution of the ! * software without specific, written prior permission. ! * ! * TEKTRONIX DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ! * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ! * TEKTRONIX BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ! * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, ! * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ! * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ! * SOFTWARE. ! * ! */ /* * NAME * keynames_xtl.h -- Macros for each XTL key raw value. *************** *** 34,40 **** #ifndef LINT #ifdef RCS_ID ! static char *rcsid= "$Header: keynames_xtl.h,v 1.1 89/09/30 18:52:53 keith Exp $"; #endif /* RCS_ID */ #endif /* LINT */ --- 44,50 ---- #ifndef LINT #ifdef RCS_ID ! static char *rcsid= "$Header: keynames_xtl.h,v 1.2 91/03/07 15:03:09 steveje Exp $"; #endif /* RCS_ID */ #endif /* LINT */ *************** *** 62,68 **** #define INDEX(keycode) (((keycode) - MIN_GDS_KEYCODE) * GDS_GLYPHS_PER_KEY) /* ! * definition of the GDS/4319 Keyboard: * ============================================================ * Defined Key Cap Glyphs Pressed value * Key Name Main Also (hex) (octal) (dec) --- 72,78 ---- #define INDEX(keycode) (((keycode) - MIN_GDS_KEYCODE) * GDS_GLYPHS_PER_KEY) /* ! * definition of the GDS/4319 & XD88/10 Keyboard: * ============================================================ * Defined Key Cap Glyphs Pressed value * Key Name Main Also (hex) (octal) (dec) diff -r -c XD88-patchlevel-26-mit/server/ddx/tek/pegEvent.c XD8810-mit/server/ddx/tek/pegEvent.c *** XD88-patchlevel-26-mit/server/ddx/tek/pegEvent.c Sat Dec 16 10:12:42 1989 --- XD8810-mit/server/ddx/tek/pegEvent.c Sat Jan 29 20:25:29 1994 *************** *** 1,32 **** ! /* $Header: pegEvent.c,v 1.4 89/12/16 13:12:28 rws Exp $ */ ! /*********************************************************** ! Copyright 1987 by Tektronix, Beaverton, Oregon, ! and the Massachusetts Institute of Technology, Cambridge, Massachusetts. ! ! All Rights Reserved ! ! 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 appear in all copies and that ! both that copyright notice and this permission notice appear in ! supporting documentation, and that the names of Tektronix or MIT not be ! used in advertising or publicity pertaining to distribution of the ! software without specific, written prior permission. ! ! TEKTRONIX DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ! ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ! DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ! ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, ! WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ! ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ! SOFTWARE. ! ! ******************************************************************/ #include "X.h" #define NEED_EVENTS #include "Xproto.h" #include "keysym.h" #include "inputstr.h" #include "miscstruct.h" #include "screenint.h" --- 1,41 ---- ! /* $Header: pegEvent.c,v 1.3 91/03/07 15:03:17 steveje Exp $ */ + /*********************************************************** + * Copyright 1987, 1988, 1989, 1990, 1991 by Tektronix, Inc., Beaverton, Oregon. + * and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + * + * All Rights Reserved. + * + * NOTICE: + * + * THIS PROGRAM IS NOT A SUPPORTED TEKTRONIX PRODUCT, AND IS + * NOT GUARANTEED TO BE FREE OF ERRORS. THERE IS NO WARRANTY + * EXPRESSED OR IMPLIED, AND TEKTRONIX ASSUMES NO LIABILITY FOR + * DAMAGES RESULTING FROM IT'S USE. + * + * + * 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 appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the names of Tektronix or MIT not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TEKTRONIX BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + */ #include "X.h" #define NEED_EVENTS #include "Xproto.h" #include "keysym.h" + #include "JUSkeysym.h" #include "inputstr.h" #include "miscstruct.h" #include "screenint.h" *************** *** 49,54 **** --- 58,71 ---- SvcCursorXY LastMousePosition; #endif /* XTESTEXT1 */ + #ifdef XINPUT + #include "XIproto.h" + extern int DeviceButtonPress, + DeviceButtonRelease; + + extern int lastPointerX, lastPointerY; + #endif /* XINPUT */ + extern InitInfo pegInfo; extern CARD16 keyModifiersList[]; extern int screenIsSaved; *************** *** 90,99 **** }; #endif /* XDEBUG */ ! static Event *RepeatKey() { static Event ev; register c = pegInfo.kv.timer[ KEYREPEAT ].key + MINKEYCODE, index; XDisplayState *dsp; --- 107,131 ---- }; #endif /* XDEBUG */ ! #ifdef UTEKV ! ! static Event_X11 ! *RepeatKey() ! ! #else /* !UTEKV */ ! ! static Event *RepeatKey() + + #endif /* !UTEKV */ + { + #ifdef UTEKV + static Event_X11 ev; + #else /* !UTEKV */ static Event ev; + #endif /* !UTEKV */ + register c = pegInfo.kv.timer[ KEYREPEAT ].key + MINKEYCODE, index; XDisplayState *dsp; *************** *** 505,510 **** --- 537,551 ---- } #ifdef UTEKV + void + SetHoldLED(on) /* this routine is ocassionally used to aid debugging*/ + Bool on; + { + if (on ) + ioctl(pegInfo.eventFd, KEYBD_HOLD_LED_ON, 0); + else + ioctl(pegInfo.eventFd, KEYBD_HOLD_LED_OFF, 0); + } #ifndef NBPC #define NBPC (4096) /* number of bytes per click (page) */ *************** *** 525,538 **** int tail; /* index into events */ } EventQueueFAKE; - - /* notes only --- */ - /* #define PHYS_HIGH_ADDR (0x60000000) * Servers Virtual Address "offset" from - * the physical address. An area - * between u and display board. - */ #endif /* UTEKV */ long GetTimeInMillis () { --- 566,574 ---- int tail; /* index into events */ } EventQueueFAKE; #endif /* UTEKV */ + long GetTimeInMillis () { *************** *** 545,567 **** if (pegInfo.dsp) { ! addr = (long *) &pegInfo.dsp->ds_ltime; ! ret = *addr; ! if (ret == 0) ! ret = *addr; } return ret; } void ProcessInputEvents () { register Event *ev; register u_long c, i; register EventQueue *queue = (EventQueue *)pegInfo.pPointer->devicePrivate; xEvent x; ! u_long nowInCentiSecs, nowInMilliSecs; ! u_long eventInCentiSecs, eventInMilliSecs; int qLimit; int count; KeyCode keycode; --- 581,614 ---- if (pegInfo.dsp) { ! addr = (long *) &pegInfo.dsp->ds_ltime; ! ret = *addr; ! if (ret == 0) ! ret = *addr; } return ret; } + + void ProcessInputEvents () { + #ifdef UTEKV + register Event_X11 *ev; + #else /* !UTEKV */ register Event *ev; + #endif /* !UTEKV */ + register u_long c, i; + #ifdef XINPUT + register EventQueue *queue = (EventQueue *)pegInfo.queue; + #else register EventQueue *queue = (EventQueue *)pegInfo.pPointer->devicePrivate; + #endif /* XINPUT */ xEvent x; ! int nowInCentiSecs, nowInMilliSecs, adjustCentiSecs; ! int needTime = 1; int qLimit; int count; KeyCode keycode; *************** *** 574,583 **** * to the Kernal Virtual Address. */ register EventQueueFAKE *queueKVA; ! register EventQueue *queueSVA; register caddr_t sparePtr; /* a spare pointer for address calc. */ register caddr_t SVAbase; /* server virtual address segment base*/ - register Event *evSVA; /* server virtual address of -the- current event */ #endif /* UTEKV */ --- 621,629 ---- * to the Kernal Virtual Address. */ register EventQueueFAKE *queueKVA; ! register EventQueueFAKE *queueSVA; register caddr_t sparePtr; /* a spare pointer for address calc. */ register caddr_t SVAbase; /* server virtual address segment base*/ #endif /* UTEKV */ *************** *** 598,603 **** --- 644,651 ---- #endif /* UTEKV */ #ifdef UTEKV + + #ifdef OLD_MAPPING /* * The servers mapping (Server Virtual Address - SVA) of the event * queue is at 0x60000000 + the physical address of the shared *************** *** 610,633 **** * the address of the event by adding the 0x6...0 value to the * KVA as though it were an offset. */ - #ifdef notdef - /* - * Make a copy of the servers pointer - * to the dsp.ds_q entry. - * - * Now add the SVA offset to the - * segment base address to compute the - * "real" address. - */ - sparePtr = (caddr_t) (((unsigned long) queue) - + ((unsigned long) SVAbase)); - - sparePtr = (caddr_t) (((unsigned long) - sparePtr) & (~(NBPS-1))); /*prune segment*/ - SVAbase = (caddr_t) (((unsigned long) SVAbase) - + ((unsigned long) sparePtr)); - #endif /* notdef */ - SVAbase = (caddr_t) ((unsigned long)queue & (~(NBPS-1))); /* strip off the lower part of the * address to get the segment address. --- 658,663 ---- *************** *** 647,653 **** sparePtr = (caddr_t) ((unsigned long) ((unsigned long) sparePtr) + ((sizeof (Event)) * i)); ! ev = (Event *)sparePtr; #endif /* UTEKV */ --- 677,732 ---- sparePtr = (caddr_t) ((unsigned long) ((unsigned long) sparePtr) + ((sizeof (Event)) * i)); ! #else /* !OLD_MAPPING (NEW_MAPPING) */ ! ! /* ! * The mapped XDisplayState page contains, among other things, the ! * X event queue. ! * ! * The Var. "queue" points to the "EventQueue" structure. This "queue" ! * structure consists of the "events" pointer & size, head & tail vars. ! * ! * Unfortunately the "events" pointer is in terms of the Kernel Virtual ! * Address (KVA) and its map is either at a segment address of "0x0" ! * or else at the more pleasant segment address 0f "0x60000000" (as is ! * the mapping for the server). Additionally the chunk of memory that ! * is of interest is "just a page" and the queue is within that page, ! * so hack off the KVA segment and page address components top leave ! * just the offset to within the page. ! * ! * Thus: ! * ! * o First establish a second pointer to the queue (queueSVA). ! * ! * o Second fetch the "events" pointer from the "events" structure ! * pointed at by the "queue" pointer ... as an "offset". ! * ! * o Third prune the segment address and page address components ! * off of the "fetched" address of the "queue" pointer to form ! * the offset into the "page" of "XDisplayState". ! * ! * o Fourth form address of "queue" in Server Virtual Address space ! * (SVA) by adding the SVA (less queue offset) -and- the fetched ! * Events queue offset. ! * ! * o Last form the address to the "current" event (element) in ! * the queue by adding the number of events "i" multiplied by ! * the "size" of the Event structure. ! * ! */ ! queueSVA = (EventQueueFAKE *)queue; ! sparePtr = (caddr_t) ((unsigned long) queueSVA->offset); ! sparePtr = (caddr_t) ((unsigned long) (((unsigned long) sparePtr) & ! (NBPC-1))); ! ! sparePtr = (caddr_t) ((unsigned long) (((unsigned long) sparePtr) + ! (((unsigned long) queueSVA) & (~(NBPC-1))))); ! ! sparePtr = (caddr_t) ((unsigned long) ((unsigned long) sparePtr) ! + ((sizeof (Event_X11)) * i)); ! #endif /* !OLD_MAPPING (NEW_MAPPING) */ ! ! ev = (Event_X11 *)sparePtr; /* pointer to "current" event element */ #endif /* UTEKV */ *************** *** 665,670 **** --- 744,753 ---- x.u.keyButtonPointer.rootX = ev->e_x; x.u.keyButtonPointer.rootY = ev->e_y; + + #ifdef UTEKV + x.u.keyButtonPointer.time = ev->e_time; + #else /* UTEKV */ /* * The following silly looking code is because the old * version of the driver only delivers 16 bits worth of *************** *** 672,685 **** * terms of 32 bits of milliseconds. Fortunately, this * is available in shared space. */ ! nowInMilliSecs = pegInfo.dsp->ds_ltime; ! nowInCentiSecs = (nowInMilliSecs / 10); ! eventInCentiSecs = ev->e_time; ! eventInCentiSecs = (nowInCentiSecs & 0xFFFF0000) | ! (eventInCentiSecs & 0x0000FFFF); ! if (eventInCentiSecs > nowInCentiSecs) ! eventInCentiSecs -= 0x10000; ! x.u.keyButtonPointer.time = eventInCentiSecs * 10; switch (ev->e_type) { case E_BUTTON: debug5((" @%d 0x%-2x %s %s\n", --- 755,774 ---- * terms of 32 bits of milliseconds. Fortunately, this * is available in shared space. */ ! if (needTime) ! { ! needTime = 0; ! nowInMilliSecs = pegInfo.dsp->ds_ltime; ! nowInCentiSecs = (nowInMilliSecs%1000) / 10; ! } ! if ((adjustCentiSecs = nowInCentiSecs - ev->e_time) < -20000) ! adjustCentiSecs += 0x10000; ! else ! if (adjustCentiSecs > 20000) ! adjustCentiSecs -= 0x10000; ! x.u.keyButtonPointer.time = ! nowInMilliSecs - adjustCentiSecs * 10; ! #endif /* UTEKV */ switch (ev->e_type) { case E_BUTTON: debug5((" @%d 0x%-2x %s %s\n", *************** *** 689,696 **** --- 778,802 ---- device[ ev->e_device&0x7 ])); switch (ev->e_device) { case E_MOUSE: + #ifdef XINPUT + if ( IS_CORE_PTR(&pegInfo.devInfo) ) + x.u.u.type = (ev->e_direction == E_KBTUP) ? + ButtonRelease : ButtonPress; + else { + deviceKeyButtonPointer *xev; + + /* Need to fix up the root_x, root_y, type and device id */ + xev = (deviceKeyButtonPointer *)&x; + xev->root_x = lastPointerX; + xev->root_y = lastPointerY; + xev->type = (ev->e_direction == E_KBTUP) ? + DeviceButtonRelease : DeviceButtonPress; + xev->deviceid = ((DeviceIntPtr)pegInfo.pPointer)->id; + } + #else x.u.u.type = (ev->e_direction == E_KBTUP) ? ButtonRelease : ButtonPress; + #endif /* XINPUT */ x.u.u.detail = ev->e_key; #ifdef XTESTEXT1 /* *************** *** 830,839 **** #ifdef USE_KANA_STUFF /* process Katakana shift state */ ! count = GetCurKeySymList(x.u.u.detail, &keysyms); for (j = 0; j < count; j++) { switch (keysyms[j]) { case XK_Kana_Lock: /* its generic, so why not do it for everyone? */ case XK_Mode_switch: if (x.u.u.type == KeyPress) { --- 936,951 ---- #ifdef USE_KANA_STUFF /* process Katakana shift state */ ! count = GetCurKeySymList((DeviceIntPtr) pegInfo.pKeyboard, ! x.u.u.detail, &keysyms); for (j = 0; j < count; j++) { switch (keysyms[j]) { + case _JUS_XK_Kana_Lock: case XK_Kana_Lock: + /* these keysyms were placed in the standard space (FFxx) + for R4, but R3 XLookupString is incompatible with them. + So we should support both, but use the Tek _JUS + versions from JUSkeysym.h */ /* its generic, so why not do it for everyone? */ case XK_Mode_switch: if (x.u.u.type == KeyPress) { *************** *** 879,884 **** --- 991,997 ---- } } goto little_break; + case _JUS_XK_Kana_Shift: case XK_Kana_Shift: /* set/unset kana state to inverse of lock when first/last shift released/depressed */ *************** *** 911,917 **** if (KanaShiftState) { keycode = x.u.u.detail + KANA_OFFSET; /* don't send Kana keycode if it has no keysym! */ ! if (GetCurKeySymList(keycode, &keysyms)) x.u.u.detail = keycode; } #endif /* USE_KANA_STUFF */ --- 1024,1031 ---- if (KanaShiftState) { keycode = x.u.u.detail + KANA_OFFSET; /* don't send Kana keycode if it has no keysym! */ ! if (GetCurKeySymList((DeviceIntPtr) pegInfo.pKeyboard, ! keycode, &keysyms)) x.u.u.detail = keycode; } #endif /* USE_KANA_STUFF */ *************** *** 927,933 **** x.u.keyButtonPointer.rootX, x.u.keyButtonPointer.rootY)) #endif /* XTESTEXT1 */ ! (*pegInfo.pKeyboard->processInputProc)(&x, pegInfo.pKeyboard, 1); break; } break; --- 1041,1049 ---- x.u.keyButtonPointer.rootX, x.u.keyButtonPointer.rootY)) #endif /* XTESTEXT1 */ ! (*pegInfo.pKeyboard->processInputProc)(&x, ! pegInfo.pKeyboard, ! 1); break; } break; *************** *** 947,952 **** --- 1063,1074 ---- LastMousePosition.x = x.u.keyButtonPointer.rootX; LastMousePosition.y = x.u.keyButtonPointer.rootY; #endif /* XTESTEXT1 */ + #ifdef XINPUT + if ( IS_CORE_PTR(&pegInfo.devInfo) ) { + lastPointerX = x.u.keyButtonPointer.rootX; + lastPointerY = x.u.keyButtonPointer.rootY; + } + #endif #ifndef MOTION_BUFFER_OFF gfbSaveMotionEvent(&x); *************** *** 981,987 **** --- 1103,1114 ---- EventQueue *queue; { int n, mask, index, cnt, red; + #ifdef UTEKV + Event_X11 *ep; + #else /* !UTEKV */ Event *ep; + #endif /* !UTEKV */ + struct timeval timeout; extern int errno; extern int pegDevFd; *************** *** 1001,1012 **** --- 1128,1149 ---- exit(1); } ep = &queue->events[ queue->tail ]; + #ifdef UTEKV + red = read(pegDevFd, ep, sizeof(Event_X11)); + if (red < sizeof(Event_X11)) { + fprintf(stderr, "pegReadEvents: red %d,errno=%d,sel=%d\n", + red, errno, n); + exit(1); + } + #else /* !UTEKV */ red = read(pegDevFd, ep, sizeof(Event)); if (red < sizeof(Event)) { fprintf(stderr, "pegReadEvents: red %d,errno=%d,sel=%d\n", red, errno, n); exit(1); } + #endif /* !UTEKV */ + /* * fprintf(stderr, "server:(%d,%d),time=0x%x,type=%s,", * ep->e_x, diff -r -c XD88-patchlevel-26-mit/server/ddx/tek/pegInit.c XD8810-mit/server/ddx/tek/pegInit.c *** XD88-patchlevel-26-mit/server/ddx/tek/pegInit.c Wed Mar 27 13:09:35 1991 --- XD8810-mit/server/ddx/tek/pegInit.c Sat Jan 29 20:32:19 1994 *************** *** 1,29 **** ! /* $XConsortium: pegInit.c,v 1.6 91/02/22 21:53:38 keith Exp $ */ /*********************************************************** ! Portions modified by Tektronix, Inc. Copyright 1987 Tektronix, Inc. ! ! Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, ! and the Massachusetts Institute of Technology, Cambridge, Massachusetts. ! ! All Rights Reserved ! ! 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 appear in all copies and that ! both that copyright notice and this permission notice appear in ! supporting documentation, and that the names of Digital or MIT not be ! used in advertising or publicity pertaining to distribution of the ! software without specific, written prior permission. ! ! DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ! ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ! DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ! ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, ! WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ! ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ! SOFTWARE. ! ! ******************************************************************/ #include "X.h" #include "Xproto.h" #include "screenint.h" --- 1,53 ---- ! #ifndef LINT ! #ifdef RCS_ID ! static char *rcsid = "$Header: pegInit.c,v 1.3 91/03/07 15:03:21 steveje Exp $"; ! #endif /* RCS_ID */ ! #endif /* LINT */ ! /* $XConsortium: pegInit.c,v 1.3 89/10/10 10:29:13 rws Exp $ */ /*********************************************************** ! * Portions modified by Tektronix, Inc. Beaverton, Oregon. ! * Copyright 1987, 1988, 1989, 1990, 1991 Tektronix, Inc. Beaverton, Oregon. ! * ! * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, ! * and the Massachusetts Institute of Technology, Cambridge, Massachusetts. ! * ! * All Rights Reserved ! * ! * 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 appear in all copies and that ! * both that copyright notice and this permission notice appear in ! * supporting documentation, and that the names of Tektronix or Digital ! * or MIT not be used in advertising or publicity pertaining to distribution ! * of the software without specific, written prior permission. ! * ! * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ! * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ! * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ! * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, ! * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ! * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ! * SOFTWARE. ! * ! * ! * NOTICE: ! * ! * THIS PROGRAM IS NOT A SUPPORTED TEKTRONIX PRODUCT, AND IS ! * NOT GUARANTEED TO BE FREE OF ERRORS. THERE IS NO WARRANTY ! * EXPRESSED OR IMPLIED, AND TEKTRONIX ASSUMES NO LIABILITY FOR ! * DAMAGES RESULTING FROM IT'S USE. ! * ! * ! * ! * TEKTRONIX DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ! * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ! * TEKTRONIX BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ! * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, ! * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ! * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ! * SOFTWARE. ! * ! */ #include "X.h" #include "Xproto.h" #include "screenint.h" *************** *** 37,52 **** #include "dixstruct.h" #include "mistruct.h" #include "peg.h" #ifdef NOTDEF #include "drawable.h" #include "pfb.h" ! #endif #ifdef UTEK #include "box/keyboard.h" #endif /* UTEK */ #ifdef UTEKV #include "redwing/keyboard.h" #endif /* UTEKV */ --- 61,81 ---- #include "dixstruct.h" #include "mistruct.h" #include "peg.h" + #ifdef NOTDEF #include "drawable.h" #include "pfb.h" ! #endif /* NOTDEF */ #ifdef UTEK #include "box/keyboard.h" #endif /* UTEK */ + #include + extern int errno; + #ifdef UTEKV + #include #include "redwing/keyboard.h" #endif /* UTEKV */ *************** *** 59,64 **** --- 88,96 ---- #ifdef UTEKV #include + #include + #include + #include #endif /* UTEKV */ #include *************** *** 68,74 **** --- 100,109 ---- #include #endif /*XDEBUG */ + #ifdef notdef #undef NULL /* misc.h defines this, but so does stdio.h */ + #endif /* notdef */ + #include #ifdef UTEKV *************** *** 78,89 **** #ifdef UTEKV #define DEBUG_ERRNO_IS_SET 1 ! #define DEBUG_SHMGET 1 /* add debug -shmget- & -shmat- messages */ ! #define DEBUG_VISUALSTUFF 1 /* add debug visual type stuff messages */ ! ! extern int shmget(); /* memory mapper */ ! extern caddr_t shmat(); /* memory attacher */ #ifndef NBPC #define NBPC (4096) /* number of bytes per click (page) */ --- 113,125 ---- #ifdef UTEKV + /* + * SYSV - MISC. SYMBOLS DEFINITIONS:: + */ #define DEBUG_ERRNO_IS_SET 1 ! /* #define DEBUG_SHM 1 */ /* add debug -shmget- & -shmat- messages */ ! /* #define DEBUG_BATC 1 */ /* add debug -BATC- messages */ ! /* #define DEBUG_VISUALSTUFF 1 */ /* add debug visual type stuff messages */ #ifndef NBPC #define NBPC (4096) /* number of bytes per click (page) */ *************** *** 106,121 **** #define OFFSET_STENCIL_FB (DS_FB_STENCIL_P - DS_DSP_BASE) #define OFFSET_TWO_COLOR_FB (DS_FB_TWO_COLOR_P - DS_DSP_BASE) #define OFFSET_PPM_FB (DS_FB_PP_P - DS_DSP_BASE) ! #define DS_NUMBER_OF_BYTES (DS_FB_PP_HI_P+1-DS_DSP_BASE) ! #define DS_NUMBER_OF_CLICKS ((DS_NUMBER_OF_BYTES+(NBPC-1)) / NBPC) ! #define DS_NUMBER_OF_SEGMENTS ((DS_NUMBER_OF_CLICKS+(NCPS-1)) / NCPS) /* * "shmget/shmat" flags:: Physical + Cache Inbibit + No Clear. */ ! #define PHYS_FLAGS (IPC_PHYS | IPC_CI | IPC_NOCLEAR) #define PHYS_HIGH_ADDR (0x60000000) /* an area between u and display board */ #endif /* UTEKV */ #define NUMSCREENS 1 --- 142,198 ---- #define OFFSET_STENCIL_FB (DS_FB_STENCIL_P - DS_DSP_BASE) #define OFFSET_TWO_COLOR_FB (DS_FB_TWO_COLOR_P - DS_DSP_BASE) #define OFFSET_PPM_FB (DS_FB_PP_P - DS_DSP_BASE) ! ! #define DS_BOARD_NUMBER_BYTES (DS_FB_PP_HI_P+1-DS_DSP_BASE) ! #define DS_BOARD_NUMBER_CLICKS ((DS_BOARD_NUMBER_BYTES+(NBPC-1))/NBPC) ! #define DS_BOARD_NUMBER_SEGMENTS ((DS_BOARD_NUMBER_CLICKS+(NCPS-1))/NCPS) ! ! ! /* ! * 88K BATC - stuff:: ! */ ! ! #define STENCIL_SIZE (512*1024) ! /* ((DS_FB_STENCIL_HI_P+1)-DS_FB_STENCIL_P) one color*/ ! #define TWOCOLOR_SIZE (512*1024) ! /* ((DS_FB_TWO_COLOR_HI_P+1)-DS_FB_TWO_COLOR_P) */ ! #define PPM_SIZE ((DS_FB_PP_HI_P+1)-DS_FB_PP_P) ! ! #ifndef SYS_MOTLOCAL ! #define SYS_MOTLOCAL 21 /* system call "sysmot" in os/syslocal.c */ ! #endif /* SYS_MOTLOCAL */ ! ! #ifndef S88MAPBATC ! #define S88MAPBATC 101 /* Map one batc (Tek-only) */ ! #endif /* S88MAPBATC */ ! #ifndef S88UNMAPBATC ! #define S88UNMAPBATC 102 /* Un Map one batc (Tek-only) */ ! #endif /* S88UNMAPBATC */ ! /* * "shmget/shmat" flags:: Physical + Cache Inbibit + No Clear. */ ! #define PHYS_FLAGS (IPC_PHYS | IPC_CI | IPC_NOCLEAR | IPC_CREAT) #define PHYS_HIGH_ADDR (0x60000000) /* an area between u and display board */ + int shMemIdXD = -1; /* shared memory return id XDriver - area */ + int shMemIdDB = -1; /* shared memory return id - display board area */ + + #define EVENT_MAGIC 0x55aaaa55 + int eventFlavor = 0; /* 0 = X10 eventsStyle, 0x55aaaa55 = X11 eventsStyle*/ + + + /* + * SYSV - EXTERNAL CALLS:: + */ + + extern int shmget(); /* system-V memory mapper */ + extern caddr_t shmat(); /* system-V memory attacher */ + extern int shmctl(); /* system-V memory controller */ + extern int shmdt(); /* memory detatcher */ + + #endif /* UTEKV */ #define NUMSCREENS 1 *************** *** 205,211 **** }; InitInfo pegInfo; ! extern errno; /* --- 282,363 ---- }; InitInfo pegInfo; ! ! extern int errno; ! ! ! #ifdef UTEKV ! /* ! * NAME ! * pegDestroyDBMapping - Device dependent cleanup ! * ! * SYNOPSIS ! * Uses "shmctl" to remove the shared memory map from the ! * shared memory system in system V kernel. This is a "root" ! * process - so it can "destroy" this mapping. ! */ ! pegDestroyDBMapping() ! { ! int result; ! struct shmid_ds shm_buf; ! ! /* ! * Clean up Display board mapping. ! */ ! if (shMemIdDB != -1) { ! result = (shmctl(shMemIdDB, IPC_STAT, &shm_buf)); /* fetch status */ ! if (result == -1) { ! ErrorF("Error in shmctl - getting status of mapping; "); ! ErrorF("shMemIdDB = %d\n", shMemIdDB); ! ErrorF("errno = %d, ", errno); ! Error(); ! } ! ! result = (shmctl(shMemIdDB, IPC_RMID, &shm_buf)); ! if (result == -1) { ! ErrorF("Error in shmctl - destroying F.B. mapping; "); ! ErrorF("shMemIdDB = %d\n", shMemIdDB); ! ErrorF("errno = %d, ", errno); ! Error(); ! } ! } ! } ! ! /* ! * NAME ! * pegDestroyXDMapping - Device dependent cleanup ! * ! * SYNOPSIS ! * Uses "shmctl" to remove the shared memory map from the ! * shared memory system in system V kernel. This is a "root" ! * process - so it can "destroy" this mapping. ! */ ! pegDestroyXDMapping() ! { ! int result; ! struct shmid_ds shm_buf; ! ! /* ! * Clean up X driver mapping. ! */ ! if (shMemIdXD != -1) { ! result = (shmctl(shMemIdXD, IPC_STAT, &shm_buf)); /* fetch status */ ! if (result == -1) { ! ErrorF("Error in shmctl - getting status of mapping; "); ! ErrorF("shMemIdXD = %d\n", shMemIdXD); ! ErrorF("errno = %d, ", errno); ! Error(); ! } ! result = (shmctl(shMemIdXD, IPC_RMID, &shm_buf)); ! if (result == -1) { ! ErrorF("Error in shmctl - destroying Xdriver mapping; "); ! ErrorF("shMemIdXD = %d\n", shMemIdXD); ! ErrorF("errno = %d, ", errno); ! Error(); ! } ! } ! } ! #endif /* UTEKV */ /* *************** *** 220,233 **** * DESCRIPTION * Routine required for dix/ddx interface. Called by * FatalError(). We don't need to do anything here ! * because closing /dev/xdev does it all. * * RETURNS * None * */ { } /* * NAME --- 372,423 ---- * DESCRIPTION * Routine required for dix/ddx interface. Called by * FatalError(). We don't need to do anything here ! * because closing /dev/xdev does it all. (SYSV - rm shared ! * memory). * * RETURNS * None * */ { + #ifdef UTEKV + /* + * Only destroy the region when server is about to die. + * (after AbortDDX is called in AbortServer ....os/utils.c calls + * "abort();") + */ + + /* + * Clean up Display board mapping. + */ + pegDestroyDBMapping(); + + /* + * flush entire pointer set. + */ + pegInfo.twoColorFb = (caddr_t) NULL; + pegInfo.oneColorFb = (caddr_t) NULL; + pegInfo.pixelFb = (caddr_t) NULL; + pegInfo.cdpCtl = (COLOR_CNTL *) NULL; + pegInfo.videoCtl = (caddr_t) NULL; + pegInfo.videostate = (unsigned char *) NULL; + + + /* + * Clean up X driver mapping. + */ + pegDestroyXDMapping(); + + /* + * flush entire pointer. + */ + pegInfo.dsp = NULL; /* xdriver connection also. */ + + + #endif /* UTEKV */ + } + /* * NAME *************** *** 279,289 **** sscanf(argv[ i ] + 7, "%x", &xflg_debug); return 1; } - #endif /* XDEBUG */ if ( strcmp( argv[i], "-mono") == 0) { FMonochrome = TRUE; return 1; } #ifdef NOTDEF if ( strcmp( argv[i], "-g") == 0) { FGammaCorrectionDisabled = FALSE; --- 469,479 ---- sscanf(argv[ i ] + 7, "%x", &xflg_debug); return 1; } if ( strcmp( argv[i], "-mono") == 0) { FMonochrome = TRUE; return 1; } + #endif /* XDEBUG */ #ifdef NOTDEF if ( strcmp( argv[i], "-g") == 0) { FGammaCorrectionDisabled = FALSE; *************** *** 418,424 **** assert (param->flavor == NUMBER_LIST); tmpArray = (long *)Xalloc((len+1) * sizeof(long)); while (fieldPtr != NULL) { ! tmpArray = (long *)Xrealloc(tmpArray, (len+2) * sizeof(long)); tmpArray[ len ] = atol(fieldPtr); /* if we've already parsed some numbers, error */ --- 608,614 ---- assert (param->flavor == NUMBER_LIST); tmpArray = (long *)Xalloc((len+1) * sizeof(long)); while (fieldPtr != NULL) { ! tmpArray = (long *)Xrealloc(tmpArray, (len+1) * sizeof(long)); tmpArray[ len ] = atol(fieldPtr); /* if we've already parsed some numbers, error */ *************** *** 431,436 **** --- 621,627 ---- len++; } if (param->u->nList && param->allocated) + Xfree( (char *) param->u->nList ); tmpArray[ len ] = 0; param->u->nList = tmpArray; *************** *** 588,597 **** Error(""); continue; } - #ifdef NOTDEF if (pegInfo.bells.str[ i ]) Xfree (pegInfo.bells.str[ i ]); - #endif pegInfo.bells.len[ i ] = st.st_size; pegInfo.bells.str[ i ] = string; } --- 779,786 ---- *************** *** 660,666 **** --- 849,857 ---- char value[ BUFSIZ ]; char usrControlFile[ BUFSIZ ]; char *home, *envVal; + #ifdef XDEBUG unsigned int pixMsk; + #endif /* XDEBUG */ #ifdef XDEBUG *************** *** 692,703 **** #endif /* UTEK */ #ifdef UTEKV /* Redwing */ ! #ifdef M4810 pegInfo.scrHeight = BITMAP_Y(pegInfo.dsp); /* 1024 (width set below)*/ pegInfo.width = BITMAP_X(pegInfo.dsp); /* 2048 */ pegInfo.height = BITMAP_Y(pegInfo.dsp); /* 1024 */ pegInfo.entries = 1 << pegInfo.depth; ! #endif /* M4810 */ #endif /* UTEKV */ /* --- 883,894 ---- #endif /* UTEK */ #ifdef UTEKV /* Redwing */ ! #ifdef XD8810 pegInfo.scrHeight = BITMAP_Y(pegInfo.dsp); /* 1024 (width set below)*/ pegInfo.width = BITMAP_X(pegInfo.dsp); /* 2048 */ pegInfo.height = BITMAP_Y(pegInfo.dsp); /* 1024 */ pegInfo.entries = 1 << pegInfo.depth; ! #endif /* XD8810 */ #endif /* UTEKV */ /* *************** *** 744,754 **** #endif /* UTEK */ #ifdef UTEKV /* only Redwing supported */ ! #ifdef M4810 /* only Redwing supported */ pegInfo.scrWidth = SCREEN_X(pegInfo.dsp); ! pegInfo.mmScreenX = 343; /* XD88/10 Redwing */ ! pegInfo.mmScreenY = 274; ! #endif /* M4810 */ #endif /* UTEKV */ /* --- 935,947 ---- #endif /* UTEK */ #ifdef UTEKV /* only Redwing supported */ ! #ifdef XD8810 pegInfo.scrWidth = SCREEN_X(pegInfo.dsp); ! if (pegInfo.mmScreenX <= 0 || pegInfo.mmScreenY <= 0) { ! pegInfo.mmScreenX = 295; /* XD88/10 Redwing 16" std. crt */ ! pegInfo.mmScreenY = 236; ! } ! #endif /* XD8810 */ #endif /* UTEKV */ /* *************** *** 760,778 **** * CDP registers to powerup defaults. We must therefore set * up our system to live with this. */ #ifdef UTEK if (FMonochrome) { ! int i; ! ! printf ("Current write0Reg: 0x%x\n", pegInfo.cdpCtl->write0Reg); ! printf ("Current write1Reg: 0x%x\n", pegInfo.cdpCtl->write1Reg); ! printf ("Current planeEnableReg: 0x%x\n", pegInfo.cdpCtl->planeEnableReg); ! printf ("Current filterReg: 0x%x\n", pegInfo.cdpCtl->filterReg); ! printf ("Current maskRegSet: 0x%x\n", pegInfo.cdpCtl->maskRegSet); ! for (i = 0; i < 5; i++) ! printf ("Current extra[%d]: 0x%x\n", i, pegInfo.cdpCtl->pad[i]); ! ! pixMsk = (1 << N_PLANE(pegInfo.softp)) - 1; pegInfo.cdpCtl->write1Reg = 0; /* FOREGROUND */ if (DISPLAY_TYPE(pegInfo.softp) == 2) /* (color) */ pegInfo.cdpCtl->write0Reg = 1; /* BACKGROUND */ --- 953,962 ---- * CDP registers to powerup defaults. We must therefore set * up our system to live with this. */ + #ifdef XDEBUG #ifdef UTEK if (FMonochrome) { ! pixMsk = GET_PIX_MSK(N_PLANE(pegInfo.softp)); pegInfo.cdpCtl->write1Reg = 0; /* FOREGROUND */ if (DISPLAY_TYPE(pegInfo.softp) == 2) /* (color) */ pegInfo.cdpCtl->write0Reg = 1; /* BACKGROUND */ *************** *** 786,792 **** #ifdef UTEKV if (FMonochrome) { ! pixMsk = (1 << N_PLANE(pegInfo.dsp)) - 1; pegInfo.cdpCtl->write1Reg = 0; /* FOREGROUND */ if (DISPLAY_TYPE(pegInfo.dsp) == DISPLAY_2) /* Redwing - color */ pegInfo.cdpCtl->write0Reg = 1; /* BACKGROUND */ --- 970,976 ---- #ifdef UTEKV if (FMonochrome) { ! pixMsk = GET_PIX_MSK(N_PLANE(pegInfo.dsp)); pegInfo.cdpCtl->write1Reg = 0; /* FOREGROUND */ if (DISPLAY_TYPE(pegInfo.dsp) == DISPLAY_2) /* Redwing - color */ pegInfo.cdpCtl->write0Reg = 1; /* BACKGROUND */ *************** *** 797,802 **** --- 981,987 ---- pegInfo.cdpCtl->maskRegSet = ~0; } #endif /* UTEKV */ + #endif /* XDEBUG */ #ifdef UTEK break; *************** *** 1007,1013 **** twoColorSize = (bitmapx >> 3) * bitmapy; if (pixelFb) ! pixelSize = (bitmapx * bitmapy * N_PLANE(pegInfo.softp)) / 8; /* * Now allocate space, moving downward from topAddr, starting with --- 1192,1198 ---- twoColorSize = (bitmapx >> 3) * bitmapy; if (pixelFb) ! pixelSize = (bitmapx * bitmapy) / (8.0 / N_PLANE(pegInfo.softp)); /* * Now allocate space, moving downward from topAddr, starting with *************** *** 1152,1160 **** #endif /* UTEK */ - #ifdef UTEKV ! /*----------------------- M4810 series pegVmScreenInit -----------------------*/ static Bool pegVmScreenInit(argc, argv) --- 1337,1344 ---- #endif /* UTEK */ #ifdef UTEKV ! /*----------------------- XD8810 series pegVmScreenInit ----------------------*/ static Bool pegVmScreenInit(argc, argv) *************** *** 1162,1180 **** char **argv; { ! #ifdef M4810 /*------------- Redwing ---------------------------------------*/ int bitmapx, bitmapy, pixelSize, twoColorSize, configSize, pageSize, offset; - int shMemId; /* shared memory return id */ caddr_t dspBaseAddr; /* mapped address of the base of the display board. */ caddr_t caddrTemp; /* handy reg */ caddr_t segmentAddr; /* pleasant reg */ /* * If the mapping is done, don't do it twice. */ ! if (pegInfo.twoColorFb) return(True); /* * Here is what is done in this "VmScreen" init code:: --- 1346,1366 ---- char **argv; { ! #ifdef XD8810 int bitmapx, bitmapy, pixelSize, twoColorSize, configSize, pageSize, offset; caddr_t dspBaseAddr; /* mapped address of the base of the display board. */ caddr_t caddrTemp; /* handy reg */ caddr_t segmentAddr; /* pleasant reg */ + struct shmid_ds shm_buf; + int result; /* * If the mapping is done, don't do it twice. */ ! if (pegInfo.twoColorFb) { return(True); + } /* * Here is what is done in this "VmScreen" init code:: *************** *** 1231,1269 **** return(False); } ! #ifdef DEBUG_SHMGET ErrorF("ioctl: CE_GETXDISPLAYSTRUCT returns -- \n"); ErrorF("config. address = 0x%x\n", caddrTemp); ErrorF("\n"); ! #endif /* DEBUG_SHMGET */ /* ! * round size of displaystate to the greater page size boundary. */ configSize = (sizeof(struct displaystate) + pageSize-1) & (~(pageSize-1)); offset = (int) caddrTemp; /* save the "offset" into 'the' segment */ /* ! * map to segment aligned and a size of one segment. */ ! shMemId = shmget(IPC_PRIVATE, NBPS, PHYS_FLAGS, ! (int)caddrTemp & (~(NBPS-1))); ! ! if (shMemId == -1) { ErrorF("Can't -shmget- Xdriver shared block\n"); ! ErrorF("mapping with: IPC_PRIVATE | IPC_CI | IPC_NOCLEAR\n"); ErrorF("address = 0x%x\n", caddrTemp); Error("errno = "); return(False); } ! caddrTemp = ((caddr_t)(PHYS_HIGH_ADDR)); ! segmentAddr = (caddr_t) (shmat(shMemId, caddrTemp, 0)); if ((int) segmentAddr == -1) { ErrorF("Can't -shmat- shared segment\n"); ErrorF("mapping with flags: 0\n"); ! ErrorF("Id = 0x%x\n", shMemId); ErrorF("address = 0x%x\n", caddrTemp); ErrorF("segment address returned = 0x%x\n", segmentAddr); Error("errno = "); --- 1417,1467 ---- return(False); } ! #ifdef DEBUG_SHM ErrorF("ioctl: CE_GETXDISPLAYSTRUCT returns -- \n"); ErrorF("config. address = 0x%x\n", caddrTemp); ErrorF("\n"); ! #endif /* DEBUG_SHM */ /* ! * Round size of XDisplayState (displaystate) to the greater page ! * size boundary. */ configSize = (sizeof(struct displaystate) + pageSize-1) & (~(pageSize-1)); + offset = (int) caddrTemp; /* save the "offset" into 'the' segment */ + #ifdef OLD_MAPPING + /* ! * Map to segment aligned and a size of one segment (4 MB). */ ! shMemIdXD = shmget(XDevMappingKeyXD, NBPS, PHYS_FLAGS, ! (int)caddrTemp & (~(NBPS-1))); ! if (shMemIdXD == -1) { ErrorF("Can't -shmget- Xdriver shared block\n"); ! ErrorF("key = 0x%x\n", XDevMappingKeyXD); ! ErrorF("mapping with: IPC_CI | IPC_NOCLEAR | IPC_CREAT\n"); ErrorF("address = 0x%x\n", caddrTemp); Error("errno = "); return(False); } ! #else /* !OLD_MAPPING (NEW_MAPPING) */ ! /* ! * Map to the page address and a size of one page (4K) (of (n) pages). ! */ ! shMemIdXD = shmget(XDevMappingKeyXD, NBPC, PHYS_FLAGS, (int)caddrTemp); ! ! #endif /* !OLD_MAPPING (NEW_MAPPING) */ ! ! caddrTemp = ((caddr_t)(PHYS_HIGH_ADDR)); /* 0x60000000 */ ! segmentAddr = (caddr_t) (shmat(shMemIdXD, caddrTemp, 0)); if ((int) segmentAddr == -1) { ErrorF("Can't -shmat- shared segment\n"); ErrorF("mapping with flags: 0\n"); ! ErrorF("Id = 0x%x\n", shMemIdXD); ErrorF("address = 0x%x\n", caddrTemp); ErrorF("segment address returned = 0x%x\n", segmentAddr); Error("errno = "); *************** *** 1271,1278 **** } /* ! * extract offset within segment:: */ offset = offset & (NBPS-1); /* --- 1469,1483 ---- } /* ! * Extract offset within segment for X driver shared memory map:: ! * ! * "segmentAddr" is the segment address "base"... ! * ! * "offset" is the offset to within the segment... ! * */ + + #ifdef OLD_MAPPING offset = offset & (NBPS-1); /* *************** *** 1280,1296 **** */ pegInfo.dsp = (XDisplayState *) (caddr_t) ((int) segmentAddr + offset); ! #ifdef DEBUG_SHMGET ErrorF("Mapping of shared segment sucessful.\n"); ErrorF("shared segment mapped to virtual address = 0x%x\n", pegInfo.dsp); ErrorF("shared segment offset = 0x%x\n", offset); ErrorF("\n"); ! #endif /* DEBUG_SHMGET */ bitmapx = pegInfo.dsp->ds_fbBitmap_x; bitmapy = pegInfo.dsp->ds_fbBitmap_y; ! #ifdef DEBUG_SHMGET ErrorF("dumping -the- items of interest from -dsp-:\n"); ErrorF("ds_maxx = %d\n", pegInfo.dsp->ds_maxx); ErrorF("ds_maxy = %d\n", pegInfo.dsp->ds_maxy); --- 1485,1531 ---- */ pegInfo.dsp = (XDisplayState *) (caddr_t) ((int) segmentAddr + offset); ! #else /* !OLD_MAPPING (NEW_MAPPING) */ ! ! pegInfo.dsp = (XDisplayState *) (caddr_t) ((int) segmentAddr); ! ! #endif /* !OLD_MAPPING (NEW_MAPPING) */ ! ! #ifdef DEBUG_SHM ErrorF("Mapping of shared segment sucessful.\n"); ErrorF("shared segment mapped to virtual address = 0x%x\n", pegInfo.dsp); ErrorF("shared segment offset = 0x%x\n", offset); + ErrorF("shMemIdXD = %d\n", shMemIdXD); ErrorF("\n"); ! #endif /* DEBUG_SHM */ bitmapx = pegInfo.dsp->ds_fbBitmap_x; bitmapy = pegInfo.dsp->ds_fbBitmap_y; ! /* ! * an insurance policy on the mapping:: ! * Check the screen height/width just to be sure...... ! * If an old server (one segment map) is run and then a ! * new (one page map) is run, the new one will get an invalid ! * map chunk of memory... reboot. ! */ ! if ((bitmapx != DISPLAY2_bitmap_x) || ! (bitmapy != DISPLAY2_bitmap_y)) { /* die -- tell em' to reboot */ ! ErrorF("Shared memory mapping of X driver shared memory page failed.\n"); ! ErrorF("df_fbBitmap_x = 0x%x\n", bitmapx); ! ErrorF("df_fbBitmap_y = 0x%x\n", bitmapy); ! ErrorF("\n"); ! ErrorF("Try re-starting the X system once more.. If this fails....\n"); ! ErrorF("Reboot the system to resolve shared memory mapping error.\n\n"); ! /* ! * although... the AbortDDX will destroy the mappings... and this ! * should make the server able to map the next time its' to run. ! */ ! return(False); ! } ! ! ! #ifdef DEBUG_SHM ErrorF("dumping -the- items of interest from -dsp-:\n"); ErrorF("ds_maxx = %d\n", pegInfo.dsp->ds_maxx); ErrorF("ds_maxy = %d\n", pegInfo.dsp->ds_maxy); *************** *** 1314,1351 **** ErrorF("videostate = 0x%x\n", pegInfo.dsp->videostate); ErrorF("keyboardlangidstyle = 0x%x\n", pegInfo.dsp->keyboardlangidstyle); ErrorF("xconsolepid = %d\n", pegInfo.dsp->xconsolepid); ! ErrorF("consolemsgbuffer = %d\n", ((int) pegInfo.dsp->consolemsgbuffer)); ErrorF("\n"); ! #endif /* DEBUG_SHMGET */ assert(bitmapx != 0); assert(bitmapy != 0); ! shMemId = shmget(IPC_PRIVATE, DS_NUMBER_OF_BYTES, PHYS_FLAGS, DS_DSP_BASE); ! if (shMemId == -1) { ! ErrorF("Can't -shmget- display board\n"); ! ErrorF("mapping with: IPC_PRIVATE | IPC_CI | IPC_NOCLEAR\n"); ! ErrorF("size = 0x%x\n", DS_NUMBER_OF_BYTES); ! ErrorF("address = 0x%x\n", DS_DSP_BASE); ! Error("errno = "); ! return(False); } ! caddrTemp = shmat(shMemId, DS_DSP_BASE, 0); if ((int) caddrTemp == -1) { /* remember display board addrs = 0x80000000 */ ! ErrorF("Can't -shmat- display board\n"); ! ErrorF("mapping with flags: 0\n"); ! ErrorF("Id = 0x%x\n", shMemId); ! ErrorF("address = 0x%x\n", DS_DSP_BASE); ! ErrorF("shmat returned = 0x%x\n", caddrTemp); ! Error("errno = "); ! return(False); } ! #ifdef DEBUG_SHMGET ErrorF("Display board mapped to address 0x%x by -shmat-\n", caddrTemp); ErrorF("\n"); ! #endif /* DEBUG_SHMGET */ dspBaseAddr = caddrTemp; /* establish the "display board" base address */ pegInfo.twoColorFb = (caddr_t) ((int) dspBaseAddr + OFFSET_TWO_COLOR_FB); --- 1549,1631 ---- ErrorF("videostate = 0x%x\n", pegInfo.dsp->videostate); ErrorF("keyboardlangidstyle = 0x%x\n", pegInfo.dsp->keyboardlangidstyle); ErrorF("xconsolepid = %d\n", pegInfo.dsp->xconsolepid); ! ErrorF("db_shMemKeyDB = %d\n", pegInfo.dsp->db_shMemKeyDB); ! ErrorF("db_shMemKeyXD = %d\n", pegInfo.dsp->db_shMemKeyXD); ErrorF("\n"); ! #endif /* DEBUG_SHM */ assert(bitmapx != 0); assert(bitmapy != 0); ! /* ! * Map whole display board using PATC's ! */ ! shMemIdDB = shmget(XDevMappingKeyDB, DS_BOARD_NUMBER_BYTES, PHYS_FLAGS, ! DS_DSP_BASE); ! if (shMemIdDB == -1) { ! ErrorF("Can't -shmget- display board\n"); ! ErrorF("key = 0x%x\n", XDevMappingKeyDB); ! ErrorF("mapping with: IPC_PHYS | IPC_CI | IPC_NOCLEAR | IPC_CREAT\n"); ! ErrorF("size = 0x%x\n", DS_BOARD_NUMBER_BYTES); ! ErrorF("address = 0x%x\n", DS_DSP_BASE); ! Error("errno = "); ! return(False); } ! caddrTemp = shmat(shMemIdDB, DS_DSP_BASE, 0); if ((int) caddrTemp == -1) { /* remember display board addrs = 0x80000000 */ ! ErrorF("Can't -shmat- display board\n"); ! ErrorF("mapping with flags: 0\n"); ! ErrorF("Id = 0x%x\n", shMemIdDB); ! ErrorF("address = 0x%x\n", DS_DSP_BASE); ! ErrorF("shmat returned = 0x%x\n", caddrTemp); ! Error("errno = "); ! return(False); } ! pegInfo.dsp->db_shMemKeyDB = XDevMappingKeyDB; /* save mapped key */ ! pegInfo.dsp->db_shMemKeyXD = XDevMappingKeyXD; /* save mapped key */ ! ! /* ! * Allow OnRamp non-root access to the display board and ! * Xdriver shared memory. ! */ ! ! result = (shmctl(shMemIdDB, IPC_STAT, &shm_buf)); /* fetch current stat.*/ ! if (result == -1) { ! ErrorF("Error in shmctl - getting F.B. board mapping status; "); ! ErrorF("shMemIdXD = %d\n", shMemIdXD); ! ErrorF("errno = %d, ", errno); ! Error(); ! } ! ! shm_buf.shm_perm.mode = 0x1ff; ! if (shmctl(shMemIdDB, IPC_SET, &shm_buf)) { ! ErrorF("Error in shmctl - setting permissions ; errno=%d\n", errno); ! return (False); ! } ! ! result = (shmctl(shMemIdXD, IPC_STAT, &shm_buf)); /* fetch current stat.*/ ! if (result == -1) { ! ErrorF("Error in shmctl - getting Xdriver mapping status; "); ! ErrorF("shMemIdXD = %d\n", shMemIdXD); ! ErrorF("errno = %d, ", errno); ! Error(); ! } ! ! shm_buf.shm_perm.mode = 0x1ff; ! if (shmctl(shMemIdXD, IPC_SET, &shm_buf)) { ! ErrorF("Error in shmctl - setting permissions ; errno=%d\n", errno); ! return (False); ! } ! ! #ifdef DEBUG_SHM ErrorF("Display board mapped to address 0x%x by -shmat-\n", caddrTemp); + ErrorF("Display board mapping permissions = 0x1ff \n"); + ErrorF("db_shMemKeyDB = %d\n", pegInfo.dsp->db_shMemKeyDB); ErrorF("\n"); ! #endif /* DEBUG_SHM */ ! dspBaseAddr = caddrTemp; /* establish the "display board" base address */ pegInfo.twoColorFb = (caddr_t) ((int) dspBaseAddr + OFFSET_TWO_COLOR_FB); *************** *** 1356,1362 **** pegInfo.videostate = (unsigned char *) &pegInfo.dsp->videostate; /* shadow reg */ ! #ifdef DEBUG_SHMGET ErrorF("Display board is mapped at: 0x%x\n", dspBaseAddr); ErrorF("Two Color Frame buffer mapped at: 0x%x\n", pegInfo.twoColorFb); ErrorF("One Color/Stencil Frame buffer at: 0x%x\n", pegInfo.oneColorFb); --- 1636,1642 ---- pegInfo.videostate = (unsigned char *) &pegInfo.dsp->videostate; /* shadow reg */ ! #ifdef DEBUG_SHM ErrorF("Display board is mapped at: 0x%x\n", dspBaseAddr); ErrorF("Two Color Frame buffer mapped at: 0x%x\n", pegInfo.twoColorFb); ErrorF("One Color/Stencil Frame buffer at: 0x%x\n", pegInfo.oneColorFb); *************** *** 1364,1406 **** ErrorF("CDPs mapped at: 0x%x\n", pegInfo.cdpCtl); ErrorF("Video control-status register mapped at: 0x%x\n", pegInfo.videoCtl); ErrorF("Video control SHADOW var. mapped at: 0x%x\n", pegInfo.videostate); ! #endif /* DEBUG_SHMGET */ /* ! * -Bill is going to think about this ... may mot be true for 88K blt code-- * - * In many algorithms in pfb, we need to access one longword at a memory - * location one longword less than the legitimate source address. To - * allow source drawables in the 2 color frame buffer, we need now to - * allocate the memory word preceding twoColorFb. We will actually - * allocate a page because mmap requires us to use page aligned - * addresses */ ! #endif /* M4810 **------------- Redwing -------------------------------------*/ return (True); } ! /*--------------- end of M4810 series pegVmScreenInit -----------------------*/ #endif /* UTEKV */ static Bool (*wrappedCloseScreen)(); static Bool ! pegCloseScreen (i, pScreen) ! int i; ! ScreenPtr pScreen; { ! int ret; pScreen->CloseScreen = wrappedCloseScreen; ! ret = (*pScreen->CloseScreen) (i, pScreen); ! (void) close (pegInfo.bells.fd); ! (void) close (pegInfo.eventFd); } /* * Screen Init for tek servers */ --- 1644,1875 ---- ErrorF("CDPs mapped at: 0x%x\n", pegInfo.cdpCtl); ErrorF("Video control-status register mapped at: 0x%x\n", pegInfo.videoCtl); ErrorF("Video control SHADOW var. mapped at: 0x%x\n", pegInfo.videostate); ! #endif /* DEBUG_SHM */ /* ! * Now setup BATC maps for the frame buffers.... SPEED - UP:: ! * ! * (BATC #0 is used by the kernel, so there are BATC's 1-7 available.) ! * ! * Map the One color (stencil) port with one BATC (size = 256K bytes, ! * but use 512K). ! * ! * Map the Two color port with one BATC (size = 256K bytes, but use 512K). ! * ! * Map the Packed Pixel port with four BATC's (size = 2M bytes). ! * ! * ! * BATC's notes: ! * ! * 0) BATC system call:: ! * result = (sys_local(V_UNISOFTMISC, SYS_MOTLOCAL, S88MAPBATC, ! * logical_address, size)); ! * ! * 1) return value == -1, errno == EINVAL:: indicates the system ! * call is not implemented in this kernel - old kernel. ! * ! * 2) return value == 0, errno == EINVAL:: indicates the system ! * call -is- implemented in this kernel, but there are problems ! * with the parameters.. etc. ! * ! * 3) return value == 0, errno == EINVAL:: indicates all went well. ! * ! * 4) return value != 0, errno == 0:: then the call was not able ! * to allocate all of the logical space requested in BATC's. ! * The returned value is the address size that was mapped. * */ ! #ifdef DEBUG_BATC ! ErrorF("\n"); ! ErrorF("BATC:: Mapping Frame Buffer ports with BATC's.\n"); ! #endif /* DEBUG_BATC */ ! ! #ifdef DEBUG_BATC ! ErrorF("BATC:: First - Map STENCIL F.B.\n"); ! #endif /* DEBUG_BATC */ ! ! result = (sys_local(V_UNISOFTMISC, SYS_MOTLOCAL, ! S88MAPBATC, DS_FB_STENCIL_P, STENCIL_SIZE)); ! if ((result == -1) && (errno == EINVAL)) { ! ErrorF("pegVmScreenInit:: sys_local BATC DS_FB_STENCIL failed,\n"); ! ErrorF(" sys_local BATC call not available in this kernel. \n"); ! ErrorF("errno = %d", errno); ! Error(); ! errno = 0; /* reset ignored error */ ! } ! else if ((result == 0) && (errno != 0)) { ! ErrorF("pegVmScreenInit:: sys_local BATC DS_FB_STENCIL failed,\n"); ! ErrorF(" sys_local returned a result = %x\n", result); ! ErrorF("errno = %d", errno); ! Error(); ! errno = 0; /* reset ignored error */ ! } ! else if (((result != 0) && (result != STENCIL_SIZE)) && (errno == 0)) { ! ErrorF("pegVmScreenInit:: sys_local BATC DS_FB_STENCIL failed,\n"); ! ErrorF(" sys_local unable to map entire space with BATC's\n"); ! ErrorF(" sys_local returned a result = %x\n", result); ! ErrorF("errno = %d", errno); ! Error(); ! errno = 0; /* reset ignored error */ ! } ! ! #ifdef DEBUG_BATC ! ErrorF("BATC:: Second - Map TWO COLOR F.B.\n"); ! #endif /* DEBUG_BATC */ ! ! result = (sys_local(V_UNISOFTMISC, SYS_MOTLOCAL, ! S88MAPBATC, DS_FB_TWO_COLOR_P,TWOCOLOR_SIZE)); ! if ((result == -1) && (errno == EINVAL)) { ! ErrorF("pegVmScreenInit:: sys_local DS_FB_TWO_COLOR failed,\n"); ! ErrorF(" sys_local BATC call not available in this kernel. \n"); ! ErrorF("errno = %d", errno); ! Error(); ! errno = 0; /* reset ignored error */ ! } ! else if ((result == 0) && (errno != 0)) { ! ErrorF("pegVmScreenInit:: sys_local DS_FB_TWO_COLOR failed,\n"); ! ErrorF(" sys_local returned a result = %x\n", result); ! ErrorF("errno = %d", errno); ! Error(); ! errno = 0; /* reset ignored error */ ! } ! else if (((result != 0) && (result != TWOCOLOR_SIZE)) && (errno == 0)) { ! ErrorF("pegVmScreenInit:: sys_local DS_FB_TWO_COLOR failed,\n"); ! ErrorF(" sys_local unable to map entire space with BATC's\n"); ! ErrorF(" sys_local returned a result = %x\n", result); ! ErrorF("errno = %d", errno); ! Error(); ! errno = 0; /* reset ignored error */ ! } ! ! #ifdef DEBUG_BATC ! ErrorF("BATC:: Last - Map PPM F.B.\n"); ! #endif /* DEBUG_BATC */ ! ! result = (sys_local(V_UNISOFTMISC, SYS_MOTLOCAL, ! S88MAPBATC, DS_FB_PP_P, PPM_SIZE)); ! if ((result == -1) && (errno == EINVAL)) { ! ErrorF("pegVmScreenInit:: sys_local DS_FB_PP failed,\n"); ! ErrorF(" sys_local BATC call not available in this kernel. \n"); ! ErrorF("errno = %d", errno); ! Error(); ! errno = 0; /* reset ignored error */ ! } ! else if ((result == 0) && (errno != 0)) { ! ErrorF("pegVmScreenInit:: sys_local DS_FB_PP failed,\n"); ! ErrorF(" sys_local returned a result = %x\n", result); ! ErrorF("errno = %d", errno); ! Error(); ! errno = 0; /* reset ignored error */ ! } ! else if (((result != 0) && (result != PPM_SIZE)) && (errno == 0)) { ! ErrorF("pegVmScreenInit:: sys_local DS_FB_PP failed,\n"); ! ErrorF(" sys_local unable to map entire space with BATC's\n"); ! ErrorF(" sys_local returned a result = %x\n", result); ! ErrorF("errno = %d", errno); ! Error(); ! errno = 0; /* reset ignored error */ ! } ! ! #ifdef DEBUG_BATC ! ErrorF("\n"); ! #endif /* DEBUG_BATC */ ! ! #endif /* XD8810 */ return (True); } ! /*--------------- end of XD8810 series pegVmScreenInit ----------------------*/ #endif /* UTEKV */ static Bool (*wrappedCloseScreen)(); static Bool ! pegCloseScreen(index, pScreen) ! /*ARGSUSED*/ ! int index; ! ScreenPtr pScreen; { ! ! int ret; ! #ifdef UTEKV ! int result; ! caddr_t caddrTemp; ! #endif /* UTEKV */ pScreen->CloseScreen = wrappedCloseScreen; ! ret = (*pScreen->CloseScreen) (index, pScreen); ! ! TimeoutOn(); /* turn on display blanking again -this is not ness.- */ ! ! if (close(pegInfo.eventFd)) { ! ErrorF("Error closing display device; errno=%d\n", errno); ! } ! pegInfo.eventFd = 0; /* zap the event fd */ ! ! if (close(pegInfo.bells.fd)) { ! ErrorF("Error closing bell device; errno=%d\n", errno); ! return (FALSE); ! } ! pegInfo.bells.fd = 0; /* zap the bells fd */ ! ! ! #ifdef DEBUG_ERRNO_IS_SET ! if (errno != 0) { ! ErrorF("pegCloseScreen -1- errno is already nonzero: "); ! ErrorF("clearing errno=%d\n", errno); ! errno = 0; ! } ! #endif /* DEBUG_ERRNO_IS_SET */ ! ! #ifdef UTEKV ! if (pegInfo.twoColorFb) { ! /* ! * ! */ ! caddrTemp = ((caddr_t)(DS_DSP_BASE)); ! result = shmdt(caddrTemp); ! if (result == -1) { ! ErrorF("Error in shmdt - detaching display board mapping; "); ! ErrorF("address = %d\n", caddrTemp); ! ErrorF("errno = %d, ", errno); ! Error(); ! } ! ! caddrTemp = ((caddr_t)(PHYS_HIGH_ADDR)); ! result = shmdt(caddrTemp); ! if (result == -1) { ! ErrorF("Error in shmdt - detaching X driver shared mem. mapping; "); ! ErrorF("address = %d\n", caddrTemp); ! ErrorF("errno = %d, ", errno); ! Error(); ! } ! ! /* ! * Now: Destroy the evidence. ! */ ! pegInfo.twoColorFb = (caddr_t) ((int) 0); ! pegInfo.oneColorFb = (caddr_t) ((int) 0); ! pegInfo.pixelFb = (caddr_t) ((int) 0); ! pegInfo.cdpCtl = (COLOR_CNTL *) ((int) 0); ! pegInfo.videoCtl = (caddr_t) ((int) 0); ! pegInfo.videostate = ((unsigned char *) 0); ! pegInfo.dsp = NULL; /* xdriver connection also. */ ! } ! ! if (pegInfo.colorDefDefault != NULL) { ! Xfree(pegInfo.colorDefDefault); /* free default color map */ ! pegInfo.colorDefDefault = NULL; /* flush pointer */ ! } ! ! #endif /* UTEKV */ ! } + /* * Screen Init for tek servers */ *************** *** 1416,1423 **** int i, j; int useCfb; int resolution; ! useCfb = pegInfo.depth != 1 && !FMonochrome; if (! pegVmScreenInit(argc, argv)) return (False); --- 1885,1893 ---- int i, j; int useCfb; int resolution; + int result; ! useCfb = (pegInfo.depth != 1) && (!FMonochrome); if (! pegVmScreenInit(argc, argv)) return (False); *************** *** 1474,1479 **** --- 1944,1961 ---- ioctl(pegInfo.eventFd, CE_SETCONS, &pegInfo.consolePid); ioctl(pegInfo.eventFd, CE_EVENTS, NULL); + #ifdef UTEKV + result = ioctl(pegInfo.eventFd, CE_SELECTX11EVENTS, NULL); + if (result == EVENT_MAGIC) { + eventFlavor = result; /* X11 events valid on this kernel */ + } + else + { + FatalError("This X server requires a newer version of the kernel,\n one which supports X11 style events.\n"); + } + #endif /* UTEKV */ + + /* * turn on screen. * X handles blanking, so turn off hardware screensaver *************** *** 1623,1657 **** #endif /* UTEK */ #ifdef UTEKV ! #ifdef M4810 ! #ifdef notdef ! ! ------ because the xdev mapping for the shared memeory has not happend YET !! -- ! ! assert (N_PLANE(pegInfo.dsp) == 8); /* hardwire display type #8 */ ! ! pegInfo.fAvailableCDP = 1; /* yep, its got CDPs */ ! ! if (N_PLANE(pegInfo.dsp) == 8) { ! formats = EightBitFormats; ! pegInfo.depth = 8; ! } ! ! #else /* notdef */ ! ! /* ! * hack for Redwing !!!!!! ! * ! * --------- cheap hack for now .... fix the ordering of the shared memory ! * ----------- later !!!! ! */ pegInfo.fAvailableCDP = 1; formats = EightBitFormats; pegInfo.depth = 8; ! #endif /* notdef */ ! #endif /* M4810 */ #endif /* UTEKV */ pegInfo.entries = 1 << pegInfo.depth; --- 2105,2117 ---- #endif /* UTEK */ #ifdef UTEKV ! #ifdef XD8810 pegInfo.fAvailableCDP = 1; formats = EightBitFormats; pegInfo.depth = 8; ! #endif /* XD8810 */ #endif /* UTEKV */ pegInfo.entries = 1 << pegInfo.depth; *************** *** 1683,1690 **** pegInfo.queue = &pegInfo.dsp->ds_q; /* * For redwing remember that this is ! * mapped at 0x60000000 + the kernel ! * virtual address. */ #ifdef XPEG_TANDEM } --- 2143,2149 ---- pegInfo.queue = &pegInfo.dsp->ds_q; /* * For redwing remember that this is ! * mapped at 0x60000000. */ #ifdef XPEG_TANDEM } *************** *** 1692,1698 **** { pegInfo.queue = (EventQueue *)Xalloc(sizeof(EventQueue)); pegInfo.queue->size = NXEVENTS; ! pegInfo.queue->events = (Event *)Xalloc(sizeof(Event) * NXEVENTS); pegInfo.queue->head = 0; pegInfo.queue->tail = 0; pegInfo.width = 640; --- 2151,2158 ---- { pegInfo.queue = (EventQueue *)Xalloc(sizeof(EventQueue)); pegInfo.queue->size = NXEVENTS; ! pegInfo.queue->events = ! (Event_X11 *)Xalloc(sizeof(Event_X11) * NXEVENTS); pegInfo.queue->head = 0; pegInfo.queue->tail = 0; pegInfo.width = 640; *************** *** 1752,1757 **** --- 2212,2218 ---- #ifdef UTEKV if ((KEYIDSTYLE(pegInfo.dsp) == KB_STYLE_VT200) || + (KEYIDSTYLE(pegInfo.dsp) == KB_STYLE_VT200_IBM) || (KEYIDSTYLE(pegInfo.dsp) == KB_STYLE_YELLOW_JACKET)) #endif /* UTEKV */ { diff -r -c XD88-patchlevel-26-mit/server/include/servermd.h XD8810-mit/server/include/servermd.h *** XD88-patchlevel-26-mit/server/include/servermd.h Sun Jun 30 08:29:43 1991 --- XD8810-mit/server/include/servermd.h Sat Jan 29 21:03:33 1994 *************** *** 178,184 **** #endif /* hpux */ ! #if defined (M4310) || defined(M4315) || defined(M4317) || defined(M4319) || defined(M4330) #define IMAGE_BYTE_ORDER MSBFirst /* Values for Pegasus only */ #define BITMAP_BIT_ORDER MSBFirst --- 178,184 ---- #endif /* hpux */ ! #if defined (M4310) || defined(M4315) || defined(M4317) || defined(M4319) || defined(M4330) || defined(XD8810) #define IMAGE_BYTE_ORDER MSBFirst /* Values for Pegasus only */ #define BITMAP_BIT_ORDER MSBFirst diff -r -c XD88-patchlevel-26-mit/server/os/access.c XD8810-mit/server/os/access.c *** XD88-patchlevel-26-mit/server/os/access.c Fri Jan 28 13:39:12 1994 --- XD8810-mit/server/os/access.c Sat Jan 29 20:53:43 1994 *************** *** 34,48 **** #include #include - #ifdef TCPCONN - #include - #endif /* TCPCONN */ - #ifdef DNETCONN - #include - #include - #endif ! #ifdef hpux # include # ifdef HAS_IFREQ # include --- 34,41 ---- #include #include ! #if defined(hpux) || defined(UTEKV) # include # ifdef HAS_IFREQ # include *************** *** 55,61 **** # include #endif # include ! #endif /* hpux */ #include #undef NULL --- 48,62 ---- # include #endif # include ! #endif /* hpux || UTEKV */ ! ! #ifdef TCPCONN ! #include ! #endif /* TCPCONN */ ! #ifdef DNETCONN ! #include ! #include ! #endif #include #undef NULL *************** *** 120,129 **** LocalHostEnabled = FALSE; } ! #if defined(SVR4) || defined (SYSV386) || (defined (hpux) && ! defined (HAS_IFREQ)) /* Define this host for access control. Find all the hosts the OS knows about * for this fd and add them to the selfhosts list. * hpux, SVR4, and SYSV386 do not have SIOCGIFCONF ioctl; */ DefineSelf (fd) int fd; --- 121,133 ---- LocalHostEnabled = FALSE; } ! #if defined(SVR4) || defined (SYSV386) || (defined (hpux) && ! defined (HAS_IFREQ)) || defined(UTEKV) /* Define this host for access control. Find all the hosts the OS knows about * for this fd and add them to the selfhosts list. * hpux, SVR4, and SYSV386 do not have SIOCGIFCONF ioctl; + * + * UTEKV version- DOES have SIOCGIFCONF ioct but the path to it is to it is convoluted! + * */ DefineSelf (fd) int fd; *************** *** 306,312 **** #endif } } ! #endif /* hpux && !HAS_IFREQ */ #ifdef XDMCP void --- 310,316 ---- #endif } } ! #endif /* hpux && !HAS_IFREQ || UTEKV */ #ifdef XDMCP void *************** *** 446,451 **** --- 450,462 ---- } fclose (fd); } + #ifdef UTEKV + /* + * fopen fails.... errno = ENOENT + */ + if (errno == ENOENT) { errno = 0; } /* clear errno */ + #endif /* UTEKV */ + } static Bool diff -r -c XD88-patchlevel-26-mit/server/os/connection.c XD8810-mit/server/os/connection.c *** XD88-patchlevel-26-mit/server/os/connection.c Fri Jan 28 13:39:14 1994 --- XD8810-mit/server/os/connection.c Sat Jan 29 20:54:28 1994 *************** *** 43,52 **** --- 43,57 ---- #include "Xproto.h" #include #include + #ifdef UTEKV + #include + #endif /* UTEKV */ #include "Xos.h" /* for strings, file, time */ #include + #ifndef UTEKV #include + #endif /* UTEKV */ #include #ifdef hpux *************** *** 60,66 **** #ifdef TCPCONN # include ! # ifndef hpux # ifdef apollo # ifndef NO_TCP_H # include --- 65,71 ---- #ifdef TCPCONN # include ! # if !defined (hpux) && !defined(UTEKV) # ifdef apollo # ifndef NO_TCP_H # include *************** *** 146,151 **** --- 151,163 ---- static void CloseDownFileDescriptor(), ErrorConnMax(); extern void FreeOsBuffers(), ResetOsBuffers(); + + #ifdef UTEKV + extern int errno; + #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 + #endif /* UTEKV */ + + #ifdef XDMCP void XdmcpOpenDisplay(), XdmcpInit(), XdmcpReset(), XdmcpCloseDisplay(); #endif *************** *** 157,167 **** --- 169,192 ---- struct sockaddr_in insock; int request; int retry; + + #ifdef UTEKV + int on = 1; /* makes it work w/4.3 networking (also still works w/4.2) */ + #endif /* UTEKV */ + + #ifndef UTEKV #ifndef SO_DONTLINGER #ifdef SO_LINGER static int linger[2] = { 0, 0 }; #endif /* SO_LINGER */ #endif /* SO_DONTLINGER */ + #else /* !UTEKV */ + /* + * UTEKV version of SYSV .... use SO_LINGER. + */ + static int linger[2] = { 0, 0 }; + #endif /* !UTEKV */ + #ifdef AIXV3 #ifndef FORCE_DISPLAY_NUM *************** *** 196,201 **** --- 221,232 ---- retry = 20; while (bind(request, (struct sockaddr *) &insock, sizeof (insock))) { + #if defined(UTEKV) + if (errno == EADDRINUSE) + setsockopt (request, SOL_SOCKET, SO_REUSEADDR, + (char *) &on, sizeof(on)); + #endif /* UTEKV */ + if (--retry == 0) { Error ("Binding TCP socket"); close (request); *************** *** 208,213 **** --- 239,245 ---- #endif /* SO_REUSEDADDR */ } } + #ifndef UTEKV #ifdef SO_DONTLINGER if(setsockopt (request, SOL_SOCKET, SO_DONTLINGER, (char *)NULL, 0)) Error ("Setting TCP SO_DONTLINGER"); *************** *** 218,223 **** --- 250,267 ---- Error ("Setting TCP SO_LINGER"); #endif /* SO_LINGER */ #endif /* SO_DONTLINGER */ + + #else /* UTEKV */ + + /* + * UTEKV version of SYSV .... use SO_LINGER. + */ + if (setsockopt (request, SOL_SOCKET, SO_LINGER, + (char *)linger, sizeof(linger))) { + Error ("open_tcp_socket: Setting TCP SO_LINGER"); + } + #endif /* UTEKV */ + if (listen (request, 5)) { Error ("TCP Listening"); close (request); *************** *** 244,249 **** --- 288,297 ---- if (!mkdir (X_UNIX_DIR, 0777)) chmod (X_UNIX_DIR, 0777); #endif + #ifdef UTEKV + if (errno == EEXIST) { errno = 0; } /* if already exists clear the errno */ + #endif /* UTEKV */ + strcpy (unsock.sun_path, X_UNIX_PATH); strcat (unsock.sun_path, display); #ifdef hpux *************** *** 268,279 **** --- 316,336 ---- } #endif /* hpux */ unlink (unsock.sun_path); + #ifdef UTEKV + if (errno == ENOENT) { errno = 0; } /* if doesn't exist clear the errno */ + #endif /* UTEKV */ + if ((request = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) { Error ("Creating Unix socket"); return -1; } + #ifdef UTEKV + if(bind(request,(struct sockaddr *)&unsock, sizeof(unsock))) + #else if (bind(request, (struct sockaddr *)&unsock, strlen(unsock.sun_path)+2)) + #endif + { Error ("Binding Unix socket"); close (request); *************** *** 461,473 **** * see if the unix domain socket has disappeared */ struct stat statb; ! if (stat (unsock.sun_path, &statb) == -1 || (statb.st_mode & S_IFMT) != S_IFSOCK) { ErrorF ("Unix domain socket %s trashed, recreating\n", unsock.sun_path); (void) unlink (unsock.sun_path); (void) close (unixDomainConnection); WellKnownConnections &= ~(1L << unixDomainConnection); unixDomainConnection = open_unix_socket (); --- 518,537 ---- * see if the unix domain socket has disappeared */ struct stat statb; ! #ifdef UTEKV ! /* UTEKV unix socket is not based on filesystem */ ! if (fstat (unixDomainConnection, &statb) == -1) ! #else if (stat (unsock.sun_path, &statb) == -1 || (statb.st_mode & S_IFMT) != S_IFSOCK) + #endif /* UTEKV */ { ErrorF ("Unix domain socket %s trashed, recreating\n", unsock.sun_path); + #ifndef UTEKV (void) unlink (unsock.sun_path); + #endif /* UTEKV */ + (void) close (unixDomainConnection); WellKnownConnections &= ~(1L << unixDomainConnection); unixDomainConnection = open_unix_socket (); diff -r -c XD88-patchlevel-26-mit/server/os/oscolor.c XD8810-mit/server/os/oscolor.c *** XD88-patchlevel-26-mit/server/os/oscolor.c Sun Jun 30 12:59:15 1991 --- XD8810-mit/server/os/oscolor.c Sat Jan 29 20:35:43 1994 *************** *** 22,40 **** ******************************************************************/ /* $XConsortium: oscolor.c,v 1.20 91/06/30 15:58:30 rws Exp $ */ #ifdef NDBM #include ! #else ! #ifdef SVR4 ! #include ! #else ! #include ! #endif ! #endif #include "rgb.h" #include "os.h" #include "opaque.h" /* Note that we are assuming there is only one database for all the screens. */ #ifdef NDBM --- 22,64 ---- ******************************************************************/ /* $XConsortium: oscolor.c,v 1.20 91/06/30 15:58:30 rws Exp $ */ + #ifdef NDBM #include ! #else /* NDBM */ ! # ifdef SVR4 ! # include ! # else /* SVR4 */ ! # ifdef DBM ! # include ! # else /* DBM */ ! # include "site.h" ! # ifdef UTEKV ! # include ! # include ! # endif /* UTEKV */ ! # endif /* DBM */ ! # endif /* SVR4 */ ! #endif /* NDBM */ ! #include "rgb.h" #include "os.h" #include "opaque.h" + #ifdef UTEKV + extern int Get_Color_RGB(); /* in gfb/colordb.c */ + + /* + * Debug switches:: + */ + /* #define LOCAL_DEBUG_PRINTFS */ /* all ! */ + + # ifdef LOCAL_DEBUG_PRINTFS + # define LOCAL_DEBUG_PRINTFS_GCRGB /* Get_Color_RGB entry */ + # endif /* LOCAL_DEBUG_PRINTFS */ + #endif /* UTEKV */ + + /* Note that we are assuming there is only one database for all the screens. */ #ifdef NDBM *************** *** 46,55 **** extern void CopyISOLatin1Lowered(); int ! OsInitColors() { if (!rgb_dbm) { #ifdef NDBM rgb_dbm = dbm_open(rgbPath, 0, 0); #else --- 70,83 ---- extern void CopyISOLatin1Lowered(); int ! OsInitColors() /* called by osinit.c */ { + + #if defined(NDBM) || defined(DBM) + if (!rgb_dbm) { + #ifdef NDBM rgb_dbm = dbm_open(rgbPath, 0, 0); #else *************** *** 62,69 **** --- 90,151 ---- } } return TRUE; + + #else /* !NDBM && !DBM */ + + if (!rgb_dbm) { + if(SetColorDB(rgbPath) == 0) { /* This must be done before the fclose*/ + rgb_dbm = 1; + } + else + { + ErrorF("OsInitColors:Couldn't open RGB_DB '%s'\n", rgbPath); + } + } + + #endif /* !NDBM && !DBM */ + } + + #if !defined(NDBM) && !defined(DBM) + /* + * Open the rgb database. Always update if possible. + */ + /*ARGSUSED*/ + int + SetColorDB(baseName) + char *baseName; + { + char tmpName[512]; + struct stat txt; + int noTxt, returnValue; + + #ifdef LOCAL_DEBUG_PRINTFS_SCDB + ErrorF("osinit:SetColorDB called -- \n"); + #endif /* LOCAL_DEBUG_PRINTFS_SCDB */ + + strcpy(tmpName, baseName); + strcat(tmpName, ".txt"); + noTxt = stat(tmpName, &txt); + + if (noTxt) { + return(-1); /* db source is missing */ + } + else + { + returnValue = Make_Color_Dict(tmpName); + /* returns 0 if all is ok, else -1 */ + #ifdef LOCAL_DEBUG_PRINTFS_SCDB + ErrorF("osinit:SetColorDB calling of `Make_Color_Dict' returns: "); + ErrorF("%d -- \n", returnValue); + #endif /* LOCAL_DEBUG_PRINTFS_SCDB */ + return(returnValue); + + } + } + #endif /* !NDBM && !DBM*/ + /*ARGSUSED*/ int OsLookupColor(screen, name, len, pred, pgreen, pblue) *************** *** 73,79 **** --- 155,166 ---- unsigned short *pred, *pgreen, *pblue; { + #if defined(DBM) || defined(NDBM) datum dbent; + #else /* DBM || NDBM */ + int returnValue; + int i, j; + #endif /* DBM || NDBM */ RGB rgb; char buf[64]; char *lowername; *************** *** 90,95 **** --- 177,199 ---- CopyISOLatin1Lowered ((unsigned char *) lowername, (unsigned char *) name, (int)len); + #ifdef UTEKV + /* + * Remove white space from name:: + */ + for (i=0,j=0; i < len; i++) + { + if (!isspace(lowername[i])) { + lowername[j++] = lowername[i]; + } + } + lowername[j] = '\0'; /* necessary if DBM defined */ + + #endif /* UTEKV */ + + + #if defined(DBM) || defined(NDBM) + dbent.dptr = lowername; dbent.dsize = len; #ifdef NDBM *************** *** 110,114 **** --- 214,243 ---- return (1); } return(0); + + #else /* DBM || NDBM */ + + /* + * Get_Color_RGB will return 1 if color found, 0 if not. + * (Get_Color_RGB is in gfb/colordb.c) + */ + returnValue = Get_Color_RGB((char *)lowername, &rgb); + if (returnValue == 1) { + *pred = rgb.red; + *pgreen = rgb.green; + *pblue = rgb.blue; + } + #ifdef LOCAL_DEBUG_PRINTFS_GCRGB + ErrorF("oscolor:Get_Color_DB calling of `Make_Color_Dict' returns: "); + ErrorF("%d -- ", returnValue); + ErrorF(" and Name: %s, Red = %d, Green %d, Blue %d \n", + lowername, rgb.red, rgb.green, rgb.blue); + #endif /* LOCAL_DEBUG_PRINTFS_GCRGB */ + + DEALLOCATE_LOCAL(lowername); + return(returnValue); + + #endif /* DBM || NDBM */ + } diff -r -c XD88-patchlevel-26-mit/server/os/osfonts.c XD8810-mit/server/os/osfonts.c *** XD88-patchlevel-26-mit/server/os/osfonts.c Tue Jul 2 06:15:32 1991 --- XD8810-mit/server/os/osfonts.c Sat Jan 29 20:35:43 1994 *************** *** 26,32 **** --- 26,36 ---- #include #include "Xos.h" + #ifdef UTEKV + #include + #else /* UTEKV */ #include + #endif /* UTEKV */ #include #include #include *** XD88-patchlevel-26-mit/include/TEKkeysym.h Fri Feb 11 09:35:02 1994 --- XD8810-mit/include/TEKkeysym.h Mon Jan 31 14:28:46 1994 *************** *** 0 **** --- 1,69 ---- + /* $XConsortium: TEKkeysym.h,v 1.2 88/09/06 15:55:54 jim Exp $ */ + #ifndef LINT + #ifdef RCS_ID + static char *rcsid= "$Header: TEKkeysym.h,v 1.3 89/07/18 14:29:21 steveje Exp $"; + #endif /* RCS_ID */ + #endif /* LINT */ + + + /*********************************************************** + Copyright (c) 1988 by Tektronix, Inc., Wilsonville, Oregon + and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + + 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 appear in all copies and that + both that copyright notice and this permission notice appear in + supporting documentation, and that the names of Tektronix or MIT not be + used in advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + TEKTRONIX DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + TEKTRONIX BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + SOFTWARE. + + ******************************************************************/ + + #ifndef TEKkeysym_h + #define TEKkeysym_h + + #include "DECkeysym.h" + /* + * DEFINES + * + * Vendor specific keysym values have the 29th bit set in + * their values. + * + * The following defines are keysym values associated with + * Tektronix specific keys. + * + * Note: Do not define 0x1000FF00 since this is the value + * DEC is using for the "Remove" key and we are using the + * DEC macro for the 4319 keyboard "Remove" key (DXK_Remove). + * See DECkeysym.h. + */ + + + /* + * TEK Function keys + */ + #define TekXK_Hold 0x1000FF10 /* Hold Screen */ + #define TekXK_Copy 0x1000FF11 /* Screen/Dialog HardCopy */ + #define TekXK_Setup 0x1000FF12 /* Setup */ + #define TekXK_SErase 0x1000FF13 /* Screen Erase */ + #define TekXK_GErase 0x1000FF14 /* Graphics Erase */ + #define TekXK_DErase 0x1000FF15 /* Dialog Erase */ + #define TekXK_Dialog 0x1000FF16 /* Dialog */ + + /* + * Other TEK keys + */ + #define TekXK_Tek 0x1000FFFF /* Tek Key */ + + #endif /* TEKkeysym_h */ *** XD88-patchlevel-26-mit/include/JUSkeysym.h Fri Feb 11 09:34:51 1994 --- XD8810-mit/include/JUSkeysym.h Mon Jan 31 14:28:47 1994 *************** *** 0 **** --- 1,48 ---- + /* $Header: JUSkeysym.h,v 1.7 89/11/28 10:24:47 raigner Exp $ */ + + #ifndef LINT + #ifdef RCS_ID + static char *rcsid= "$Header: JUSkeysym.h,v 1.7 89/11/28 10:24:47 raigner Exp $"; + #endif /* RCS_ID */ + #endif /* LINT */ + + /* $XConsortium: JUSkeysym.h,v 1.3 89/09/30 20:09:51 keith Exp $ */ + /* $XConsortium: JUSkeysym.h,v 1.2 88/10/13 16:43:22 rws Exp $ */ + /* Note - these keysyms are not yet standardized by the X consortium, + and XLookupString is bogus and can't handle more language keysyms, hence + these are defined as private for now. */ + + /* these valuses are left over from > R3 and probably should be phased out of tek code */ + + #define _JUS_XK_Muhenkan 0x1000FF22 /* Cancel Conversion */ + #define _JUS_XK_Henkan_Mode 0x1000FF23 /* Start/Stop Conversion */ + #define _JUS_XK_Romaji 0x1000FF24 /* to Romaji */ + #define _JUS_XK_Hiragana 0x1000FF25 /* to Hiragana */ + #define _JUS_XK_Katakana 0x1000FF26 /* to Katakana */ + #define _JUS_XK_Hiragana_Katakana 0x1000FF27 /* Hiragana/Katakana */ + #define _JUS_XK_Zenkaku 0x1000FF28 /* to Zenkaku */ + #define _JUS_XK_Hankaku 0x1000FF29 /* to Hankaku */ + #define _JUS_XK_Zenkaku_Hankaku 0x1000FF2A /* Zenkaku/Hankaku */ + #define _JUS_XK_Touroku 0x1000FF2B /* Add to Dictionary */ + #define _JUS_XK_Massyo 0x1000FF2C /* Delete from Dictionary */ + #define _JUS_XK_Kana_Lock 0x1000FF2D /* Kana toggle, Shift Lock */ + #define _JUS_XK_Kana_Shift 0x1000FF2E /* Kana Shift */ + #define _JUS_XK_Eisu_Lock 0x1000FF2F /* Alpha-numeric Shift Lock */ + + /* these are the R4 values below */ + + #define XK_Kanji 0xFF21 /* Kanji, Kanji Convert */ + #define XK_Muhenkan 0xFF22 /* Cancel Conversion */ + #define XK_Henkan_Mode 0xFF23 /* Start/Stop Conversion */ + #define XK_Romaji 0xFF24 /* to Romaji */ + #define XK_Hiragana 0xFF25 /* to Hiragana */ + #define XK_Katakana 0xFF26 /* to Katakana */ + #define XK_Hiragana_Katakana 0xFF27 /* Hiragana/Katakana */ + #define XK_Zenkaku 0xFF28 /* to Zenkaku */ + #define XK_Hankaku 0xFF29 /* to Hankaku */ + #define XK_Zenkaku_Hankaku 0xFF2A /* Zenkaku/Hankaku */ + #define XK_Touroku 0xFF2B /* Add to Dictionary */ + #define XK_Massyo 0xFF2C /* Delete from Dictionary */ + #define XK_Kana_Lock 0xFF2D /* Kana toggle, Kana Shift Lock */ + #define XK_Kana_Shift 0xFF2E /* Kana Shift */ + #define XK_Eisu_Lock 0xFF2F /* Alpha-numeric Shift Lock */ *** XD88-patchlevel-26-mit/server/ddx/tek/colordb.c Fri Feb 11 09:38:31 1994 --- XD8810-mit/server/ddx/tek/colordb.c Sat Jan 29 20:34:37 1994 *************** *** 0 **** --- 1,563 ---- + /* + * $Header: colordb.c,v 1.2 91/03/07 15:02:41 steveje Exp $ + * $Locker: $ + * + * Author: Steve Jensen + * + */ + + /* + * ----------------------------------------------------------------------------- + * + * Copyright 1989, 1990, 1991 by Tektronix, Inc., Beaverton, Oregon. + * + * All Rights Reserved. + * + * NOTICE: + * + * THIS PROGRAM IS NOT A SUPPORTED TEKTRONIX PRODUCT, AND IS + * NOT GUARANTEED TO BE FREE OF ERRORS. THERE IS NO WARRANTY + * EXPRESSED OR IMPLIED, AND TEKTRONIX ASSUMES NO LIABILITY FOR + * DAMAGES RESULTING FROM IT'S USE. + * + * + * 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 appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Tektronix not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TEKTRONIX BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + */ + + /* + * INCLUDED FILES: + */ + + #ifndef DBM + + #ifdef UTEKV + #include + #endif /* UTEKV */ + + #include + #include + #include + #include + #include + #include "../../include/rgb.h" + + #ifndef LINT + #ifdef RCS_ID + static char *rcsid= "$Header: colordb.c,v 1.2 91/03/07 15:02:41 steveje Exp $"; + #endif /* RCS_ID */ + #endif /* LINT */ + + /* + * Debug switches:: + */ + + /* #define LOCAL_DEBUG_PRINTFS */ /* all ! */ + + #ifdef LOCAL_DEBUG_PRINTFS + #define LOCAL_DEBUG_PRINTFS_MCD /* Make_Color_Dict entry */ + #define LOCAL_DEBUG_PRINTFS_GCRGB /* Get_Color_RGB entry */ + #define LOCAL_DEBUG_PRINTFS_BD /* bubble_down entry */ + #define LOCAL_DEBUG_PRINTFS_FRGB /* find_rgb entry */ + #define LOCAL_DEBUG_PRINTFS_FNB /* find_next_break entry */ + #define LOCAL_DEBUG_PRINTFS_GF /* get_file entry */ + #define LOCAL_DEBUG_PRINTFS_STOI /* stoi entry */ + #define LOCAL_DEBUG_PRINTFS_SE /* SyntaxError entry */ + #endif /* LOCAL_DEBUG_PRINTFS */ + + /* + * LOCAL DEFINITIONS:: + */ + #define SpaceChar 0x20 /* ASCII space character */ + + /* + * the structure of the dictionary entry + */ + struct c_spec { + char *name; + unsigned short r, g, b; + }; + + /* + * EXTERNAL and FORWARD DECLARATIONS + */ + char *Xalloc(); + char *get_file(); + char *find_rgb(); + char *find_next_break(); + void bubble_down(); + + extern int Get_Color_RGB(); + extern int Make_Color_Dict(); + + #ifdef LOCAL_DEBUG_PRINTFS + extern int errno; + #endif /* LOCAL_DEBUG_PRINTFS */ + + /* + * GLOBAL VARiableS for this module + */ + static char *filename; /* the input filename */ + static int cc; /* the number of bytes read for the text file */ + static int n_entries; /* entries in the dictionary */ + + static char *db; /* the name strings for the dictionary */ + static struct c_spec *dict; /* the dictionary entries */ + + static int first = 1; /* indicates first pass through file */ + static char *sl; /* indicates the start of the line */ + static char *fp; /* indicates the '\n' of the line */ + + /*ARGSUSED*/ + int + Make_Color_Dict(pathname) + char *pathname; + { + register int i; + char *file; /* points to the file image */ + char *s, *p; /* working pointers within line of file image */ + unsigned short r, g, b; /* temporaries for the rgb values */ + int length, total; /* length of this, and all name strings */ + int j; /* index of the next dictionary entry */ + char *k; /* pointer to the next name string storage */ + + if ((file = get_file(pathname)) == 0) { + fprintf(stderr,"colordb: Make_Color_Dict - Calling of"); + fprintf(stderr," `get_file' failed."); + fprintf(stderr," `%s'", pathname); + fprintf(stderr," Text not available for dictionary."); + fprintf(stderr," Make_color_Dict - returning -1 (error)\n"); + return(-1); + } + filename = pathname; /* move pointer to global access */ + /* + * Now process the file text. + * Determine the amount of storage required. + */ + total = n_entries = 0; + for (s = sl = fp = file; fp < file + cc; fp++) { + if (*fp == '\n' ) { + /* increment number of entries and scan past rgb values */ + n_entries++; + s = find_rgb(s, &r, &g, &b); + + /* determine string length and increment total */ + while ((*s == SpaceChar) || (*s == '\t')) { + s++; /* find name string*/ + } + p = s; /* mark beginning */ + s = fp-1; + #ifdef notdef + while ((*s == SpaceChar) || (*s == '\t')) { + s--; /* find end */ + } + #endif /* notdef */ + + /* error if p has passed fp */ + if ( fp <= p ) { + SyntaxError(); + s = sl = fp +1; + continue; + } + + length = s + 2 - p; + total += length; + + /* move the line pointer forward */ + s = sl = fp +1; + } + } + /* create the dictionary and the string space */ + if((dict=(struct c_spec *)Xalloc(n_entries*sizeof(struct c_spec))) == 0 ) { + fprintf(stderr,"colordb: Can't Xalloc dictionary space\n"); + Xfree(file); + n_entries = 0; + return(-1); + } + if((db = Xalloc(total)) == 0 ) { + fprintf(stderr,"colordb: Can't Xalloc dictionary's string space\n"); + Xfree(file); + n_entries = 0; + return(-1); + } + /* re-process the file into dictionary entries */ + first = 0; + j = 0; + k = db; + for (s = sl = fp = file; fp < file + cc; fp++) { + if (*fp == '\n') { + s = find_rgb(s, &dict[j].r, &dict[j].g, &dict[j].b); + dict[j].name = k; + + /* determine string start and end */ + while ((*s == SpaceChar) || (*s == '\t')) { + s++; /* find name start*/ + } + p = s; + s = fp-1; + + #ifdef notdef + while (( *s == SpaceChar) || (*s == '\t')) { + s--; /* find end */ + } + #endif /* notdef */ + + s++; /* move off last character and NULL terminate */ + *s = '\0'; + + /* error if p has passed fp */ + if ( fp <= p ) { + n_entries--; + s = sl = fp +1; + continue; + } + + #ifdef notdef + /* copy string into string space (from p to k) */ + strcpy( k, p ); + #endif /* notdef */ + + /* new FIX white space in name bug */ + /* + * Remove white space from name:: + */ + while (*p != '\0') { + if ((*p == SpaceChar) || (*p == '\t')) { + p++; /* skip spaces and tabs */ + } + else + { + *k = *p; /* copy all the other characters */ + k++; p++; + } + } + *k = '\0'; + /* new */ + /* bubble down for binary searching */ + (void) bubble_down( j); + + /* increment for next entry */ + k += s - p + 1; + s = sl = fp +1; + j++; + } + } + + Xfree(file); + return (0); + } + + /*ARGSUSED*/ + /* Get the rgb values for a named color; return status if not found */ + int + Get_Color_RGB(name, color) + char *name; + RGB *color; + { + register int i, low, high, compare; + + low = 0; + high = n_entries; + while (low <= high) { + i = (low + high) /2; + if ((compare = strcmp(name, dict[i].name)) == 0) { + color->red = dict[i].r; + color->green = dict[i].g; + color->blue = dict[i].b; + #ifdef LOCAL_DEBUG_PRINTFS_GCRGB + fprintf(stderr,"colordb: Get_Color_RGB - "); + fprintf(stderr,"Look-up of: %s \n", name); + fprintf(stderr,", Returned RGB: "); + fprintf(stderr,"%d, ", color->red); + fprintf(stderr,"%d, ", color->green); + fprintf(stderr,"%d", color->blue); + fprintf(stderr,"Get_Color_RGB -- returning (1)\n"); + fflush(stderr); + #endif /* LOCAL_DEBUG_PRINTFS_GCRGB */ + return (1); + } + if (compare > 0) { + low = i + 1; + } + else + { + high = i - 1; + } + } + #ifdef LOCAL_DEBUG_PRINTFS_GCRGB + fprintf(stderr,"colordb: Get_Color_RGB - "); + fprintf(stderr,"Look-up of: %s \n", name); + fprintf(stderr,", Returned RGB: "); + fprintf(stderr,"%d, ", color->red); + fprintf(stderr,"%d, ", color->green); + fprintf(stderr,"%d", color->blue); + fprintf(stderr,"Get_Color_RGB -- returning (0)\n"); + fflush(stderr); + #endif /* LOCAL_DEBUG_PRINTFS_GCRGB */ + return (0); + } + + + /* bubble the top entry down to the correct lexical place for searching */ + /*ARGSUSED*/ + void + bubble_down(j) + int j; + { + struct c_spec temp; + register int i; + + i = j - 1; + while (( j > 0 ) && (strcmp(dict[j].name, dict[i].name) < 0 )) { + temp = dict[i]; + dict[i] = dict[j]; + dict[j] = temp; + i--; + j--; + } + } + + + /* scans forward and isolates the rgb values; returns pointer to next char */ + /*ARGSUSED*/ + char + *find_rgb(s, r, g, b) + char *s; + unsigned short *r, *g, *b; + { + short n; + char *p; + char t[40]; + + p = s; + s = find_next_break( s); + n = (short) stoi(p); + if (first && ((n < 0) || (n > 255))) InputError(p) ; + *r = n << 8; + + p = s; + s = find_next_break( s); + n = (short) stoi(p); + if (first && ((n < 0) || (n > 255))) InputError(p) ; + *g = n << 8; + + p = s; + s = find_next_break( s); + n = (short) stoi(p); + if (first && ((n < 0) || (n > 255))) InputError(p) ; + *b = n << 8; + + return(s); + } + + + /* return the pointer to the next white position */ + /*ARGSUSED*/ + char + *find_next_break(ptr) + char *ptr; + { + while ((*ptr == SpaceChar) || (*ptr == '\t')) { + ptr++; /* move past white */ + } + while ((*ptr != SpaceChar) && (*ptr != '\t') && + (*ptr != '\n')) { + ptr++; /* pass non white */ + } + return (ptr); + } + + + /* + * Opens the "color name/value file" (rgb.txt) file, + * Xallocs a buffer, + * and + * returns the file in the buffer. + */ + /*ARGSUSED*/ + char + *get_file(pathname) + char *pathname; + { + int fd; /* the file descriptor for the text file */ + struct stat file; + char *buf; /* the input buffer for the text file */ + char string[80]; /* a string for error messages */ + + /* + * Open the file and determine its size. + */ + if ((fd = open(pathname, O_RDONLY)) < 0) { + sprintf(string, "colordb: get_file - Trouble opening file: %s", pathname); + perror (string); + #ifdef LOCAL_DEBUG_PRINTFS_GF + fprintf(stderr, "colordb: get_file - Open of: %s\n", pathname); + fprintf(stderr, "colordb: get_file - File descriptor 'fd' = %d\n", fd); + fprintf(stderr, "colordb: get_file - Errno = %d\n", errno); + fflush(stderr); + #endif /* LOCAL_DEBUG_PRINTFS_GF */ + + return(0); /* return failure */ + } + #ifdef LOCAL_DEBUG_PRINTFS_GF + fprintf(stderr, "colordb: get_file - Open of: %s\n", pathname); + fprintf(stderr, "colordb: get_file - File descriptor 'fd' = %d\n", fd); + fprintf(stderr, "colordb: get_file - Errno = %d\n", errno); + fflush(stderr); + #endif /* LOCAL_DEBUG_PRINTFS_GF */ + + if (fstat(fd, &file)) { + sprintf(string,"colordb: get_file - Trouble status-ing file: %s, pathname"); + perror (string); + close(fd); + return(0); /* return failure */ + } + + /* Xalloc space for the file and read it into the space */ + if ((buf = Xalloc ( file.st_size) ) == NULL ) { + fprintf(stderr,"colordb: Trouble Xalloc'ing "); + fprintf(stderr,"%d as file buffer\n", file.st_size); + close(fd); + return(0); + } + if ((cc = read (fd, buf, file.st_size )) != file.st_size ) { + fprintf(stderr, "colordb: get_file - Trouble reading "); + fprintf(stderr, " %s; %d read != %d size\n", + pathname, cc, file.st_size ); + close(fd); + Xfree(buf); + return(0); /* return failure */ + } + close(fd); + return (buf); + } + + /*ARGSUSED*/ + stoi(p) + char *p; + { + int base = 10; + int num = 0; + int c; + char *s; + + s = p; /* save a pointer to the front of the string */ + while (*p == SpaceChar || *p == '\t' ) { + p++; /* move to first char */ + } + if ( *p == '0' ) { /* base is not decimal*/ + base = 8; + p++; + if (*p == 'x' || *p == 'X' ) { /* could be hex */ + base = 16; + p++; + } + } + while( *p != SpaceChar && *p != '\t' && *p != '\n' ) { + if (((c = *p) >= '0') && (c <= '7') ) { + c = c - '0'; + } else { + switch (base) { + case (16): + if ( c >= 'a' && c <= 'f' ) { + c = c - 'a' + 10; + break; + } + if ( c >= 'A' && c <= 'F' ) { + c = c - 'A' + 10; + break; + } + case (10): + if ( c >= '8' && c <= '9') { + c = c - '0'; + break; + } + case (8): + InputError(s); + return(num); + } + } + num = num * base + c; + p++; + } + return(num); + } + + + /* indicate a syntax error on the input line */ + + SyntaxError() + { + fprintf(stderr,"Make_Color_Dict(): found bad line in input\n"); + fprintf(stderr," line %d of input file >%s<.\n", + n_entries, filename); + fprintf(stderr," Apparently too few fields on line.\n"); + fprintf(stderr," Input lines should contain 3 "); + fprintf(stderr, "integers for r, g, and b,\n"); + fprintf(stderr," and a name string "); + fprintf(stderr, "(embedded blanks allowed).\n"); + fprintf(stderr," For example:\n"); + fprintf(stderr," 255 0 0 full red \n"); + fprintf(stderr," Full line looks like:\n"); + *fp = '\0'; + fprintf(stderr,"%s\n", sl); + *fp = '\n'; + } + + /* indicate a range or conversion error in the RGB input */ + /*ARGSUSED*/ + InputError(f) + char *f; /* points to the front of the string causing the error. */ + { + char t[20]; /* storage for isolating the offending string */ + char *e; /* points to the end of the offending string */ + int i; /* number of chars in the string */ + + if (first) { + + fprintf(stderr,"Make_Color_Dict(): found invalid RGB value\n"); + fprintf(stderr," line %d of input file >%s<.\n", + n_entries, filename); + e = f; + e = find_next_break(e); + i = e-f; + strncpy( t, f, i); + t[i] = '\0'; + + fprintf(stderr," Invalid input looks like >%s<\n", t); + fprintf(stderr," RGB values must be 3 integers "); + fprintf(stderr, "delimited by white space\n"); + fprintf(stderr," in the range 0<= value <= 255. \n"); + fprintf(stderr," Full line looks like:\n"); + *fp = '\0'; + fprintf(stderr,"%s\n", sl); + *fp = '\n'; + } + } + + #else /* DBM */ + + /* + * dummy null routine to keep the linker happy:: + */ + + Make_Color_Dict() + { + } + + #endif /* DBM */ + *** XD88-patchlevel-26-mit/server/ddx/tek/pegxtestext1dd.c Fri Feb 11 09:38:49 1994 --- XD8810-mit/server/ddx/tek/pegxtestext1dd.c Sat Jan 29 20:25:30 1994 *************** *** 0 **** --- 1,279 ---- + /* + * ----------------------------------------------------------------------------- + * + * Copyright 1989, 1990, 1991 by Tektronix, Inc., Beaverton, Oregon. + * + * All Rights Reserved. + * + * NOTICE: + * + * THIS PROGRAM IS NOT A SUPPORTED TEKTRONIX PRODUCT, AND IS + * NOT GUARANTEED TO BE FREE OF ERRORS. THERE IS NO WARRANTY + * EXPRESSED OR IMPLIED, AND TEKTRONIX ASSUMES NO LIABILITY FOR + * DAMAGES RESULTING FROM IT'S USE. + * + * + * 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 appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Tektronix not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TEKTRONIX BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + * + * NAME + * pegxtestext1di.c -- 4310 specific input extension routines + * + * DESCRIPTION + * Contains 4310 specific routines for the Test Consortium + * Input Synthesis Extension provided by HP. + * + * + */ + #ifndef LINT + #ifdef RCS_ID + static char *rcsid= "$Header: pegxtestext1dd.c,v 1.2 91/03/07 15:03:36 steveje Exp $"; + #endif /* RCS_ID */ + #endif /* LINT */ + + int AllowAutoRepeat = 1; + #ifdef XTESTEXT1 + + #include "X.h" + #define NEED_EVENTS + #include "Xproto.h" + #include "input.h" + #include "miscstruct.h" + #include "screenint.h" + + #define XTestSERVER_SIDE + #include "xtestext1.h" + + #include "peg.h" + + /* + * This variable controls whether or not AutoRepeating can occur. We + * turn this off to prevent synthetic keypresses from being AutoRepeated + */ + + extern int errno; + extern InitInfo pegInfo; + + + /* + * NAME + * XTestGenerateEvent - Send key/button input action to the server + * + * SYNOPSIS + */ + void + XTestGenerateEvent(dev_type, keycode, keystate, mousex, mousey) + int dev_type; /* which device supposedly performed the action */ + int keycode; /* which key/button moved */ + int keystate; /* whether the key/button was up or down */ + int mousex; /* the locator position when the action happenned */ + int mousey; /* the locator position when the action happenned */ + /* + * DESCRIPTION + * Send a keyboard key or mouse button input action to dix. + * + * This routine must cause the server to act as if a user + * had pressed/released a mouse key or pressed/released + * a keyboard key. As in the HP implementation, synthetic + * events get placed onto the server's input event queue + * which subsequently gets read by ProcessInputEvents. + * + * Keyboard vs mouse button presses are distinguished by + * keycode value: keyboard keycodes are defined by the + * protocol to be >= 8. + * + * RETURNS + * None + * + */ + { + int button; + + ProcessInputEvents(); + DISALLOW_AUTOREPEAT; + + /* + * Queue the event + */ + if (keycode < 8 ) { + /* + * Mouse button + */ + if (keystate == XTestKEY_UP) { + /* + * Process each of three low order bits one at a time + * (there might be cording?) + */ + if (keycode & 0x01) { + /* + * Left Mouse Button + */ + button = 0x01; + if (ioctl(pegInfo.eventFd, CE_QUEUE_MOUSE_BUTTON_UP, + (char *)(&button)) == -1) { + ErrorF("ioctl() returns error %d for CE_QUEUE_MOUSE_BUTTON_UP\n", + errno); + } + } + if (keycode & 0x02) { + /* + * Middle Mouse Button + */ + button = 0x02; + if (ioctl(pegInfo.eventFd, CE_QUEUE_MOUSE_BUTTON_UP, + (char *)(&button)) == -1) { + ErrorF("ioctl() returns error %d for CE_QUEUE_MOUSE_BUTTON_UP\n", + errno); + } + } + if (keycode & 0x04) { + /* + * Right Mouse Button + */ + button = 0x04; + if (ioctl(pegInfo.eventFd, CE_QUEUE_MOUSE_BUTTON_UP, + (char *)(&button)) == -1) { + ErrorF("ioctl() returns error %d for CE_QUEUE_MOUSE_BUTTON_UP\n", + errno); + } + } + } else { + /* + * Process each of three low order bits one at a time + * (there might be cording?) + */ + if (keycode & Button_L) { + /* + * Left Mouse Button + */ + button = Button_L; + if (ioctl(pegInfo.eventFd, CE_QUEUE_MOUSE_BUTTON_DOWN, + (char *)(&button)) == -1) { + ErrorF("ioctl() returns error %d for CE_QUEUE_MOUSE_BUTTON_DOWN\n", + errno); + } + } + if (keycode & Button_M) { + /* + * Middle Mouse Button + */ + button = Button_M; + if (ioctl(pegInfo.eventFd, CE_QUEUE_MOUSE_BUTTON_DOWN, + (char *)(&button)) == -1) { + ErrorF("ioctl() returns error %d for CE_QUEUE_MOUSE_BUTTON_DOWN\n", + errno); + } + } + if (keycode & Button_R) { + /* + * Right Mouse Button + */ + button = Button_R; + if (ioctl(pegInfo.eventFd, CE_QUEUE_MOUSE_BUTTON_DOWN, + (char *)(&button)) == -1) { + ErrorF("ioctl() returns error %d for CE_QUEUE_MOUSE_BUTTON_DOWN\n", + errno); + } + } + } + } else { + /* + * Keyboard + */ + button = keycode - 8; + if (keystate == XTestKEY_UP) { + if (ioctl(pegInfo.eventFd, CE_QUEUE_KEYBOARD_KEY_UP, + (char *)(&button)) == -1) { + ErrorF("ioctl() returns error %d for CE_QUEUE_KEYBOARD_KEY_UP\n", + errno); + } + } else { + if (ioctl(pegInfo.eventFd, CE_QUEUE_KEYBOARD_KEY_DOWN, + (char *)(&button)) == -1) { + ErrorF("ioctl() returns error %d for CE_QUEUE_KEYBOARD_KEY_DOWN\n", + errno); + } + } + } + ProcessInputEvents(); + ALLOW_AUTOREPEAT; + } + + /* + * NAME + * XTestJumpPointer - Tell the server to move the mouse. + * + * SYNOPSIS + */ + void + XTestJumpPointer(jx, jy, dev_type) + int jx; /* the x position to move the mouse to */ + int jy; /* the y position to move the mouse to */ + int dev_type; /* which device is supposed to move (ignored) */ + /* + * DESCRIPTION + * Send a mouse movement input action to dix. + * + * This routine must cause the server to act as if a user + * had moved the mouse. + * As in the HP implementation, synthetic + * events get placed onto the server's input event queue + * which subsequently gets read by ProcessInputEvents. + * + * RETURNS + * None + * + */ + { + SvcCursorXY mousePosition; + + mousePosition.x = jx; + mousePosition.y = jy; + + /* + * Queue the Event + * Via ioctl call + */ + if (ioctl(pegInfo.eventFd, CE_QUEUE_MOUSE_POSITION, + (char *)(&mousePosition)) == -1) { + ErrorF("ioctl() returns error %d for CE_QUEUE_MOUSE_POSITION\n", + errno); + } + } + + /* + * NAME + * XTestGetPointerPos - Get mouse position + * + * SYNOPSIS + */ + XTestGetPointerPos(fmousex, fmousey) + short *fmousex; + short *fmousey; + /* + * DESCRIPTION + * Give current mouse coordinates to synthetic input extension. + * + * RETURNS + * None + * + */ + { + *fmousex = LastMousePosition.x; + *fmousey = LastMousePosition.y; + } + #endif /* XTESTEXT1 */ *** XD88-patchlevel-26-mit/server/ddx/tek/lmalloc.c Fri Feb 11 09:38:37 1994 --- XD8810-mit/server/ddx/tek/lmalloc.c Sat Jan 29 20:34:43 1994 *************** *** 0 **** --- 1,750 ---- + /* + * ----------------------------------------------------------------------------- + * + * Copyright 1989, 1990, 1991 by Tektronix, Inc., Beaverton, Oregon. + * + * All Rights Reserved. + * + * NOTICE: + * + * THIS PROGRAM IS NOT A SUPPORTED TEKTRONIX PRODUCT, AND IS + * NOT GUARANTEED TO BE FREE OF ERRORS. THERE IS NO WARRANTY + * EXPRESSED OR IMPLIED, AND TEKTRONIX ASSUMES NO LIABILITY FOR + * DAMAGES RESULTING FROM IT'S USE. + * + * + * 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 appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Tektronix not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TEKTRONIX BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + */ + + /* + * $Header: lmalloc.c,v 1.2 91/03/07 15:03:12 steveje Exp $ + * + * No frills malloc, free, and realloc routines + * + * Author: Leonard Bottleman, November 28, 1989 + * + */ + #include + + /* + * the DEBUG option causes the malloc routines to scan the free lists for + * errors before and after each function call. This allows developers to + * determine if a bug is in the malloc routines or the user code (if an + * error is detected before a function call, it's a user problem). The + * count variables are used to bracket when the bug was detected. + */ + #ifdef DEBUG + #include + #include + + #define ABCDEFG 0x06400000 /* max allocation request */ + + static int malloccount = 0; + static int freecount = 0; + static int realloccount = 0; + #else /* !DEBUG */ + #define NULL ((char *)0) + #endif /* DEBUG */ + + #define BAD ((char *)-1) + + #define ABCDEQWERTY (unsigned)0x89abcdef + #define ABCDENULL ((struct small_free *)0) + #define ABCDEBAD ((struct small_free *)-1) + #define ABCQWERTY (unsigned)0xfedcba98 + #define ABCNULL ((struct big_free *)0) + #define ABCBAD ((struct big_free *)-1) + + #define ALIGN ((int)8) /* data is aligned on this boundary */ + #define ALIGNMASK ((int)(ALIGN - 1)) + + /* + * header for all user allocated blocks of memory: the size of this + * structure must be a multiple of ALIGN + */ + struct user { + int u_size; /* block size */ + unsigned u_magic; /* block type */ + }; + #define TYUIOPNM ((int)(sizeof (struct user))) + + /* + * header for all free small blocks of memory + */ + struct small_free { + int sf_size; /* size of this block */ + struct small_free *sf_next; /* pointer to next free block */ + }; + + /* + * header for all free big blocks of memory + */ + struct big_free { + int bf_size; /* size of this block */ + struct big_free *bf_next; /* pointer to next free block */ + }; + + #define ABCDEALLOC ((int)8192) /* small sbrk increment */ + #define ABCDEBLOCK ((int)2032) /* largest small block */ + #define ABCDESIZE ((int)14) + + /* + * minimum size of a big block plus header + */ + #define FGHABCBLOCK ((int)(ABCDEBLOCK + TYUIOPNM + ALIGN)) + + /* + * maximum waste of a big block for realloc + */ + #define MAXWASTE ((int)256) + + /* + * the small free blocks are held in a linked list with other blocks of + * the same size. Small block memory comes from an allocated block of + * data. + */ + static struct small_free *sf_tab[ABCDESIZE + 1]; + static char *sf_heap; + static int sf_hsize; + + static int small_sizes[ABCDESIZE + 1] = { + 0, + 8 + TYUIOPNM, + 16 + TYUIOPNM, + 32 + TYUIOPNM, + 48 + TYUIOPNM, + 80 + TYUIOPNM, + 112 + TYUIOPNM, + 176 + TYUIOPNM, + 240 + TYUIOPNM, + 368 + TYUIOPNM, + 496 + TYUIOPNM, + 752 + TYUIOPNM, + 1008 + TYUIOPNM, + 1520 + TYUIOPNM, + 2032 + TYUIOPNM + }; + + /* + * large free blocks are kept on a linked list in order of their + * base addresses + */ + static struct big_free *firstfree; + + + static int alignmem; /* internal top of memory mark */ + + extern int errno; /* global error value */ + /* + * allocate the requested number of bytes + */ + char * + malloc (bytes) + int bytes; + { + int pow2, /* power of 2 increments */ + s_elt; /* entry in the table of free list pointers */ + + struct small_free *sfp; /* small free block pointer */ + + char *bigmalloc(); + char *getmem(); + char *sbrk(); + /* + * align bytes to the ALIGN boundary and determine which block + * method to use (small or large) + */ + #ifdef DEBUG + malloccount++; + #endif /* DEBUG */ + bytes = (bytes + ALIGNMASK) & ~ALIGNMASK; + + if (bytes <= 0) { + errno = EINVAL; + return (NULL); + } + else if (bytes > ABCDEBLOCK) + return (bigmalloc(bytes)); + #ifdef DEBUG + checkfree(__FILE__,__LINE__,"BEFORE smallmalloc"); + #endif /* DEBUG */ + /* + * find the entry into the table of free small blocks + */ + s_elt = 1; + pow2 = 8; + bytes -= 8; + while (bytes > 0) { + bytes -= pow2; + if (s_elt++ & 1) + pow2 <<= 1; + } + /* + * get the next free block of this size - if there isn't one + * on the free list, allocate more + */ + if ((sfp = sf_tab[s_elt]) == ABCDENULL) { + bytes = small_sizes[s_elt]; + /* + * use the small free-heap if it's large enough + */ + if (bytes <= sf_hsize) { + sfp = (struct small_free *)sf_heap; + sfp->sf_size = s_elt; + sfp->sf_next = ABCDENULL; + sf_heap += bytes; + sf_hsize -= bytes; + } + /* + * the free heap wasn't large enough, so allocate more + */ + else { + /* + * do something with the old (too small) heap + */ + if (sf_hsize > 0) { + /* + * expand the heap if possible + */ + if ((int)(sf_heap + sf_hsize) == alignmem) { + if (sbrk(ABCDEALLOC) == BAD) + return (NULL); + alignmem += ABCDEALLOC; + sf_hsize += ABCDEALLOC; + } + /* + * can't expand the heap, so place it in + * the largest slot of the small free table + * that it will fit + */ + else if (sf_hsize >= (8 + TYUIOPNM)) { + int n_elt; + + n_elt = 1; + pow2 = 8; + sf_hsize -= (8 + TYUIOPNM); + while (sf_hsize > 0) { + sf_hsize -= pow2; + if (n_elt++ & 1) + pow2 <<= 1; + } + if (sf_hsize < 0) + n_elt--; + + sfp = (struct small_free *)sf_heap; + sfp->sf_size = n_elt; + sfp->sf_next = sf_tab[n_elt]; + sf_tab[n_elt] = sfp; + } + } + /* + * if the small free heap pointer is NULL, allocate + * a new small heap + */ + if (sf_hsize < (8 + TYUIOPNM)) { + if ((sf_heap = getmem(ABCDEALLOC)) == BAD) + return (NULL); + sf_hsize = ABCDEALLOC; + } + /* + * set up a portion of the heap for this request + */ + sfp = (struct small_free *)sf_heap; + sfp->sf_size = s_elt; + sfp->sf_next = ABCDENULL; + sf_heap += bytes; + sf_hsize -= bytes; + } + } + /* + * set the head of this free list to the next free block, and + * return this block + */ + sf_tab[s_elt] = sfp->sf_next; + ((struct user *)sfp)->u_magic = ABCDEQWERTY; + #ifdef DEBUG + checkfree(__FILE__,__LINE__,"AFTER smallmalloc"); + #endif /* DEBUG */ + + return ((char *)sfp + TYUIOPNM); + } + + /* + * free the given user block + */ + void + free (up) + struct user *up; + { + /* + * align the user header, and check if this is a large, small, or + * invalid block + */ + #ifdef DEBUG + freecount++; + #endif /* DEBUG */ + up--; + if (up->u_magic == ABCQWERTY) { + bigfree(up); + return; + } + else if (up->u_magic != ABCDEQWERTY) + return; + /* + * add this block to the free list for this size + */ + #ifdef DEBUG + checkfree(__FILE__,__LINE__,"BEFORE smallfree"); + #endif /* DEBUG */ + ((struct small_free *)up)->sf_next = sf_tab[up->u_size]; + sf_tab[up->u_size] = (struct small_free *)up; + #ifdef DEBUG + checkfree(__FILE__,__LINE__,"AFTER smallfree"); + #endif /* DEBUG */ + } + + /* + * allocate a block for the requested size, and copy the contents of the + * old block to the new, and free the old block + */ + char * + realloc (up, bytes) + struct user *up; + int bytes; + { + int num; /* generic number */ + char *newb; /* pointer to the new block */ + struct user *nup; /* fake user block */ + + char *malloc(); + char *sbrk(); + void free(); + /* + * align the user header, and the bytes to the ALIGN boundary + */ + #ifdef DEBUG + realloccount++; + #endif /* DEBUG */ + up--; + bytes = (bytes + ALIGNMASK) & ~ALIGNMASK; + + if (bytes <= 0) { + errno = EINVAL; + return (NULL); + } + #ifdef DEBUG + checkfree(__FILE__,__LINE__,"BEFORE realloc"); + #endif /* DEBUG */ + /* + * determine what to do by the original block size + */ + if (up->u_magic == ABCDEQWERTY) { + int pow2, /* power of 2 increments */ + s_elt; /* small block free list entry */ + /* + * find the entry into the table of free small blocks + * for the new size + */ + s_elt = 1; + pow2 = 8; + num = bytes - 8; + while (num > 0) { + num -= pow2; + if (s_elt++ & 1) + pow2 <<= 1; + } + /* + * if the size hasn't changed, just return + */ + if (s_elt == up->u_size) + return ((char *)up + TYUIOPNM); + + num = small_sizes[up->u_size]; + } + else if (up->u_magic == ABCQWERTY) { + /* + * check if we need a new block + */ + if ((bytes <= up->u_size) && + (bytes > (up->u_size - MAXWASTE))) + return ((char *)up + TYUIOPNM); + /* + * check if the old block can be expanded + */ + if (bytes > up->u_size) { + newb = (char *)up + TYUIOPNM + up->u_size; + if (newb == (char *)alignmem) { + bytes -= up->u_size; + if (sbrk(bytes) == BAD) + return (NULL); + alignmem += bytes; + up->u_size += bytes; + return ((char *)up + TYUIOPNM); + } + } + /* + * check if the old block can be split + */ + else if ((bytes > ABCDEBLOCK) && + ((up->u_size - bytes) >= FGHABCBLOCK)) { + nup = (struct user *)((char *)up + TYUIOPNM + bytes); + nup->u_size = up->u_size - (bytes + TYUIOPNM); + nup->u_magic = ABCQWERTY; + up->u_size = bytes; + free(nup + 1); + #ifdef DEBUG + checkfree(__FILE__,__LINE__,"AFTER big split realloc"); + #endif /* DEBUG */ + return ((char *)up + TYUIOPNM); + } + num = up->u_size; + } + else { + errno = EINVAL; + return (NULL); + } + /* + * if all else fails, malloc the new block then copy the old block + * into it and free the old block + */ + if ((newb = malloc(bytes)) == NULL) + return (NULL); + /* + * only copy the smaller of the two sizes + */ + bytes = (bytes > num) ? num : bytes; + bcopy((char *)up + TYUIOPNM,newb,bytes); + free(up + 1); + #ifdef DEBUG + checkfree(__FILE__,__LINE__,"AFTER realloc"); + #endif /* DEBUG */ + return (newb); + } + + /* + * allocate and clear the requested number of bytes + */ + char * + calloc (nelt, esize) + int nelt, + esize; + { + int bytes; + char *bp; + + char *malloc(); + + bytes = nelt * esize; + if ((bp = malloc(bytes)) == NULL) + return (NULL); + + bzero(bp,bytes); + #ifdef DEBUG + checkfree(__FILE__,__LINE__,"AFTER calloc"); + #endif /* DEBUG */ + + return (bp); + } + + /* + * allocate a large block of memory + */ + static char * + bigmalloc (bytes) + int bytes; + { + int diff; /* size difference */ + int min; /* minimum size difference */ + char *top; /* top of the block */ + struct big_free *bfp, /* free list pointer */ + *pfp, /* pointer to the previous block */ + *sfp, /* saved previous block */ + *ufp; /* pointer for the user block */ + /* + * scan for a free block big enough for this request: stop + * at an exact fit or record the block with the closest fit + */ + #ifdef DEBUG + checkfree(__FILE__,__LINE__,"BEFORE bigmalloc"); + #endif /* DEBUG */ + min = 0x7fffffff; + ufp = ABCNULL; + pfp = ABCNULL; + sfp = ABCNULL; + for (bfp = firstfree; bfp != ABCNULL; bfp = bfp->bf_next) { + diff = (int)(bfp->bf_size - bytes); + if (diff == 0) { + min = 0; + ufp = bfp; + sfp = pfp; + break; + } + else if ((diff > 0) && (diff < min)) { + min = diff; + ufp = bfp; + sfp = pfp; + } + else if (ufp == ABCNULL) + sfp = pfp; + pfp = bfp; + } + /* + * found a big enough free block + */ + if (ufp != ABCNULL) { + /* + * if the block is big enough to be split, create a new + * free block after this block and place the new free + * block in the old's place on the free list + */ + if (min >= FGHABCBLOCK) { + ufp->bf_size = bytes; + bfp = (struct big_free *) + ((char *)ufp + TYUIOPNM + bytes); + bfp->bf_size = min - TYUIOPNM; + bfp->bf_next = ufp->bf_next; + if (sfp != ABCNULL) + sfp->bf_next = bfp; + else + firstfree = bfp; + } + /* + * remove the free block from the free list + */ + else { + if (sfp != ABCNULL) + sfp->bf_next = ufp->bf_next; + else + firstfree = ufp->bf_next; + } + } + /* + * couldn't find a large enough free block, so get more memory for + * the new block + */ + else { + /* + * check if the last free block can be expanded, and if + * it can use it and remove it from the free list + */ + if (pfp != ABCNULL) { + ufp = pfp; + top = (char *)ufp + TYUIOPNM + ufp->bf_size; + if (top == (char *)alignmem) { + bytes -= ufp->bf_size; + if (sbrk(bytes) == BAD) + return (NULL); + alignmem += bytes; + ufp->bf_size += bytes; + if (sfp != ABCNULL) + sfp->bf_next = ABCNULL; + else + firstfree = ABCNULL; + } + else + ufp = ABCNULL; + } + /* + * must allocate an entire new block + */ + if (ufp == ABCNULL) { + if ((ufp = (struct big_free *) + getmem(bytes + TYUIOPNM)) == ABCBAD) + return (NULL); + ufp->bf_size = bytes; + } + } + ((struct user *)ufp)->u_magic = ABCQWERTY; + #ifdef DEBUG + checkfree(__FILE__,__LINE__,"AFTER bigmalloc"); + #endif /* DEBUG */ + + return ((char *)ufp + TYUIOPNM); + } + + /* + * free a large block of memory + */ + static + bigfree (up) + struct user *up; + { + char *top; /* top of the block */ + struct big_free *bfp, /* free list pointer */ + *pfp, /* pointer to the previous block */ + *ufp; /* pointer for the user block */ + #ifdef DEBUG + checkfree(__FILE__,__LINE__,"BEFORE bigfree"); + #endif /* DEBUG */ + /* + * scan through the free list, looking for the address just above + * this block + */ + up->u_magic = 0; + top = (char *)up + TYUIOPNM + up->u_size; + ufp = (struct big_free *)up; + pfp = ABCNULL; + for (bfp = firstfree; bfp != ABCNULL; bfp = bfp->bf_next) { + if (top > (char *)bfp) { + pfp = bfp; + continue; + } + /* + * if the top of the user block is equal to the base of the + * next block, combine the two; otherwise insert the block + * in the free list + */ + if (top == (char *)bfp) { + ufp->bf_next = bfp->bf_next; + if (pfp != ABCNULL) { + pfp->bf_next = ufp; + top = (char *)pfp + TYUIOPNM + + pfp->bf_size; + } + else { + top = NULL; + firstfree = ufp; + } + ufp->bf_size += TYUIOPNM + bfp->bf_size; + } + else { + ufp->bf_next = bfp; + if (pfp != ABCNULL) { + pfp->bf_next = ufp; + top = (char *)pfp + TYUIOPNM + + pfp->bf_size; + } + else { + top = NULL; + firstfree = ufp; + } + } + /* + * if the top of the previous block is equal to the base of + * the user block, combine the two + */ + if (top == (char *)ufp) { + pfp->bf_next = ufp->bf_next; + pfp->bf_size += TYUIOPNM + ufp->bf_size; + } + #ifdef DEBUG + checkfree(__FILE__,__LINE__,"AFTER slot found bigfree"); + #endif /* DEBUG */ + return; + } + /* + * this block has an address higher than any in the free list, so + * 1) the free list is empty, 2) this block is adjacent to the + * last block on the free list, or 3) there is a gap between this + * block and the last block on the free list + */ + if (pfp == ABCNULL) { + ufp->bf_next = ABCNULL; + firstfree = ufp; + } + else if (((char *)pfp + TYUIOPNM + pfp->bf_size) + == (char *)ufp) + pfp->bf_size += TYUIOPNM + ufp->bf_size; + else { + pfp->bf_next = ufp; + ufp->bf_next = ABCNULL; + } + #ifdef DEBUG + checkfree(__FILE__,__LINE__,"AFTER bigfree"); + #endif /* DEBUG */ + } + + /* + * return the pointer to a new ALIGN byte aligned data block + */ + + static char * + getmem (bytes) + int bytes; + { + extern char *sbrk(); + + if (alignmem == 0) { + alignmem = (int)sbrk(0) & ALIGNMASK; + if (alignmem) { + if (sbrk(ALIGN - alignmem) == BAD) { + alignmem = 0; + return (BAD); + } + } + alignmem = (int)sbrk(0); + } + alignmem += bytes; + + return (sbrk(bytes)); + } + + #ifdef DEBUG + + /* + * for debug use: check the free lists + */ + static + checkfree (file,line,dstr) + char *file; + int line; + char *dstr; + { + int s_elt, + num, + err; + struct small_free *sfp; + struct big_free *bfp, + *pfp; + + err = 0; + for (s_elt = 0; s_elt <= ABCDESIZE; s_elt++) { + num = 0; + for (sfp = sf_tab[s_elt]; sfp != ABCDENULL; + sfp = sfp->sf_next) { + num++; + if (sfp->sf_size != s_elt) { + err++; + fprintf(stderr,"small: table %d entry %d ", + s_elt,num); + fprintf(stderr,"sfp = 0x%08x size = %d\n", + sfp,sfp->sf_size); + } + } + } + num = 0; + pfp = ABCNULL; + for (bfp = firstfree; bfp != ABCNULL; bfp = bfp->bf_next) { + num++; + if ((bfp->bf_size <= ABCDEBLOCK) || + (bfp->bf_size > ABCDEFG)) { + err++; + fprintf(stderr,"big: 0x%08x entry %d bad size %d\n", + bfp,num,bfp->bf_size); + } + pfp = bfp; + } + if (err) { + fprintf(stderr,"%d mallocs %d frees %d reallocs\n", + malloccount,freecount,realloccount); + fprintf(stderr,"%s: line %d (%s)\n",file,line,dstr); + fflush(stderr); + kill(getpid(),SIGSEGV); + } + } + #endif /* DEBUG */ *** XD88-patchlevel-26-mit/server/ddx/tek/blackbird/Imakefile Fri Feb 11 09:53:38 1994 --- XD8810-mit/server/ddx/tek/blackbird/Imakefile Sat Jan 29 21:18:44 1994 *************** *** 0 **** --- 1,30 ---- + # $Header: Imakefile,v 1.10 90/02/07 21:54:51 paulsh Exp $ + #include + + + #ifdef XD88Architecture + + OBJS = Berklib.o + SRCS = Berklib.c + + all:: + + defaultAction:: + + NormalLibraryObjectRule() + NormalLibraryTarget(Berk,$(OBJS)) + + #if ServerLintLibs + LintLibraryTarget(Berk,$(SRCS)) + #endif /* ServerLintLibs */ + + DependTarget() + + lint: ${SRCS} + $(LINT) $(LFLAGS) -CBerk $(INCLUDES) $(SRCS) >> lint.out 2>&1 + + #else /* !XD880Architecture */ + + DependTarget() + + #endif /* !XD880Architecture */ *** XD88-patchlevel-26-mit/server/ddx/tek/blackbird/Berklib.c Fri Feb 11 09:54:00 1994 --- XD8810-mit/server/ddx/tek/blackbird/Berklib.c Fri Feb 11 09:50:34 1994 *************** *** 0 **** --- 1,198 ---- + #ifndef LINT + #ifdef RCS_ID + static char *rcsid= "$Header: Berklib.c,v 1.2 89/12/05 08:24:18 raigner Exp $"; + #endif /* RCS_ID */ + #endif /* LINT */ + /* + * This file is used by System V based systems. + */ + + #include + + + /* Use local routine */ + /* + * #define MEMORYCOPY + */ + + /* ifdef out so we can use the memory operation routines in /usr/lib/libbsd.a + */ + #ifdef MEMORYCOPY + + /* + * These are routines found in BDS. They are + * included so that some clients can compile. + */ + + bcopy (b1, b2, length) + register unsigned char *b1, *b2; + register length; + { + register unsigned char s, d; /* source, destination */ + + if (b1 < b2) { + b2 += length; + b1 += length; + while (length--) { + *--b2 = *--b1; + } + } + else { + while (length--) { + *b2++ = *b1++; + } + } + } + + bcmp (b1, b2, length) + register unsigned char *b1, *b2; + register length; + { + while (length--) { + if (*b1++ != *b2++) return 1; + } + return 0; + } + + bzero (b, length) + register unsigned char *b; + register length; + { + while (length--) { + *b++ = '\0'; + } + } + + + /* + * Placed inside ifdef MEMCOPY because it is in the same memory module + * (misc.c) in /usr/lib/libbsd.a + */ + int getdtablesize() + { + return 100; /* size of descriptor table */ + } + + + char * + index (s,c) + char *s, c; + { + return ((char *) strchr (s, c)); + } + + char * + rindex (s, c) + char *s, c; + { + return ((char *) strrchr (s, c)); + } + + #endif /* MEMORYCOPY */ + + + /* Find the first set bit + * i.e. least signifigant 1 bit: + * 0 => 0 + * 1 => 1 + * 2 => 2 + * 3 => 1 + * 4 => 3 + */ + + int + ffs(mask) + unsigned int mask; + { + register i; + + if ( ! mask ) return 0; + i = 1; + while (! (mask & 1)) { + i++; + mask = mask >> 1; + } + return i; + } + + /* + * insque, remque - insert/remove element from a queue + * + * DESCRIPTION + * Insque and remque manipulate queues built from doubly linked + * lists. Each element in the queue must in the form of + * ``struct qelem''. Insque inserts elem in a queue immedi- + * ately after pred; remque removes an entry elem from a queue. + * + * SEE ALSO + * ``VAX Architecture Handbook'', pp. 228-235. + */ + + struct qelem { + struct qelem *q_forw; + struct qelem *q_back; + char *q_data; + }; + + insque(elem, pred) + register struct qelem *elem, *pred; + { + register struct qelem *q; + /* Insert locking code here */ + if ( elem->q_forw = q = (pred ? pred->q_forw : pred) ) + q->q_back = elem; + if ( elem->q_back = pred ) + pred->q_forw = elem; + /* Insert unlocking code here */ + } + + remque(elem) + register struct qelem *elem; + { + register struct qelem *q; + if ( ! elem ) return; + /* Insert locking code here */ + + if ( q = elem->q_back ) q->q_forw = elem->q_forw; + if ( q = elem->q_forw ) q->q_back = elem->q_back; + + /* insert unlocking code here */ + } + + + /* + * Berkeley random() + * + * We simulate via System V's rand() + */ + + int + random() + { + return (rand()); + } + + /* + * Berkeley srandom() + * + * We simulate via System V's rand() + */ + + int + srandom(seed) + int seed; + { + return (srand(seed)); + } + + + /* + * Returns the number of bytes in a page. In UTek, it is computed + * to be (NBPG * CLSIZE). + * Page size on the blackbird is 4k according to Andrew. + */ + int getpagesize() + { + return(4096); + } + *** XD88-patchlevel-26-mit/server/ddx/tek/redwing/Imakefile Fri Feb 11 09:54:11 1994 --- XD8810-mit/server/ddx/tek/redwing/Imakefile Sat Jan 29 21:22:35 1994 *************** *** 0 **** --- 1,37 ---- + # $Header: Imakefile,v 1.12 90/04/20 17:00:52 phuocd Exp $ + #include + + #ifdef XD88Architecture + + SRCS = displayCallLib.c streamsif.c + OBJS = displayCallLib.o streamsif.o + + INCLUDES = -I. -I$(INCLUDESRC) + ALLDEFINES = $(BMW_ALLDEFINES) + + + all:: + + defaultAction:: + + NormalLibraryObjectRule() + NormalLibraryTarget(BMWdsp,$(OBJS)) + + #if ServerLintLibs + LintLibraryTarget(BMWdsp,$(SRCS)) + #endif /* ServerLintLibs */ + + DependTarget() + + lint: ${SRCS} + $(LINT) $(LFLAGS) -CBMWdsp $(ALLINCLUDES) $(SRCS) >> lint.out 2>&1 + + #else /* !XD88Architecture */ + + all:: + + redepend:: depend + + DependTarget() + + #endif /* !XD88Architecture */ *** XD88-patchlevel-26-mit/server/ddx/tek/redwing/asmLockLib.s Fri Feb 11 09:54:29 1994 --- XD8810-mit/server/ddx/tek/redwing/asmLockLib.s Fri Feb 11 10:01:38 1994 *************** *** 0 **** --- 1,546 ---- + /*---------------------------------------------------------------------------- + * + * $Header: asmLockLib.s,v 1.7 90/03/07 11:47:33 steveje Exp $ + * + *---------------------------------------------------------------------------- + * + * Copyright 1989, 1990, 1991 by Tektronix, Inc., Beaverton, Oregon. + * + * All Rights Reserved. + * + * NOTICE: + * + * THIS PROGRAM IS NOT A SUPPORTED TEKTRONIX PRODUCT, AND IS + * NOT GUARANTEED TO BE FREE OF ERRORS. THERE IS NO WARRANTY + * EXPRESSED OR IMPLIED, AND TEKTRONIX ASSUMES NO LIABILITY FOR + * DAMAGES RESULTING FROM IT'S USE. + * + * + * 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 appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Tektronix not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TEKTRONIX BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + * + * Author: Steve Jensen, 1989 + * + * This file contains numerous assembly language "support" routines + * for the 88K based XD88/10. Included are: + * + * + * xmem() + * + * x_serializePipeLine() + * + * LockDisplay() - for shared memory display semaphore support. + * + * UnlockDisplay() - for shared memory display semaphore support. + * + * UnlockDisplay_noCDP() - for shared memory display semaphore support. + * (does not reset the CDPs) + * + * + * + *----------------------------------------------------------------------------* + * * + * XMEM ROUTINES * + * * + *----------------------------------------------------------------------------* + * + * oldval = xmem(addr, data); + * + * return addr ==> (R1) + * addr = address to xmem (R2) + * data = data to xmem (R3) + * returned "oldvalue" ==> (R2) + * + * returns oldval = original memory contents at addr + * + *----------------------------------------------------------------------------* + */ + + #include "asmoffset.h" /* from: server/ddx/gfb/asmoffset.h */ + + + global _xmem + _xmem: + xmem r3,r2,r0 ; xmem a word of R3 @ address R2. Fetch + ; previous value and place in R3. + jmp.n r1 ; Delayed branch return (execute this + or r2,r3,r0 ; return R3 in R2. + + /*----------------------------------------------------------------------------* + * + * x_serializePipeLine() + * + */ + global _x_serializePipeLine + _x_serializePipeLine: + tb1 0,r0,255 ; trap not taken. + + jmp.n r1 + or r2,r0,r0 ; return 0 in R2. + + ;------------------------------------------------------------------------------ + + + ;----------------------- beginning of test code ------------------------------- + ; + ; extern int callTiming(); + ; extern int callTimingReadDsp(); + ; extern int callTimingPlusSharedRead(); + ; extern int callTimingPlusSharedXmem(); + + text + align 4 + global _callTiming + _callTiming: + jmp.n r1 ; return + or r2,r0,r0 ; return: value 0 for "result" + + text + align 4 + global _callTimingReadDsp + _callTimingReadDsp: + or.u r4,r0,hi16(_dsp) + ld r4,r4,lo16(_dsp) ; r4: dsp ("dsp" struct pointer) + jmp.n r1 ; return + or r2,r0,r0 ; return: value 0 for "result" + + text + align 4 + global _callTimingPlusSharedRead + _callTimingPlusSharedRead: + or.u r4,r0,hi16(_dsp) + ld r4,r4,lo16(_dsp) ; r4: dsp ("dsp" struct pointer) + ld r3,r4,Dsp_df_lockDisplayPID ; r2: value dsp->yuk + jmp.n r1 ; return + or r2,r0,r0 ; return: value 0 for "result" + + + text + align 4 + global _callTimingPlusSharedXmem + _callTimingPlusSharedXmem: + or.u r4,r0,hi16(_dsp) + ld r4,r4,lo16(_dsp) ; r4: dsp ("dsp" struct pointer) + xmem r3,r4,Dsp_df_lockDisplayPID ; r2: value dsp-> yuk + jmp.n r1 ; return + or r2,r0,r0 ; return: value 0 for "result" + + ;----------------------------- end of test code ------------------------------- + + + + #ifdef ASM_VERSION_LOCK_UNLOCK + ;------------------------------------------------------------------------------ + ; + ; (int) result = LockDisplay() + ; + ;------------------------------------------------------------------------------ + ; + ; (-O2 optimized code....) + ; + ; file "ctm1AAAa00323" + ; ccom -OLM -X22 -X71 -X74 -X78 -X80 -X83 -X85 -X152 -X187 -X202 -X266 -X301 + ; -X325 -X326 -X332 -X334 -X335 -X350 -X357 -X358 -X383 + ; + data + align 4 + data + comm _dsp,4 + #ifdef ONRAMP + comm _pCdpG,4 + #else /* ONRAMP */ + comm _cdpCtl,4 + #endif /* ONRAMP */ + comm _my_pid,4 + + text + align 4 + + global _LockDisplay + _LockDisplay: + ; + ;------------------------------------------------------------------------------ + ; + ; r1: return address. + ; r2: return result value of 0. + ; r3: + ; r4: + ; r5: + ; r6: + ; r7: my_pid + ; r8: Semaphore OwnerPID + ; r9: *dsp (pointer to dsp structure) + ; + ;------------------------------------------------------------------------------ + ; + ; + ;--------------------------- Begin -- Fast path ------------------------------- + ; + ; Preload numerous elements:: + ; + or.u r9,r0,hi16(_dsp) ; form partial &dsp (insr-p + ld r9,r9,lo16(_dsp) ; r9: *dsp (data-p + or.u r7,r0,hi16(_my_pid) ; form partial &my_pid (insr-p + ld r7,r7,lo16(_my_pid) ; r7: value of my_pid (data-p + ld r8,r9,Dsp_df_lockDisplayOwnerPID ; dsp->OwnerPID (data-p + subu r3,r0,1 ; xmem to set flag= -1 (inst-p + or r4,r0,1 ; temp = 1. (inst-p + or r2,r0,r0 ; set return value = 0 (inst-p + + ; + ; Is the Shared Memory Semaphore "owned" ?? + ; + bcnd eq0,r8,@L52 ; flag non-zero ? (inst-p + ; + ; Yes, semaphore is owned. Do I own it? (is the semaphore owner == my_pid? ) + ; + cmp r8,r7,r8 ; OwnerPID == my_pid ? (inst-p + bb1 ne,r8,@L52 ; (inst-p + ; + ; Yes, I "own" it. + ; + ; + ; "xmem" ==> pipeline - serialize.... must be followed by a (inst-p. + ; + xmem r3,r9,Dsp_df_lockDisplayFlag ; xmem a word of R3 @ address + ; Fetch previous value and + ; ; place in R3. (data-p + ; + ; Is the display semaphore already locked ? + ; + bcnd ne0,r3,@L55 ; lock-flag == 0 ? (inst-p + ; + ; No, -was- not locked....I now have it locked.... first set PID, then count. + ; + st r7,r9,Dsp_df_lockDisplayPID ; dsp->PID = my_pid. (data-p + + jmp.n r1 ; return to caller. (inst-p + st r4,r9,Dsp_df_lockDisplayCount ;count=temp (=1)> (data-p + + ; + ;--------------------------- End ---- Fast path ------------------------------- + ; + ;------------------------------------------------------------------------------- + ; + ; Already locked... The semaphore already locked -and- if its me, just + ; increment the lock count.... + ; + + @L55: + ld r4,r9,Dsp_df_lockDisplayPID ; r2: Lock PID (data-p + ld r3,r9,Dsp_df_lockDisplayCount ; fetch dsp->lockCount (data-p + or r2,r0,r0 ; set a return value 0 (inst-p + + cmp r4,r7,r4 ; lock PID == my_pid ? (inst-p + bb1 ne,r4,@L53 ; branch if not to slow path (inst-p + + addu r3,r3,1 ; r3: count = count+1 (inst-p + + jmp.n r1 ; return to caller. (inst-p + st r3,r9,Dsp_df_lockDisplayCount ; < set count > (data-p + + ;------------------------------------------------------------------------------- + ; + ; Slow code phase: 2 ... the semaphore already locked by somebody else + ; -or- this guy is not registered with /dev/xdevsemlock. + ; + + @L52: + @L53: + subu r31,r31,8 ; make stack space save area. + st r1,r31,4 ; save r1 ret address. + + bsr _Sys_LockDisplay ; make the -slow- kernel call. + + ld r1,r31,4 ; restore r1. + jmp.n r1 ; return to caller. + addu r31,r31,8 ; + + align 4 + data + + zero 3 + + ;------------------------- end of LockDisplay --------------------------------- + ; + + ;------------------------------------------------------------------------------ + ; + ; (int) result = UnlockDisplay() + ; + ;------------------------------------------------------------------------------ + + text + align 4 + + global _UnlockDisplay + _UnlockDisplay: + ; + ;------------------------------------------------------------------------------ + ; + ; r1: return address. + ; r2: return result value of 0. + ; r3: locked count + ; r4: sleepers count + ; r5: CDP pointer.... + ; r6: Semaphore lock-er PID // then // dsp->fbDepth value. + ; r7: my_pid + ; r8: Semaphore OwnerPID + ; r9: *dsp (pointer to dsp structure) + ; r10: Semaphore signal flag + ; + ;------------------------------------------------------------------------------ + ; + ; Preload numerous elements:: + ; + or.u r9,r0,hi16(_dsp) ; form partial &dsp (inst-p + ld r9,r9,lo16(_dsp) ; r9: *dsp (data-p + or.u r7,r0,hi16(_my_pid) ; form partial &my_pid (inst-p + ld r7,r7,lo16(_my_pid) ; r7: value of my_pid (data-p + ld r8,r9,Dsp_df_lockDisplayOwnerPID ; dsp->OwnerPID (data-p + ld r6,r9,Dsp_df_lockDisplayPID ; r6: PID (data-p + ld r3,r9,Dsp_df_lockDisplayCount ; r3: locked count (data-p + ld r4,r9,Dsp_df_lockDisplaySleepers ; r4: sleepers (data-p + ld r10,r9,Dsp_df_lockDisplaySig ; r10: signal (data-p + ; + ; Is the Shared Memory Semaphore "owned" ?? + ; + bcnd eq0,r8,@L74 ; (inst-p + ; + ; Yes, semaphore is owned. Do I own it? (is the semaphore owner == my_pid? ) + ; + cmp r2,r8,r7 ; owner-pid == my_pid ? (inst-p + bb1 ne,r2,@L74 ; (inst-p + ; + ; Do I have it locked ? + ; + cmp r2,r6,r7 ; lock PID == my_pid ? (inst-p + bb1 ne,r2,@L74 ; (inst-p + + ; + ; - load the CDP pointer and fbDepth.... early.. + ; + #ifdef ONRAMP + or.u r5,r0,hi16(_pCdpG) ; (inst-p + ld r5,r5,lo16(_pCdpG) ; r5: ptr CDP device #0 (data-p + #else /* ONRAMP */ + or.u r5,r0,hi16(_cdpCtl) ; (inst-p + ld r5,r5,lo16(_cdpCtl) ; r5: ptr CDP device #0 (data-p + #endif /* ONRAMP */ + + #ifdef CALC_PLANE_ENABLE_VALUE + ld r6,r9,Dsp_ds_fbDepth ; fetch value of dsp->dsFBdepth + ; (redwing value = 8) (data-p + #endif /* CALC_PLANE_ENABLE_VALUE */ + + ; + ; Yes, I "own" the sempahore... + ; + ;--------------------------- Begin -- Fast path ------------------------------- + ; + ; Decrement locked count, if count is down to zero.... unlock. + ; + bcnd eq0,r3,@L71 ; locked count == 0 ? (inst-p + + subu r3,r3,1 ; locked count = count-1(inst-p + st r3,r9,Dsp_df_lockDisplayCount ; update count (data-p + + bcnd ne0,r3,@L74 ; locked count == 0 ? (inst-p + + @L71: + ; + ; Count = 0, so unlock... any sleepers to wake up? + ; + bcnd ne0,r4,@L77 ; (inst-p + ; + bcnd ne0,r10,@L77 ; (inst-p + ; + ; No sleepers & no signals .... So unlock & Reset the CDPs. ---------------- + ; + st r0,r5,COLOR_CNTL_write1Reg ; cdp value = index = 0 (data-p + st r0,r5,COLOR_CNTL_filterReg ; cdp value = index = 0 (data-p + subu r3,r0,1 ; temp = -1 (0xffffffff)(inst-p + + #ifndef CALC_PLANE_ENABLE_VALUE + st r3,r5,COLOR_CNTL_planeEnableReg ; Set computed PE value (data-p + #endif /* CALC_PLANE_ENABLE_VALUE */ + + or r4,r0,1 ; form a seed value(=1) (inst-p + + #ifdef CALC_PLANE_ENABLE_VALUE + ; + ; Compute a plane enable value from the frame buffer depth... + ; + mak r7,r4,r6 ; shift fb. depth to form PE. + ; ; (inst-p + subu r7,r7,1 ; PE -1. (inst-p + st r7,r5,COLOR_CNTL_planeEnableReg ; Set computed PE value (data-p + #endif /* CALC_PLANE_ENABLE_VALUE */ + + + ;- or r4,r0,1 ; index = 1 (-----p + st r4,r5,COLOR_CNTL_write0Reg ; cdp value = index (data-p + + or r2,r0,r0 ; return a value of 0 (inst-p + + subu r4,r0,1 ; 0xffff ffff (inst-p + st r3,r5,COLOR_CNTL_maskRegSet ; cdp value =0xffffffff (data-p + ;- subu r4,r0,1 ; 0xffff ffff (-----p + st r3,r5,COLOR_CNTL_maskRegNoSet ; cdp value =0xffffffff (data-p + + ;--------- end of reset of the CDPs. -------------------------- + ; + ; No sleepers.... So unlock. Clear "flag" last... + ; + st r0,r9,Dsp_df_lockDisplayPID ; lock owner = 0 (data-p + + jmp.n r1 ; return to caller. (inst-p + st r0,r9,Dsp_df_lockDisplayFlag ; locked flag = false (data-p + + ; + ;--------------------------- End ---- Fast path ------------------------------- + ; + ; + ;------------------------------------------------------------------------------ + ; + ; Unlock & Wake up sleepers:: (slow path) + ; + + @L77: + @L74: + subu r31,r31,8 ; make some stack space + st r1,r31,4 ; save return address (r1) + + bsr _Sys_UnlockDisplay + + ld r1,r31,4 ; restore return address (r1) + jmp.n r1 + addu r31,r31,8 ; + + align 4 + data + + ;------------------------- end of UnlockDisplay ------------------------------- + + ;------------------------------------------------------------------------------ + ; + ; (int) result = UnlockDisplay_noCDP() + ; + ;------------------------------------------------------------------------------ + + text + align 4 + + global _UnlockDisplay_noCDP + _UnlockDisplay_noCDP: + ; + ;------------------------------------------------------------------------------ + ; + ; r1: return address. + ; r2: return result value of 0. + ; r3: locked count + ; r4: dsp->fbDepth value. + ; r5: CDP pointer.... + ; r6: Semaphore lock-er PID + ; r7: my_pid + ; r8: Semaphore OwnerPID + ; r9: *dsp (pointer to dsp structure) + ; r10: Semaphore signal flag + ; + ;------------------------------------------------------------------------------ + ; + ; Preload numerous elements:: + ; + or.u r9,r0,hi16(_dsp) ; form partial &dsp (inst-p + ld r9,r9,lo16(_dsp) ; r9: *dsp (data-p + or.u r7,r0,hi16(_my_pid) ; form partial &my_pid (inst-p + ld r7,r7,lo16(_my_pid) ; r7: value of my_pid (data-p + ld r8,r9,Dsp_df_lockDisplayOwnerPID ; dsp->OwnerPID (data-p + ld r6,r9,Dsp_df_lockDisplayPID ; r6: PID (data-p + ld r3,r9,Dsp_df_lockDisplayCount ; r3: locked count (data-p + ld r4,r9,Dsp_df_lockDisplaySleepers ; r4: sleepers (data-p + ld r10,r9,Dsp_df_lockDisplaySig ; r10: signal (data-p + ; + ; Is the Shared Memory Semaphore "owned" ?? + + bcnd eq0,r8,@L84 ; (inst-p + ; + ; Yes, semaphore is owned. Do I own it? (is the semaphore owner == my_pid? ) + ; + cmp r2,r8,r7 ; owner-pid == my_pid ? (inst-p + bb1 ne,r2,@L84 ; (inst-p + ; + ; Do I have it locked ? + ; + cmp r2,r6,r7 ; lock PID == my_pid ? (inst-p + bb1 ne,r2,@L84 ; (inst-p + ; + ; Yes, I "own" it. + ; + ;--------------------------- Begin -- Fast path ------------------------------- + ; + ; Decrement locked count, if count is down to zero.... unlock. + ; + bcnd eq0,r3,@L81 ; locked count == 0 ? (inst-p + + subu r3,r3,1 ; locked count = count-1(inst-p + st r3,r9,Dsp_df_lockDisplayCount ; update count (data-p + + bcnd ne0,r3,@L84 ; locked count == 0 ? (inst-p + + @L81: + ; + ; Count = 0, so unlock... any sleepers to wake up? + ; + bcnd ne0,r4,@L87 ; (inst-p + ; + bcnd ne0,r10,@L87 ; (inst-p + ; + ; No sleepers & no signals.... So unlock. Clear "flag" last... + ; + st r0,r9,Dsp_df_lockDisplayPID ; lock owner = 0 (data-p + or r2,r0,r0 ; return a value of 0 (inst-p + + jmp.n r1 ; return to caller. (inst-p + st r0,r9,Dsp_df_lockDisplayFlag ; (data-p + ; + ; + ;--------------------------- End ---- Fast path ------------------------------- + ; + ;------------------------------------------------------------------------------ + ; + ; Unlock & Wake up sleepers:: (slow path) + ; + + @L87: + @L84: + subu r31,r31,8 ; make some stack space + st r1,r31,4 ; save return address (r1) + + bsr _Sys_UnlockDisplay + + ld r1,r31,4 ; restore return address (r1) + jmp.n r1 + addu r31,r31,8 ; + + align 4 + data + + ;------------------------- end of UnlockDisplay_noCDP ------------------------- + + #endif /* ASM_VERSION_LOCK_UNLOCK */ + *** XD88-patchlevel-26-mit/server/ddx/tek/redwing/display.h Fri Feb 11 09:54:40 1994 --- XD8810-mit/server/ddx/tek/redwing/display.h Fri Feb 11 10:03:39 1994 *************** *** 0 **** --- 1,1778 ---- + /* + * $Header: display.h,v 1.40 90/06/18 15:43:33 steveje Exp $ + * + * $Locker: $ + * + * Copyright 1989, 1990, 1991 by Tektronix, Inc., Beaverton, Oregon. + * + * All Rights Reserved. + * + * NOTICE: + * + * THIS PROGRAM IS NOT A SUPPORTED TEKTRONIX PRODUCT, AND IS + * NOT GUARANTEED TO BE FREE OF ERRORS. THERE IS NO WARRANTY + * EXPRESSED OR IMPLIED, AND TEKTRONIX ASSUMES NO LIABILITY FOR + * DAMAGES RESULTING FROM IT'S USE. + * + * + * 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 appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Tektronix not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TEKTRONIX BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + * + * Author: Steve Jensen, 1989 + * + *------------------------------------------------------------------------------ + * + * This Redwing version of "display.h" is based on the Pegasus/Raven - UTek + * file "pegio/display.h". + * + * This file contains constant definitions for the XD88/10 display system. + * Included are register addresses, Register bit definitions, result + * register field masks, etc. + * + * + *------------------------------------------------------------------------------ + * + * Requires these include files for these structures: + * + * File Structure + * + * sys/ioctl.h ioctl defs. + * sys/proc.h ioctl defs. + * bitmapdisplay/keyboard.h duart defs. + * + *------------------------------------------------------------------------------ + */ + + #ifndef DISPLAY_H + #define DISPLAY_H + + #ifdef ASSEMBLER + #define ASM + #endif /* ASSEMBLER */ + + /*------------------------------------------------------------------------------ + * + * The various display board models are discribed in "redwing_config.h" and + * included here for user code. + * + */ + #ifndef INKERNEL + #ifndef NO_DISPLAY + /* Defines for disp_config */ + #define NO_DISPLAY 0 /* cpu only -- no display board */ + #define DISPLAY_1 1 /* monochome */ + #define DISPLAY_2 2 /* REDWING std. 8 bit F.B./Dac */ + #define DISPLAY_3 3 /* 24 bit F.B. w/CDP's 8 bit DACs */ + #define DISPLAY_4 4 /* 24 bit "dumb" PPM F.B. & 8 bit DACs */ + #define DISPLAY_5 5 /* 24 bit "dumb" PPM F.B. & 4 bit DACs */ + #endif /* ! NO_DISPLAY */ + #endif /* ! INKERNEL */ + + /*------------------------------------------------------------------------------ + * + * The DISPLAY_2 type frame buffer is a 1024 lines (Y) by 2048 (X) bits + * array populated by byte wide elements along the X axis (Column). The full + * 2048 is not used rather 1280 is used. + * + */ + #define DISPLAY2_ramdac_depth 8 /* REDWING std. 8 bit F.B./Dac */ + #define DISPLAY3_ramdac_depth 8 /* 24 bit F.B. w/CDP's 8 bit DACs */ + #define DISPLAY4_ramdac_depth 8 /* 24 bit "dumb" PPM F.B. & 8 bit DACs*/ + #define DISPLAY5_ramdac_depth 4 /* 24 bit "dumb" PPM F.B. & 4 bit DACs*/ + + #define DISPLAY2_fb_depth 8 /* REDWING std. 8 bit F.B. */ + #define DISPLAY3_fb_depth 24 /* 24 bit F.B. w/CDP's 8 bit DACs */ + #define DISPLAY4_fb_depth 24 /* 24 bit "dumb" PPM F.B. & 8 bit DACs*/ + #define DISPLAY5_fb_depth 4 /* 24 bit "dumb" PPM F.B. & 4 bit DACs*/ + + #define DISPLAY2_bitmap_x 2048 /* f.b. memory is 2048x1024 */ + #define DISPLAY2_bitmap_y 1024 + #define DISPLAY2_vscreen_x 1280 /* f.b. screen is 1280x1024 */ + #define DISPLAY2_vscreen_y 1024 + #define DISPLAY2_hc_screen_x 1280 + #define DISPLAY2_hc_screen_y 1024 + #define DISPLAY2_MemWidth 256 /* 2048(x) X 1024(y) bitmap 256 bytes wide*/ + #define DISPLAY2_MemHeight 1024 /* 1024 scan lines heigh. */ + + /* + * DISPLAY_2 TWO_COLOR frame buffer "Char/Byte" organizational flavor. + */ + + #ifdef notdef + + typedef struct D2_ScanLine_C { + unsigned char EachByte[DISPLAY2_MemWidth]; /* 256 of em' 2k memory width */ + } D2_ScanLine_C_t; + + typedef struct D2_Frame_C { + D2_ScanLine_C_t EachLine[DISPLAY2_MemHeight]; /* 1024 of em' */ + } D2_Frame_C_t; + + #endif /* notdef */ + + /*------------------------------------------------------------------------------ + * + * Video control/status register bit definitions: many of the bits are + * the same as 4315/16/17. (Raven CPU only). + * + * The video control/status hardware register has two images depending on + * whether the access is write or read. + * + * - WRITE ACCESS / READ ACCESS - + * + * Bit - 0 -> CDP Scroll bit/ CDP Scroll bit + * Bit - 1 -> Lsb-PVIOC (Progammable Vertical Interrupt Offset Comparator) + * Bit - 2 -> Lsb+1 + * Bit - 3 -> Msb-1 + * Bit - 4 -> Msb-PVIOC + * Bit - 5 -> VintCmpEnable -/- VBlnkTrue + * Bit - 6 -> ScreenOn -/- nHBlnkTrue + * Bit - 7 -> VintEnable -/- VintTrue + * + */ + + #ifndef ASM + + struct ds_video_control_struct { + unsigned char + VerticalInterruptEnable:1, /* bit - 7 */ + VideoScreenOn:1, /* bit - 6 */ + VideoInterruptCmpEnable:1, /* bit - 5 */ + VideoInterruptScanLine:4, /* bit - 4 thru 1 */ + CDP_Scroll:1; /* bit - 0 */ + }; + + struct ds_video_status_struct { + unsigned char + VerticalInterruptTrue:1, /* bit - 7 */ + HorizontalInterruptTrue:1, /* bit - 6 */ + VerticalInterruptTrue_XXX:1, /* bit - 5 */ + VideoInterruptScanLine:4, /* bit - 4 thru 1 */ + CDP_Scroll:1; /* bit - 0 */ + }; + + struct ds_video_struct { /* must be a byte */ + union { + struct ds_video_status_struct v_status; + struct ds_video_control_struct v_control; + unsigned char theWholeRegister; + } VSCR_u ; /* name of the union */ + }; + + #endif /* ASM */ + + #define VID_INVERT 0x20 /* invert screen */ + #define VID_ON 0x40 /* turn screen on */ + #define VID_INTEN 0x80 /* vertical sync interrupt enable */ + + /* + * Bit definitions for the above (0-7). + */ + #define VID_INVERT_BIT 5 + #define VID_ON_BIT 6 + #define VID_INTEN_BIT 7 + + #define VBlank 0x20 /* vertical blank signal */ + #define VBlank_b 5 /* turn screen on (VBlank bit) */ + #define HBlankNot 0x40 /* horizontal blank signal */ + #define VideoData 0x80 /* video data to monitor */ + + + /*------------------------------------------------------------------------------ + * + * CDP "ColorDataPaths" ASIC's definitions: + */ + + #ifndef ASM + + typedef struct CDP_device_struct { + unsigned long CDP_PlaneEnableReg; /* mask for plane access */ + unsigned long CDP_FilterReg; /* */ + unsigned long CDP_WriteReg0; /* index written when zero bit */ + /* written to the display in two */ + /* color mode. */ + unsigned long CDP_WriteReg1; /* index written when ONE bit */ + /* written to the display in one */ + /* or two color mode. */ + unsigned long CDP_MaskRegSet; /* */ + unsigned long CDP_MaskRegNoSet; /* */ + unsigned long CDP_unassigned_1; /* filler to pad to 0x20 size */ + unsigned long CDP_unassigned_2; + } CDP_device_t; + + #endif /* ASM */ + + #define CDP_Offset_4316 0x00000020 /* offset to the CDP(#2) 4316/17 */ + #define CDP_Offset_RAVEN CDP_Offset_4316 /* same for CDP(n) */ + + #define CDP_NumPlanes 4 /* number of bits per pixel */ + #define CDP_SetFlag 0x80000000 /* Mask Register "SET" flag bit */ + + /*------------------------------------------------------------------------------ + * + * Brooktree Model Bt451 RAMDAC definitions: + * + */ + #define ColorMapGrayIncr_4316_17 0x1111 /* GRAY incr value for the gray map */ + #define ColorMapGrayIncr_RAVEN 0x0100 /* GRAY incr value for the gray map */ + + /* + * GRAY: 16 indicies, 16 levels (four bit dac, one channel "INTENSITY"). + * COLOR: 16 indicies, 64 colors (four bit dac, three channels "RGB"). + */ + #define monochrome_defaultDepth 1 /* No DAC present. */ + #define Bt458RamDAC_defaultDepth 8 /* Bt458 8 bits */ + #define Bt451RamDAC_defaultDepth 4 /* Bt451 4 bits */ + + #ifndef ASM + /* + * The dacs registers are bytes located (addressed) on long boundaries. + */ + typedef struct DAC_device_struct { + + unsigned char dac_Address; /* the dac chip address register + * offset. + */ + unsigned char dac_addr_dummy_1; + unsigned char dac_addr_dummy_2; + unsigned char dac_addr_dummy_3; + + unsigned char dac_ColorMap; /* the dac chip color map offset */ + + unsigned char dac_cm_dummy_1; + unsigned char dac_cm_dummy_2; + unsigned char dac_cm_dummy_3; + + unsigned char dac_Control; /* the dac chip control register + * access offset. + */ + unsigned char dac_crtl_dummy_1; + unsigned char dac_crtl_dummy_2; + unsigned char dac_crtl_dummy_3; + + unsigned char dac_OverLay; /* the dac chip overlay register + * access offset. + */ + unsigned char dac_ovly_dummy_1; + unsigned char dac_ovly_dummy_2; + unsigned char dac_ovly_dummy_3; + } DAC_device_t; + + #endif /* ASM */ + + /* + * Values written to the "address" register inorder to set the "base" address of + * communication with the desired register to be written to of: + * [ paletteMap | overlayColor [0|1|2|3] | + * readMask | blinkMask | commandReg | testRegister ] + * + */ + #define x_DacColorPalette 0 /* use the "Dac_1_FirstColorMapIndex" def. below */ + #define DacOverlay_0 0 + #define DacOverlay_1 1 + #define DacOverlay_2 2 + #define DacOverlay_3 3 + #define DacReadMask 4 + #define DacBlinkMask 5 + #define DacCommandReg 6 + /* #define DacTestReg 7 */ /* {not used.} */ + + /*------------------------------------------------------------------------------ + * + * 4316/7/RAVEN User Color Map Structure:: + */ + + #ifndef ColorMapSize_4316_17 + #define ColorMapSize_4316_17 16 /* 4316/7 four bits deep DAC. */ + #endif /* ColorMapSize_4316_17 */ + + #ifndef ColorMapSize_RAVEN + #define ColorMapSize_RAVEN 256 /* RAVEN/Redwing eight bits deep DAC. */ + #endif /* ColorMapSize_RAVEN */ + + /* + * The first 4316/17 16 (4316_17_ColorMapSize) entries are used for THE + * "frame buffer color" map. The remaining THREE groups of 16 entries are + * used for the cursor chips. + * + */ + + #define Dac_1_FirstColorMapIndex x_DacColorPalette /* The first 16/256 color + * map entries. + */ + #define Dac_2_FirstColorMapIndex Dac_1_FirstColorMapIndex+ColorMapSize_4316_17 + #define Dac_3_FirstColorMapIndex Dac_2_FirstColorMapIndex+ColorMapSize_4316_17 + #define Dac_4_FirstColorMapIndex Dac_3_FirstColorMapIndex+ColorMapSize_4316_17 + + /*------------------------------------------------------------------------------ + * + * Brooktree Model Bt431 Hardware Cursor Controller definitions: + * + * CUR_x's, a collection of hardware constants for X/Y position calculations. + * + */ + + #define Cur_Form_H 64 /* Form cursor height */ + #define Cur_Form_W 64 /* Form cursor width */ + + #define Default_H 377 /* Raven/Redwing: + * Number of pixels between the first rising + * edge of CLOCK following the falling edge + * of HSYNC to active video. + */ + /* + * Cursor (x,y) Position defs. + */ + #define Cur_Pos_P 52 /* 4:1 multiplexing. */ + #define Cur_Pos_D 0 /* Skew (in pixels) between the output cursor + * data and external pixel data. + */ + + #define Cur_Pos_H Default_H /* The number of pixels between the first + * rising edge of CLOCK following the falling + * edge of HSYNC to active video. + */ + + #define Cur_Pos_V 27 /* Raven/Redwing: + * The number of scan lines from the first + * falling edge of HSYNC that is two or more + * clock cycles after the falling edge of VSYNC + * to active video. + */ + + #define Cur_Pos_X_default (Cur_Pos_D+Cur_Pos_H-Cur_Pos_P) + #define Cur_Pos_Y_default (Cur_Pos_V-32) + #define Cur_FormXYoffset 31 /* Bt431 spec. Pg-6. XY offset from UpperLeft.*/ + + /* + * Window (x,y) Register defs. + */ + #define Cur_Window_P 20 /* 4:1 multiplexing. */ + #define Cur_Window_D 0 /* Skew (in pixels) between the output cursor + * data and external pixel data. + */ + + #define Cur_Window_H Default_H /* The number of pixels between the first + * rising edge of CLOCK following the falling + * edge of HSYNC to active video. + */ + + #define Cur_Window_V 26 /* Raven/Redwing: + * The number of scan lines from the first + * falling edge of HSYNC that is two or more + * clock cycles after the falling edge of VSYNC + * to active video. + */ + + #define Cur_Window_X_default (Cur_Window_D+Cur_Window_H-Cur_Window_P) + #define Cur_Window_Y_default (Cur_Window_V) + + + #ifndef ASM + /* + * The dacs registers are bytes located (addressed) on long boundaries. + */ + typedef struct CURSOR_device_struct { + unsigned char cur_Address0; /* Cursor chip address register 0 */ + + unsigned char cur_addr0_dummy_1; + unsigned char cur_addr0_dummy_2; + unsigned char cur_addr0_dummy_3; + + unsigned char cur_Address1; /* Cursor chip address register 1 */ + + unsigned char cur_addr1_dummy_1; + unsigned char cur_addr1_dummy_2; + unsigned char cur_addr1_dummy_3; + + unsigned char cur_RamBitMap; /* Cursor chip ram bit map offset */ + + unsigned char cur_RamB_dummy_1; + unsigned char cur_RamB_dummy_2; + unsigned char cur_RamB_dummy_3; + + unsigned char cur_Control; /* Cursor chip control register access*/ + + unsigned char cur_Crtl_dummy_1; + unsigned char cur_Crtl_dummy_2; + unsigned char cur_Crtl_dummy_3; + + } CURSOR_device_t; + + #endif /* ASM */ + + #define _CURSOR_OFFSET 0x100 /* offset to the base of the second cursor chip */ + #define Cur_ChipNumber2 _CURSOR_OFFSET + + #define Cur_Mask 0x7f /* always filter out bit 7. */ + #define Cur_64by64Enable 0x40 /* set bit 6 to enable 64 x 64 cursor form. */ + #define Cur_CrossHairEnable 0x20 /* set to enable the crosshair cursor. */ + + #define Cur_CursorFormatCntrl 0x10 /* set to control the "format" of the cursor + Selects XOR or OR when both crosshair and + 64x64 form cursors are enabled. */ + + #define Cur_4to1Mux 0x04 /* set to 4:1 multiplexing. Four cursor bits are + output each clock cycle. */ + + #define Cur_CrossHairThickness1Pixels 0x00 /* crosshair thickness set to 1 */ + #define Cur_CrossHairThickness3Pixels 0x01 /* crosshair thickness set to 2 */ + #define Cur_CrossHairThickness5Pixels 0x10 /* crosshair thickness set to 5 */ + #define Cur_CrossHairThickness7Pixels 0x11 /* crosshair thickness set to 7 */ + + /* + * Values for selecting a particular register. + */ + #define Cur_SelectMapAddressZero 0 /* address zero of the maps. */ + #define Cur_SelectCommandReg 0 /* register number 0 */ + #define Cur_SelectCursorXYReg 1 /* register number 1 */ + #define Cur_SelectWindowXYReg 5 /* register number 5 */ + #define Cur_SelectWindowWHReg 9 /* register number 9 */ + + + /*------------------------------------------------------------------------------ + * Physical Memory map layout for the Redwing Display Board + * (an 88K version of Raven-4319) + *------------------------------------------------------------------------------ + * + * + *------------------------------------------------------------------------------ + * + * type: "DISPLAY_2" - REDWING Standard Display Board - 8 bit F.B./Dac + * (PHYSICAL ADDRESSES) + * + *------------------------------------------------------------------------------ + */ + + #define DS_SPACE_P ((struct ds_space *)0x80000000) + + /* Start of Display Board Addresses + * (0x8000 0000 - 0xbfff ffff) + * See following definitions. + */ + + #define DS_DSP_BASE 0x80000000 + #define DS_DSP_P 0x80000000 + #define DS_DSPROM_P 0x80000000 + #define DS_Reserved_1_P 0x80010000 + #define DS_VIDEO_CNTL_P 0x80020000 + #define DS_VIDEO_STAT_P 0x80020000 + #define DS_DUART_P 0x80020100 + #define DS_MOUSE_IO_P 0x80020200 + #define DS_KMPRT_P 0x80020300 + #define DS_Reserved_2_P 0x80020400 + #define DS_RAMDAC_P 0x80020500 + #define DS_CURSOR_0_P 0x80020600 + #define DS_CURSOR_1_P 0x80020700 + #define DS_CURSOR_BASE_P DS_CURSOR_0_P + + #define DS_CDP_0_P 0x80040000 + #define DS_CDP_P DS_CDP_0_P + #define _CDP_OFFSET 0x00000020 /* CDP OFFSET */ + #define DS_CDP_1_P 0x80040020 + #define DS_CDP_2_P 0x80040040 + #define DS_CDP_3_P 0x80040060 + #define DS_FB_STENCIL_P 0x80100000 + #define DS_FB_STENCIL_HI_P 0x8013ffff + #define DS_FB_TWO_COLOR_P 0x80180000 + #define DS_FB_TWO_COLOR_HI_P 0x801bffff + #define DS_FB_PP_P 0x80200000 + #define DS_FB_PP_HI_P 0x803fffff + /* (0x8010 0000 - 0x8013 ffff) */ + /* (0x8018 0000 - 0x801b ffff) */ + /* (0x8020 0000 - 0x803f ffff) */ + + + struct ds_space { + unsigned char eprom[0x80010000-0x80000000]; + /* 8000 0000 - 8000 FFFF (8 bit port) */ + + char __und1[0x80020000-0x80010000]; /* reserved space */ + + unsigned char ds_video_register; + + /* for some reason the structure of ds_video_status/control_struct + * ends up being a sizeof #2, why ??? So the "struct declairation + * is commented out. + */ + /* struct ds_video_struct ds_video_register; */ /* 1 byte */ + + /* Video control/(status) + * (control: writable side + * of register - 8 bit port). + * (status: readable side of + * the register). + * (0x8002 0000 - 0x8002 00ff) + */ + char __und1_1[0x80020100-0x80020001]; /*reserved space*/ + + struct Duart_Regs ds_keyboard_duart; /* 64 bytes (0x40) */ + /* Keyboard DUART device BASE + * (register - 8 bit port). + * (0x8002 0100 - 0x8002 01ff) + */ + + char __und1_3[0x80020200-0x80020140]; /*reserved space*/ + + char __und2[0x80020300-0x80020200]; /* reserved space */ + /* I/O Mouse Port device BASE + * not used - only address + * space reserved. + * (register - 8 bit port). + * (0x8002 0200 - 0x8002 02ff) + */ + + unsigned char keyboard_diags[0x80020400-0x80020300]; /* 256 0x100 */ + /* Keyboard-Diagnostic/printer + * port (register - 8 bit port). + * (0x8002 0300 - 0x8002 03ff) + */ + + char __und3[0x80020500-0x80020400]; /* reserved space */ + /* (0x8002 0400 - 0x8002 04ff)*/ + + DAC_device_t ds_ramdac; /* 16 bytes (0x10) */ + /* Brooktree Bt458 - RAMDAC BASE + * (Standard F.B. & Red DAC for + * 24 bit). + * (register - 8 bit port). + * (0x8002 0500 - 0x8002 05ff) + */ + + char __und3_2[0x80020600-0x80020510]; /*reserved space*/ + + CURSOR_device_t ds_cursor_0; /* 16 bytes (0x10) */ + /* Brooktree Bt431 - CURSOR chip + * #1. (register - 8 bit port). + * (0x8002 0600 - 0x8002 06ff) + */ + + char __und3_4[0x80020700-0x80020610]; /*reserved space*/ + + CURSOR_device_t ds_cursor_1; /* 16 bytes (0x10) */ + /* Brooktree Bt431 - CURSOR chip + * #2. (register - 8 bit port). + * (0x8002 0700 - 0x8002 07ff) + */ + + char __und3_6[0x80020800-0x80020710]; /*reserved space*/ + char __und3_7[0x80030000-0x80020800]; /*reserved space*/ + /*(0x8002 0800 - 0x8002 ffff)*/ + + char __und4[0x80040000-0x80030000]; /* reserved space */ + /*(0x8003 0000 - 0x8003 ffff)*/ + + CDP_device_t ds_cdp_0; + /* CDP #0 BASE + * (register - 32 bit port). + * (0x8004 0000 - 0x8004 001f) + */ + CDP_device_t ds_cdp_1; + /* CDP #1 - BASE + * (0x8004 0020 - 0x8004 003f) + */ + CDP_device_t ds_cdp_2; + /* CDP #2 - BASE + * (0x8004 0040 - 0x8004 005f) + */ + CDP_device_t ds_cdp_3; + /* CDP #3 .. #12 - BASE + * (0x8004 0060 - 0x8004 007f) + */ + + char __und4_1[0x80080000-0x80040080]; /*reserved space*/ + /*(0x8004 0080 - 0x8007 ffff)*/ + + char __und5[0x80100000-0x80080000]; /* reserved space */ + /*(0x8080 0000 - 0x800f ffff)*/ + + unsigned char ds_fb_stencil[(DISPLAY2_MemWidth*DISPLAY2_MemHeight)]; + /* Start of One Color Frame + * Buffer. + * (Stencil FB - 32 bit port) + * (0x8010 0000 - 0x8013 ffff) + */ + char __und6[0x80180000-0x80140000]; /* reserved space */ + + unsigned char ds_fb_two_color[(DISPLAY2_MemWidth*DISPLAY2_MemHeight)]; + /* Start of Two Color Frame + * Buffer. + * (Standard FB - 32 bit port) + * (0x8018 0000 - 0x801b ffff) + */ + char __und7[0x80200000-0x801c0000]; /* reserved space */ + + unsigned char ds_fb_ppm + [(DISPLAY2_fb_depth*DISPLAY2_MemWidth*DISPLAY2_MemHeight)]; + /* Start of Packed Pixel Mode + * (PPM) port Frame Buffer. + * (Standard FB - 32 bit port) + * (Start of the Red PPM port + * in the 24 bit frame buffer) + * (0x8020 0000 - 0x803f ffff) + */ + + /* 0x80400000 -1 = end of display board space */ + }; /* end of ds_space display board type #2 space structure */ + + /*------------------------------------------------------------------------------ + * + * type: "Display_3" - 24 bit frame buffer additions. + */ + #define DS_PPM_GRN_P 0xffffffff /* Start of Green PPM FB Port */ + #define DS_PPM_GRN_HI_P 0xffffffff /* Top of Green PPM FB Port */ + #define DS_PPM_BLU_P 0xffffffff /* Start of Blue PPM FB Port */ + #define DS_PPM_BLU_HI_P 0xffffffff /* Top of Blue PPM FB Port */ + + /*------------------------------------------------------------------------------ + * + * type: "Display_3/4/5" - 24 bit frame buffers RAMDACs. + */ + #define DS_RAMDAC_GRN_P 0x80020800 + /* Brooktree RAMDAC GREEN (24bit t.c.)*/ + + #define DS_RAMDAC_BLU_P 0x80020900 + /* Brooktree RAMDAC BLUE (24bit t.c.)*/ + + + + /*------------------------------------------------------------------------------ + * + * Here I define the necessary items for the "X" driver display interface: + * cursor information, event queue, etc. + * + * + */ + + + /*------------------------------------------------------------------------------ + * + * "X" driver (/dev/xdev) stuff. + */ + + #ifndef XDEV_TRUE + #define XDEV_TRUE 1 + #endif /* XDEV_TRUE */ + + #ifndef XDEV_FALSE + #define XDEV_FALSE 0 + #endif /* XDEV_FALSE */ + + /* + * Minor device number definitions for "/dev/console", "/dev/display" + * and "/dev/xdev". + * + * - /dev/console - the console connection + * - /dev/display - the terminal emulator + * - /dev/xdev - the X driver. + */ + + /* Manifest constants for (blackbird) GDS channels. */ + #define DISPLAY_CONSOLE_MAJOR 19 /* Major of console */ + #define DISPLAY_FCONS_DEV 0 /* Minor of floating console */ + #define DISPLAY_CONS_DEV 1 /* Minor of console channel */ + + #define DISPLAY_DEV_MAJOR 21 + #define DISPLAY_DEV_MINOR 0 + + #define X_DEV_MAJOR 18 /* /dev/xdev 18 */ + #define X_DEV_MINOR 0 /* /dev/xdev 18,0 */ + #define X_DEVINFO_MINOR 1 /* /dev/xdevinfo 18,1 */ + #define X_SEMLOCK_MINOR 2 /* /dev/xdevsemlock 18,2 */ + #define X_DEVTEST_MINOR 3 /* /dev/xdevtest 18,3 */ + + #ifndef ASM + /*------------------------------------------------------------------------------ + * + * "X" driver (/dev/xdev) internal state information. + */ + struct ce_state { + int ce_flags; + struct proc *ce_selproc; + }; + + #endif /* ASM */ + + /* + * "X" driver internal state information defines. + */ + #define XCOLL_BIT 0 /* 00000001 */ + #define XOPEN_BIT 1 /* 00000002 */ + #define XEVENT_BIT 2 /* 00000004 */ + #define XEVENTSTYLE_BIT 3 /* 00000008 */ + #define XOPEN_SUID_BIT 4 /* 00000010 */ + #define XSEMLOCK_BIT 5 /* 00000020 */ + #define XDEVTEST_BIT 6 /* 00000040 */ + /* 00000080 & up not assigned */ + + #define XCOLL 1<ce_selproc; \ + if (p) { \ + selwakeup(p, cep->ce_flags & XCOLL); \ + cep->ce_flags = cep->ce_flags & (~(XCOLL)); \ + cep->ce_selproc = 0; \ + } \ + } + #endif /* INKERNEL */ + + /* + * Maximum size of supportable cursor form in the "displaystate". (OBSOLETE + * but needed for correct padding). + */ + #define NCURSORBITS 32 + #define CSTORE ((NCURSORBITS/8)*NCURSORBITS) + + /* + * "X" Number of events in X event queue. + * + * Notes: The event queue actually resides in the software/hardware + * configuration structure (soft_config.sc_eventque). The current + * definition is as a "char" array of 1536 elements. The byte count + * for an "X-10" event is 10 bytes (640 bytes total), and the byte + * count for an "X-11" event is 12 bytes (768 bytes total). + */ + + #define NXEVENTS 64 + + #ifndef ASM + /* + * Event queue entries structure for "X-10" + */ + + typedef struct _event_X10 { + unsigned short e_x; /* x position */ + unsigned short e_y; /* y position */ + unsigned short e_time; /* 10 millisecond units (button only) */ + char e_type; /* button or motion? */ + unsigned char e_key; /* the key (button only) */ + char e_direction; /* which direction (button only) */ + char e_device; /* which device (button only) */ + } Event_X10; + + /* + * Event queue entries structure for "X-11" + */ + + typedef struct _event_X11 { + unsigned short e_x; /* x position */ + unsigned short e_y; /* y position */ + unsigned long e_time; /* 10 millisecond units (button only) */ + char e_type; /* button or motion? */ + unsigned char e_key; /* the key (button only) */ + char e_direction; /* which direction (button only) */ + char e_device; /* which device (button only) */ + } Event_X11; + + #endif /* ASM */ + + /* + * e_type field. + */ + #define E_BUTTON 0 /* button moved */ + #define E_MMOTION 1 /* mouse moved */ + #define E_TMOTION 2 /* tablet moved */ + + /* + * e_direction field. + */ + #define E_KBTUP 0 /* up */ + #define E_KBTDOWN 1 /* down */ + #define E_KBTRAW 2 /* undetermined */ + + /* + * e_device field. + */ + #define E_MOUSE 1 /* mouse */ + #define E_DKB 2 /* main keyboard */ + #define E_TABLET 3 /* graphics tablet */ + #define E_AUX 4 /* auxiliary */ + #define E_CONSOLE 5 /* console */ + + /* + * The event queue. + */ + #ifndef ASM + typedef struct _eventqueue { + union _ptrU{ + Event_X10 *events10; /* X10 input event buffer pointer */ + Event_X11 *events11; /* X11 input event buffer pointer */ + } ptrU; + int size; /* size of event buffer */ + int head; /* index into events */ + int tail; /* index into events */ + } EventQueue; + + + /* + * mouse cursor position. + */ + + typedef struct _cursorxy { + short x; + short y; + } Cursorxy; + + /* + * mouse motion rectangle. + */ + + typedef struct _box { + short bottom; + short right; + short left; + short top; + } Box; + + /* + * The internal state of the "X" driver is described here. Several items are + * marked as obsolete, eg. no longer used in the driver, but may be still used + * by the "X" server (this structure is mapped by the server). + */ + typedef struct displaystate { + short ds_deltax; + short ds_deltay; /* Change in x and y values */ + short ds_maxx; + short ds_maxy; /* maximum x and y values (floating) */ + short ds_minx; + short ds_miny; /* minimum x and y values (floating) */ + short ds_cWidth; /* cursor width */ + short ds_cHeight; /* cursor height */ + short ds_shortpad[8]; /* room for future expansion */ + unsigned long ds_timeout; /* ms time to issue repeat event */ + unsigned long ds_ltime; /* millisecond counter: updated each vertical */ + unsigned long ds_lastevent; /* millisecond time of last event */ + unsigned long ds_ulongpad[8]; /* room for future expansion */ + unsigned char ds_buttons; /* current button state */ + unsigned char ds_ucharpad[15];/* room for future expansion */ + EventQueue ds_q; /* event queue for server */ + Box ds_box; /* box where no events needed (OBSOLETE) */ + Box ds_src; /* box where mouse is not drawn (OBSOLETE) */ + Box ds_dest; /* box where mouse is not drawn (OBSOLETE) */ + Cursorxy ds_xy; /* xy coordinate of nw corner of cursor */ + + #define ds_x ds_xy.x + #define ds_y ds_xy.y + + Cursorxy ds_newxy; /* new xy coordinates */ + #define ds_newx ds_newxy.x + #define ds_newy ds_newxy.y + + Cursorxy ds_point; /* xy offset from ds_xy to point of mouse */ + + + /*-- display board specific environmental items -- */ + + unsigned long ds_displayModel; /* model of display board */ + unsigned long ds_ramdacDepth; /* depth of each RGB DAC element + * (Raven/Redwing are: 8) + */ + unsigned long ds_fbDepth; /* # of fb planes (Raven/Redwing: 8) */ + unsigned long ds_fbBitmap_x; /* Raven/Redwing are: 2048 */ + unsigned long ds_fbBitmap_y; /* Raven/Redwing are: 1024 */ + unsigned long ds_fbScreen_x; /* Raven/Redwing are: 1280 */ + unsigned long ds_fbScreen_y; /* Raven/Redwing are: 1024 */ + + /* 1/2/4 byte increment to the next scan line */ + unsigned long ds_fbLong_incr; /* Raven/Redwing are: 64 */ + unsigned long ds_fbShort_incr; /* Raven/Redwing are: 128 */ + unsigned long ds_fbByte_incr; /* Raven/Redwing are: 256 */ + + /*------------------------------------------------ */ + + unsigned char videostate; /* video state/control shadow register*/ + unsigned char dummy_char_1; /* alignment */ + + unsigned short keyboardlangidstyle; + /* + * "keyboard language id style" contains + * the keyboard language in the upper + * byte and the style in the lower byte. + * Current definitions include 0xF1-0xFB + * for keyboard languages and values + * 0x0 and 0x2 for the style. See + * "keyboard.h" for additional info. + * If not supported the value is zero. + */ + + unsigned long xconsolepid; /* X driver console Process ID */ + unsigned long db_spare_1; + + unsigned char Xeventque[1536]; /* -THE- XDev event queue */ + + unsigned long db_shMemKeyDB; /* this is the "key" for the X servers + * mapping of the display board. + */ + unsigned long db_shMemKeyXD; /* this is the "key" for the X servers + * mapping of the x driver shared mem. + */ + + /* (begin) Shared memory display semaphore items:: */ + + unsigned long df_lockDisplayFlag; + /* This flag (non-zero) indicates + * shared memory semaphore is locked + * (owned). unlocked state = 0. + */ + unsigned long df_lockDisplayOwnerPID; + /* This is the PID of the shared memory + * semaphore "owner" process (set + * by the xdevsema -ioctl). + * unlocked state = 0. + */ + unsigned long df_lockDisplayPID; + /* This is the PID of the "current" + * shared memory semaphore "owner" + * process (set by locking). + * unlocked state = 0. + */ + + unsigned long df_lockDisplaySleepers; + /* This flag set by the display lock + * semaphore when there "are sleepers" + * for the display semaphore. + * no sleepers state = 0. + */ + + unsigned long df_lockDisplayCount; + /* This is the "lock count" for the + * shared memory semaphore. + * default: 0 + * unlocked state = 0. + */ + /* (end of) Shared memory display semaphore items:: */ + + + /* (begin) Streams shared memory items:: */ + + unsigned long st_currentWindowID; + /* This is set by the X server "dix" + * layer whenever a "window" "id" + * is determined. + * + * default: 0 + */ + + unsigned long st_spare_1; /* streams i/f spare. + */ + /* (almost--- end of) Streams shared memory items */ + + + /* (begin) Shared memory OnRamp "clips" items:: */ + + unsigned long or_shMemKeyCL; /* this is the "key" for the X servers + * mapping of the OnRamp "clips" shared + * memory. + */ + + unsigned long or_spare_[5]; /* OnRamp i/f spares. + */ + + /* (end of) Shared memory OnRamp items */ + + + /* (continuation of) Shared memory display semaphore items */ + /* (ya can't win'em all) */ + + unsigned long df_lockDisplaySig; /* Signals were handled for the + * shared memory semaphore owner + * process. + */ + + unsigned long df_spares_[7]; /* spares */ + + /* (end of) Shared memory display semaphore items:: */ + + + unsigned long _spares_[56]; /* spares */ + + unsigned long _spares_2k_[512]; /* spares */ + + } XDisplayState; /* size = 4096.. adj. spares to maintain size */ + + + #define XDevMappingKeyDB 0x7a646576 /* ascii "zdev" (xdev) */ + #define XDevMappingKeyXD 0x7a6d656d /* ascii "zmem" (xmem) */ + #define XClipMappingKeyXD 0x636c6970 /* ascii "clip" X & -OnRamp- */ + #define XZbufMappingKeyXD 0x7a627566 /* ascii "zbuf" X & -OnRamp- */ + + + #endif /* ASM */ + + /* + * Macro for getting new event and incrementing the index. + * WARNINGS: + * 1) USES KERNEL MAPPED ADDRESS OF THE QUEUE. + * 2) Requires "dsp" previously setup. + * + */ + #define NEWEVENT_X10(dsp, ep10) \ + { \ + register index = dsp->ds_q.tail + 1; \ + ep10 = &dsp->ds_q.ptrU.events10[ dsp->ds_q.tail ]; \ + if (index >= dsp->ds_q.size) \ + index = 0; \ + if (index != dsp->ds_q.head) \ + dsp->ds_q.tail = index; \ + } + + #define NEWEVENT_X11(dsp, ep11) \ + { \ + register index = dsp->ds_q.tail + 1; \ + ep11 = &dsp->ds_q.ptrU.events11[ dsp->ds_q.tail ]; \ + if (index >= dsp->ds_q.size) \ + index = 0; \ + if (index != dsp->ds_q.head) \ + dsp->ds_q.tail = index; \ + } + + #ifndef ASM + /* + * Definitions for ioctl's for the cursor-event driver "/dev/xdev". + */ + + #define CE_IOCTL ('X' << 8) + /* u.u_rval1 = short (two bytes) of ['X'| 00 ] */ + #define CE_SHIFTLOCKON (CE_IOCTL | 1) /* Shift Lock LED */ + #define CE_SHIFTLOCKOFF (CE_IOCTL | 2) /* Shift Lock LED */ + #define CE_EVENTS (CE_IOCTL | 3) + #define CE_SETCONS (CE_IOCTL | 4) /* param in: int */ + #define CE_GETCONS (CE_IOCTL | 5) /* param out: int */ + #define CE_SELECTX10EVENTS (CE_IOCTL | 6) + #define CE_SELECTX11EVENTS (CE_IOCTL | 7) + #define CE_GETKEYBOARDID (CE_IOCTL | 8) + /* Returns the keyboard + * language and font ID in the + * lower two bytes. + */ + + #define CE_GETXDISPLAYSTRUCT (CE_IOCTL | 10) /* param in: address of + * caddr_t pointer (to be + * used as a return value. + * + * returns: The physical + * address of XDisplayState + * structure will be written + * to the memory location + * pointed to by parameter. + * + * The X server will + * "map physical" for access + * to the X event buffer + * portion of the structure. + */ + + #define CE_GETXSTRUCTINFO (CE_IOCTL | 11) /* param in: address of + * xdisplaystate pointer (to + * be used. + * + * returns: The contents of + * XDisplayState structure will + * be written to the + * xdisplaystate structure at + * the "pointer parameter" + */ + + /* + * "/dev/xdev" ioctl additions for RAVEN/TNT/CRYSTAL keyboard. + * + * The following additional keyboard "LED" functions are supported. + * + */ + + #define KEYBD_HOLD_LED_ON (CE_IOCTL | 20) + #define KEYBD_HOLD_LED_OFF (CE_IOCTL | 21) + + #define KEYBD_COMPOSE_LED_ON (CE_IOCTL | 22) + #define KEYBD_COMPOSE_LED_OFF (CE_IOCTL | 23) + + #define KEYBD_WAIT_LED_ON (CE_IOCTL | 24) + #define KEYBD_WAIT_LED_OFF (CE_IOCTL | 25) + + #define KEYBD_TEK_LED_ON (CE_IOCTL | 26) + #define KEYBD_TEK_LED_OFF (CE_IOCTL | 27) + + #define KEYBD_XMT_LED_ON (CE_IOCTL | 28) + #define KEYBD_XMT_LED_OFF (CE_IOCTL | 29) + + #define KEYBD_RCV_LED_ON (CE_IOCTL | 30) + #define KEYBD_RCV_LED_OFF (CE_IOCTL | 31) + + /* + * "/dev/xdev" -or- "/dev/xdevtest" ioctl additions for input + * synthesis: "X" TESTING ONLY !! + */ + + #define CE_QUEUE_MOUSE_BUTTON_DOWN (CE_IOCTL | 40) /* param int */ + #define CE_QUEUE_MOUSE_BUTTON_UP (CE_IOCTL | 41) /* param int */ + #define CE_QUEUE_KEYBOARD_KEY_DOWN (CE_IOCTL | 42) /* param int */ + #define CE_QUEUE_KEYBOARD_KEY_UP (CE_IOCTL | 43) /* param int */ + #define CE_QUEUE_MOUSE_POSITION (CE_IOCTL | 44) /* param SvcCursorXY */ + #define CE_NEW_MOUSE_POSITION_NO_EVT (CE_IOCTL | 45) /* param SvcCursorXY */ + /* No Event Queued */ + + #define CE_SET_LOCK_OWNER (CE_IOCTL | 50) /* no param */ + #define CE_GET_LOCK_OWNER (CE_IOCTL | 51) /* ptr to "long" param*/ + #define CE_RELEASE_LOCK_OWNER (CE_IOCTL | 52) /* no param */ + + #endif /* ASM */ + + /*------------------------------------------------------------------------------ + * + * from :: sysdisplay.h,v 1.14 89/05/01 12:06:24 steveje + * + *------------------------------------------------------------------------------ + * ---------------------- Tektronix 4405+/4406+/4310 -------------------------- + *------------------------------------------------------------------------------ + * + * File: sysdisplay.h + * + * This portion of this file contains: + * + * . Function codes for BMW Local Display System Calls. + * (sys_local(TEKTRONIX_BMW, DisplayFunction#, arg1, arg2, ... arg(10))) + * + * . Various parameters types definitions. + * + * ---------------------------------------------------------------------------- + */ + + #ifndef SYSDISPLAY_H /* insurance for now */ + #define SYSDISPLAY_H + + /* + * The magic number for Display System Calls is: V_TEKTRONIX_BMW + */ + + /* + * 00 - 39 are for Standard display system support. + */ + + #define cursorOn 0 + #define cursorOff 1 + #define cursorLink 2 + #define cursorUnlink 3 + #define cursorPanOn 4 + #define cursorPanOff 5 + #define displayOn 6 + #define displayOff 7 + #define joyPanOn 8 + #define joyPanOff 9 + #define timeoutOn 10 + #define timeoutOff 11 + #define blackOnWhite 12 + #define whiteOnBlack 13 + #define terminalOn 14 + #define terminalOff 15 + #define getMousePoint 16 + #define setMousePoint 17 + #define getCursorPoint 18 + #define setCursorPoint 19 + #define setCursorPoint_noEvt 85 /* no X event */ + #define getButtons 20 + #define setSource 21 + #define setDestination 22 + #define setDest setDestination + #define updateComplete 23 + #define getCursorForm 24 + #define setCursorForm 25 + #define getViewport 26 + #define setViewport 27 + #define getDisplayState 28 + #define setKeyboardCode 29 + #define getMouseBounds 30 + #define setMouseBounds 31 + #define setMousePositionNoXevent 32 + #define reserved_33 33 + #define setCursorOffset 34 + #define getCursorOffset 35 + #define setMouseSpeed 36 + #define getMouseSpeed 37 + #define reserved_38 38 + #define reserved_39 39 + + /* + * 40 - 49 are for Standard display system "events" support + */ + + #define eventsEnable 40 + #define eventsDisable 41 + #define eventSignalOn 42 + #define eventMouseInterval 43 + #define getEventCount 44 + #define getNewEventCount 45 + #define getNextEvent 46 + #define getMillisecondTime 47 + #define setAlarmTime 48 + #define clearAlarm 49 + + /* + * 50 - 55 are for 4316/4317 color/gray operations. + */ + #define setCursorSourceAndMask 50 + #define getCursorSourceAndMask 51 + #define setCrosshairCursor 52 + #define getCrosshairCursor 53 + #define setCursorMode 54 + #define getCursorMode 55 + #define getColorState 56 + + /* + * 59 is reserved. + */ + + #ifdef notdef + #define putAnEventCode 59 + /* put a RAW keycode into the event queue.(debug) */ + #endif /* notdef */ + + /* + * 63 - 69 are for 4316/7 color/gray operations. + */ + #define notAssigned_2 60 + #define setColorEntry 61 + #define setGrayEntry 62 + #define setCursorColor 63 + #define getCursorColor 64 + #define setColorMap 65 + #define getColorMap 66 + #define setGrayMap 67 + #define getGrayMap 68 + #define getColorEntry 69 + #define getGrayEntry 70 + #define lockDisplay 71 + #define unlockDisplay 72 + #define lockColorMap 73 + #define unlockColorMap 74 + + #define inquireDisplayLock 78 + #define inquireColorMapLock 79 + + #define reserved_75 75 + #define reserved_76 76 + #define reserved_77 77 + + /* + * 80 - 90 are misc. calls. + */ + #define getVerticalInfo 80 + /* #define getVerticalInfo 85 */ + + #define lastDisplaySVCcode 90 + + #ifndef ASM + + /*------------------------------------------------------------------------------ + * + * From: graphics.h - definitions for Tektronix 4400/4310-Series display system + * that support "old'er" St-80 compatable graphics model... + * + */ + + /* + * Various structures needed for bitblt, etc. + */ + struct POINT { + short x, y; /* x and y coordinates */ + }; + + struct RECT { + short x, y; /* coordinates of upper left corner */ + short w, h; /* width and height */ + }; + + struct QUADRECT { /* structure used for returning 0 to 4 RECTs */ + short next; /* value of 0 to 4, inclusive, is number of RECTs */ + struct RECT region[4]; + }; + + struct FORM { + short *addr; /* memory address of first bit of bitmap */ + short w, h; /* width and height of form */ + short offsetw, offseth; /* used for cursors to mark "hotspot" */ + short inc; /* byte increment from one line to next, must be even */ + }; + + /* defines to help with mouse buttons */ + #define M_LEFT 4 + #define M_MIDDLE 2 + #define M_RIGHT 1 + #define M_ANY 7 + + /* + * structure and bit definitions for save/restore state + */ + struct DISPSTATE { + long statebits; /* bits defined below */ + struct POINT viewp; /* upper left corner of viewport */ + struct POINT ulmouseb; /* upper left corner of mouse bounds */ + struct POINT lrmouseb; /* lower right corner of mouse bounds */ + short curarray[16]; /* the bits for the cursor */ + char keycode; /* kb encoding (0 = event, 1 = ANSI) */ + char b1_reserved; /* reserved for future use */ + short lineincr; /* byte increment between lines of screen */ + short dispwidth; /* width of virtual display bitmap */ + short dispheight; /* height of virtual display bitmap */ + short viewwidth; /* width of visible viewport */ + short viewheight; /* height of visible viewport */ + short cursorxoffset; /* x offset of cursor hotpoint */ + short cursoryoffset; /* y offset of cursor hotpoint */ + long l1_reserved[2]; /* reserved for future use */ + }; + + #define DS_DISPON 0x0001 /* 1=display enabled, 0=disabled */ + #define DS_SCRSAVE 0x0002 /* 1=screen saver enabled, 0=disabled */ + #define DS_VIDEO 0x0004 /* 1=video normal, 0=video inverse */ + #define DS_TERMEM 0x0008 /* 1=terminal emulator enabled, 0=disabled */ + #define DB_CAPSLOCK 0x0010 /* 1=caps lock led on, 0=off */ + /* 0x0020 -- reserved */ + /* 0x0040 -- reserved */ + /* 0x0080 -- reserved */ + #define DS_CURSOR 0x0100 /* 1=cursor enabled, 0=disabled */ + #define DS_TRACK 0x0200 /* 1=cursor tracks mouse, 0=no tracking */ + #define DS_PANCUR 0x0400 /* 1=cursor panning enabled, 0=disabled */ + #define DS_PANDISK 0x0800 /* 1=joydisk panning enabled, 0=disabled */ + /* 0x1000 -- reserved */ + /* 0x2000 -- reserved */ + /* 0x4000 -- reserved */ + /* 0x8000 -- reserved */ + #define DS_KBEVENTS 0x10000 /* 1 = keyboard generates event codes, 0 = not*/ + /* 0x20000 through 0x80000000 are reserved */ + + #ifdef ST80_SUPPORT + /* + * St-80 style Event value structure and type definitions:: + */ + + union EVENTUNION { /* events are either a struct or a specific value */ + struct { + :16; + unsigned int eparam : 12; /* parameter associated with type */ + unsigned int etype : 4; /* type code, defined below */ + } estruct; + unsigned long evalue; /* some types have parameters with */ + }; /* more than 12 bits, so they use */ + /* the next event codes, too. */ + /* + * St-80 style etype definitions:: + */ + #define E_DELTATIME 0 + #define E_XMOUSE 1 + #define E_YMOUSE 2 + #define E_PRESS 3 + #define E_RELEASE 4 + #define E_ABSTIME 5 + + #endif /* ST80_SUPPORT */ + + + + /*------------------------------------------------------------------------------ + * + * Get/Set Machine Type Calls User Structure:: + * + * The get/set Machine type calls support the 440x (UniFLEX) and 440x+ (UTek) + * systems. The "Real" machine type cannot be changed. The get/set machine type + * may be manipulated to target software characteristics to multiple platforms. + * + * The long word "type" is defined as follows: + * + * bits 31-16 contain the HEX value of the machine model number. + * UniFLEX systems 4404/5/6 return/expect: + * 0x4404xxxx : 4404 + * 0x4405xxxx : 4405 + * 0x4406xxxx : 4406 + * The low order word is reserved hence "xxxx". + * + * UTek systems 4405/6/4315/6/7 return/expect: + * 0x44058xxx : 4405 (plus machine) + * 0x44068xxx : 4406 (plus machine) + * 0x4316C8xx : 4316 (gray scale + hardware cursor) + * 0x4317E8xx : 4317 (4316 + color crt) + * + * + * bit 15 contains the UTek "+" series (SET) / UniFLEX (CLEAR) system + * model indicator. + * (0x00008000) + * + * Additional UTek definitions { 4316 and 4317 only } + * + * + * bit 14 contains the display ColorDataPath/ColorMap hardware + * present indicator: SET indicates that this hardware + * is present. + * (0x00004000) + * + * bit 13 contains the color CRT display indicator: SET color CRT, + * NOT-SET monochrone CRT present. + * (0x00002000) + * + * bit 11 contains the color CRT display indicator: SET color CRT, + * NOT-SET monochrone CRT present. + * (0x00000800) + * + * bit 10 contains the color map style indicator: SET the "TRUE" + * color model is used, NOT-SET the "INDEXED" color map + * model is used. + * (0x00000400) + */ + + #define B_CLEAR 0 + #define B_SET 1 + + #define plus_machine_b 15 + #define plus_machine 1< + #include /* includes sys/errno.h & does an extern on errno */ + #include + #include + #include + #ifndef MACH + #include + #endif /* MACH */ + #include + + #ifdef ONRAMP + #include "keyboard88k.h" + #include "displayX.h" + #else /* ONRAMP */ + #include "keyboard.h" + #include "display.h" + #endif /* ONRAMP */ + + + #ifdef MACH + extern int errno; + #endif /* MACH */ + + extern int sys_local(); /* local system call interface */ + + + #ifdef ASM_VERSION_LOCK_UNLOCK + + extern int LockDisplay(); /* in the assy file */ + extern int UnlockDisplay(); /* in the assy file */ + + #endif /* ASM_VERSION_LOCK_UNLOCK */ + + + + /* + * LOCAL STRUCTURE DEFINITIONS: + */ + + #ifndef V_TEKTRONIX_BMW + #define V_TEKTRONIX_BMW 769 + #endif /* V_TEKTRONIX_BMW */ + + #ifndef NULL + #define NULL 0 + #endif /* NULL */ + + #ifdef SHARED_MEMORY_SEMAPHORE + /* + * various DEBUG items.... + */ + /*#define DEBUG_MESSAGES 1 */ + /*#define SEMAPHORE_TEST_CODE 1 */ + + #ifdef SEMAPHORE_TEST_CODE + extern unsigned long xmem(); /* xmem instruction in a sub-routine: xmem.s */ + extern x_serializePipeLine(); /* flush system: xmem.s */ + #endif /* SEMAPHORE_TEST_CODE */ + + /* + * VARS:: + */ + + extern int my_pid; /* my process ID */ + extern XDisplayState *dsp; /* handy & pleasant reg */ + #ifdef ONRAMP + extern CDP_device_t *pCdpG; /* pointer to the mapped CDP reg's */ + #else /* ONRAMP */ + extern CDP_device_t *cdpCtl; /* pointer to the mapped CDP reg's */ + #endif /* ONRAMP */ + + #endif /* SHARED_MEMORY_SEMAPHORE */ + + + /* */ + + #ifndef JUST_LOCK_UNLOCK + /*----------------------------------------------------------------------------*/ + + int + EnableCursor() /* SVC - 0 */ + { + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,cursorOn)); + } + + int + DisableCursor() /* SVC - 1 */ + { + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,cursorOff)); + } + + int + LinkCursorToMouse() /* SVC - 2 */ + { + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,cursorLink)); + } + + int + UnlinkCursorFromMouse() /* SVC - 3 */ + { + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,cursorUnlink)); + } + + int + CursorEnable() /* X-11: support: SVC-0 + SVC-2 */ + { + EnableCursor(); /* SVC - 0 */ + LinkCursorToMouse(); /* SVC - 2 */ + return(0); + } + + int + CursorDisable() /* X-11: support: SVC-1 + SVC-3 */ + { + DisableCursor(); /* SVC - 1 */ + UnlinkCursorFromMouse(); /* SVC - 3 */ + return(0); + } + + + int + DisplayOn() /* SVC - 6 */ + { + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,displayOn)); + } + + int + DisplayOff() /* SVC - 7 */ + { + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,displayOff)); + } + + int + EnableScreenSaver() /* SVC - 10 */ + { + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,timeoutOn)); + } + + int + TimeoutOn() /* SVC - 10 */ /* X-11 support */ + { + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,timeoutOn)); + } + + int + DisableScreenSaver() /* SVC - 11 */ + { + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,timeoutOff)); + } + + int + TimeoutOff() /* SVC - 11 */ /* X-11 support */ + { + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,timeoutOff)); + } + + int + SetNormalVideo() /* SVC - 12 */ + { + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,blackOnWhite)); + } + + int + SetInverseVideo() /* SVC - 13 */ + { + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,whiteOnBlack)); + } + + /*---------------------------------------------------------------------------- + * + * GetCurrentMousePosition -- + * + * when called: + * arg1: no args. + * + * upon return: + * ret_val: == X/Y point in packed form of 16 bits each part, + * packed in an unsigned long. + * errors: returns -1, error value in _errno + * + * possible errors: + * display primitive failed + */ + + unsigned long + GetCurrentMousePosition() /* SVC - 16 */ + { + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,getMousePoint)); + } + + /*---------------------------------------------------------------------------- + * + * SetMousePosition -- + * + * when called: + * arg1: == pointer to an X/Y SvcCursorXY structure. + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * display primitive failed + */ + + int + SetMousePosition(point) /* SVC - 17 */ + SvcCursorXY *point; + { + register short arg1; + register short arg2; + errno = 0; /* force a reset of errors prior to the system call */ + arg1 = point->x; + arg2 = point->y; + return(sys_local(V_TEKTRONIX_BMW,setMousePoint,arg1, arg2)); + } + + int + SetMousePosition_no_X_Event(point) /* SVC - */ + SvcCursorXY *point; + { + register short arg1; + register short arg2; + errno = 0; /* force a reset of errors prior to the system call */ + arg1 = point->x; + arg2 = point->y; + return(sys_local(V_TEKTRONIX_BMW,setMousePositionNoXevent, arg1, arg2)); + } + + unsigned long + GetCurrentCursorPosition() /* SVC - 18 */ + { + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,getCursorPoint)); + } + + int + SetCursorPosition(point) /* SVC - 19 */ + SvcCursorXY *point; + { + register short arg1; + register short arg2; + errno = 0; /* force a reset of errors prior to the system call */ + arg1 = point->x; + arg2 = point->y; + return(sys_local(V_TEKTRONIX_BMW,setCursorPoint, arg1, arg2)); + } + + int + SetCursorPosition_noEvt(point) /* SVC - 85 */ + SvcCursorXY *point; + { + register short arg1; + register short arg2; + errno = 0; /* force a reset of errors prior to the system call */ + arg1 = point->x; + arg2 = point->y; + return(sys_local(V_TEKTRONIX_BMW,setCursorPoint_noEvt, arg1, arg2)); + } + + int + SetCursorPoint(point) /* SVC - 19 */ /* X-11 support */ + SvcCursorXY *point; + { + register short arg1; + register short arg2; + arg1 = point->x; + arg2 = point->y; + return(sys_local(V_TEKTRONIX_BMW,setCursorPoint, arg1, arg2)); + } + + + /*---------------------------------------------------------------------------- + * + * SetSourceRectangle -- + * + * when called: + * arg1: pointer to an RECTangle structure. + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + SetSourceRectangle(arg1) /* S.W. cursor machines only. SVC - 21 */ + register struct RECT *arg1; + { + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,setSource, + arg1->x, arg1->y, arg1->h, arg1->w)); + } + + ProtectSource(arg1) /* stubb - no-op for X-11 */ + register struct RECT *arg1; + { + errno = 0; /* force a reset of errors prior to the system call */ + return(0); + } + + ProtectDestination(arg1) /* stubb - no-op for X-11 */ + register struct RECT *arg1; + { + errno = 0; /* force a reset of errors prior to the system call */ + return(0); + } + + ProtectCursorCompleted() /* stubb - no-op for X-11 */ + { + errno = 0; /* force a reset of errors prior to the system call */ + return(0); + } + + MousePanOn() /* stubb - no-op for X-11 */ + { + errno = 0; /* force a reset of errors prior to the system call */ + return(0); + } + + JoyPanOff() /* stubb - no-op for X-11 */ + { + errno = 0; /* force a reset of errors prior to the system call */ + return(0); + } + + /*---------------------------------------------------------------------------- + * + * SetDestinationRectangle -- + * + * when called: + * arg1: pointer to an RECTangle structure. + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + SetDestinationRectangle(arg1) /* S.W. cursor machines only. SVC - 22 */ + register struct RECT *arg1; + { + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,setDestination, + arg1->x, arg1->y, arg1->h, arg1->w)); + } + + /*---------------------------------------------------------------------------- + * + * DisplayRelease -- + * + * when called: + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + DisplayRelease() /* S.W. cursor machines only. SVC - 23 */ + { + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,updateComplete)); + } + + /*---------------------------------------------------------------------------- + * + * GetDisplayState -- + * + * when called: + * arg1: pointer to an "DisplayState" array. + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + GetDisplayState(arg1) /* SVC - 28 */ + register struct DisplayState *arg1; + { + if (arg1 == NULL) { + errno = EINVAL; + return(-1); + } + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,getDisplayState,arg1); + if (errno != 0) { + return(-1); + } + return(0); + } + + /*---------------------------------------------------------------------------- + * + * GetMouseBounds -- + * + * when called: + * arg1: longword which gives size of color map array + * arg2: pointer to an array of color map entries + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + GetMouseBounds(arg1) /* SVC - 30 */ + register struct RECT *arg1; + { + struct POINT ULpoint; + struct POINT LRpoint; + + if (arg1 == NULL) { + errno = EINVAL; + return(-1); + } + + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW, getMouseBounds, &ULpoint, &LRpoint ); + if (errno != 0) { + return(-1); + } + arg1->x = ULpoint.x; + arg1->y = ULpoint.y; + arg1->w = LRpoint.x - ULpoint.x; + arg1->h = LRpoint.y - ULpoint.y; + return(0); + } + + int + GetCursorBounds(arg1) /* SVC - 30 */ /* X-11 support */ + register struct RECT *arg1; + { + struct POINT ULpoint; + struct POINT LRpoint; + + if (arg1 == NULL) { + errno = EINVAL; + return(-1); + } + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW, getMouseBounds, &ULpoint, &LRpoint); + if (errno != 0) { + return(-1); + } + arg1->x = ULpoint.x; + arg1->y = ULpoint.y; + arg1->w = LRpoint.x - ULpoint.x; + arg1->h = LRpoint.y - ULpoint.y; + return(0); + } + + /*---------------------------------------------------------------------------- + * + * SetMouseBounds -- + * + * when called: + * arg1: pointer to an XY point upper left. + * arg2: pointer to an XY point lower right. + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + SetMouseBounds(arg1, arg2) /* SVC - 31 */ + SvcCursorXY *arg1, *arg2; + { + if (arg1 == NULL) { + errno = EINVAL; + return(-1); + } + + if (arg2 == NULL) { + errno = EINVAL; + return(-1); + } + + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,setMouseBounds, + (int) arg1->x, (int) arg1->y, (int) arg2->x, (int) arg2->y); + if (errno != 0) { + return(-1); + } + return(0); + } + + int + SetCursorBounds(arg1, arg2) /* SVC - 31 */ /* X-11 support */ + SvcCursorXY *arg1, *arg2; + { + if (arg1 == NULL) { + errno = EINVAL; + return(-1); + } + + if (arg2 == NULL) { + errno = EINVAL; + return(-1); + } + + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,setMouseBounds, + (int) arg1->x, (int) arg1->y, (int) arg2->x, (int) arg2->y); + if (errno != 0) { + return(-1); + } + return(0); + } + + /*---------------------------------------------------------------------------- + * + * SetCursorSourceAndMask -- + * + * when called: + * arg1: longword which gives size of color map array + * arg2: pointer to an array of color map entries + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + SetCursorSourceAndMask(arg1) /* SVC - 50 */ + register struct CursorFormStructure *arg1; + { + if (arg1 == NULL) { + errno = EINVAL; + return(-1); + } + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,setCursorSourceAndMask,arg1); + if (errno != 0) { + return(-1); + } + return(0); + } + + /*---------------------------------------------------------------------------- + * + * GetCursorSourceAndMask -- + * + * when called: + * arg1: longword which gives size of color map array + * arg2: pointer to an array of color map entries + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + GetCursorSourceAndMask(arg1) /* SVC - 51 */ + register struct CursorFormStructure *arg1; + { + if (arg1 == NULL) { + errno = EINVAL; + return(-1); + } + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,getCursorSourceAndMask,arg1); + if (errno != 0) { + return(-1); + } + return(0); + } + + /*---------------------------------------------------------------------------- + * + * SetCrosshairCursor -- + * + * when called: + * arg1: longword which gives size of color map array + * arg2: pointer to an array of color map entries + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + SetCrosshairCursor (arg1) /* SVC - 52 */ + register struct CrosshairCursorStructure *arg1; + { + if (arg1 == NULL) { + errno = EINVAL; + return(-1); + } + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,setCrosshairCursor,arg1)); + } + + /*---------------------------------------------------------------------------- + * + * GetCrosshairCursor -- + * + * when called: + * arg1: longword which gives size of color map array + * arg2: pointer to an array of color map entries + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + GetCrosshairCursor(arg1) /* SVC - 53 */ + register struct CrosshairCursorStructure *arg1; + { + if (arg1 == NULL) { + errno = EINVAL; + return(-1); + } + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,getCrosshairCursor,arg1)); + } + + /*---------------------------------------------------------------------------- + * + * SetCursorMode -- + * + * when called: + * arg1: longword which gives size of color map array + * arg2: pointer to an array of color map entries + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + SetCursorMode(arg1) /* SVC - 54 */ + register struct CursorMode *arg1; + { + if (arg1 == NULL) { + errno = EINVAL; + return(-1); + } + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,setCursorMode,arg1)); + } + + /*---------------------------------------------------------------------------- + * + * GetCursorMode -- + * + * when called: + * arg1: longword which gives size of color map array + * arg2: pointer to an array of color map entries + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + GetCursorMode() /* SVC - 55 */ + { + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,getCursorMode)); + } + + /*---------------------------------------------------------------------------- + * + * SetCursorFormCombinationRule(Rule_paramter) -- + * + * when called: + * arg1: longword which gives size of color map array + * arg2: pointer to an array of color map entries + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + /* -NEW- SetCursorFormCombinationRule(Rule_paramter) */ + + + /*---------------------------------------------------------------------------- + * + * SetColorMap -- Set color map entries + * + * when called: + * arg1: longword which gives size of color map array + * arg2: pointer to an array of color map entries + * If arg2 is a null pointer, the "default" display + * system color map will be installed. + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * display primitive failed + */ + + int + SetColorMap(arg1, arg2) + register unsigned long arg1; + register struct An_ColorMap *arg2; + { + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,setColorMap,arg1,arg2); + if (errno != 0) { + return(-1); + } + return(0); + } + + /*----------------------------------------------------------------------------- + * + * SetGrayMap -- Set grayscale map entries + * + * when called: + * arg1: longword which gives size of grayscale map array + * arg2: pointer to an array of grayscale map entries + * If arg2 is a null pointer, the "default" display + * system color map will be installed. + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + SetGrayMap (arg1, arg2) + register unsigned long arg1; + register struct An_GrayMap *arg2; + { + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,setGrayMap,arg1,arg2); + if (errno != 0) { + return(-1); + } + return(0); + } + + /*------------------------------------------------------------------------------ + * + * SetGrayEntry -- Set a grayscale entry + * + * when called: + * arg1: pointer to grayscale entry array. + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + SetGrayEntry(arg1) + register struct GrayMapEntry *arg1; + { + if (arg1 == NULL) { + errno = EINVAL; + return(-1); + } + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,setGrayMap,arg1); + if (errno != 0) { + return(-1); + } + return(0); + } + + /*------------------------------------------------------------------------------ + * + * SetColorEntry -- Set a color entry + * + * when called: + * arg1: pointer to color entry array. + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + SetColorEntry(arg1) + register struct ColorMapEntry *arg1; + { + if (arg1 == NULL) { + errno = EINVAL; + return(-1); + } + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,setColorEntry,arg1); + if (errno != 0) { + return(-1); + } + return(0); + } + + /*------------------------------------------------------------------------------ + * + * GetColorMap -- get color map entries + * + * when called: + * arg1: pointer to unsigned long to hold color map size + * arg2: pointer to array to hold color map + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + GetColorMap(arg1, arg2) + register unsigned long *arg1; + register struct An_ColorMap *arg2; + { + if (arg1 == NULL) { + errno = EINVAL; + return(-1); + } + if (arg2 == NULL) { + errno = EINVAL; + return(-1); + } + errno = 0; /* force a reset of errors prior to the system call */ + *arg1 = (sys_local(V_TEKTRONIX_BMW,getColorMap,arg2)); + if (errno != 0) { + return(-1); + } + return(0); + } + + /*------------------------------------------------------------------------------ + * + * GetGrayMap -- get color map entries + * + * when called: + * arg1: pointer to unsigned long to hold color map size + * arg2: pointer to array to hold color map + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + GetGrayMap(arg1, arg2) + register unsigned long *arg1; + register struct An_GrayMap *arg2; + { + if (arg1 == NULL) { + errno = EINVAL; + return(-1); + } + if (arg2 == NULL) { + errno = EINVAL; + return(-1); + } + errno = 0; /* force a reset of errors prior to the system call */ + *arg1 = (sys_local(V_TEKTRONIX_BMW,getColorMap,arg2)); + if (errno != 0) { + return(-1); + } + return(0); + } + + /*------------------------------------------------------------------------------ + * + * GetGrayEntry -- get a color map entry + * + * when called: + * arg1: index of desired entry. + * arg2: pointer to array to hold color map entry + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + GetGrayEntry(arg1, arg2) + register unsigned long arg1; + register struct GrayMapEntry *arg2; + { + if (arg2 == NULL) { + errno = EINVAL; + return(-1); + } + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,getGrayEntry,arg1,arg2); + if (errno != 0) { + return(-1); + } + return(0); + } + + /*------------------------------------------------------------------------------ + * + * GetColorEntry -- get a gray map entry + * + * when called: + * arg1: index of desired entry. + * arg2: pointer to array to hold color map entry + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + GetColorEntry(arg1, arg2) + register unsigned long arg1; + register struct GrayMapEntry *arg2; + { + if (arg2 == NULL) { + errno = EINVAL; + return(-1); + } + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,getColorEntry,arg1,arg2); + if (errno != 0) { + return(-1); + } + return(0); + } + + /*------------------------------------------------------------------------------ + * + * SetMouseSpeed -- Set Mouse Speed + * + * when called: + * arg1: pointer to an array of mouse speed characteristics + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + SetMouseSpeed(arg1) + register struct MouseSpeedStruct *arg1; + { + if (arg1 == NULL) { + errno = EINVAL; + return(-1); + } + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,setMouseSpeed,arg1); + if (errno != 0) { + return(-1); + } + return(0); + } + + int + SetCursorSpeed(arg1) /* X-11 support */ + register struct MouseSpeedStruct *arg1; + { + if (arg1 == NULL) { + errno = EINVAL; + return(-1); + } + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,setMouseSpeed,arg1); + if (errno != 0) { + return(-1); + } + return(0); + } + + + /*---------------------------------------------------------------------------- + * + * GetCursorOffset -- Get Cursor Form Image offset + * + * when called: -nothing- + * + * upon return: + * ret_val: a packed unsigned integer of 16:16 x:y offset. + * + * possible errors: + * display primitive failed + */ + + int + GetCursorOffset() + { + errno = 0; /* force a reset of errors prior to the system call */ + + return(sys_local(V_TEKTRONIX_BMW,getCursorOffset)); + } + + /*---------------------------------------------------------------------------- + * + * GetMouseSpeed -- Get Mouse Speed + * + * when called: + * arg1: pointer to an array to be filled with the current + * mouse speed characteristics. + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + GetMouseSpeed(arg1) + register struct MouseSpeedStruct *arg1; + { + if (arg1 == NULL) { + errno = EINVAL; + return(-1); + } + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,getMouseSpeed,arg1); + if (errno != 0) { + return(-1); + } + return(0); + } + + int + GetCursorSpeed(arg1) /* X-11 support */ + register struct MouseSpeedStruct *arg1; + { + if (arg1 == NULL) { + errno = EINVAL; + return(-1); + } + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,getMouseSpeed,arg1); + if (errno != 0) { + return(-1); + } + return(0); + } + + /*------------------------------------------------------------------------------ + * + * GetColorState -- Get Color State + * + * when called: + * arg1: pointer to an array to be filled with the current + * color (stuff) characteristics. + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + GetColorState(arg1) + register struct ColorStateStruct *arg1; + { + if (arg1 == NULL) { + errno = EINVAL; + return(-1); + } + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,getColorState,arg1); + if (errno != 0) { + return(-1); + } + return(0); + } + + /*------------------------------------------------------------------------------ + * + * SetCursorColor -- Get Cursor Color + * + * when called: + * arg1: pointer to an array to be used for the current cursor colors. + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + SetCursorColor(arg1) + register struct CursorColorStruct *arg1; + { + if (arg1 == NULL) { + errno = EINVAL; + return(-1); + } + + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,setCursorColor,arg1); + if (errno != 0) { + return(-1); + } + return(0); + } + + /*------------------------------------------------------------------------------ + * + * GetCursorColor -- Get Cursor Color + * + * when called: + * arg1: pointer to an array to be filled with the current + * cursor colors. + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * null pointer + * display primitive failed + */ + + int + GetCursorColor(arg1) + register struct CursorColorStruct *arg1; + { + if (arg1 == NULL) { + errno = EINVAL; + return(-1); + } + + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,getCursorColor,arg1); + if (errno != 0) { + return(-1); + } + return(0); + } + + /*------------------------------------------------------------------------------ + * + * InquireDisplayLock - lock state. + * + * upon return: + * ret_val: == PID and process pointer address: successful + * + */ + + unsigned long + InquireDisplayLock() + { + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,inquireDisplayLock)); + } + + /*------------------------------------------------------------------------------ + * + * InquireColorMapLock - lock state. + * + * upon return: + * ret_val: == PID and process pointer address: successful + * + */ + + unsigned long + InquireColorMapLock() + { + errno = 0; /* force a reset of errors prior to the system call */ + return(sys_local(V_TEKTRONIX_BMW,inquireColorMapLock)); + } + + /*---------------------------------------------------------------------------*/ + #endif /* JUST_LOCK_UNLOCK */ + + + /*----------------------------------------------------------------------------- + * + * LockDisplay - lock the display resource. + * + * when called: + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * display primitive failed + */ + + #ifndef SHARED_MEMORY_SEMAPHORE + int + LockDisplay() + #else /* SHARED_MEMORY_SEMAPHORE */ + int + Sys_LockDisplay() + #endif /* SHARED_MEMORY_SEMAPHORE */ + { + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,lockDisplay); + if (errno != 0) { + return(-1); + } + return(0); + } + + /*----------------------------------------------------------------------------- + * + * UnlockDisplay - unlock the display resource. + * + * UnlockDisplay_noCDP - unlock the display resource but don't -reset- the + * CDP registers..... + * + * when called: + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * display primitive failed + */ + + #ifndef SHARED_MEMORY_SEMAPHORE + int + UnlockDisplay() + #else /* SHARED_MEMORY_SEMAPHORE */ + int + Sys_UnlockDisplay() + #endif /* SHARED_MEMORY_SEMAPHORE */ + { + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,unlockDisplay); + if (errno != 0) { + return(-1); + } + return(0); + } + + #ifndef SHARED_MEMORY_SEMAPHORE + int + UnlockDisplay_noCDP() + { + return(UnlockDisplay()); + } + #endif /* SHARED_MEMORY_SEMAPHORE */ + + /*----------------------------------------------------------------------------- + * + * LockColorMap - lock the display resource. + * + * when called: + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * display primitive failed + */ + LockColorMap() + { + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,lockColorMap); + if (errno != 0) { + return(-1); + } + return(0); + } + + /*----------------------------------------------------------------------------- + * + * UnlockColorMap - unlock the display resource. + * + * when called: + * + * upon return: + * ret_val: == 0 : successful + * < 0 : error, error condition code in _errno + * + * possible errors: + * display primitive failed + */ + + int + UnlockColorMap() + { + errno = 0; /* force a reset of errors prior to the system call */ + sys_local(V_TEKTRONIX_BMW,unlockColorMap); + if (errno != 0) { + return(-1); + } + return(0); + } + + + /* */ + + + #ifdef SHARED_MEMORY_SEMAPHORE + /*------------------------------------------------------------------------------ + * + * (int) initSharedMemoryDisplaySemaphore():: + * + * + * Returns:: + * + * 0 - if cannot get it, already in use. -or- kernel incompatable. + * 1 - got it! + * + */ + + int + initSharedMemoryDisplaySemaphore() + { + int xdevfd; + /* + * Open /dev/xdevsemlock + */ + if ((xdevfd = open("/dev/xdevsemlock", O_RDONLY)) < 0) { + #ifdef DEBUG + printf("can't open /dev/xdevsemlock\n"); + printf("\terrno = %d\n", errno); + perror(); + #endif /* DEBUG */ + return(0); /* already in use */ + } + /* + * Make ioctl() call set shared memory lock -owner- + */ + if (ioctl(xdevfd, CE_SET_LOCK_OWNER, 0) == -1) { + #ifdef DEBUG + printf("ioctl() returns error "); + printf("%d for CE_SET_LOCK_OWNER\n", errno); + perror(); + #endif /* DEBUG */ + close(xdevfd); /* not available */ + return(0); /* already in use */ + } + + return(1); /* got it */ + } + + #ifndef ASM_VERSION_LOCK_UNLOCK + /*------------------------------------------------------------------------------ + * + * LockDisplay():: + * + */ + + int + LockDisplay() + { + register unsigned long *address; + register unsigned long oldValue; + register unsigned long data; + register int result; + + /* + * Is it owned -and- do I own it ? (bullit proofing). + */ + if ((dsp->df_lockDisplayOwnerPID != 0) && + (dsp->df_lockDisplayOwnerPID == my_pid)) { + + /* + * Establish a pointer to the display semaphore + * located in the shared memory block. + */ + address = &dsp->df_lockDisplayFlag; + data = -1; /* 0xffffffff : non zero */ + + /* + * Now try to -GET- semaphore:: + */ + oldValue = xmem(address, data); + + /* + * Was it already locked ? + */ + if (oldValue == 0) { + /* + * Not owned:: Establish single lock count & my pid as owner. + */ + dsp->df_lockDisplayPID = my_pid; + dsp->df_lockDisplayCount = 1; + return(0); /* return "ok" value */ + } + else + { + /* + * display semaphore already locked: + * + * Do I own it ? + */ + if (dsp->df_lockDisplayPID == my_pid) { + dsp->df_lockDisplayCount = dsp->df_lockDisplayCount +1; + + #ifdef DEBUG_MESSAGES + fprintf(stdout, "LockDisplay:: Shared memory display "); + fprintf(stdout, "semaphore already locked.\n"); + fflush(stdout); + fprintf(stdout, "I already own it, lock count incr.\n"); + fflush(stdout); + #endif /* DEBUG_MESSAGES */ + + return(0); /* return "ok" value */ + } + } + } + + /* + * SLOW path:: + * + * Just do a system call to get the semaphore:: + * + * This handles the cases where I don't own the display sempahore, + * where it is unlocked and there are sleepers, -and- the case + * where no one owns the shared memory semaphore. + */ + + #ifdef DEBUG_MESSAGES + fprintf(stdout, "LockDisplay:: Shared memory display "); + fprintf(stdout, "semaphore already locked.\n"); + fflush(stdout); + fprintf(stdout, "Calling Sys_LockDisplay() display call.\n"); + fprintf(stdout, "-to- sleep on the display semaphore.\n"); + fflush(stdout); + #endif /* DEBUG_MESSAGES */ + + result = Sys_LockDisplay(); /* kernel call */ + + #ifdef DEBUG_MESSAGES + fprintf(stdout, "\nLockDisplay:: Returned from Sys_LockDisplay.\n"); + fflush(stdout); + #endif /* DEBUG_MESSAGES */ + + return(result); + } + + + /*------------------------------------------------------------------------------ + * + * UnlockDisplay():: + * + */ + + #define ColorBackGroundIndex 1 /* index 1 : white */ + #define ColorForeGroundIndex 0 /* index 0 : black */ + + int + UnlockDisplay() + { + + register unsigned long *address; + register unsigned long oldValue; + + register int result; + register CDP_device_t *CDPp; + + /* + * Is it owned -and- do I own it ? (bullit proofing). + */ + if ((dsp->df_lockDisplayOwnerPID != 0) && + (dsp->df_lockDisplayOwnerPID == my_pid)) { + + /* + * Do I own it ? + */ + if (dsp->df_lockDisplayPID == my_pid) { + + #ifdef DEBUG_MESSAGES + fprintf(stdout, "UnlockDisplay:: Decrement lock count.\n"); + fflush(stdout); + #endif /* DEBUG_MESSAGES */ + + /* + * Decrement lock count, if 0, clear out ownership:: + */ + if (dsp->df_lockDisplayCount > 0) { + dsp->df_lockDisplayCount = dsp->df_lockDisplayCount -1; + } + if (dsp->df_lockDisplayCount == 0) { + if ((dsp->df_lockDisplaySleepers == 0) && + (dsp->df_lockDisplaySig == 0)) { + + /* + * No sleepers & no signals, so just clean + * up the CDP and return. + */ + #ifdef ONRAMP + CDPp = pCdpG; /* fetch pointer */ + #else /* ONRAMP */ + CDPp = cdpCtl; /* fetch pointer */ + #endif /* ONRAMP */ + + CDPp->CDP_PlaneEnableReg = (1 << dsp->ds_fbDepth) -1; + /* Enable all bit planes */ + CDPp->CDP_WriteReg0 = ColorBackGroundIndex; + CDPp->CDP_WriteReg1 = ColorForeGroundIndex; + CDPp->CDP_FilterReg = ColorForeGroundIndex; + CDPp->CDP_MaskRegSet = 0xFFFFFFFF; + /* mask Set reg, enable all */ + CDPp->CDP_MaskRegNoSet = 0xFFFFFFFF; + /* mask NoSet reg, enable */ + /* all pixels to be written. */ + /* + * Now unlock !! + * (remove flag last!). + */ + dsp->df_lockDisplayPID = 0; /* reset owner */ + dsp->df_lockDisplayFlag = 0; /* no longer locked */ + return(0); /* return result = 0 */ + } + else + { + #ifdef DEBUG_MESSAGES + fprintf(stdout, "UnlockDisplay:: There are sleepers\n"); + fprintf(stdout, "calling Sys_UnlockDisplay().\n"); + fflush(stdout); + #endif /* DEBUG_MESSAGES */ + } + } + + } + } + + /* + * SLOW path:: + * + * Just do a system call to get the semaphore:: + * + * This handles the cases where I don't own the display sempahore, + * where it is unlocked and there are sleepers, -and- the case + * where no one owns the shared memory semaphore. + */ + result = Sys_UnlockDisplay(); /* kernel call */ + + return(result); + } + + /*------------------------------------------------------------------------------ + * + * UnlockDisplay_noCDP():: + * + */ + + int + UnlockDisplay_noCDP() + { + + register unsigned long *address; + register unsigned long oldValue; + + register int result; + + /* + * Is it owned -and- do I own it ? (bullit proofing). + */ + if ((dsp->df_lockDisplayOwnerPID != 0) && + (dsp->df_lockDisplayOwnerPID == my_pid)) { + + /* + * Do I own it ? + */ + if (dsp->df_lockDisplayPID == my_pid) { + + #ifdef DEBUG_MESSAGES + fprintf(stdout, "UnlockDisplay:: Decrement lock count.\n"); + fflush(stdout); + #endif /* DEBUG_MESSAGES */ + + /* + * Decrement lock count, if 0, clear out ownership:: + */ + if (dsp->df_lockDisplayCount > 0) { + dsp->df_lockDisplayCount = dsp->df_lockDisplayCount -1; + } + if (dsp->df_lockDisplayCount == 0) { + if ((dsp->df_lockDisplaySleepers == 0) && + (dsp->df_lockDisplaySig == 0)) { + + /* + * No sleepers & no signals, so NOW UNLOCK & just + * return. (remove flag last!). + */ + dsp->df_lockDisplayPID = 0; /* reset owner */ + dsp->df_lockDisplayFlag = 0; /* no longer locked */ + return(0); /* return result = 0 */ + } + else + { + #ifdef DEBUG_MESSAGES + fprintf(stdout, "UnlockDisplay:: There are sleepers\n"); + fprintf(stdout, "calling Sys_UnlockDisplay().\n"); + fflush(stdout); + #endif /* DEBUG_MESSAGES */ + } + } + + } + } + + /* + * SLOW path:: + * + * Just do a system call to get the semaphore:: + * + * This handles the cases where I don't own the display sempahore, + * where it is unlocked and there are sleepers, -and- the case + * where no one owns the shared memory semaphore. + */ + result = Sys_UnlockDisplay(); /* kernel call */ + + return(result); + } + + #else /* ASM_VERSION_LOCK_UNLOCK */ + #endif /* ASM_VERSION_LOCK_UNLOCK */ + + + #ifdef SEMAPHORE_TEST_CODE + /*------------------------------------------------------------------------------ + * + * SemaphoreTest(): + * + */ + SemaphoreTest() + { + unsigned long *address; + unsigned long oldValue; + unsigned long data; + + LockDisplay(); + + #ifdef DEBUG_MESSAGES + fprintf(stdout, "\nReturned from LockDisplay.......\n"); + fflush(stdout); + #endif /* DEBUG_MESSAGES */ + + /* + * Own it for 3 seconds:: + */ + sleep(3); /* sleep for 3 seconds */ + + #ifdef DEBUG_MESSAGES + fprintf(stdout, "Now giving up ownership.\n"); + fprintf(stdout, "calling UnlockDisplay().\n"); + fflush(stdout); + #endif /* DEBUG_MESSAGES */ + + UnlockDisplay(); /* wake up the sleepers */ + } + + #endif /* SEMAPHORE_TEST_CODE */ + #endif /* SHARED_MEMORY_SEMAPHORE */ + + /*------------------------------------------------------------------------------*/ + *** XD88-patchlevel-26-mit/server/ddx/tek/redwing/keyboard.h Fri Feb 11 09:54:56 1994 --- XD8810-mit/server/ddx/tek/redwing/keyboard.h Fri Feb 11 10:03:59 1994 *************** *** 0 **** --- 1,1157 ---- + /* + * $Header: keyboard.h,v 1.16 90/03/13 10:41:57 steveje Exp $ + * + * $Locker: $ + * + * Copyright 1989, 1990, 1991 by Tektronix, Inc., Beaverton, Oregon. + * + * All Rights Reserved. + * + * NOTICE: + * + * THIS PROGRAM IS NOT A SUPPORTED TEKTRONIX PRODUCT, AND IS + * NOT GUARANTEED TO BE FREE OF ERRORS. THERE IS NO WARRANTY + * EXPRESSED OR IMPLIED, AND TEKTRONIX ASSUMES NO LIABILITY FOR + * DAMAGES RESULTING FROM IT'S USE. + * + * + * 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 appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Tektronix not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TEKTRONIX BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + * + * Author: Steve Jensen, 1989 + * + * + * This Redwing file "keyboard.h" is based on the UTek kernel include + * files pegio/keyboard.h, pegio/commregs.h & pegio/duart_regs.h for + * the 4405/6/4315/16/17/19. + * + * Included are -raw- key code tables for 4400/4310 (Unicorn) and 4200/4330 + * (TNT/CRYSTAL) style keyboards and hardware definitions for the duart device. + * + *------------------------------------------------------------------------------ + * + * Requires these include files for these structures: + * + * File Structure + * + * sys/ioctl.h reference only.. + * + *------------------------------------------------------------------------------ + */ + + #ifndef KEYBOARD_H + #define KEYBOARD_H + + /* + * bits assignments within metaState word: + */ + #define KBcapsLockOn 0x8000 + #define KBshiftOn 0x4000 + #define KBctlOn 0x2000 + + #ifndef Released + #define Released 0x00 /* bit 7 is CLEARED for an DOWN-STROKE */ + #define Pressed 0x80 /* bit 7 is SET for an UP-STROKE */ + #endif /* Released */ + + + /*------------------------------------------------------------------------------ + * + * Key Code equates for 4400/4310 (VT100-Unicorn) style keyboards: + * + *------------------------------------------------------------------------------ + * + * Key Legend value from Press Code (Hex) + * duart + *------------------------------------------------------------------------------ + */ + #define KBCapsLock 0x00 /* 3F (?) */ + #define KBShiftL 0x01 /* 3F (?) */ + #define KBShiftR 0x02 /* 3F (?) */ + #define KBCtrl 0x03 /* 3F (?) */ + #define KBLeftArrow 0x04 /* F8 (248) */ + #define KBBreak 0x05 /* FC (252) */ + #define KBBackSpace 0x06 /* 08 (BS) */ + #define KBTab 0x07 /* 09 (HT) */ + #define KBLineFeed 0x08 /* 0A (LF) */ + #define KBReturn 0x09 /* 0D (CR) */ + #define KBEsc 0x0A /* 1B (ESC) */ + #define KBSpaceBar 0x0B /* 20 (SP) */ + #define KBQuote 0x0C /* 27 (') */ + #define KBComma 0x0D /* 2C (,) */ + #define KBHyphon 0x0E /* 2D (-) */ + #define KBPeriod 0x0F /* 2E (.) */ + #define KBSlash 0x10 /* 2F (/) */ + #define KB0 0x11 /* 30 (0) */ + #define KB1 0x12 /* 31 (1) */ + #define KB2 0x13 /* 32 (2) */ + #define KB3 0x14 /* 33 (3) */ + #define KB4 0x15 /* 34 (4) */ + #define KB5 0x16 /* 35 (5) */ + #define KB6 0x17 /* 36 (6) */ + #define KB7 0x18 /* 37 (7) */ + #define KB8 0x19 /* 38 (8) */ + #define KB9 0x1A /* 39 (9) */ + #define KBSemiColon 0x1B /* 3B (;) */ + #define KBEqual 0x1C /* 3D (=) */ + #define KBA 0x1D /* 61 (a) */ + #define KBB 0x1E /* 62 (b) */ + #define KBC 0x1F /* 63 (c) */ + #define KBD 0x20 /* 64 (d) */ + #define KBE 0x21 /* 65 (e) */ + #define KBF 0x22 /* 66 (f) */ + #define KBG 0x23 /* 67 (g) */ + #define KBH 0x24 /* 68 (h) */ + #define KBI 0x25 /* 69 (i) */ + #define KBJ 0x26 /* 6A (j) */ + #define KBK 0x27 /* 6B (k) */ + #define KBL 0x28 /* 6C (l) */ + #define KBM 0x29 /* 6D (m) */ + #define KBN 0x2A /* 6E (n) */ + #define KBO 0x2B /* 6F (o) */ + #define KBP 0x2C /* 70 (p) */ + #define KBQ 0x2D /* 71 (q) */ + #define KBR 0x2E /* 72 (r) */ + #define KBS 0x2F /* 73 (s) */ + #define KBT 0x30 /* 74 (t) */ + #define KBU 0x31 /* 75 (u) */ + #define KBV 0x32 /* 76 (v) */ + #define KBW 0x33 /* 77 (w) */ + #define KBX 0x34 /* 78 (x) */ + #define KBY 0x35 /* 79 (y) */ + #define KBZ 0x36 /* 7A (z) */ + #define KBBraceL 0x37 /* 5B ([) */ + #define KBBackSlash 0x38 /* 5C (\) */ + #define KBBraceR 0x39 /* 5D (]) */ + #define KBBar 0x3A /* 7C (|) */ + #define KBRubOut 0x3B /* 7F (DEL) */ + #define KBEnter 0x3C /* 0D (CR) */ + + /* + * Key Pad Definitions: + */ + #define KPComma 0x3D /* 2C (,) */ + #define KPHyphon 0x3E /* 2D (-) */ + #define KPPeriod 0x3F /* 2E (.) */ + #define KP0 0x40 /* 30 (0) */ + #define KP1 0x41 /* 31 (1) */ + #define KP2 0x42 /* 32 (2) */ + #define KP3 0x43 /* 33 (3) */ + #define KP4 0x44 /* 34 (4) */ + #define KP5 0x45 /* 35 (5) */ + #define KP6 0x46 /* 36 (6) */ + #define KP7 0x47 /* 37 (7) */ + #define KP8 0x48 /* 38 (8) */ + #define KP9 0x49 /* 39 (9) */ + + /* + * Key Board Function Key Definitions: + */ + #define KBF5 0x4A /* 90 (144) */ + #define KBF6 0x4B /* 94 (148) */ + #define KBF7 0x4C /* 98 (152) */ + #define KBF8 0x4D /* 9C (156) */ + #define KBF9 0x4E /* A0 (160) */ + #define KBF10 0x4F /* A4 (164) */ + #define KBF11 0x50 /* A8 (168) */ + #define KBF12 0x51 /* AC (172) */ + #define KBF1 0x52 /* 80 (128) */ + #define KBF2 0x53 /* 84 (132) */ + #define KBF3 0x54 /* 88 (136) */ + #define KBF4 0x55 /* 8C (140) */ + + /* + * joy disk: + */ + #define KBJoyRight 0x56 /* B8 (184) */ + #define KBJoyUp 0x57 /* B0 (176) */ + #define KBJoyLeft 0x58 /* BC (188) */ + #define KBJoyDown 0x59 /* B4 (180) */ + + /* + * auxiliary joy disk codes: + */ + #define KBJoyRtUp 0x60 + #define KBJoyLfUp 0x61 + #define KBJoyLfDown 0x62 + #define KBJoyRtDown 0x63 + + /* + * Reply codes received from keyboard: + */ + #define KB_TESTOK 0xf0 /* keyboard selftest passes */ + #define KB_TESTBAD 0xff /* keyboard selftest fails */ + + /* + * Keyboard Language Identifiers: + */ + #define KB_LANG_NAMERICAN 0xF1 /* - North American */ + #define KB_LANG_SPANISH 0xF2 /* - Spanish */ + #define KB_LANG_SWEDISH 0xF3 /* - Swedish */ + #define KB_LANG_ITALIAN 0xF4 /* - Italian */ + #define KB_LANG_FRENCH 0xF5 /* - French */ + #define KB_LANG_HEBREW 0xF6 /* - Hebrew */ + #define KB_LANG_DAN_NOR 0xF7 /* - Danish/Norwegian */ + #define KB_LANG_GERMAN 0xF8 /* - German */ + #define KB_LANG_UK 0xF9 /* - United Kingdom */ + #define KB_LANG_SWISS_GERMAN 0xFA /* - Swiss / German */ + #define KB_LANG_KATAKANA 0xFB /* - Katakana */ + + /* + * command codes sent to the keyboard: + */ + #define KB_DORESET 0x08 + #define KB_CAPSFLASHOFF 0x1a + #define KB_KEY_ID 0x20 /* Request Keyboard Language (font) + * model command: + * 0xF0 = reserved + * 0xF1 = North American + * 0xF2 = Spanish + * 0xF3 = Swedish + * etc. See keyboard specfications and + * information listed above for models and + * definitions. + */ + #define KB_KEY_ID_LANG KB_KEY_ID + + #define KB_CAPSON 0x30 + #define KB_CAPSOFF 0x50 + + /*------------------------------------------------------------------------------ + * + * END -- 4400/4310 (VT100-Unicorn) style keyboards + * + *------------------------------------------------------------------------------ + */ + + + #ifndef KEY_Lock + /*------------------------------------------------------------------------------ + * + * Key Code equates for 4320/4330/4319 (VT200) style keyboards: + * + *------------------------------------------------------------------------------ + * + * + * + * Key Code equates for 4200/4330 (TNT/CRYSTAL) style keyboards: + * + * (Note: These definitions from file X.v11/server/ddx/gds/keynames.h) + * + *------------------------------------------------------------------------------ + * + * Defined Key Cap Glyphs Pressed code + * Key Name Main Also (hex) (octal) (dec) + * ---------------- ---------- ------- ------ ----- ----- + */ + + #define KEY_Lock /* Lock 0x00 0000 */ 0 + #define KEY_ShiftL /* Shift(left) 0x01 0001 */ 1 + #define KEY_ShiftR /* Shift(right) 0x02 0002 */ 2 + #define KEY_Ctrl /* Ctrl 0x03 0003 */ 3 + #define KEY_SErase /* S Eras 0x04 0004 */ 4 + #define KEY_Break /* Break 0x05 0005 */ 5 + #define KEY_BackSpace /* Back Space 0x06 0006 */ 6 + #define KEY_Tab /* Tab 0x07 0007 */ 7 + #define KEY_Linefeed /* Line Feed 0x08 0010 */ 8 + #define KEY_Return /* Return 0x09 0011 */ 9 + #define KEY_Escape /* Esc(Escape) 0x0A 0012 */ 10 + #define KEY_Space /* (SpaceBar) 0x0B 0013 */ 11 + #define KEY_Quote /* ' (Apostr) " (Quote) 0x0C 0014 */ 12 + #define KEY_Comma /* , (Comma) , (Comma) 0x0D 0015 */ 13 + #define KEY_Minus /* - (Minus) _ (Under) 0x0E 0016 */ 14 + #define KEY_Period /* . (Period) .(Period) 0x0F 0017 */ 15 + #define KEY_Slash /* / (Slash) ? 0x10 0020 */ 16 + #define KEY_0 /* 0 ) 0x11 0021 */ 17 + #define KEY_1 /* 1 ! 0x12 0022 */ 18 + #define KEY_2 /* 2 @ 0x13 0023 */ 19 + #define KEY_3 /* 3 # 0x14 0024 */ 20 + #define KEY_4 /* 4 $ 0x15 0025 */ 21 + #define KEY_5 /* 5 % 0x16 0026 */ 22 + #define KEY_6 /* 6 ^ 0x17 0027 */ 23 + #define KEY_7 /* 7 & 0x18 0030 */ 24 + #define KEY_8 /* 8 * 0x19 0031 */ 25 + #define KEY_9 /* 9 ( 0x1A 0032 */ 26 + #define KEY_SemiColon /* ;(SemiColon) :(Colon) 0x1B 0033 */ 27 + #define KEY_Equal /* = (Equal) + 0x1C 0034 */ 28 + #define KEY_a /* A 0x1D 0035 */ 29 + #define KEY_b /* B 0x1E 0036 */ 30 + #define KEY_c /* C 0x1F 0037 */ 31 + #define KEY_d /* D 0x20 0040 */ 32 + #define KEY_e /* E 0x21 0041 */ 33 + #define KEY_f /* F 0x22 0042 */ 34 + #define KEY_g /* G 0x23 0043 */ 35 + #define KEY_h /* H 0x24 0044 */ 36 + #define KEY_i /* I 0x25 0045 */ 37 + #define KEY_j /* J 0x26 0046 */ 38 + #define KEY_k /* K 0x27 0047 */ 39 + #define KEY_l /* L 0x28 0050 */ 40 + #define KEY_m /* M 0x29 0051 */ 41 + #define KEY_n /* N 0x2A 0052 */ 42 + #define KEY_o /* O 0x2B 0053 */ 43 + #define KEY_p /* P 0x2C 0054 */ 44 + #define KEY_q /* Q 0x2D 0055 */ 45 + #define KEY_r /* R 0x2E 0056 */ 46 + #define KEY_s /* S 0x2F 0057 */ 47 + #define KEY_t /* T 0x30 0060 */ 48 + #define KEY_u /* U 0x31 0061 */ 49 + #define KEY_v /* V 0x32 0062 */ 50 + #define KEY_w /* W 0x33 0063 */ 51 + #define KEY_x /* X 0x34 0064 */ 52 + #define KEY_y /* Y 0x35 0065 */ 53 + #define KEY_z /* Z 0x36 0066 */ 54 + #define KEY_LBrace /* [ { 0x37 0067 */ 55 + #define KEY_VertBar /* \(BckSlash) |(VertBar)0x38 0070 */ 56 + #define KEY_RBrace /* ] } 0x39 0071 */ 57 + #define KEY_Tilde /* ` (Accent) ~ (Tilde) 0x3A 0072 */ 58 + #define KEY_RubOut /* (Less) 0x6D 0155 */ 109 + #define KEY_Cursor_UR /* (UpRight) 0x70 0160 */ 112 + #define KEY_Cursor_UL /* (UpLeft) 0x71 0161 */ 113 + #define KEY_Cursor_DR /* (DownRight) 0x72 0162 */ 114 + #define KEY_Cursor_DL /* (DownLeft) 0x73 0163 */ 115 + + + /* + * Various commands for TNT/XTAL style keyboard: + */ + + #define KB_KEY_ID_STYLE 0x28 /* Request keyboard configuation. */ + #define KB_KEY_CLICK 0x40 /* emit a single "Click" */ + #define KB_KEY_BELL_DURATION_MAX 0x4F /* Ring the bell. Where the duration + is actually part of the command + * code. 40-4F. + * Duration = ((0 to F) * 40 ms.) + */ + + #define KB_KEY_BELL_DURATION_SHORT 0x43 /* Short duration. */ + #define KB_KEY_BELL_DURATION_OK 0x46 /* Ok duration. */ + #define KB_KEY_BELL_DURATION_MED 0x46 /* Ok duration. */ + #define KB_KEY_BELL_DURATION_LONG 0x4F /* Long duration. */ + + #define KB_BUTTON_MOTION_OFF 0x60 /* Disable mouse reporting functions */ + #define KB_BUTTON_ON 0x61 /* Enable mouse buttons reporting */ + #define KB_MOTION_ON 0x62 /* Enable mouse buttons reporting */ + #define KB_BUTTON_MOTION_ON 0x63 /* Enable mouse XY & button reporting */ + + #define KB_DEV_ON_LED 0x30+0 /* Enable - Caps lock LED */ + #define KB_DEV_ON_CLICK_SOFT 0x30+1 /* Enable - Click soft */ + #define KB_DEV_ON_CLICK_MED 0x30+2 /* Enable - Click medium */ + #define KB_DEV_ON_CLICK_LOUD 0x30+3 /* Enable - Click loud */ + /* 0x30+4 Is not defined */ + #define KB_DEV_ON_BELL_SOFT 0x30+5 /* Enable - Bell soft*/ + #define KB_DEV_ON_BELL_MED 0x30+6 /* Enable - Bell medium */ + #define KB_DEV_ON_BELL_LOUD 0x30+7 /* Enable - Bell loud */ + #define KB_DEV_ON_BELL_DISCRETE 0x30+8 /* Enable - Bell discrete */ + #define KB_DEV_ON_CURSOR_PAD_8_SEG 0x30+9 /* Select 8 seg. cursor pad */ + #define KB_DEV_ON_XMIT_LED 0x30+0x0A /* Enable - "xmit" LED */ + #define KB_DEV_ON_REC_LED 0x30+0x0B /* Enable - "rec" LED */ + #define KB_DEV_ON_HOLD_SCRN 0x30+0x0C /* Enable - "Hold screen" LED */ + #define KB_DEV_ON_TEK_MODE_LED 0x30+0x0D /* Enable - "TEK mode" LED */ + #define KB_DEV_ON_COMPOSE_LED 0x30+0x0E /* Enable - "Compose" LED */ + #define KB_DEV_ON_WAIT_LED 0x30+0x0F /* Enable - "Wait" LED */ + + #define KB_DEV_OFF_LED 0x50+0 /* Disable - Caps lock LED */ + #define KB_DEV_BLINK_XMT_LED 0x50+1 /* Disable - XMT LED BLINK */ + #define KB_DEV_BLINK_REC_LED 0x50+2 /* Disable - REC LED BLINK */ + #define KB_DEV_OFF_CLICK 0x50+3 /* Disable - Click */ + #define KB_DEV_OFF_BELL 0x50+4 /* Disable - Bell */ + /* 0x50+5, 6 & 7 Are not defined */ + + #define KB_DEV_OFF_BELL_CONTINUOUS 0x50+8 /* Select - Bell continuous */ + #define KB_DEV_OFF_CURSOR_PAD_4_SEG 0x50+9 /* Select 4 seg. cursor pad */ + + #define KB_DEV_OFF_XMIT_LED 0x50+0x0A /* Disable - "xmit" LED */ + #define KB_DEV_OFF_REC_LED 0x50+0x0B /* Disable - "rec" LED */ + #define KB_DEV_OFF_HOLD_SCRN 0x50+0x0C /* Disable - "Hold screen" LED*/ + #define KB_DEV_OFF_TEK_MODE_LED 0x50+0x0D /* Disable - "TEK mode" LED */ + #define KB_DEV_OFF_COMPOSE_LED 0x50+0x0E /* Disable - "Compose" LED */ + #define KB_DEV_OFF_WAIT_LED 0x50+0x0F /* Disable - "Wait" LED */ + + /* + * Reply code: VT-200 style keyboard. + */ + #define KB_STYLE_VT100 0x00 /* 119-1872-01 old Unicorn VT100 style*/ + #define KB_STYLE_VT200 0x02 /* 119-2468-04 (4220/30-4319) */ + #define KB_STYLE_VT200_IBM 0x03 /* 119-3240-0x */ + #define KB_STYLE_YELLOW_JACKET 0x42 /* 119-1989-00 (4207) */ + /* not a reply code just a magic number */ + /* for VT100 + MouseConnection */ + + /* + * Reply codes: 0x70-0x77 mouse reports. + */ + #define KB_MOUSEMOTION 0x70 + #define KB_MOUSEL 0x71 + #define KB_MOUSEC 0x72 + #define KB_MOUSELC 0x73 + #define KB_MOUSER 0x74 + #define KB_MOUSELR 0x75 + #define KB_MOUSECR 0x76 + #define KB_MOUSELCR 0x77 + + /*------------------------------------------------------------------------------ + * + * END -- 4320/4330/4319 (VT200) style keyboards + * + *------------------------------------------------------------------------------ + */ + #endif /* KEY_Lock */ + + + /*------------------------------------------------------------------------------ + * + * Key Code equates for VT200-IBM style keyboards: + * + *------------------------------------------------------------------------------ + * + * This set of definitions covers the differences from the VT200 style + * keyboard... + * + *------------------------------------------------------------------------------ + * + * Defined Key Cap Glyphs Pressed code + * Key Name Main Also (hex) (octal) (dec) + * ---------------- ---------- ------- ------ ----- ----- + */ + + #define KEY_IBM_Reset_Compose /* Reset (Compose) 0x6A 0152 */ 106 + #define KEY_IBM_Enter_Do /* Enter (Do) 0x6E 0156 */ 110 + #define KEY_IBM_Jump_Hold /* Jump (Hold Scrn) 0x6F 0157 */ 111 + + /*------------------------------------------------------------------------------ + * + * END - Key Code equates for VT200-IBM style keyboards + * + *------------------------------------------------------------------------------ + */ + + #ifndef ASM + + #ifndef MEM_SOUND + + /*------------------------------------------------------------------------------ + * + * "/dev/bell" ioctl additions for RAVEN/TNT/CRYSTAL keyboard. + * + *------------------------------------------------------------------------------ + * + * + * Minor device number definitions for "/dev/sound" and "/dev/bell". + * + * - /dev/sound (returns error) + * - /dev/bell (rings the bell) + * + *------------------------------------------------------------------------------ + */ + + #define SOUND_DEV_MAJOR 22 + #define SOUND_DEV_MINOR 0 + #define BELL_DEV_MINOR 1 + + /* + * "bell" ioctls:: + */ + #define BELL_IOCTL ('B' << 8) + /* u.u_rval1 = short (two bytes) of ['B'| 00 ] */ + #define BELL_KEYBD_CLICK_OFF (BELL_IOCTL | 10) + #define BELL_KEYBD_CLICK_ON_SOFT (BELL_IOCTL | 11) + #define BELL_KEYBD_CLICK_ON_MED (BELL_IOCTL | 12) + #define BELL_KEYBD_CLICK_ON_LOUD (BELL_IOCTL | 13) + + #define BELL_KEYBD_BELL_OFF (BELL_IOCTL | 20) + #define BELL_KEYBD_BELL_ON_SOFT (BELL_IOCTL | 21) + #define BELL_KEYBD_BELL_ON_MED (BELL_IOCTL | 22) + #define BELL_KEYBD_BELL_ON_LOUD (BELL_IOCTL | 23) + + #define BELL_KEYBD_BELL_DURATION_SET (BELL_IOCTL | 30) + /* param in: Write (int) */ + #define BELL_KEYBD_BELL_DURATION_GET (BELL_IOCTL | 31) + /* param out: Read (int) */ + #endif /* MEM_SOUND */ + #endif /* ASM */ + + #ifndef Button_L_bit + /*------------------------------------------------------------------------------ + * + * "Tek/Logitech" 3 Button Mouse - Mouse buttons (hardware) definitions:: + * + * (also see: M_LEFT, M_MIDDLE, M_RIGHT, M_ANY). + */ + + #define Button_R_bit 0 /* Mouse register bit 0 --> button 1 (right) */ + #define Button_M_bit 1 /* Mouse register bit 1 --> button 2 (middle)*/ + #define Button_L_bit 2 /* Mouse register bit 2 --> button 3 (left) */ + + #define Button_R 0x01 /* Mouse register bit 0 --> button 1 (right) */ + #define Button_M 0x02 /* Mouse register bit 1 --> button 2 (middle)*/ + #define Button_L 0x04 /* Mouse register bit 2 --> button 3 (left) */ + #endif /* Button_L_bit */ + + + #ifndef ASM + + /*------------------------------------------------------------------------------ + *------------- Keyboard duart defs. from pegio/commregs.h --------------------- + *------------------------------------------------------------------------------ + * + * Keyboard port definitions for Signetics SCN/MC68681 DUART + * + * (For further reference see user's manual for SCN/MC68681) + * + *------------------------------------------------------------------------------ + */ + + /* + * Keyboard uses Channel A of the DUART (Channel A is not used). + * + * Chip registers are 8-bit, but addressing is set up so + * registers appear on long boundries (two LS bits are + * ignored). Hence the pad SHORT and BYTE between each + * byte register. + * + * Register selection depends on Read/Write mode; hence the + * defines that follow the structure definition. + * + * 'A' and 'B' refer to channels A (keyboard) and B (not used) + * of the DUART. + */ + + struct Duart_Regs { + union mra { /* use union to give each part a unique name */ + unsigned char ukb_mr1a; /* mode register A part 1 */ + unsigned char ukb_mr2a; /* mode register A part 2 */ + unsigned long ukb_pad1; + } kb_mra; + + unsigned char kb_sra; /* status register A */ + unsigned char kb_pad2; + unsigned short kb_pad2_1; + + unsigned char kb_cra; /* command register A */ + unsigned char kb_pad3; + unsigned short kb_pad3_1; + + unsigned char kb_rhra; /* Rx holding register A */ + unsigned char kb_pad4; + unsigned short kb_pad4_1; + + unsigned char kb_ipcr; /* input port change register */ + unsigned char kb_pad5; + unsigned short kb_pad5_1; + unsigned char kb_imr; /* interrupt mask register */ + unsigned char kb_pad6; + unsigned short kb_pad6_1; + unsigned char kb_ctu; /* count/timer upper half */ + unsigned char kb_pad7; + unsigned short kb_pad7_1; + unsigned char kb_ctl; /* count/timer lower half */ + unsigned char kb_pad8; + unsigned short kb_pad8_1; + union mrb { + unsigned char ukb_mr1b; /* mode register B part 1 */ + unsigned char ukb_mr2b; /* mode register B part 1 */ + unsigned long kb_pad9; + } kb_mrb; + unsigned char kb_srb; /* status register B */ + unsigned char kb_pad10; + unsigned short kb_pad10_1; + unsigned char kb_crb; /* command register B */ + unsigned char kb_pad11; + unsigned short kb_pad11_1; + unsigned char kb_rhrb; /* Rx holding register B */ + unsigned char kb_pad12; + unsigned short kb_pad12_1; + unsigned char kb_ivr; /* interrupt vector register */ + unsigned char kb_pad13; + unsigned short kb_pad13_1; + unsigned char kb_iport; /* input port */ + unsigned char kb_pad14; + unsigned short kb_pad14_1; + unsigned char kb_strt_ctr; /* "start counter" pseudo-op */ + unsigned char kb_pad15; + unsigned short kb_pad15_1; + unsigned char kb_stop_ctr; /* "stop counter" pseudo-op */ + unsigned char kb_pad16; + unsigned short kb_pad16_1; + }; + + #define kb_mr1a kb_mra.ukb_mr1a /* mode register A, part 1 */ + #define kb_mr2a kb_mra.ukb_mr2a /* mode register A, part 2 */ + #define kb_csra kb_sra /* clock select register A */ + #define kb_thra kb_rhra /* Tx holding register A */ + #define kb_acr kb_ipcr /* aux. control register */ + #define kb_isr kb_imr /* interrupt mask register */ + #define kb_ctur kb_ctu /* count/timer upper register */ + #define kb_ctlr kb_ctl /* count/timer lower register */ + #define kb_mr1b kb_mrb.ukb_mr1b /* mode register B, part 1 */ + #define kb_mr2b kb_mrb.ukb_mr2b /* mode register B, part 2 */ + #define kb_csrb kb_srb /* clock select register B */ + #define kb_thrb kb_rhrb /* Tx holding register B */ + #define kb_opcr kb_iport /* output port control register */ + #define kb_soport kb_strt_ctr /* "set output bits" pseudo-op */ + #define kb_roport kb_stop_ctr /* "reset output bits" pseudo-op */ + + /* NOTES - + * Access to kb_mr1a and kb_mr2a are via the same location. The pointer + * can be set explicitly via a set pointer command. If it is pointing + * to kb_mr1a, any access to kb_mr1a will cause it to point to kb_mr2a. + * It must be explicitly reset to get back to kb_mr1a. kb_mr1b and kb_mr2b + * behave in the same way. + * + * kb_soport and kb_roport set and reset bits in the output port register (OPR). + * a bit set in the OPR results in the corresponding output being low. A + * bit reset results int the output being high. + */ + + /* + * Because half of these registers are write only, then, of course, you + * can't read them to do a bset or a bclr. This implies that a software + * copy needs to be kept and modified, and that value plugged into the + * hardware registers. A few are written entirely each time, and do + * not need the software copy. To this end, macros have been provided + * for modifying those registers that need a software copy, which are: + * + * kb_mr1a + * kb_mr1b + * kb_cra + * kb_acr + * kb_imr + * kb_mr2a + * kb_mr2b + * kb_crb + * kb_opcr + * + * In general you can modify the registers with SET_BITS() or RESET_BITS(), + * but there are other macros which call these macros, e.g. DTR_ON(). + */ + + /* + * software copies of registers + */ + typedef struct soft_duartregs soft_duartregs; + + struct soft_duartregs { + unsigned char kb_mr1a_soft, + kb_mr2a_soft, + kb_cra_soft, + kb_acr_soft, + kb_imr_soft, + kb_mr1b_soft, + kb_mr2b_soft, + kb_crb_soft, + kb_opcr_soft; + }; + + + /* + * HARDWARE ACCESS MACRO DEFINITIONS:: + */ + + /* + * 16Mhz clock = 63ns, 20Mhz clock = 50ns. -or- approx. (* 0.80) + */ + #ifdef m68k + #define INTERVAL_1S ((526315*4)/1) /* 1s in the 16Mhz 68K env.*/ + #define INTERVAL_1MS ((526315*4)/1000) /* 1ms in the 16Mhz 68K env.*/ + #define INTERVAL_1US ((526315*4)/1000000) /* 1us in the 16Mhz 68K env.*/ + #define INTERVAL_500NS ((526315*4)/2000000) /* 500ns in the 16Mhz 68K env.*/ + #define INTERVAL_400NS ((526315*4)/2000000) /* 400ns in the 20Mhz 68K env.*/ + #endif /* m68k */ + + #ifdef m88k + #define INTERVAL_1S 6666666 /* 1s in the 20Mhz 88K env.*/ + #define INTERVAL_250MS (6666*250) /* 250ms in the 20Mhz 88K env.*/ + #define INTERVAL_100MS (6666*100) /* 100ms in the 20Mhz 88K env.*/ + #define INTERVAL_1MS 6666 /* 1ms in the 20Mhz 88K env.*/ + #define INTERVAL_1US 6 /* 1us in the 20Mhz 88K env.*/ + #define INTERVAL_450NS 3 /* 450ns in the 20Mhz 88K env.*/ + #define INTERVAL_300NS 2 /* 300ns in the 20Mhz 88K env.*/ + #define INTERVAL_150NS 1 /* 150ns in the 20Mhz 88K env.*/ + #define INTERVAL_400NS INTERVAL_450NS /* close enough */ + #endif /* m88k */ + + /* + * NOP2:: (serializePipeLine) + * + * In the 68K platforms the "NOP2" macro emitted + * -two- inline assembly language "nop" instructions. + * For the 68020 the "nop" instruction would cause a + * 2 cpu clock cycle execution time plus a serialize of the + * pipeline on external bus cycle operations. Therefore + * A "NOP2" would guarantee a duart access "dead time" + * of 4 cpu clock cycles (50ns/clock @ 20mhz-Raven) or + * 200ns between accesses (68681 spec. sheet indicates + * a range of 100ns-400ns for timings, with the commanly + * used register access times of 100ns-175ns, so 200ns+ + * seems "safe". + * + * For the 88K platforms the "NOP2" replacement "serializePipeLine" + * macro emits a "tb1" (trap on bit set) instruction (with a value + * of trap not taken "255"). + * + * + */ + #ifdef m68k + #define NOP2() \ + { \ + asm ("nop; nop"); \ + } + #endif /* m68k */ + + #ifdef m88k + #ifndef TB1_SERIALIZE + #define serializePipeLine() \ + { \ + { } \ + } + #else /* TB1_SERIALIZE */ + #define serializePipeLine() \ + { \ + asm ("tb1 0,r0,255"); \ + } + #endif /* TB1_SERIALIZE */ + #endif /* m88k */ + + /* + * DELAY:: + * + * "Spin's" for "n" cpu cycles of "subtract 1 from + * register branch greater than zero" instruction ticks. + * 68020 loop: subtract = 2 clocks, branch = 6 clocks + * + * For the 16Mhz 68K platforms the value for approx. + * one second delay was (526315*4 | 0x807EB) and calculates + * to 8*63ns*526315*4/1e9 = 1.061 seconds. + * + * For the 20Mhz 68K platforms the value for approx. + * one second delay was (526000*4 | 0x806B0) and calculates + * to 8*50ns*526000*4/1e9 = 0.85 seconds (850ms). + * + * For the 20Mhz 88K platforms the value for approx. + * one second delay is (526000*4 | 0x806B0) and calculates + * to 3*50ns*6666666/1e9 = 0.999 seconds. + * 88100 loop: addu, cmp, bb1 = 3 clocks. + * + */ + + #define DELAY(n) \ + { \ + register int N = (n); \ + serializePipeLine(); /* hit the pipeline */ \ + while (--N > 0); { \ + /* spin */ \ + } \ + } + + #ifdef INKERNEL + /* + * Following are register field definitions needed by the kernel driver. + */ + + /* mode register 1 */ + #define MR_RxRTS 0x80 /* Rx RTS control */ + #define MR_NOPAR 0x10 /* No parity */ + #define MR_ODPAR 0x4 /* Odd parity */ + #define MR_BITS8 0x3 /* 8 bits per char */ + #define MR_BITS7 0x2 /* 7 bits per char */ + #define MR_BITS6 0x1 /* 6 bits per char */ + #define MR_BITS5 0x0 /* 5 bits per char */ + + /* mode register 2 */ + #define MR_TxRTS 0x20 /* Tx RTS control */ + #define MR_CTS 0x10 /* CTR enable Tx */ + #define MR_STOP1 0x7 /* stop bit length=1 */ + #define MR_STOP2 0xF /* stop bit length=2 */ + + /* clock select register */ + + /* + * NOTES on baud rate selection. using the clock select register + * and the aux. control register: + * + * Baud rates are selected using the CSR values from two + * possible tables which follow. The table currently + * selected depends upon the value of bit 7 of the ACR. + * Bits 0-3 select output baud, while bits 4-7 select input + * baud. + * Table 1 Table 2 + * CSR ACR[7]=0 ACR[7]=1 + * --- -------- -------- + * 0 50 75 + * 1 110 110 + * 2 134.5 134.5 + * 3 200 150 + * 4 300 300 + * 5 600 600 + * 6 1200 1200 + * 7 1050 2000 + * 8 2400 2400 + * 9 4800 4800 + * a 7200 1800 + * b 9600 9600 + * c 38.4K 19.2K + * d Timer Timer + * e IP4-16x IP4-16x + * f IP4-1x IP4-1x + * + * We use Table 2. ACR[7] = 1 + */ + + /* command register */ + #define CR_NOP 0x0 /* no-op */ + #define CR_RMRP 0x10 /* reset MR pointer */ + #define CR_RRx 0x20 /* reset receiver */ + #define CR_RTx 0x30 /* reset transmitter */ + #define CR_RERR 0x40 /* reset error status */ + #define CR_RBRK 0x50 /* reset brk interrupt */ + #define CR_STRTB 0x60 /* start break */ + #define CR_STOPB 0x70 /* stop break */ + + #define CR_TxDIS 0x8 /* disable transmitter */ + #define CR_TxENA 0x4 /* enable transmitter */ + #define CR_RxDIS 0x2 /* disable receiver */ + #define CR_RxENA 0x1 /* enable receiver */ + + /* status register */ + #define SR_BRK 0x80 /* recieved break */ + #define SR_FRAME 0x40 /* framing error */ + #define SR_PARITY 0x20 /* parity error */ + #define SR_OVRUN 0x10 /* overrun error */ + #define SR_TxEMT 0x8 /* tranmitter empty */ + #define SR_TxRDY 0x4 /* transmitter ready */ + #define SR_FFULL 0x2 /* recieve FIFO full */ + #define SR_RxRDY 0x1 /* receiver ready */ + + /* output port config register */ + #define OP_TxRDYB 0x80 /* OP7 <- ~(TxRDYB) */ + #define OP_TxRDYA 0x40 /* OP6 <- ~(TxRDYA) */ + #define OP_RxRDYB 0x20 /* OP5 <- ~(ISR[5]) */ + #define OP_RxRDYA 0x10 /* OP4< - ~(ISR[1]) */ + + /* + * output port hardware connections + */ + #define CO_DTR 0x40 /* OP6 == DTR */ + #define CO_DDTR 0x20 /* OP5 == DTR disable */ + #define CO_KDATA 0x10 /* OP4 == keyboard data enable */ + #define CO_KRESET 0x8 /* OP3 == keyboard reset */ + #define CO_DDTR2 0x4 /* OP2 == 2nd DTR diaable */ + #define CO_RTS 0x2 /* OP1 == RTS */ + + + /* + * aux. control register + * + * NOTE: it just so happens that the keyboard is hardwired to + * 1200 baud, which is the same CSR index into both Baud-Rate + * groups. Therefore changing the BRG in the ACR doesn't affect + * the keyboard baud rate in this case. + */ + #define AC_BSET1 0x00 /* baud rate group set 1 select */ + #define AC_BSET2 0x80 /* baud rate group set 2 select */ + #define AC_C16 0x30 /* crystal/16 clock counter */ + #define AC_IP0INT 0x01 /* allow IP0 (keyboard CTS) interrupts */ + #define AC_IP1INT 0x02 /* allow IP1 (RS232 CTS) interrupts */ + #define AC_IP2INT 0x04 /* allow IP2 (RS232 rx clk) interrupts */ + #define AC_IP3INT 0x08 /* allow IP3 (RS232 DSR) interrupts */ + + /* interrupt status register (ISR) */ + #define IS_IPCH 0x80 /* input port change */ + #define IS_CBRKB 0x40 /* channel B change in break */ + #define IS_RxRDYB 0x20 /* channel B receiver ready/full */ + #define IS_TxRDYB 0x10 /* channel B transmitter ready */ + #define IS_CTRDY 0x8 /* counter ready */ + #define IS_CBRKA 0x4 /* channel A change in break */ + #define IS_RxRDYA 0x2 /* channel A receiver ready/full */ + #define IS_TxRDYA 0x1 /* channel A transmitter ready */ + + /* input port change register (IPCR) */ + #define IP_IP3CH 0x80 /* change in ip3 */ + #define IP_IP2CH 0x40 /* change in ip2 */ + #define IP_IP1CH 0x20 /* change in ip1 */ + #define IP_IP0CH 0x10 /* change in ip0 */ + #define IP_IP3 0x08 /* state of ip3 */ + #define IP_IP2 0x04 /* state of ip2 */ + #define IP_IP1 0x02 /* state of ip1 */ + #define IP_IP0 0x01 /* state of ip0 */ + + /* interrupt mask register - direct correspondence to ISR above */ + #define IM_IPCH 0x80 + #define IM_CBRKB 0x40 + #define IM_RxRDYB 0x20 + #define IM_TxRDYB 0x10 + #define IM_CTRDY 0x8 + #define IM_CBRKA 0x4 + #define IM_RxRDYA 0x2 + #define IM_TxRDYA 0x1 + + /* input port register (IPORT) */ + #define IP_IP5 0x20 /* state of ip5 */ + #define IP_IP4 0x10 /* state of ip4 */ + /*#define IP_IP3 0x08 * state of ip3 */ + /*#define IP_IP2 0x04 * state of ip2 */ + /*#define IP_IP1 0x02 * state of ip1 */ + /*#define IP_IP0 0x01 * state of ip0 */ + + /* + * Bit setting, clearing and saving macros for the duart registers. + */ + #define SET_BITS(r, rname, bits) /* set 'bits' in reg 'rname' */ \ + { \ + soft_duart.rname/**/_soft |= bits; \ + (r)->rname = soft_duart.rname/**/_soft; \ + } + + #define RESET_BITS(r, rname, bits) /* reset 'bits' in reg 'rname' */ \ + { \ + soft_duart.rname/**/_soft &= ~bits; \ + (r)->rname = soft_duart.rname/**/_soft; \ + } + + /* + * set a field of 'bits' in 'rname' + */ + #define SET_FIELD(r, rname, field, bits) \ + { \ + soft_duart.rname/**/_soft &= ~field; \ + soft_duart.rname/**/_soft |= bits; \ + (r)->rname = soft_duart.rname/**/_soft; \ + } + + /* + * Specific macros for accomplishing well defined tasks. + */ + #ifndef LINT + #define KB_STOP_BITS(r,n) /* Make keyboard use 'n' stop bits */ \ + { \ + register junk; \ + junk = (r)->kb_mr1a; /* read register to bump to mr2a */ \ + SET_FIELD(r, kb_mr2a, 0x0f, 0xf70 >> (n*4)); \ + } + + #else /* LINT */ + #define KB_STOP_BITS(r,n) /* Make keyboard use 'n' stop bits */ \ + { \ + register junk; \ + junk = (r)->kb_mr1a; /* read register to bump to mr2a */ \ + junk = junk; /* LINT SHUT-UP */ \ + SET_FIELD(r, kb_mr2a, 0x0f, 0xf70 >> (n*4)); \ + } + #endif /* LINT */ + + #ifndef LINT + #define RS232_STOP_BITS(r,n) /* Make rs232 line use 'n' stop bits */ \ + { \ + register junk; \ + junk = (r)->kb_mr1b; /* read register to bump to mr2b */ \ + SET_FIELD(r, kb_mr2b, 0x0f, 0xf70 >> (n*4)); \ + } + #else /* LINT */ + #define RS232_STOP_BITS(r,n) /* Make rs232 line use 'n' stop bits */ \ + { \ + register junk; \ + junk = (r)->kb_mr1b; /* read register to bump to mr2b */ \ + junk = junk; /* LINT SHUT-UP */ \ + SET_FIELD(r, kb_mr2b, 0x0f, 0xf70 >> (n*4)); \ + } + #endif /* LINT */ + + #define KB_RX_INT_ENABLE(r) /* enable keyboard receiver interrupts */ \ + { \ + SET_BITS(r, kb_imr, IS_RxRDYA); \ + } + + /* + * Output port configuration macros. + * + * The output lines OP0-OP7 are connected to the keyboard hardware + * and rs232 port as follows + * rs232 port + * op7 not connected + * op6 \ + * op5 } control dtr hardware flagging on rs232 port + * op2 / + * op1 control rts on rs232 port + * + * keyboard + * op4 enables keyboard RDA (receive data available) + * op3 keyboard reset signal + * op0 CTS (clear to send) for the keyboard + * + * Now op[2-7] are controlled by the opcr register; they are set to + * follow some signal provided by the chip or, if we wish, to follow + * whatever we happen to set or reset in the output port bits (using + * r_sopb or r_ropb). Op[0-1] are controlled by MR1A, MR2A, MR1B, MR2B + * or to follow whatever we happen to set or reset in the output port bits. + * + * Since these are fairly complicated relation ships, all that is provided + * here is a set of macros for setting the right registers at the right + * to to accomplish a given task. Refer to the SCN/MC68681 data sheet and the + * 4405/6/4315/16/17/19 schematics for more detail. + * + * Note that since both the keyboard and the rs232 port use r_opcr, we + * update a software copy as well. + */ + #define DTR_ON(r) /* DTR flagging on all the time */ \ + { \ + RESET_BITS(r, kb_opcr, 0x63); /* clear op[256] */ \ + (r)->kb_soport = CO_DTR; /* this sets op6 low */ \ + } + + /* associate op[256] with corresponding bits in opr * + * selectivly set and clear bits in opr to result in * + * op[6] low * + * op[5], and op[2] high * + * taking into account that op[x] = ~opr[x] * + */ + + #define DTR_OFF(r) /* DTR off all the time */ \ + { \ + RESET_BITS(r, kb_opcr, 0x63); /* assoc op[256] with opr */ \ + (r)->kb_roport = CO_DTR; /* set op6 low */ \ + serializePipeLine(); \ + (r)->kb_soport = (CO_DDTR|CO_DDTR2); /* set op[25] high */ \ + } + + #define CHAR_DTR(r) /* Character by character dtr */ \ + { \ + RESET_BITS(r, kb_opcr, 0x43); /* clear op[26] */ \ + SET_BITS(r, kb_opcr, 0x20); /* op5 is RxRDY/FULLB */ \ + (r)->kb_roport = 0x44; /* set op[62] high */ \ + serializePipeLine(); \ + (r)->kb_roport = 0x04; /* set op5 low */ \ + } + + #define RTS_ON(r) /* RTS asserted always on chanel B */ \ + { \ + (r)->kb_crb = CMD_RMRP; \ + RESET_BITS(r, kb_mr1b, MR_RxRTS); /* clear bit 7 */ \ + RESET_BITS(r, kb_mr2b, MR_TxRTS); /* clear bit 5 */ \ + (r)->kb_soport = 0x02; /* set op1 low */ \ + } + + #define RTS_OFF(r) /* RTS off always */ \ + { \ + (r)->kb_roport = 0x02; /* set op1 high */ \ + } + + #define KB_RESET(r) /* Do a reset signal to the keyboard */ \ + { \ + (r)->kb_soport = 0x08; /* set op3 low */ \ + DELAY(INTERVAL_250MS); /* give it time */ \ + (r)->kb_roport = 0x08; /* set op3 high */ \ + } + + #define KB_CTS_ON(r) /* tell the keyboard ``clear to send'' */ \ + { \ + SET_BITS(r, kb_opcr, 0x10); /* op4 = rx ready channel a */ \ + } + + #define KB_CTS_OFF(r) /* tell the keyboard ``clear to send'' */ \ + { \ + RESET_BITS(r, kb_opcr, 0x10); /* op4 follows opr4 */ \ + (r)->kb_soport = 0x10; /* set op4 low */ \ + } + + /* + * Input port configuration macros. + * The connection on the pegasus to the input port is as follows: + * + * ip1 rs232 clear-to-send (CTS) + * ip2 rs232 receiver clock + * ip3 rs232 dsr + * ip0 keyboard clear-to-send (CTS) + */ + #define KB_CTS_INT_ENABLE(r) /* enable interrupts on keyboard CTS */ \ + { \ + SET_BITS(r, kb_acr, AC_IP0INT); \ + SET_BITS(r, kb_imr, IM_IPCH); \ + } + + #define RS232_CTS_INT_ENABLE(r) /* enable interrupts on rs232 CTS */ \ + { \ + SET_BITS(r, kb_acr, AC_IP1INT); \ + SET_BITS(r, kb_imr, IM_IPCH); \ + } + + #define RS232_RXCLK_INT_ENABLE(r)/* enable interrupts on rs232 rx clock */ \ + { \ + SET_BITS(r, kb_acr, AC_IP2INT); \ + SET_BITS(r, kb_imr, IM_IPCH); \ + } + + #define RS232_DSR_INT_ENABLE(r) /* enable interrupts on rs232 DSR */ \ + { \ + SET_BITS(r, kb_acr, AC_IP3INT); \ + SET_BITS(r, kb_imr, IM_IPCH); \ + } + + /*------- end of Keyboard duart defs. ----------------------------------------*/ + + #endif /* INKERNEL */ + #endif /* ASM */ + #endif /* KEYBOARD_H */ *** XD88-patchlevel-26-mit/server/ddx/tek/redwing/streamsif.c Fri Feb 11 09:55:02 1994 --- XD8810-mit/server/ddx/tek/redwing/streamsif.c Fri Feb 11 10:03:14 1994 *************** *** 0 **** --- 1,180 ---- + /* + * $Header: streamsif.c,v 1.3 90/03/12 15:31:05 steveje Exp $ + * + * $Locker: $ + * + * Copyright 1989, 1990, 1991 by Tektronix, Inc., Beaverton, Oregon. + * + * All Rights Reserved. + * + * NOTICE: + * + * THIS PROGRAM IS NOT A SUPPORTED TEKTRONIX PRODUCT, AND IS + * NOT GUARANTEED TO BE FREE OF ERRORS. THERE IS NO WARRANTY + * EXPRESSED OR IMPLIED, AND TEKTRONIX ASSUMES NO LIABILITY FOR + * DAMAGES RESULTING FROM IT'S USE. + * + * + * 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 appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Tektronix not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TEKTRONIX BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + * + * Author: Leonard Bottleman, 1989 + * + */ + + /*------------------------------------------------------------------------------ + * + * init_mux(): + * + * initialize mux. establish lower connections to all default devices. + * + * static + * mux_inq(): + * + * request the list of lower mux connections + */ + + #include + #include + #include + #include + #include + #include + /* + #include + #include + */ + #include "strmux.h" + #include "strxdev.h" + + #define CONTROL_MUX "/dev/mux0" /* c 13 0 */ + #define CLONE_MUX "/dev/mux" /* c 11 13 */ + #define KEYBOARD "/dev/xdevs/keyboard" /* c 16 0 */ + #define MOUSE "/dev/xdevs/mouse" /* c 16 1 */ + #define CLOCK "/dev/xdevs/clock" /* c 16 2 */ + + /* + * record of lower mux connections + */ + static struct muxinq lowmux[MUX_MAXLOWER]; + static int lownum; + int muxfd = -1; /* mux file descriptor */ + + /* + * Open the mux, open and link the default devices to the mux, get + * the list of lower mux connections + * + * returns: -1 if mux init failed. + * else: mux fd + */ + int + init_mux () + { + int mcount, /* counter */ + xfd; /* lower device fd */ + + if (muxfd != -1) { + /* Already open, this call must be a "restart" + * of the server, so just return muxfd. + */ + return(muxfd); + } + + /* + * open the controlling mux + */ + if ((muxfd = open(CONTROL_MUX,O_RDWR)) == -1) { + Error(CONTROL_MUX); + return (-1); + } + + /* + * open each default STREAMS device and link it to the mux + */ + if ((xfd = open(KEYBOARD,O_RDWR)) == -1) { + Error(KEYBOARD); + close(muxfd); + return (-1); + } + else if (ioctl(muxfd,I_LINK,xfd) == -1) { + Error("I_LINK"); + ErrorF("%s\n",KEYBOARD); + close(muxfd); + return (-1); + } + close(xfd); + if ((xfd = open(MOUSE,O_RDWR)) == -1) { + Error(MOUSE); + close(muxfd); + return (-1); + } + else if (ioctl(muxfd,I_LINK,xfd) == -1) { + Error("I_LINK"); + ErrorF("%s\n",MOUSE); + close(muxfd); + return (-1); + } + close(xfd); + if ((xfd = open(CLOCK,O_RDWR)) == -1) { + Error(CLOCK); + close(muxfd); + return (-1); + } + else if (ioctl(muxfd,I_LINK,xfd) == -1) { + Error("I_LINK"); + ErrorF("%s\n",CLOCK); + close(muxfd); + return (-1); + } + close(xfd); + + /* + * get the list of lower mux connections (failure is not fatal) + */ + if (mux_inq(muxfd,lowmux,&lownum) == -1) { + ErrorF("Couldn't initialize lower mux table\n"); + lownum = -1; + } + + return (muxfd); + } + + /* + * request a list of lower mux connections + * + * returns: -1 if request failed. + * else: 0 + */ + static + mux_inq (muxfd,lowmi,lown) + int muxfd; /* mux file descriptor */ + struct muxinq *lowmi; /* table of lower mux connections */ + int *lown; /* number of lower mux connections */ + { + struct strioctl st; /* STREAMS ioctl interface */ + + st.ic_cmd = M_LOWINQUIRE; + st.ic_timout = 0; + st.ic_len = sizeof (struct muxinq) * MUX_MAXLOWER; + st.ic_dp = (char *)lowmi; + if (ioctl(muxfd,I_STR,&st) == -1) { + Error("M_LOWINQUIRE"); + return (-1); + } + *lown = st.ic_len / sizeof (struct muxinq); + return (0); + } *** XD88-patchlevel-26-mit/server/ddx/tek/redwing/strmux.h Fri Feb 11 09:55:28 1994 --- XD8810-mit/server/ddx/tek/redwing/strmux.h Fri Feb 11 10:04:13 1994 *************** *** 0 **** --- 1,145 ---- + /* + * STREAMS multiplexor/demultiplexor header file + * + * $Header: strmux.h,v 1.1 90/02/28 11:24:28 steveje Exp $ + * + * Copyright 1989, 1990, 1991 by Tektronix, Inc., Beaverton, Oregon. + * + * All Rights Reserved. + * + * NOTICE: + * + * THIS PROGRAM IS NOT A SUPPORTED TEKTRONIX PRODUCT, AND IS + * NOT GUARANTEED TO BE FREE OF ERRORS. THERE IS NO WARRANTY + * EXPRESSED OR IMPLIED, AND TEKTRONIX ASSUMES NO LIABILITY FOR + * DAMAGES RESULTING FROM IT'S USE. + * + * + * 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 appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Tektronix not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TEKTRONIX BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + * Author: Leonard Bottleman + */ + + #define MUX_MAXUPPER 64 /* maximum upper connection to STREAMS mux */ + #define MUX_MAXLOWER 32 /* maximum upper connection to STREAMS mux */ + /* + * Mux address field definitions + */ + #define MUX_ADDR_MASK 0xc0ff /* mask for address values */ + #define MUX_ADDR_INDEX 0x00ff /* mask for the index in umux/lmux */ + + #define MUX_ADDR_UP 0x8000 /* flag for upper mux addresses */ + #define MUX_ADDR_ALLUP 0xc0ff /* all upper mux addresses */ + + #define MUX_ADDR_LOST 0x2000 /* lost messages */ + /* + * Error flags for current message: MUX_ADDR_FAIL is set on all returned + * failed messages. One of the other error flags may be set specifying the + * type of error encountered + */ + #define MUX_ADDR_FAIL 0x1000 /* failed to send message */ + #define MUX_ADDR_RES 0x0800 /* resource allocation failed */ + #define MUX_ADDR_FULL 0x0400 /* destination queue is full */ + #define MUX_ADDR_INVLD 0x0200 /* invalid destination address */ + #define MUX_ADDR_FMT 0x0100 /* invalid message format */ + #define MUX_ADDR_ERROR 0x0f00 /* mask for mux error types */ + /* + * Minor device 0 is the controlling mux, and only it can link or unlink + * devices to the lower stream + */ + #define MUX_ADDR_CONTROL MUX_ADDR_UP + + /* + * mux address structure + */ + struct muxaddr { + ushort mx_route; /* mux routing and error field */ + ushort mx_id; /* user and device definable ID field */ + }; + + /* + * inquiry command structure + */ + struct muxinq { + ushort mi_route; /* stream head address */ + ushort mi_id; /* stream head ID */ + uint mi_ignored; /* messages are ignored */ + }; + + /* + * Mux ioctl commands + */ + #define MUXCMD ('M' << 8) + #define M_SETIGNORE (MUXCMD | 0x01) /* ignore messages from the given + address */ + #define M_DELIGNORE (MUXCMD | 0x02) /* recieve messages from the given + address */ + #define M_UPINQUIRE (MUXCMD | 0x03) /* upper stream head inquire */ + #define M_LOWINQUIRE (MUXCMD | 0x04) /* lower stream head inquire */ + + #ifdef INKERNEL + /* + * definitions for upper stream input screening lists + */ + #define MUX_ULIST ((MUX_MAXUPPER + 31) / 32) + #define MUX_LLIST ((MUX_MAXLOWER + 31) / 32) + + #define INDEX(_bit) (_bit >> 5) + #define SBIT(_bit) (1 << ((_bit) & 31)) + + #define MATCH_INPUT(_list,_index,_sbit) ((_list)[(_index)] & (_sbit)) + #define CHECK_INPUT(_list,_mbit) ((_list)[INDEX(_mbit)] & SBIT(_mbit)) + #define IGNORE_INPUT(_list,_mbit) ((_list)[INDEX(_mbit)] |= SBIT(_mbit)) + #define RECEIVE_INPUT(_list,_mbit) ((_list)[INDEX(_mbit)] &= ~SBIT(_mbit)) + + /* + * Upper mux stream head connection + */ + struct umux { + queue_t *u_qptr; /* pointer to the read queue */ + struct umux + *u_next, /* pointer to next active entry */ + *u_prev; /* pointer to previous active entry */ + uint u_ulist[MUX_ULIST]; /* list of ignored upper stream heads */ + uint u_llist[MUX_LLIST]; /* list of ignored lower stream heads */ + ushort u_id; /* stream head ID */ + ushort u_flags; /* stream head flags */ + }; + + /* + * Lower mux stream head connection + */ + struct lmux { + queue_t *l_qptr; /* pointer to the write queue */ + uint l_index; /* index into lmux table */ + ushort l_id; /* stream head ID */ + ushort l_flags; /* stream head flags */ + }; + + /* + * stream head flags + */ + #define MUX_FL_LOST 0x0001 /* stream head lost a message */ + /* + * the link and unlink commands and flags which the mux sends to device + * drivers when connected to or disconnected from the mux with I_LINK + * or I_UNLINK + */ + #define MUX_UNLINK 0x00 /* driver is unlinked from the mux */ + #define MUX_LINK 0x01 /* driver is linked to the mux */ + + #endif /* INKERNEL */ *** XD88-patchlevel-26-mit/server/ddx/tek/redwing/strxdev.h Fri Feb 11 09:55:33 1994 --- XD8810-mit/server/ddx/tek/redwing/strxdev.h Fri Feb 11 10:04:24 1994 *************** *** 0 **** --- 1,102 ---- + /* + * Xdev STREAMS interface header file + * + * $Header: strxdev.h,v 1.1 90/02/28 11:24:45 steveje Exp $ + * + * Copyright 1989, 1990, 1991 by Tektronix, Inc., Beaverton, Oregon. + * + * All Rights Reserved. + * + * NOTICE: + * + * THIS PROGRAM IS NOT A SUPPORTED TEKTRONIX PRODUCT, AND IS + * NOT GUARANTEED TO BE FREE OF ERRORS. THERE IS NO WARRANTY + * EXPRESSED OR IMPLIED, AND TEKTRONIX ASSUMES NO LIABILITY FOR + * DAMAGES RESULTING FROM IT'S USE. + * + * + * 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 appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Tektronix not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TEKTRONIX BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + * Author: Leonard Bottleman + */ + + /* + * commonly used event message header + */ + struct event { + ushort e_route; /* source/destination mux address */ + ushort e_id; /* source ID */ + uint e_windowid; /* window ID */ + }; + + #define XDEV_MAXDEVS 3 + + #define XDEV_ID 0x8000 + + #define XDEV_KEYBOARD 0 + #define XDEV_MOUSE 1 + #define XDEV_CLOCK 2 + + #define XDEV_KEYBOARD_ID (XDEV_ID | XDEV_KEYBOARD) + #define XDEV_MOUSE_ID (XDEV_ID | XDEV_MOUSE) + #define XDEV_CLOCK_ID (XDEV_ID | XDEV_CLOCK) + + /* Mouse event */ + struct mouse_event { + short me_absx; /* cursor absolute x screen position */ + short me_absy; /* cursor absolute y screen position */ + char me_deltax; /* mouse change in x */ + char me_deltay; /* mouse change in y */ + unchar me_buttonid; /* ID of changed button */ + unchar me_mouseflag; /* mouse flags */ + }; + + /* buttonid definitions */ + #define XDEV_MOUSE_LEFT 0x04 + #define XDEV_MOUSE_MIDDLE 0x02 + #define XDEV_MOUSE_RIGHT 0x01 + + /* mouseflags definitions */ + #define XDEV_MOUSEDOWN 0x01 /* mouse button depressed */ + + /* + * xlock request + */ + struct xclock_request { + ushort xcr_route; /* mux address or slot # */ + ushort xcr_id; /* unused */ + uint xcr_msec; /* millisecond request */ + }; + + /* + * Xdev ioctl commands + */ + #define XDEVCMD ('X' << 8) + #define X_CLOCKSET (XDEVCMD | 0x01) /* set the xclock */ + #define X_GETWINDOWID (XDEVCMD | 0x02) /* get the current window ID */ + + /* + * Definitions for the X module + */ + #define XMOD_ID (XDEV_ID | 3) + + #define XM_ADDWIN (XDEVCMD | 0x10) /* add a window ID */ + #define XM_DELWIN (XDEVCMD | 0x20) /* delete a window ID */ + #define XM_MOUSEMOVE_ON (XDEVCMD | 0x30) /* mouse move on */ + #define XM_MOUSEMOVE_OFF (XDEVCMD | 0x40) /* mouse move off */ + #define XM_MOUSEBUTTON_ON (XDEVCMD | 0x50) /* mouse button on */ + #define XM_MOUSEBUTTON_OFF (XDEVCMD | 0x60) /* mouse button off */