File: back_null.c

package info (click to toggle)
nvtv 0.4.7-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,328 kB
  • ctags: 4,303
  • sloc: ansic: 30,302; sh: 6,614; makefile: 159
file content (296 lines) | stat: -rw-r--r-- 7,494 bytes parent folder | download | duplicates (5)
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
/* NVTV null backend -- Dirk Thierbach <dthierbach@gmx.de>
 *
 * This file is part of nvtv, a tool for tv-output on NVidia cards.
 * 
 * nvtv is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * nvtv 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
 *
 * $Id: back_null.c,v 1.27 2004/01/27 17:05:25 dthierbach Exp $
 *
 * Contents:
 *
 * Null backend for testing/debugging/calculating without hardware present.
 *
 */

#include "local.h" /* before everything else */

#include "backend.h"
#include "back_null.h"
#include "data.h"

static ChipInfo null_chip_nx = {
  name: "<Null Nvidia chip> (6:00)", type: TV_NVIDIA, 
  bus:6, addr:0x00, next: NULL
};
  
static ChipInfo null_chip_ph2 = {
  name: "<Null Philips-2 chip> (5:8a)", type: TV_PHILIPS_MODEL2, 
  bus:5, addr:0x8a, next: &null_chip_nx
};
  
static ChipInfo null_chip_ph1 = {
  name: "<Null Philips-1 chip> (4:8a)", type: TV_PHILIPS_MODEL1, 
  bus:4, addr:0x8a, next: &null_chip_ph2
};
  
static ChipInfo null_chip_ch2 = {
  name: "<Null Chrontel-2 chip> (3:ec)", type: TV_CHRONTEL_MODEL2, 
  bus:3, addr:0xec, next: &null_chip_ph1
};
  
static ChipInfo null_chip_ch1 = {
  name: "<Null Chrontel-1 chip> (2:ea)", type: TV_CHRONTEL_MODEL1, 
  bus:2, addr:0xea, next: &null_chip_ch2
};
  
static ChipInfo null_chip_cx = {
  name: "<Null Conexant chip> (1:8a)", type: TV_CONEXANT, 
  bus:1, addr:0x8a, next: &null_chip_ch1
};
  
static ChipInfo null_chip_bt = {
  name: "<Null Brooktree chip> (0:88)", type: TV_BROOKTREE, 
  bus:0, addr:0x88, next: &null_chip_cx
};

#define null_chips null_chip_bt
  
static CardInfo null_i810_card = {
  name: "<Null Intel card>", type: CARD_I810, 
  dev:NULL, reg_base:0x0, pci_id:0x7121,
  arch: "No Architecture", chips: &null_chips, next: NULL
};

static CardInfo null_tdfx_card = {
  name: "<Null Voodoo card>", type: CARD_TDFX, 
  dev:NULL, reg_base:0x0, pci_id:0x0005,
  arch: "No Architecture", chips: &null_chips, next: &null_i810_card
};

static CardInfo null_xbox_card = {
  name: "<Null XBox card>", type: CARD_XBOX, 
  dev:NULL, reg_base:0x0, pci_id:0x02A0,
  arch: "No Architecture", chips: &null_chips, next: &null_tdfx_card
};

static CardInfo null_nv_card = {
  name: "<Null NVidia card>", type: CARD_NVIDIA, 
  dev:NULL, reg_base:0x0, pci_id:0x0110,
  arch: "No Architecture", chips: &null_chips, next: &null_xbox_card
};

#define null_cards null_nv_card

static DataFunc *bnull_data = NULL;
static CardPtr bnull_card = NULL;

void bnull_openCard (CardPtr card)
{
  RAISE (MSG_DEBUG, "bnull_open");
  bnull_card = card;
  bnull_data = data_func (card->type, card->chips->type);
}

void bnull_closeCard (void)
{
  RAISE (MSG_DEBUG, "bnull_close");
}

#ifdef DEBUG_PROBE
void bnull_probeSystem (CardPtr card_list)
{
  RAISE (MSG_DEBUG, "bnull_probeSystem");
}

void bnull_probeCard (void)
{
  RAISE (MSG_DEBUG, "bnull_probeCard");
}

I2CChainPtr bnull_probeBus (void)
{
  RAISE (MSG_DEBUG, "bnull_probeBus");
  return NULL;
}
#endif

void bnull_setHeads (int main, int tv, int video)
{
  RAISE (MSG_DEBUG, "bnull_setHeads");
}

void bnull_getHeads (int *main, int *tv, int *video, int *max) 
{
  RAISE (MSG_DEBUG, "bnull_getHeads");
  if (max)   *max = 2;
}

void bnull_getHeadDev (int head, int *devFlags) 
{
  RAISE (MSG_DEBUG, "bnull_getHeadDev");
  if (devFlags) *devFlags = DEV_MONITOR;
}

void bnull_probeChips (void)
{
  RAISE (MSG_DEBUG, "bnull_probe");
  if (bnull_card) {
    bnull_data = data_func (bnull_card->type, bnull_card->chips->type);
  } else {
    bnull_data = &null_func;
  }
}

void bnull_setChip (ChipPtr chip, Bool init)
{
  RAISE (MSG_DEBUG, "bnull_setChip %s %i", chip->name, init);
  bnull_data = data_func (bnull_card->type, chip->type);
}

void bnull_setSettings (TVSettings *set)
{
  RAISE (MSG_DEBUG, "bnull_setSettings");
}

void bnull_getSettings (TVSettings *set)
{
  RAISE (MSG_DEBUG, "bnull_getSettings");
}

void bnull_setMode (TVRegs *r)
{
  RAISE (MSG_DEBUG, "bnull_setMode");
}

void bnull_getMode (TVRegs *r)
{
  RAISE (MSG_DEBUG, "bnull_getMode");
}

void bnull_setModeSettings (TVRegs *r, TVSettings *set)
{
  RAISE (MSG_DEBUG, "bnull_setModeSettings");
}

void bnull_setTestImage (TVEncoderRegs *tv, TVSettings *set)
{
  RAISE (MSG_DEBUG, "bnull_setTestImage");
}

long bnull_getStatus (int index)
{
  RAISE (MSG_DEBUG, "bnull_getStatus");
  return 0;
}

TVConnect bnull_getConnection (void)
{
  RAISE (MSG_DEBUG, "bnull_getConnection");
  return CONNECT_NONE;
}

int bnull_listModes (TVSystem system, TVMode *(list[]))
{
  return data_listModes (bnull_data->modes (), system, list);
}

Bool bnull_findBySize (TVSystem system, int xres, int yres, char *size, 
    TVMode *mode)
{
  TVMode *tvm;

  RAISE (MSG_DEBUG, "bnull_findBySize %i %i,%i %s", system, xres, yres, size);
  /* FIXME: All cards */
  tvm = data_find (bnull_data->modes (), system, xres, yres, size);
  if (!tvm) return FALSE;
  *mode = *tvm;
  return TRUE;
}

Bool bnull_findByOverscan (TVSystem system, int xres, int yres, 
    double hoc, double voc, TVMode *mode)
{
  RAISE (MSG_DEBUG, "bnull_findByOC %i %i,%i", system, xres, yres);
  return FALSE;
}

void bnull_initSharedView (int *view_x, int *view_y)
{
  *view_x = *view_y = 0;
}

Bool bnull_getTwinView (int *view_x, int *view_y)
{
  *view_x = *view_y = 0;
  return FALSE;
}

Bool bnull_adjustViewport (int flags, int *view_x, int *view_y)
{
  *view_x = *view_y = 0;
  return FALSE;
}

Bool bnull_serviceViewportCursor (int flags, int cursor_x, int cursor_y, 
  int *view_x, int *view_y)
{
  *view_x = *view_y = 0;
  return FALSE;
}

BackAccessRec bnull_access_func = {
  openCard:    bnull_openCard,
  closeCard:   bnull_closeCard,
#ifdef DEBUG_PROBE
  probeSystem: bnull_probeSystem,
#endif
};

BackCardRec bnull_card_func = {
  openCard:              bnull_openCard,
  closeCard:             bnull_closeCard,
#ifdef DEBUG_PROBE
  probeCard:             bnull_probeCard,
  probeBus:              bnull_probeBus,
#endif
  setHeads:              bnull_setHeads,
  getHeads:              bnull_getHeads,
  getHeadDev:            bnull_getHeadDev,
  probeChips:            bnull_probeChips,
  setChip:               bnull_setChip,
  setSettings:           bnull_setSettings,
  getSettings:           bnull_getSettings,
  setMode:               bnull_setMode,
  getMode:               bnull_getMode,
  setModeSettings:       bnull_setModeSettings,
  setTestImage:          bnull_setTestImage, 
  getStatus:             bnull_getStatus,    
  getConnection:         bnull_getConnection,
  listModes:		 bnull_listModes,
  findBySize:            bnull_findBySize, 
  findByOverscan:        bnull_findByOverscan,
  initSharedView:        bnull_initSharedView,
  getTwinView:           bnull_getTwinView,
  adjustViewport:        bnull_adjustViewport,
  serviceViewportCursor: bnull_serviceViewportCursor,
};

CardPtr back_null_init (void)
{
  back_access = &bnull_access_func;
  back_card   = &bnull_card_func;
  return &null_cards;
}