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
|
/*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _CRT_H_
#define _CRT_H_
#ifdef Watcom
#define CRT_REMAP_OFFSET 0x10000
#else
#define CRT_REMAP_OFFSET 0x0
#endif
/********************************************************/
/* CRT register */
/********************************************************/
#define CRT_BASE_OFFSET 0x6000+CRT_REMAP_OFFSET
#define CRT1_CONTROL_REG 0x00 + CRT_BASE_OFFSET
#define GRAPH_DISPLAY_BIT 0
#define GRAPH_DISPLAY_MASK (1<<0)
#define GRAPH_DISPLAY_ON 1
#define GRAPH_DISPLAY_OFF 0
#define FORMAT_SELECT_BIT 8
#define FORMAT_SELECT_MASK (3<<8)
#define HOR_SYNC_SELECT_BIT 16
#define HOR_SYNC_SELECT_MASK (1<<16)
#define HOR_NEGATIVE 1
#define HOR_POSITIVE 0
#define VER_SYNC_SELECT_BIT 17
#define VER_SYNC_SELECT_MASK (1<<17)
#define VER_NEGATIVE 1
#define VER_POSITIVE 0
#define CRT1_CONTROL2_REG 0x04 + CRT_BASE_OFFSET
#define CRT1_VIDEO_PLL_REG 0x0C + CRT_BASE_OFFSET
#define POST_DIV_BIT 18
#define POST_DIV_MASK 3<<18
#define DIV_1_1 0
//#define DIV_1_2 1
#define DIV_1_2 2
#define DIV_1_4 3
#define CRT1_HOR_TOTAL_END_REG 0x10 + CRT_BASE_OFFSET
#define HOR_TOTAL_BIT 0
#define HOR_ENABLE_END_BIT 16
#define CRT1_HOR_RETRACE_REG 0x14 + CRT_BASE_OFFSET
#define HOR_RETRACE_START_BIT 0
#define HOR_RETRACE_END_BIT 16
#define CRT1_VER_TOTAL_END_REG 0x18 + CRT_BASE_OFFSET
#define VER_TOTAL_BIT 0
#define VER_ENABLE_END_BIT 16
#define CRT1_VER_RETRACE_REG 0x1C + CRT_BASE_OFFSET
#define VER_RETRACE_START_BIT 0
#define VER_RETRACE_END_BIT 16
#define CRT1_DISPLAY_ADDRESS 0x20 + CRT_BASE_OFFSET
#define DISPLAY_ADDRESS_MASK 0x0FFFFFFF
#define CRT1_DISPLAY_OFFSET 0x24 + CRT_BASE_OFFSET
#define DISPLAY_OFFSET_ALIGN 7 /* 8 byte alignment*/
#define TERMINAL_COUNT_BIT 16
#define CRT1_THRESHOLD_REG 0x28 + CRT_BASE_OFFSET
#define THRES_LOW_BIT 0
#define THRES_HIGHT_BIT 8
#define CURSOR_POSITION 0x30 + OFFSET
#define CURSOR_OFFSET 0x34 + OFFSET
#define CURSOR_PATTERN 0x38 + OFFSET
#define OSD_HORIZONTAL 0x40 + OFFSET
#define OSD_VERTICAL 0x44 + OFFSET
#define OSD_PATTERN 0x48 + OFFSET
#define OSD_OFFSET 0x4C + OFFSET
#define OSD_THRESHOLD 0x50 + OFFSET
//Ch7301c
#define DEVICE_ADDRESS_CH7301_CRT1 0xEA
#define DEVICE_ADDRESS_CH7301_CRT2 0xEC
#define DEVICE_SELECT_CH7301 0x3
/* CH7301 Register Definition */
#define CH7301_CD_REG 0x20
#define CD_DACT 0x0E
#define CD_DVIT 1 << 5
#define CH7301_DC_REG 0x21
#define CH7301_PM_REG 0x49
BOOL CheckHotPlug(int nCRTIndex);
BOOL CheckDAC(int nCRTIndex);
BOOL ASTSetModeV (ULONG MMIOBase,
int nCRTIndex,
ULONG VGABaseAddr,
USHORT Horizontal,
USHORT Vertical,
BYTE ColorFormat,
BYTE CenterMode);
BOOL SelCRTClock(ULONG MMIOBase,
int nCRTIndex,
USHORT Horizontal,
USHORT Vertical);
void DisableCRT(ULONG MMIOBase, int nCRTIndex);
void ClearCRTWithBlack(ULONG ulCRTAddr, int iWidth, int iHeight);
#endif /* _CRT_H_ */
|