annotate vidix/sis_bridge.c @ 36858:bb067298265a

Fix bug with btnSet(). Only change the pressed state if the item actually has a button. Additionally, change variable name.
author ib
date Fri, 28 Feb 2014 14:11:25 +0000
parents 36818ea5ce95
children 3c5c93a30fb7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23046
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
1 /*
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
2 * VIDIX driver for SiS chipsets.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
3 * Video bridge detection for SiS 300 and 310/325 series.
26718
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 23048
diff changeset
4 *
28307
2391228b7ff0 cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents: 26753
diff changeset
5 * Copyright (C) 2003 Jake Page, Sugar Media
26718
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 23048
diff changeset
6 * Based on SiS Xv driver
28307
2391228b7ff0 cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents: 26753
diff changeset
7 * Copyright 2002-2003 by Thomas Winischhofer, Vienna, Austria
23046
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
8 *
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
9 * This file is part of MPlayer.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
10 *
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
11 * MPlayer is free software; you can redistribute it and/or modify
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
12 * it under the terms of the GNU General Public License as published by
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
14 * (at your option) any later version.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
15 *
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
16 * MPlayer is distributed in the hope that it will be useful,
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
19 * GNU General Public License for more details.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
20 *
26719
3abd1629658b Use standard license headers.
diego
parents: 26718
diff changeset
21 * You should have received a copy of the GNU General Public License along
3abd1629658b Use standard license headers.
diego
parents: 26718
diff changeset
22 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
3abd1629658b Use standard license headers.
diego
parents: 26718
diff changeset
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23046
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
24 */
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
25
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
26 #include <stdio.h>
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
27 #include <stdlib.h>
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
28 #include <unistd.h>
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
29
22901
a7605669b114 renamed libdha.[hc] to dha.[hc]
ben
parents: 22900
diff changeset
30 #include "dha.h"
30551
36818ea5ce95 Add header file for sis_init_video_bridge() instead of forward declaring it.
diego
parents: 28307
diff changeset
31 #include "sis_bridge.h"
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
32 #include "sis_regs.h"
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
33 #include "sis_defs.h"
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
34
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
35
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
36 static void sis_ddc2_delay(unsigned short delaytime)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
37 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
38 unsigned short i;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
39 int temp;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
40
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
41 for (i = 0; i < delaytime; i++) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
42 inSISIDXREG(SISSR, 0x05, temp);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
43 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
44 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
45
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
46
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
47 static int sis_do_sense(int tempbl, int tempbh, int tempcl, int tempch)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
48 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
49 int temp;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
50
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
51 outSISIDXREG(SISPART4, 0x11, tempbl);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
52 temp = tempbh | tempcl;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
53 setSISIDXREG(SISPART4, 0x10, 0xe0, temp);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
54 //usleep(200000);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
55 sis_ddc2_delay(0x1000);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
56 tempch &= 0x7f;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
57 inSISIDXREG(SISPART4, 0x03, temp);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
58 temp ^= 0x0e;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
59 temp &= tempch;
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
60 return temp == tempch;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
61 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
62
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
63
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
64 /* sense connected devices on 30x bridge */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
65 static void sis_sense_30x(void)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
66 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
67 unsigned char backupP4_0d, backupP2_00, biosflag;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
68 unsigned char testsvhs_tempbl, testsvhs_tempbh;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
69 unsigned char testsvhs_tempcl, testsvhs_tempch;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
70 unsigned char testcvbs_tempbl, testcvbs_tempbh;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
71 unsigned char testcvbs_tempcl, testcvbs_tempch;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
72 unsigned char testvga2_tempbl, testvga2_tempbh;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
73 unsigned char testvga2_tempcl, testvga2_tempch;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
74 int myflag, result = 0, i, j, haveresult;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
75
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
76 inSISIDXREG(SISPART4, 0x0d, backupP4_0d);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
77 outSISIDXREG(SISPART4, 0x0d, (backupP4_0d | 0x04));
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
78
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
79 inSISIDXREG(SISPART2, 0x00, backupP2_00);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
80 outSISIDXREG(SISPART2, 0x00, (backupP2_00 | 0x1c));
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
81
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
82 sis_do_sense(0, 0, 0, 0);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
83
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
84 if (sis_vga_engine == SIS_300_VGA) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
85 testvga2_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
86 testvga2_tempbl = 0xd1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
87 testsvhs_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
88 testsvhs_tempbl = 0xb9;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
89 testcvbs_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
90 testcvbs_tempbl = 0xb3;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
91 biosflag = 0;
23048
7973a6935234 removed useless code from vidix drivers
ben
parents: 23046
diff changeset
92
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
93 if (sis_vbflags & (VB_301B | VB_302B | VB_301LV | VB_302LV)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
94 testvga2_tempbh = 0x01;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
95 testvga2_tempbl = 0x90;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
96 testsvhs_tempbh = 0x01;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
97 testsvhs_tempbl = 0x6b;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
98 testcvbs_tempbh = 0x01;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
99 testcvbs_tempbl = 0x74;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
100 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
101 inSISIDXREG(SISPART4, 0x01, myflag);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
102 if (myflag & 0x04) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
103 testvga2_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
104 testvga2_tempbl = 0xfd;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
105 testsvhs_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
106 testsvhs_tempbl = 0xdd;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
107 testcvbs_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
108 testcvbs_tempbl = 0xee;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
109 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
110 testvga2_tempch = 0x0e;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
111 testvga2_tempcl = 0x08;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
112 testsvhs_tempch = 0x06;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
113 testsvhs_tempcl = 0x04;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
114 testcvbs_tempch = 0x08;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
115 testcvbs_tempcl = 0x04;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
116
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
117 if (sis_device_id == DEVICE_SIS_300) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
118 inSISIDXREG(SISSR, 0x3b, myflag);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
119 if (!(myflag & 0x01)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
120 testvga2_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
121 testvga2_tempbl = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
122 testvga2_tempch = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
123 testvga2_tempcl = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
124 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
125 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
126 } else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
127 testvga2_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
128 testvga2_tempbl = 0xd1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
129 testsvhs_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
130 testsvhs_tempbl = 0xb9;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
131 testcvbs_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
132 testcvbs_tempbl = 0xb3;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
133 biosflag = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
134
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
135 if (sis_vbflags & (VB_301B | VB_302B | VB_301LV | VB_302LV)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
136 if (sis_vbflags & (VB_301B | VB_302B)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
137 testvga2_tempbh = 0x01;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
138 testvga2_tempbl = 0x90;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
139 testsvhs_tempbh = 0x01;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
140 testsvhs_tempbl = 0x6b;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
141 testcvbs_tempbh = 0x01;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
142 testcvbs_tempbl = 0x74;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
143 } else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
144 testvga2_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
145 testvga2_tempbl = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
146 testsvhs_tempbh = 0x02;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
147 testsvhs_tempbl = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
148 testcvbs_tempbh = 0x01;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
149 testcvbs_tempbl = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
150 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
151 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
152 if (sis_vbflags & (VB_301 | VB_301B | VB_302B)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
153 inSISIDXREG(SISPART4, 0x01, myflag);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
154 if (myflag & 0x04) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
155 testvga2_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
156 testvga2_tempbl = 0xfd;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
157 testsvhs_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
158 testsvhs_tempbl = 0xdd;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
159 testcvbs_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
160 testcvbs_tempbl = 0xee;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
161 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
162 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
163 if (sis_vbflags & (VB_301LV | VB_302LV)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
164 /* TW: No VGA2 or SCART on LV bridges */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
165 testvga2_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
166 testvga2_tempbl = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
167 testvga2_tempch = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
168 testvga2_tempcl = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
169 testsvhs_tempch = 0x04;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
170 testsvhs_tempcl = 0x08;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
171 testcvbs_tempch = 0x08;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
172 testcvbs_tempcl = 0x08;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
173 } else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
174 testvga2_tempch = 0x0e;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
175 testvga2_tempcl = 0x08;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
176 testsvhs_tempch = 0x06;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
177 testsvhs_tempcl = 0x04;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
178 testcvbs_tempch = 0x08;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
179 testcvbs_tempcl = 0x04;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
180 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
181 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
182
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
183 /* XXX: ?? andSISIDXREG(SISCR, 0x32, ~0x14); */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
184 /* pSiS->postVBCR32 &= ~0x14; */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
185
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
186 /* scan for VGA2/SCART */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
187 if (testvga2_tempch || testvga2_tempcl ||
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
188 testvga2_tempbh || testvga2_tempbl) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
189
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
190 haveresult = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
191 for (j = 0; j < 10; j++) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
192 result = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
193 for (i = 0; i < 3; i++) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
194 if (sis_do_sense(testvga2_tempbl, testvga2_tempbh,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
195 testvga2_tempcl, testvga2_tempch))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
196 result++;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
197 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
198 if ((result == 0) || (result >= 2))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
199 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
200 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
201 if (result) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
202 if (biosflag & 0x01) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
203 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
204 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
205 ("[SiS] SiS30x: Detected TV connected to SCART output\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
206 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
207 sis_vbflags |= TV_SCART;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
208 orSISIDXREG(SISCR, 0x32, 0x04);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
209 /*pSiS->postVBCR32 |= 0x04; */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
210 } else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
211 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
212 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
213 ("[SiS] SiS30x: Detected secondary VGA connection\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
214 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
215 sis_vbflags |= VGA2_CONNECTED;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
216 orSISIDXREG(SISCR, 0x32, 0x10);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
217 /*pSiS->postVBCR32 |= 0x10; */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
218 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
219 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
220 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
221
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
222 /* scanning for TV */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
223
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
224 /* XXX: ?? andSISIDXREG(SISCR, 0x32, ~0x03); */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
225 /* pSiS->postVBCR32 &= ~0x03; */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
226
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
227 result = sis_do_sense(testsvhs_tempbl, testsvhs_tempbh,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
228 testsvhs_tempcl, testsvhs_tempch);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
229
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
230
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
231 haveresult = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
232 for (j = 0; j < 10; j++) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
233 result = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
234 for (i = 0; i < 3; i++) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
235 if (sis_do_sense(testsvhs_tempbl, testsvhs_tempbh,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
236 testsvhs_tempcl, testsvhs_tempch))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
237 result++;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
238 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
239 if ((result == 0) || (result >= 2))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
240 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
241 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
242 if (result) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
243 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
244 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
245 ("[SiS] SiS30x: Detected TV connected to SVIDEO output\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
246 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
247 /* TW: So we can be sure that there IS a SVIDEO output */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
248 sis_vbflags |= TV_SVIDEO;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
249 orSISIDXREG(SISCR, 0x32, 0x02);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
250 //pSiS->postVBCR32 |= 0x02;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
251 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
252
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
253 if ((biosflag & 0x02) || (!(result))) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
254 haveresult = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
255 for (j = 0; j < 10; j++) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
256 result = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
257 for (i = 0; i < 3; i++) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
258 if (sis_do_sense(testcvbs_tempbl, testcvbs_tempbh,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
259 testcvbs_tempcl, testcvbs_tempch))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
260 result++;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
261 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
262 if ((result == 0) || (result >= 2))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
263 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
264 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
265 if (result) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
266 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
267 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
268 ("[SiS] SiS30x: Detected TV connected to COMPOSITE output\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
269 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
270 sis_vbflags |= TV_AVIDEO;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
271 orSISIDXREG(SISCR, 0x32, 0x01);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
272 //pSiS->postVBCR32 |= 0x01;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
273 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
274 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
275
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
276 sis_do_sense(0, 0, 0, 0);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
277
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
278 outSISIDXREG(SISPART2, 0x00, backupP2_00);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
279 outSISIDXREG(SISPART4, 0x0d, backupP4_0d);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
280 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
281
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
282
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
283 static void sis_detect_crt1(void)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
284 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
285 unsigned char CR32;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
286 unsigned char CRT1Detected = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
287 unsigned char OtherDevices = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
288
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
289 if (!(sis_vbflags & VB_VIDEOBRIDGE)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
290 sis_crt1_off = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
291 return;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
292 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
293
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
294 inSISIDXREG(SISCR, 0x32, CR32);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
295
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
296 if (CR32 & 0x20)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
297 CRT1Detected = 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
298 if (CR32 & 0x5F)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
299 OtherDevices = 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
300
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
301 if (sis_crt1_off == -1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
302 if (!CRT1Detected) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
303 /* BIOS detected no CRT1. */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
304 /* If other devices exist, switch it off */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
305 if (OtherDevices)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
306 sis_crt1_off = 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
307 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
308 sis_crt1_off = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
309 } else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
310 /* BIOS detected CRT1, leave/switch it on */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
311 sis_crt1_off = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
312 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
313 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
314 if (sis_verbose > 0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
315 printf("[SiS] %sCRT1 connection detected\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
316 sis_crt1_off ? "No " : "");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
317 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
318 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
319
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
320 static void sis_detect_tv(void)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
321 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
322 unsigned char SR16, SR38, CR32, CR38 = 0, CR79;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
323 int temp = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
324
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
325 if (!(sis_vbflags & VB_VIDEOBRIDGE))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
326 return;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
327
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
328 inSISIDXREG(SISCR, 0x32, CR32);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
329 inSISIDXREG(SISSR, 0x16, SR16);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
330 inSISIDXREG(SISSR, 0x38, SR38);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
331 switch (sis_vga_engine) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
332 case SIS_300_VGA:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
333 if (sis_device_id == DEVICE_SIS_630_VGA)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
334 temp = 0x35;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
335 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
336 case SIS_315_VGA:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
337 temp = 0x38;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
338 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
339 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
340 if (temp) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
341 inSISIDXREG(SISCR, temp, CR38);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
342 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
343
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
344 if (CR32 & 0x47)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
345 sis_vbflags |= CRT2_TV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
346
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
347 if (CR32 & 0x04)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
348 sis_vbflags |= TV_SCART;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
349 else if (CR32 & 0x02)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
350 sis_vbflags |= TV_SVIDEO;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
351 else if (CR32 & 0x01)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
352 sis_vbflags |= TV_AVIDEO;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
353 else if (CR32 & 0x40)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
354 sis_vbflags |= (TV_SVIDEO | TV_HIVISION);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
355 else if ((CR38 & 0x04) && (sis_vbflags & (VB_301LV | VB_302LV)))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
356 sis_vbflags |= TV_HIVISION_LV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
357 else if ((CR38 & 0x04) && (sis_vbflags & VB_CHRONTEL))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
358 sis_vbflags |= (TV_CHSCART | TV_PAL);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
359 else if ((CR38 & 0x08) && (sis_vbflags & VB_CHRONTEL))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
360 sis_vbflags |= (TV_CHHDTV | TV_NTSC);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
361
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
362 if (sis_vbflags & (TV_SCART | TV_SVIDEO | TV_AVIDEO | TV_HIVISION)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
363 if (sis_vga_engine == SIS_300_VGA) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
364 /* TW: Should be SR38 here as well, but this
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
365 * does not work. Looks like a BIOS bug (2.04.5c).
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
366 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
367 if (SR16 & 0x20)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
368 sis_vbflags |= TV_PAL;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
369 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
370 sis_vbflags |= TV_NTSC;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
371 } else if ((sis_device_id == DEVICE_SIS_550_VGA)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
372 inSISIDXREG(SISCR, 0x79, CR79);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
373 if (CR79 & 0x08) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
374 inSISIDXREG(SISCR, 0x79, CR79);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
375 CR79 >>= 5;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
376 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
377 if (CR79 & 0x01) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
378 sis_vbflags |= TV_PAL;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
379 if (CR38 & 0x40)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
380 sis_vbflags |= TV_PALM;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
381 else if (CR38 & 0x80)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
382 sis_vbflags |= TV_PALN;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
383 } else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
384 sis_vbflags |= TV_NTSC;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
385 } else if ((sis_device_id == DEVICE_SIS_650_VGA)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
386 inSISIDXREG(SISCR, 0x79, CR79);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
387 if (CR79 & 0x20) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
388 sis_vbflags |= TV_PAL;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
389 if (CR38 & 0x40)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
390 sis_vbflags |= TV_PALM;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
391 else if (CR38 & 0x80)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
392 sis_vbflags |= TV_PALN;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
393 } else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
394 sis_vbflags |= TV_NTSC;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
395 } else { /* 315, 330 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
396 if (SR38 & 0x01) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
397 sis_vbflags |= TV_PAL;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
398 if (CR38 & 0x40)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
399 sis_vbflags |= TV_PALM;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
400 else if (CR38 & 0x80)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
401 sis_vbflags |= TV_PALN;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
402 } else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
403 sis_vbflags |= TV_NTSC;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
404 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
405 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
406
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
407 if (sis_vbflags &
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
408 (TV_SCART | TV_SVIDEO | TV_AVIDEO | TV_HIVISION | TV_CHSCART |
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
409 TV_CHHDTV)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
410 if (sis_verbose > 0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
411 printf("[SiS] %sTV standard %s\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
412 (sis_vbflags & (TV_CHSCART | TV_CHHDTV)) ? "Using " :
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
413 "Detected default ",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
414 (sis_vbflags & TV_NTSC) ? ((sis_vbflags & TV_CHHDTV) ?
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
415 "480i HDTV" : "NTSC")
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
416 : ((sis_vbflags & TV_PALM) ? "PALM"
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
417 : ((sis_vbflags & TV_PALN) ? "PALN" : "PAL")));
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
418 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
419 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
420
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
421 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
422
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
423
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
424 static void sis_detect_crt2(void)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
425 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
426 unsigned char CR32;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
427
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
428 if (!(sis_vbflags & VB_VIDEOBRIDGE))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
429 return;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
430
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
431 /* CRT2-VGA not supported on LVDS and 30xLV */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
432 if (sis_vbflags & (VB_LVDS | VB_301LV | VB_302LV))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
433 return;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
434
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
435 inSISIDXREG(SISCR, 0x32, CR32);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
436
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
437 if (CR32 & 0x10)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
438 sis_vbflags |= CRT2_VGA;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
439 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
440
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
441
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
442 /* Preinit: detect video bridge and sense connected devs */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
443 static void sis_detect_video_bridge(void)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
444 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
445 int temp, temp1, temp2;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
446
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
447
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
448 sis_vbflags = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
449
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
450 if (sis_vga_engine != SIS_300_VGA && sis_vga_engine != SIS_315_VGA)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
451 return;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
452
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
453 inSISIDXREG(SISPART4, 0x00, temp);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
454 temp &= 0x0F;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
455 if (temp == 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
456 inSISIDXREG(SISPART4, 0x01, temp1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
457 temp1 &= 0xff;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
458 if (temp1 >= 0xE0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
459 sis_vbflags |= VB_302LV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
460 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
461 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
462 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
463 ("[SiS] Detected SiS302LV video bridge (ID 1; Revision 0x%x)\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
464 temp1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
465 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
466
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
467 } else if (temp1 >= 0xD0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
468 sis_vbflags |= VB_301LV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
469 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
470 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
471 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
472 ("[SiS] Detected SiS301LV video bridge (ID 1; Revision 0x%x)\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
473 temp1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
474 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
475 } else if (temp1 >= 0xB0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
476 sis_vbflags |= VB_301B;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
477 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301B;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
478 inSISIDXREG(SISPART4, 0x23, temp2);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
479 if (!(temp2 & 0x02))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
480 sis_vbflags |= VB_30xBDH;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
481 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
482 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
483 ("[SiS] Detected SiS301B%s video bridge (Revision 0x%x)\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
484 (temp2 & 0x02) ? "" : " (DH)", temp1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
485 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
486 } else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
487 sis_vbflags |= VB_301;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
488 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
489 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
490 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
491 ("[SiS] Detected SiS301 video bridge (Revision 0x%x)\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
492 temp1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
493 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
494 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
495
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
496 sis_sense_30x();
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
497
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
498 } else if (temp == 2) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
499
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
500 inSISIDXREG(SISPART4, 0x01, temp1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
501 temp1 &= 0xff;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
502 if (temp1 >= 0xE0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
503 sis_vbflags |= VB_302LV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
504 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
505 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
506 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
507 ("[SiS] Detected SiS302LV video bridge (ID 2; Revision 0x%x)\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
508 temp1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
509 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
510 } else if (temp1 >= 0xD0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
511 sis_vbflags |= VB_301LV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
512 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
513 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
514 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
515 ("[SiS] Detected SiS301LV video bridge (ID 2; Revision 0x%x)\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
516 temp1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
517 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
518 } else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
519 sis_vbflags |= VB_302B;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
520 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_302B;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
521 inSISIDXREG(SISPART4, 0x23, temp2);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
522 if (!(temp & 0x02))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
523 sis_vbflags |= VB_30xBDH;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
524 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
525 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
526 ("[SiS] Detected SiS302B%s video bridge (Revision 0x%x)\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
527 (temp2 & 0x02) ? "" : " (DH)", temp1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
528 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
529 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
530
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
531 sis_sense_30x();
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
532
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
533 } else if (temp == 3) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
534 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
535 printf("[SiS] Detected SiS303 video bridge - not supported\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
536 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
537 } else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
538 /* big scary mess of code to handle unknown or Chrontel LVDS */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
539 /* skipping it for now */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
540 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
541 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
542 ("[SiS] Detected Chrontel video bridge - not supported\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
543 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
544 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
545
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
546 /* this is probably not relevant to video overlay driver... */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
547 /* detects if brdige uses LCDA for low res text modes */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
548 if (sis_vga_engine == SIS_315_VGA) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
549 if (sis_vbflags & (VB_302B | VB_301LV | VB_302LV)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
550 inSISIDXREG(SISCR, 0x34, temp);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
551 if (temp <= 0x13) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
552 inSISIDXREG(SISCR, 0x38, temp);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
553 if ((temp & 0x03) == 0x03) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
554 //pSiS->SiS_Pr->SiS_UseLCDA = TRUE;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
555 sis_vbflags |= VB_USELCDA;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
556 } else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
557 inSISIDXREG(SISCR, 0x30, temp);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
558 if (temp & 0x20) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
559 inSISIDXREG(SISPART1, 0x13, temp);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
560 if (temp & 0x40) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
561 //pSiS->SiS_Pr->SiS_UseLCDA = TRUE;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
562 sis_vbflags |= VB_USELCDA;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
563 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
564 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
565 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
566 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
567 if (sis_vbflags & VB_USELCDA) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
568 /* printf("Bridge uses LCDA for low resolution and text modes\n"); */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
569 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
570 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
571 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
572
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
573
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
574 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
575
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
576
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
577 /* detect video bridge type and sense connected devices */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
578 void sis_init_video_bridge(void)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
579 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
580
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
581 sis_detect_video_bridge();
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
582
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
583 sis_detect_crt1();
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
584 //sis_detect_lcd();
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
585 sis_detect_tv();
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
586 sis_detect_crt2();
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
587
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
588 sis_detected_crt2_devices =
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
589 sis_vbflags & (CRT2_LCD | CRT2_TV | CRT2_VGA);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
590
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
591 // force crt2 type
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
592 if (sis_force_crt2_type == CRT2_DEFAULT) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
593 if (sis_vbflags & CRT2_VGA)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
594 sis_force_crt2_type = CRT2_VGA;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
595 else if (sis_vbflags & CRT2_LCD)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
596 sis_force_crt2_type = CRT2_LCD;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
597 else if (sis_vbflags & CRT2_TV)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
598 sis_force_crt2_type = CRT2_TV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
599 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
600
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
601 switch (sis_force_crt2_type) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
602 case CRT2_TV:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
603 sis_vbflags = sis_vbflags & ~(CRT2_LCD | CRT2_VGA);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
604 if (sis_vbflags & VB_VIDEOBRIDGE)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
605 sis_vbflags = sis_vbflags | CRT2_TV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
606 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
607 sis_vbflags = sis_vbflags & ~(CRT2_TV);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
608 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
609 case CRT2_LCD:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
610 sis_vbflags = sis_vbflags & ~(CRT2_TV | CRT2_VGA);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
611 if ((sis_vbflags & VB_VIDEOBRIDGE) /* XXX: && (pSiS->VBLCDFlags) */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
612 )
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
613 sis_vbflags = sis_vbflags | CRT2_LCD;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
614 else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
615 sis_vbflags = sis_vbflags & ~(CRT2_LCD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
616 if (sis_verbose > 0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
617 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
618 ("[SiS] Can't force CRT2 to LCD, no panel detected\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
619 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
620 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
621 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
622 case CRT2_VGA:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
623 if (sis_vbflags & VB_LVDS) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
624 if (sis_verbose > 0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
625 printf("[SiS] LVDS does not support secondary VGA\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
626 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
627 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
628 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
629 if (sis_vbflags & (VB_301LV | VB_302LV)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
630 if (sis_verbose > 0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
631 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
632 ("[SiS] SiS30xLV bridge does not support secondary VGA\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
633 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
634 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
635 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
636 sis_vbflags = sis_vbflags & ~(CRT2_TV | CRT2_LCD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
637 if (sis_vbflags & VB_VIDEOBRIDGE)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
638 sis_vbflags = sis_vbflags | CRT2_VGA;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
639 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
640 sis_vbflags = sis_vbflags & ~(CRT2_VGA);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
641 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
642 default:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
643 sis_vbflags &= ~(CRT2_TV | CRT2_LCD | CRT2_VGA);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
644 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
645
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
646 /* CRT2 gamma correction?? */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
647
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
648 /* other force modes: */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
649 /* have a 'force tv type' (svideo, composite, scart) option? */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
650 /* have a 'force crt1 type' (to turn it off, etc??) */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
651
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
652 /* TW: Check if CRT1 used (or needed; this eg. if no CRT2 detected) */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
653 if (sis_vbflags & VB_VIDEOBRIDGE) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
654
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
655 /* TW: No CRT2 output? Then we NEED CRT1!
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
656 * We also need CRT1 if depth = 8 and bridge=LVDS|630+301B
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
657 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
658 if ((!(sis_vbflags & (CRT2_VGA | CRT2_LCD | CRT2_TV))) || ( /*(pScrn->bitsPerPixel == 8) && */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
659 ((sis_vbflags & (VB_LVDS | VB_CHRONTEL)) || ((sis_vga_engine == SIS_300_VGA) && (sis_vbflags & VB_301B))))) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
660 sis_crt1_off = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
661 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
662 /* TW: No CRT2 output? Then we can't use hw overlay on CRT2 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
663 if (!(sis_vbflags & (CRT2_VGA | CRT2_LCD | CRT2_TV)))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
664 sis_overlay_on_crt1 = 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
665
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
666 } else { /* TW: no video bridge? */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
667
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
668 /* Then we NEED CRT1... */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
669 sis_crt1_off = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
670 /* ... and can't use CRT2 for overlay output */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
671 sis_overlay_on_crt1 = 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
672 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
673
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
674 /* tvstandard options ? */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
675
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
676 // determine using CRT1 or CRT2?
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
677 /* -> NO dualhead right now... */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
678 if (sis_vbflags & DISPTYPE_DISP2) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
679 if (sis_crt1_off) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
680 sis_vbflags |= VB_DISPMODE_SINGLE;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
681 /* TW: No CRT1? Then we use the video overlay on CRT2 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
682 sis_overlay_on_crt1 = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
683 } else /* TW: CRT1 and CRT2 - mirror or dual head ----- */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
684 sis_vbflags |= (VB_DISPMODE_MIRROR | DISPTYPE_CRT1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
685 } else { /* TW: CRT1 only ------------------------------- */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
686 sis_vbflags |= (VB_DISPMODE_SINGLE | DISPTYPE_CRT1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
687 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
688
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
689 if (sis_verbose > 0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
690 printf("[SiS] Using hardware overlay on CRT%d\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
691 sis_overlay_on_crt1 ? 1 : 2);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
692 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
693
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
694 }