pm2vramdac.c revision 1fb744b4
1/*
2 * Copyright 1998 by Alan Hourihane, Wigan, England.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of Alan Hourihane not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission.  Alan Hourihane makes no representations
11 * about the suitability of this software for any purpose.  It is provided
12 * "as is" without express or implied warranty.
13 *
14 * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
21 *
22 * Authors:  Alan Hourihane, <alanh@fairlite.demon.co.uk>
23 *
24 * Permedia2vOutIndReg() and Permedia2vInIndReg() are used to access
25 * the indirect Permedia2v RAMDAC registers only.
26 */
27
28#ifdef HAVE_CONFIG_H
29#include "config.h"
30#endif
31
32#include "xf86.h"
33#include "xf86_OSproc.h"
34
35#include "xf86Pci.h"
36
37#include "glint_regs.h"
38#include "glint.h"
39
40void
41Permedia2vOutIndReg(ScrnInfoPtr pScrn,
42		     CARD32 reg, unsigned char mask, unsigned char data)
43{
44  GLINTPtr pGlint = GLINTPTR(pScrn);
45  unsigned char tmp = 0x00;
46
47  GLINT_SET_INDEX(reg);
48
49  if (mask != 0x00)
50    tmp = GLINT_READ_REG (PM2VDACIndexData) & mask;
51
52  GLINT_WRITE_REG (tmp | data, PM2VDACIndexData);
53}
54
55unsigned char
56Permedia2vInIndReg (ScrnInfoPtr pScrn, CARD32 reg)
57{
58  GLINTPtr pGlint = GLINTPTR(pScrn);
59  unsigned char ret;
60
61  GLINT_SET_INDEX(reg);
62  ret = GLINT_READ_REG (PM2VDACIndexData);
63
64  return (ret);
65}
66