summaryrefslogtreecommitdiff
path: root/hw/xfree86/xf4bpp/vgaVideo.h
blob: ecc2fa738d3f503d0eec64e3f7db9f84b60fd77d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/vgaVideo.h,v 1.2 1998/07/25 16:59:45 dawes Exp $ */
/*
 * Copyright IBM Corporation 1987,1988,1989
 *
 * 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.
 *
*/

/* $XConsortium: vgaVideo.h /main/4 1996/02/21 17:59:14 kaleb $ */

#include "misc.h"	/* GJA -- for pointer data type */
#ifdef lint
#if defined(volatile)
#undef volatile
#endif
#define volatile /**/
#if defined(const)
#undef const
#endif
#define const /**/
#if defined(signed)
#undef signed
#endif
#define signed /**/
#endif

/*
 * References to all pc ( i.e. '286 ) memory in the
 * regions used by the [ev]ga server ( the 128K windows )
 * MUST be long-word ( i.e. 32-bit ) reads or writes.
 * This definition will change for other memory architectures
 * ( e.g. AIX-Rt )
 */
typedef unsigned char VideoAdapterObject ;
typedef volatile VideoAdapterObject *VideoMemoryPtr ;
typedef volatile VideoAdapterObject *VgaMemoryPtr ;
#if !defined(BITMAP_BIT_ORDER)
#define BITMAP_BIT_ORDER MSBFirst
#endif

#if !defined(IMAGE_BYTE_ORDER)
#define IMAGE_BYTE_ORDER LSBFirst
#endif

/* Bit Ordering Macros */
#if !defined(SCRLEFT8)
#define SCRLEFT8(lw, n)	( (unsigned char) (((unsigned char) lw) << (n)) )
#endif
#if !defined(SCRRIGHT8)
#define SCRRIGHT8(lw, n)	( (unsigned char) (((unsigned char)lw) >> (n)) )
#endif
/* These work ONLY on 8-bit wide Quantities !! */
#define LeftmostBit ( SCRLEFT8( 0xFF, 7 ) & 0xFF )
#define RightmostBit ( SCRRIGHT8( 0xFF, 7 ) & 0xFF )

/*
 * [ev]ga video screen defines & macros
 */
#define VGA_BLACK_PIXEL 0
#define VGA_WHITE_PIXEL 1

#define VGA_MAXPLANES 4
#define VGA_ALLPLANES 0xFL

#define VIDBASE(pDraw) ((volatile unsigned char *) \
	(((PixmapPtr)(((DrawablePtr)(pDraw))->pScreen->devPrivate))-> \
		devPrivate.ptr))
#define BYTES_PER_LINE(pDraw) \
   ((int)((PixmapPtr)(((DrawablePtr)(pDraw))->pScreen->devPrivate))->devKind)

#define ROW_OFFSET( x ) ( ( x ) >> 3 )
#define BIT_OFFSET( x ) ( ( x ) & 0x7 )
#define SCREENADDRESS( pWin, x, y ) \
	( VIDBASE(pWin) + (y) * BYTES_PER_LINE(pWin) + ROW_OFFSET(x) )