summaryrefslogtreecommitdiff
path: root/src/i740.h
blob: 63f78f2ed6cf0d0a324686f5092858f388774531 (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157

/**************************************************************************

Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

**************************************************************************/
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740.h,v 1.7 2002/10/23 16:08:36 tsi Exp $ */

/*
 * Authors:
 *   Daryll Strauss <daryll@precisioninsight.com>
 *
 */

#ifndef _I740_H_
#define _I740_H_

#include "xf86PciInfo.h"
#include "xf86Pci.h"

#include "i740_reg.h"
#include "i740_macros.h"

#include "xaa.h"
#include "xf86Cursor.h"

/* Globals */
/* Memory mapped register access macros */
#define INREG8(addr)        *(volatile CARD8  *)(pI740->MMIOBase + (addr))
#define INREG16(addr)       *(volatile CARD16 *)(pI740->MMIOBase + (addr))
#define INREG(addr)         *(volatile CARD32 *)(pI740->MMIOBase + (addr))
#define OUTREG8(addr, val)  *(volatile CARD8  *)(pI740->MMIOBase + (addr)) = (val)
#define OUTREG16(addr, val) *(volatile CARD16 *)(pI740->MMIOBase + (addr)) = (val)
#define OUTREG(addr, val)   *(volatile CARD32 *)(pI740->MMIOBase + (addr)) = (val)

typedef struct _I740Rec *I740Ptr;

typedef void (*I740WriteIndexedByteFunc)(I740Ptr pI740, int addr, 
					 unsigned char index, char value);
typedef char (*I740ReadIndexedByteFunc)(I740Ptr pI740, int addr, 
					unsigned char index);
typedef void (*I740WriteByteFunc)(I740Ptr pI740, int addr, unsigned char value);
typedef char (*I740ReadByteFunc)(I740Ptr pI740, int addr);

typedef struct {
  unsigned char DisplayControl;
  unsigned char PixelPipeCfg0;
  unsigned char PixelPipeCfg1;
  unsigned char PixelPipeCfg2;
  unsigned char VideoClk2_M;
  unsigned char VideoClk2_N;
  unsigned char VideoClk2_MN_MSBs;
  unsigned char VideoClk2_DivisorSel;
  unsigned char PLLControl;
  unsigned char AddressMapping;
  unsigned char IOControl;
  unsigned char BitBLTControl;
  unsigned char ExtVertTotal;
  unsigned char ExtVertDispEnd;
  unsigned char ExtVertSyncStart;
  unsigned char ExtVertBlankStart;
  unsigned char ExtHorizTotal;
  unsigned char ExtHorizBlank;
  unsigned char ExtOffset;
  unsigned char InterlaceControl;
  unsigned int  LMI_FIFO_Watermark;
} I740RegRec, *I740RegPtr;

typedef struct _I740Rec {
  unsigned char *MMIOBase;
  unsigned char *FbBase;
  long FbMapSize;
  int cpp;
  int MaxClock;
  int CursorStart;
  int Chipset;
  unsigned long LinearAddr;
  unsigned long MMIOAddr;
  EntityInfoPtr pEnt;
  pciVideoPtr PciInfo;
  PCITAG PciTag;
  int HasSGRAM;
  I740RegRec SavedReg;
  I740RegRec ModeReg;
  XAAInfoRecPtr AccelInfoRec;
  xf86CursorInfoPtr CursorInfoRec;
  FBAreaPtr CursorData;
  CloseScreenProcPtr CloseScreen;
  GFX2DOPREG_BLTER_FULL_LOAD bltcmd;
  Bool usePIO;
  I740WriteIndexedByteFunc writeControl;
  I740ReadIndexedByteFunc readControl;
  I740WriteByteFunc writeStandard;
  I740ReadByteFunc readStandard;
  OptionInfoPtr Options;

  /*DGA*/
  DGAModePtr DGAModes;
  int numDGAModes;
  Bool DGAactive;
  int DGAViewportStatus;
  BoxRec FbMemBox;
  /*-*/

  /*I2C*/
  I2CBusPtr             rc_i2c;
  /*-*/

  /*-*/ /*Overlay*/
  XF86VideoAdaptorPtr adaptor;
  unsigned long OverlayStart;
  unsigned long OverlayPhysical;
  int colorKey;
  ScreenBlockHandlerProcPtr BlockHandler;
  int ov_offset_x,ov_offset_y;
  /*-*/

  Bool usevgacompat;
} I740Rec;

#define I740PTR(p) ((I740Ptr)((p)->driverPrivate))

extern Bool I740CursorInit(ScreenPtr pScreen);
extern Bool I740AccelInit(ScreenPtr pScreen);
void I740SetPIOAccess(I740Ptr pI740);
void I740SetMMIOAccess(I740Ptr pI740);
void I740InitVideo(ScreenPtr pScreen);

Bool I740SwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
void I740AdjustFrame(int scrnIndex, int x, int y, int flags);


#define minb(p) MMIO_IN8(pI740->MMIOBase, (p))
#define moutb(p,v) MMIO_OUT8(pI740->MMIOBase, (p),(v))

#endif