pm2vramdac.c revision c35d236e
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/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2vramdac.c,v 1.5 2001/01/30 10:06:35 alanh Exp $ */
28
29#ifdef HAVE_CONFIG_H
30#include "config.h"
31#endif
32
33#include "xf86.h"
34#include "xf86_OSproc.h"
35
36#include "xf86PciInfo.h"
37#include "xf86Pci.h"
38
39#include "glint_regs.h"
40#include "glint.h"
41
42void
43Permedia2vOutIndReg(ScrnInfoPtr pScrn,
44		     CARD32 reg, unsigned char mask, unsigned char data)
45{
46  GLINTPtr pGlint = GLINTPTR(pScrn);
47  unsigned char tmp = 0x00;
48
49  GLINT_SET_INDEX(reg);
50
51  if (mask != 0x00)
52    tmp = GLINT_READ_REG (PM2VDACIndexData) & mask;
53
54  GLINT_WRITE_REG (tmp | data, PM2VDACIndexData);
55}
56
57unsigned char
58Permedia2vInIndReg (ScrnInfoPtr pScrn, CARD32 reg)
59{
60  GLINTPtr pGlint = GLINTPTR(pScrn);
61  unsigned char ret;
62
63  GLINT_SET_INDEX(reg);
64  ret = GLINT_READ_REG (PM2VDACIndexData);
65
66  return (ret);
67}
68