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 >
Wrap
C/C++ Source or Header
|
1991-09-20
|
4KB
|
141 lines
/*
* $Id: brcOSD.c,v 1.1 1991/09/20 19:10:24 mtranle Exp $
*
* Copyright IBM Corporation 1987,1990
*
* 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 name of IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* IBM 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.
*
*/
/*
* PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
* LICENSED MATERIALS - PROPERTY OF IBM
* REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
*/
/*
* Hardware interface routines for IBM 8514/A adapter for
* X.11 server(s) on IBM equipment.
*
*/
#include <fcntl.h>
#include <sys/ioctl.h>
#if defined(ibm032) && defined(BSDrt)
#define ATR
#include <machinecons/buf_emul.h>
#endif
#include "X.h"
#include "miscstruct.h"
#include "scrnintstr.h"
#include "cursorstr.h"
#include "ibmScreen.h"
#include "ibmTrace.h"
#include "ibmXhftMap.h"
#include "x8514.h"
extern void ibmInfoMsg() ;
extern ibmPerScreenInfo ibm8514ScreenInfoStruct ;
extern PixmapFormatRec ibm8514Formats[] ;
/* GLOBAL FILE DESCRIPTOR -- for ioctl's etc. */
int ibm8514FD = -1 ;
/*ARGSUSED*/
void
ibm8514osdInit( index )
int index ;
{
TRACE( ( "ibm8514osdInit()\n" ) ) ;
return ;
}
/*****************************************************************************/
void
ibm8514SetVideoRegisters()
{
#ifndef BSDrt
/* THE FOLLOWING 8 OUTPUT VALUES ARE MAGIC NUMBERS */
/* Note that they are not queued */
/* This is the only place they occur, so screw the #define theory */
ibm8514outw( 0x12e8, 0x0660 ) ; /* frame total width */
ibm8514outw( 0x1ae8, 0x0600 ) ; /* frame sync posn */
ibm8514outw( 0x16e8, 0x05fb ) ; /* frame blank start */
outb( 0x1ee8, 0x08 ) ; /* frame sync width */
ibm8514outw( 0x02e8, 0x009d ) ; /* line total length */
ibm8514outw( 0x0ae8, 0x0081 ) ; /* line sync posn */
ibm8514outw( 0x06e8, 0x007f ) ; /* line blank start */
ibm8514outw( 0x0ee8, 0x0016 ) ; /* line sync width */
/* END MAGIC NUMBERS */
#endif /* not BSDrt */
return ;
}
/*****************************************************************************/
int
ibm8514Probe()
{
int fd ;
#if defined(IBM_OS_HAS_X_QUEUE) || defined(BSDrt)
if ( ( fd = open( IBM8514_DEV_FILE, O_RDWR | O_NDELAY ) ) >= 0 )
{
# ifdef i386
ioctl (fd, 'B'<<8|1, 0); /* 8514 specific I/O permissions */
# else
ioctl (fd, BUFINIT8514, 0);
# endif /* i386 */
}
#endif /* IBM_OS_HAS_X_QUEUE or BSDrt */
#ifdef IBM_OS_HAS_HFT
if ( ( fd = hftProbe( IBM8514xHFTid ) ) < 0 )
return fd ;
#endif
ibmInfoMsg( "Found a %d-plane 8514a with ",
ibm8514Formats[0].depth = ibm8514QueryPlanes() ) ;
switch ( ibm8514QueryHead() )
{
case PseudoColor:
ibmInfoMsg( "a Color display\n" ) ;
break ;
case GrayScale:
ibmInfoMsg( "a Grayscale display\n" ) ;
break ;
default:
ibmInfoMsg( "no known display\n" ) ;
ErrorF( "Not bothering with headless 8514\n" ) ;
(void) close( fd ) ;
return -1 ;
}
return ibm8514FD = fd ;
}
/*
* blockoutw() and blockinw() have been moved to brcImg.c
* that was the only place they were used.
*/