45e9809aff7304721fddb95654901b32195c9c7avboxsync/*
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright IBM Corporation 1987,1988,1989
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * All Rights Reserved
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Permission to use, copy, modify, and distribute this software and its
45e9809aff7304721fddb95654901b32195c9c7avboxsync * documentation for any purpose and without fee is hereby granted,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * provided that the above copyright notice appear in all copies and that
45e9809aff7304721fddb95654901b32195c9c7avboxsync * both that copyright notice and this permission notice appear in
45e9809aff7304721fddb95654901b32195c9c7avboxsync * supporting documentation, and that the name of IBM not be
45e9809aff7304721fddb95654901b32195c9c7avboxsync * used in advertising or publicity pertaining to distribution of the
45e9809aff7304721fddb95654901b32195c9c7avboxsync * software without specific, written prior permission.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
45e9809aff7304721fddb95654901b32195c9c7avboxsync * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
45e9809aff7304721fddb95654901b32195c9c7avboxsync * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
45e9809aff7304721fddb95654901b32195c9c7avboxsync * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
45e9809aff7304721fddb95654901b32195c9c7avboxsync * SOFTWARE.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync*/
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef HAVE_XORG_CONFIG_H
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <xorg-config.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include "misc.h" /* GJA -- for pointer data type */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef lint
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if defined(volatile)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef volatile
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define volatile /**/
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if defined(const)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef const
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define const /**/
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if defined(signed)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef signed
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define signed /**/
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/*
45e9809aff7304721fddb95654901b32195c9c7avboxsync * References to all pc ( i.e. '286 ) memory in the
45e9809aff7304721fddb95654901b32195c9c7avboxsync * regions used by the [ev]ga server ( the 128K windows )
45e9809aff7304721fddb95654901b32195c9c7avboxsync * MUST be long-word ( i.e. 32-bit ) reads or writes.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * This definition will change for other memory architectures
45e9809aff7304721fddb95654901b32195c9c7avboxsync * ( e.g. AIX-Rt )
45e9809aff7304721fddb95654901b32195c9c7avboxsync */
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef unsigned char VideoAdapterObject ;
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef volatile VideoAdapterObject *VideoMemoryPtr ;
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef volatile VideoAdapterObject *VgaMemoryPtr ;
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if !defined(BITMAP_BIT_ORDER)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define BITMAP_BIT_ORDER MSBFirst
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if !defined(IMAGE_BYTE_ORDER)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define IMAGE_BYTE_ORDER LSBFirst
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* Bit Ordering Macros */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if !defined(SCRLEFT8)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define SCRLEFT8(lw, n) ( (unsigned char) (((unsigned char) lw) << (n)) )
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if !defined(SCRRIGHT8)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define SCRRIGHT8(lw, n) ( (unsigned char) (((unsigned char)lw) >> (n)) )
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync/* These work ONLY on 8-bit wide Quantities !! */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define LeftmostBit ( SCRLEFT8( 0xFF, 7 ) & 0xFF )
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define RightmostBit ( SCRRIGHT8( 0xFF, 7 ) & 0xFF )
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/*
45e9809aff7304721fddb95654901b32195c9c7avboxsync * [ev]ga video screen defines & macros
45e9809aff7304721fddb95654901b32195c9c7avboxsync */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define VGA_BLACK_PIXEL 0
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define VGA_WHITE_PIXEL 1
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define VGA_MAXPLANES 4
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define VGA_ALLPLANES 0xFL
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define VIDBASE(pDraw) ((volatile unsigned char *) \
45e9809aff7304721fddb95654901b32195c9c7avboxsync (((PixmapPtr)(((DrawablePtr)(pDraw))->pScreen->devPrivate))-> \
45e9809aff7304721fddb95654901b32195c9c7avboxsync devPrivate.ptr))
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define BYTES_PER_LINE(pDraw) \
45e9809aff7304721fddb95654901b32195c9c7avboxsync ((int)((PixmapPtr)(((DrawablePtr)(pDraw))->pScreen->devPrivate))->devKind)
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define ROW_OFFSET( x ) ( ( x ) >> 3 )
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define BIT_OFFSET( x ) ( ( x ) & 0x7 )
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define SCREENADDRESS( pWin, x, y ) \
45e9809aff7304721fddb95654901b32195c9c7avboxsync ( VIDBASE(pWin) + (y) * BYTES_PER_LINE(pWin) + ROW_OFFSET(x) )
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync