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 / brcOSD.c < prev    next >
C/C++ Source or Header  |  1991-09-20  |  4KB  |  141 lines

  1. /*
  2.  * $Id: brcOSD.c,v 1.1 1991/09/20 19:10:24 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 <fcntl.h>
  37. #include <sys/ioctl.h>
  38.  
  39. #if defined(ibm032) && defined(BSDrt)
  40. #define ATR
  41. #include <machinecons/buf_emul.h>
  42. #endif
  43.  
  44. #include "X.h"
  45. #include "miscstruct.h"
  46. #include "scrnintstr.h"
  47. #include "cursorstr.h"
  48.  
  49. #include "ibmScreen.h"
  50. #include "ibmTrace.h"
  51. #include "ibmXhftMap.h"
  52.  
  53. #include "x8514.h"
  54.  
  55. extern void ibmInfoMsg() ;
  56.  
  57. extern ibmPerScreenInfo ibm8514ScreenInfoStruct ;
  58. extern PixmapFormatRec ibm8514Formats[] ;
  59. /* GLOBAL FILE DESCRIPTOR -- for ioctl's etc. */
  60. int ibm8514FD = -1 ;
  61.  
  62. /*ARGSUSED*/
  63. void
  64. ibm8514osdInit( index )
  65.      int index ;
  66. {
  67.     TRACE( ( "ibm8514osdInit()\n" ) ) ;
  68.     return ;
  69. }
  70.  
  71. /*****************************************************************************/
  72.  
  73. void
  74. ibm8514SetVideoRegisters()
  75. {
  76. #ifndef BSDrt
  77.     /* THE FOLLOWING 8 OUTPUT VALUES ARE MAGIC NUMBERS */
  78.     /* Note that they are not queued */
  79.     /* This is the only place they occur, so screw the #define theory */
  80.     ibm8514outw( 0x12e8, 0x0660 ) ;     /* frame total width     */
  81.     ibm8514outw( 0x1ae8, 0x0600 ) ;     /* frame sync posn     */
  82.     ibm8514outw( 0x16e8, 0x05fb ) ;     /* frame blank start     */
  83.     outb( 0x1ee8, 0x08 ) ;        /* frame sync width     */
  84.     ibm8514outw( 0x02e8, 0x009d ) ;     /* line total length     */
  85.     ibm8514outw( 0x0ae8, 0x0081 ) ;     /* line sync posn     */
  86.     ibm8514outw( 0x06e8, 0x007f ) ;     /* line blank start     */
  87.     ibm8514outw( 0x0ee8, 0x0016 ) ;     /* line sync width     */
  88.     /* END MAGIC NUMBERS */
  89. #endif /* not BSDrt */
  90.     return ;
  91. }
  92.  
  93. /*****************************************************************************/
  94.  
  95. int
  96. ibm8514Probe()
  97. {
  98.     int fd ;
  99.  
  100. #if defined(IBM_OS_HAS_X_QUEUE) || defined(BSDrt)
  101.     if ( ( fd = open( IBM8514_DEV_FILE, O_RDWR | O_NDELAY ) ) >= 0 )
  102.     {
  103. # ifdef i386
  104.     ioctl (fd, 'B'<<8|1, 0); /* 8514 specific I/O permissions */
  105. # else
  106.     ioctl (fd, BUFINIT8514, 0);
  107. # endif /* i386 */
  108.     }
  109. #endif /* IBM_OS_HAS_X_QUEUE or BSDrt */
  110.  
  111. #ifdef IBM_OS_HAS_HFT
  112.     if ( ( fd = hftProbe( IBM8514xHFTid ) ) < 0 )
  113.         return fd ;
  114. #endif
  115.  
  116.     ibmInfoMsg( "Found a %d-plane 8514a with ",
  117.            ibm8514Formats[0].depth = ibm8514QueryPlanes() ) ;
  118.  
  119.     switch ( ibm8514QueryHead() )
  120.     {
  121.       case PseudoColor:
  122.     ibmInfoMsg( "a Color display\n" ) ;
  123.     break ;
  124.       case GrayScale:
  125.     ibmInfoMsg( "a Grayscale display\n" ) ;
  126.     break ;
  127.       default:
  128.     ibmInfoMsg( "no known display\n" ) ;
  129.     ErrorF( "Not bothering with headless 8514\n" ) ;
  130.     (void) close( fd ) ;
  131.     return -1 ;
  132.     }
  133.     return ibm8514FD = fd ;
  134. }
  135.  
  136.  
  137. /*
  138.  * blockoutw() and blockinw() have been moved to brcImg.c
  139.  * that was the only place they were used.
  140.  */
  141.