1 | /*
|
---|
2 | * Copyright IBM Corporation 1987,1988,1989
|
---|
3 | *
|
---|
4 | * All Rights Reserved
|
---|
5 | *
|
---|
6 | * Permission to use, copy, modify, and distribute this software and its
|
---|
7 | * documentation for any purpose and without fee is hereby granted,
|
---|
8 | * provided that the above copyright notice appear in all copies and that
|
---|
9 | * both that copyright notice and this permission notice appear in
|
---|
10 | * supporting documentation, and that the name of IBM not be
|
---|
11 | * used in advertising or publicity pertaining to distribution of the
|
---|
12 | * software without specific, written prior permission.
|
---|
13 | *
|
---|
14 | * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
---|
15 | * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
---|
16 | * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
---|
17 | * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
---|
18 | * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
---|
19 | * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
---|
20 | * SOFTWARE.
|
---|
21 | *
|
---|
22 | */
|
---|
23 |
|
---|
24 | #ifdef HAVE_XORG_CONFIG_H
|
---|
25 | #include <xorg-config.h>
|
---|
26 | #endif
|
---|
27 |
|
---|
28 | #include "misc.h" /* GJA -- for pointer data type */
|
---|
29 | #ifdef lint
|
---|
30 | #if defined(volatile)
|
---|
31 | #undef volatile
|
---|
32 | #endif
|
---|
33 | #define volatile /**/
|
---|
34 | #if defined(const)
|
---|
35 | #undef const
|
---|
36 | #endif
|
---|
37 | #define const /**/
|
---|
38 | #if defined(signed)
|
---|
39 | #undef signed
|
---|
40 | #endif
|
---|
41 | #define signed /**/
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | /*
|
---|
45 | * References to all pc ( i.e. '286 ) memory in the
|
---|
46 | * regions used by the [ev]ga server ( the 128K windows )
|
---|
47 | * MUST be long-word ( i.e. 32-bit ) reads or writes.
|
---|
48 | * This definition will change for other memory architectures
|
---|
49 | * ( e.g. AIX-Rt )
|
---|
50 | */
|
---|
51 | typedef unsigned char VideoAdapterObject ;
|
---|
52 | typedef volatile VideoAdapterObject *VideoMemoryPtr ;
|
---|
53 | typedef volatile VideoAdapterObject *VgaMemoryPtr ;
|
---|
54 | #if !defined(BITMAP_BIT_ORDER)
|
---|
55 | #define BITMAP_BIT_ORDER MSBFirst
|
---|
56 | #endif
|
---|
57 |
|
---|
58 | #if !defined(IMAGE_BYTE_ORDER)
|
---|
59 | #define IMAGE_BYTE_ORDER LSBFirst
|
---|
60 | #endif
|
---|
61 |
|
---|
62 | /* Bit Ordering Macros */
|
---|
63 | #if !defined(SCRLEFT8)
|
---|
64 | #define SCRLEFT8(lw, n) ( (unsigned char) (((unsigned char) lw) << (n)) )
|
---|
65 | #endif
|
---|
66 | #if !defined(SCRRIGHT8)
|
---|
67 | #define SCRRIGHT8(lw, n) ( (unsigned char) (((unsigned char)lw) >> (n)) )
|
---|
68 | #endif
|
---|
69 | /* These work ONLY on 8-bit wide Quantities !! */
|
---|
70 | #define LeftmostBit ( SCRLEFT8( 0xFF, 7 ) & 0xFF )
|
---|
71 | #define RightmostBit ( SCRRIGHT8( 0xFF, 7 ) & 0xFF )
|
---|
72 |
|
---|
73 | /*
|
---|
74 | * [ev]ga video screen defines & macros
|
---|
75 | */
|
---|
76 | #define VGA_BLACK_PIXEL 0
|
---|
77 | #define VGA_WHITE_PIXEL 1
|
---|
78 |
|
---|
79 | #define VGA_MAXPLANES 4
|
---|
80 | #define VGA_ALLPLANES 0xFL
|
---|
81 |
|
---|
82 | #define VIDBASE(pDraw) ((volatile unsigned char *) \
|
---|
83 | (((PixmapPtr)(((DrawablePtr)(pDraw))->pScreen->devPrivate))-> \
|
---|
84 | devPrivate.ptr))
|
---|
85 | #define BYTES_PER_LINE(pDraw) \
|
---|
86 | ((int)((PixmapPtr)(((DrawablePtr)(pDraw))->pScreen->devPrivate))->devKind)
|
---|
87 |
|
---|
88 | #define ROW_OFFSET( x ) ( ( x ) >> 3 )
|
---|
89 | #define BIT_OFFSET( x ) ( ( x ) & 0x7 )
|
---|
90 | #define SCREENADDRESS( pWin, x, y ) \
|
---|
91 | ( VIDBASE(pWin) + (y) * BYTES_PER_LINE(pWin) + ROW_OFFSET(x) )
|
---|
92 |
|
---|
93 |
|
---|