home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xibm.zip / ibm8514 / brcIO.c < prev    next >
C/C++ Source or Header  |  1991-10-03  |  4KB  |  140 lines

  1. /*
  2.  * $Id: brcIO.c,v 1.2 1991/10/03 23:28:43 mtranle Exp $
  3.  *
  4.  * Copyright IBM Corporation 1987,1990
  5.  *
  6.  * All Rights Reserved
  7.  *
  8.  * Permission to use, copy, modify, and distribute this software and its
  9.  * documentation for any purpose and without fee is hereby granted,
  10.  * provided that the above copyright notice appear in all copies and that 
  11.  * both that copyright notice and this permission notice appear in
  12.  * supporting documentation, and that the name of IBM not be
  13.  * used in advertising or publicity pertaining to distribution of the
  14.  * software without specific, written prior permission.
  15.  *
  16.  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  17.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
  18.  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  19.  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  20.  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  21.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  22.  * SOFTWARE.
  23.  *
  24. */
  25. /*
  26.  * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
  27.  * LICENSED MATERIALS - PROPERTY OF IBM
  28.  * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
  29.  */
  30. /*
  31.  *  Hardware interface routines for IBM 8514/A adapter for
  32.  *  X.11 server(s) on IBM equipment.
  33.  *
  34.  */
  35.  
  36. #include "X.h"
  37. #include "servermd.h"
  38. #include "screenint.h"
  39. #include "scrnintstr.h"
  40. #include "pixmapstr.h"
  41. #include "miscstruct.h"
  42. #include "window.h"
  43. #include "windowstr.h"
  44. #include "colormap.h"
  45. #include "colormapst.h"
  46. #include "resource.h"
  47.  
  48. #include "ibmScreen.h"
  49.  
  50. #include "mi.h"
  51. #include "ppc.h"
  52.  
  53. #include "x8514.h"
  54.  
  55. #include "ibmTrace.h"
  56.  
  57. int ibm8514HeadInstalled = HEAD_NONE ;
  58. int ibm8514NumberOfPlanes = IBM8514MAXPLANES ;
  59.  
  60. /******************************************************************************/
  61.  
  62. static int ibm8514Generation = 0 ;
  63.  
  64. /* Declared in "ibm8514Data.c" */
  65. extern GC ibm8514PrototypeGC ;
  66. extern ScreenRec ibm8514ScreenRec ;
  67. extern ppcScrnPriv ibm8514ScrnPriv ;
  68. extern VisualRec ibm8514Visuals[] ;
  69. extern DepthRec ibm8514Depths[] ;
  70. extern unsigned long ibm8514DepthVIDs[];
  71. extern PixmapFormatRec ibm8514Formats[] ;
  72.  
  73. Bool
  74. ibm8514ScreenInit( index, pScreen, argc, argv )
  75.      const int index ;
  76.      ScreenPtr const pScreen ;
  77.      int const argc ;        /* these two may NOT be changed */
  78.      char * const * const argv ;
  79. {
  80.     int    i;
  81.     TRACE( ( "ibm8514ScreenInit(index=%d,pScreen=0x%x,argc=%d,argv=0x%x)\n",
  82.         index, pScreen, argc, argv ) ) ;
  83.  
  84.     if ( ibm8514Generation != serverGeneration )
  85.     {
  86.     for (i = 0; i < ibm8514ScreenRec.numVisuals; i++)
  87.     {
  88.         ibm8514DepthVIDs[i] =
  89.         ibm8514Visuals[i].vid = FakeClientID(0);
  90.     }
  91.     ibm8514ScreenRec.rootVisual = ibm8514Visuals[0].vid;
  92.     if ( ( ibm8514NumberOfPlanes = ibm8514ScreenInitHW( index ) ) != 8 )
  93.     {
  94.         ibm8514PrototypeGC.planemask =
  95.         ( ibm8514Visuals[0].ColormapEntries =
  96.          1 << ( ibm8514Visuals[0].nplanes =
  97.                ibm8514Formats[0].depth = 
  98.                ibm8514Depths[1].depth =
  99.                ibm8514ScreenRec.rootDepth =
  100.                ibm8514ScrnPriv.pixmap.drawable.depth =
  101.                ibm8514PrototypeGC.depth =
  102.                ibm8514NumberOfPlanes ) ) - 1 ;
  103.     }
  104.     ibm8514ScrnPriv.pixmap.devKind =
  105.         PixmapBytePad( _8514_SCREEN_WIDTH,
  106.               ibm8514NumberOfPlanes ) ;
  107.     ibm8514Visuals[0].class = ibm8514QueryHead() ;
  108.     ibm8514Generation = serverGeneration;
  109.     }
  110.     /* Magic Hardware Initialization */
  111.     ibm8514outw( ibm8514_MiscIO, 0x0005 ) ;
  112.  
  113.     ppcCommonScreenInit( pScreen, index, &ibm8514ScreenRec ) ;
  114.  
  115.     mfbRegisterCopyPlaneProc (pScreen, miCopyPlane);
  116.  
  117.     ibm8514CursorInit( index ) ;
  118.     ibm8514InitFontCache();
  119.  
  120.     /* we MIGHT return 0 if we had been keeping track of potential
  121.        allocation failures.  one day someone will clean this up.
  122.        */
  123.     return 1 ;
  124. }
  125.  
  126. /*ARGSUSED*/
  127. Bool
  128. ibm8514ScreenClose( index, pScreen )
  129.      const int index ;
  130.      ScreenPtr const pScreen ;
  131. {
  132.     TRACE( ( "ibm8514ScreenClose(index=%d,pScreen=0x%x)\n", index, pScreen ) );
  133.     ppcCommonScreenClose( pScreen, index, &ibm8514ScreenRec ) ;
  134.     if ( ibm8514Generation == serverGeneration ) {
  135.     ibm8514outw( ibm8514_MiscIO, 0 ) ; /* reset 'miscio' */
  136.     }
  137.  
  138.     return TRUE ;
  139. }
  140.