1/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_rtns.h,v 1.1 2002/12/10 15:12:25 alanh Exp $ */
2/*
3 * $Workfile: gfx_rtns.h $
4 *
5 * This header file defines the Durango routines and variables used
6 * to access the memory mapped regions.
7 *
8 * NSC_LIC_ALTERNATIVE_PREAMBLE
9 *
10 * Revision 1.0
11 *
12 * National Semiconductor Alternative GPL-BSD License
13 *
14 * National Semiconductor Corporation licenses this software
15 * ("Software"):
16 *
17 *      Durango
18 *
19 * under one of the two following licenses, depending on how the
20 * Software is received by the Licensee.
21 *
22 * If this Software is received as part of the Linux Framebuffer or
23 * other GPL licensed software, then the GPL license designated
24 * NSC_LIC_GPL applies to this Software; in all other circumstances
25 * then the BSD-style license designated NSC_LIC_BSD shall apply.
26 *
27 * END_NSC_LIC_ALTERNATIVE_PREAMBLE */
28
29/* NSC_LIC_BSD
30 *
31 * National Semiconductor Corporation Open Source License for Durango
32 *
33 * (BSD License with Export Notice)
34 *
35 * Copyright (c) 1999-2001
36 * National Semiconductor Corporation.
37 * All rights reserved.
38 *
39 * Redistribution and use in source and binary forms, with or without
40 * modification, are permitted provided that the following conditions
41 * are met:
42 *
43 *   * Redistributions of source code must retain the above copyright
44 *     notice, this list of conditions and the following disclaimer.
45 *
46 *   * Redistributions in binary form must reproduce the above
47 *     copyright notice, this list of conditions and the following
48 *     disclaimer in the documentation and/or other materials provided
49 *     with the distribution.
50 *
51 *   * Neither the name of the National Semiconductor Corporation nor
52 *     the names of its contributors may be used to endorse or promote
53 *     products derived from this software without specific prior
54 *     written permission.
55 *
56 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
57 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
58 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
59 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
60 * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY
61 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
62 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
63 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
64 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
65 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE,
66 * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY
67 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
68 * OF SUCH DAMAGE.
69 *
70 * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
71 * YOUR JURISDICTION. It is licensee's responsibility to comply with
72 * any export regulations applicable in licensee's jurisdiction. Under
73 * CURRENT (2001) U.S. export regulations this software
74 * is eligible for export from the U.S. and can be downloaded by or
75 * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed
76 * destinations which include Cuba, Iraq, Libya, North Korea, Iran,
77 * Syria, Sudan, Afghanistan and any other country to which the U.S.
78 * has embargoed goods and services.
79 *
80 * END_NSC_LIC_BSD */
81
82/* NSC_LIC_GPL
83 *
84 * National Semiconductor Corporation Gnu General Public License for Durango
85 *
86 * (GPL License with Export Notice)
87 *
88 * Copyright (c) 1999-2001
89 * National Semiconductor Corporation.
90 * All rights reserved.
91 *
92 * Redistribution and use in source and binary forms, with or without
93 * modification, are permitted under the terms of the GNU General
94 * Public License as published by the Free Software Foundation; either
95 * version 2 of the License, or (at your option) any later version
96 *
97 * In addition to the terms of the GNU General Public License, neither
98 * the name of the National Semiconductor Corporation nor the names of
99 * its contributors may be used to endorse or promote products derived
100 * from this software without specific prior written permission.
101 *
102 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
103 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
104 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
105 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
106 * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY
107 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
108 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
109 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
110 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
111 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE,
112 * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY
113 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
114 * OF SUCH DAMAGE. See the GNU General Public License for more details.
115 *
116 * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
117 * YOUR JURISDICTION. It is licensee's responsibility to comply with
118 * any export regulations applicable in licensee's jurisdiction. Under
119 * CURRENT (2001) U.S. export regulations this software
120 * is eligible for export from the U.S. and can be downloaded by or
121 * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed
122 * destinations which include Cuba, Iraq, Libya, North Korea, Iran,
123 * Syria, Sudan, Afghanistan and any other country to which the U.S.
124 * has embargoed goods and services.
125 *
126 * You should have received a copy of the GNU General Public License
127 * along with this file; if not, write to the Free Software Foundation,
128 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
129 *
130 * END_NSC_LIC_GPL */
131
132#ifndef _gfx_rtns_h
133#define _gfx_rtns_h
134
135/* INCLUDE DURANGO DEFINITIONS */
136/* These definitions are placed in another file to allow their inclusion      */
137/* in a user application.  Such applications generally work through driver    */
138/* shell routines that simply pass their parameters to Durango routines.      */
139/* An external file provides an easy way to provide the definitions for these */
140/* parameters without the applications gaining any Durango visisbility.       */
141
142#include "gfx_type.h"
143
144/* COMPILER OPTION FOR C++ PROGRAMS */
145
146#ifdef __cplusplus
147extern "C"
148{
149#endif
150
151/* DURANGO MEMORY POINTERS */
152
153   extern unsigned char *gfx_virt_regptr;
154   extern unsigned char *gfx_virt_fbptr;
155   extern unsigned char *gfx_virt_vidptr;
156   extern unsigned char *gfx_virt_vipptr;
157   extern unsigned char *gfx_virt_spptr;
158   extern unsigned char *gfx_virt_gpptr;
159
160   extern unsigned char *gfx_phys_regptr;
161   extern unsigned char *gfx_phys_fbptr;
162   extern unsigned char *gfx_phys_vidptr;
163   extern unsigned char *gfx_phys_vipptr;
164   extern unsigned char *gfx_phys_spptr;
165   extern unsigned char *gfx_phys_gpptr;
166
167/* DURANGO VARIBLES FOR RUNTIME SELECTION AND POSSIBLE VALUES */
168
169   extern int gfx_display_type;
170#define GFX_DISPLAY_TYPE_GU1		0x0001
171#define GFX_DISPLAY_TYPE_GU2		0x0002
172
173   extern int gfx_init_type;
174#define GFX_INIT_TYPE_GU1           0x0001
175#define GFX_INIT_TYPE_GU2           0x0002
176
177   extern int gfx_msr_type;
178#define GFX_MSR_TYPE_REDCLOUD       0x0001
179
180   extern int gfx_2daccel_type;
181#define GFX_2DACCEL_TYPE_GU1		0x0001
182#define GFX_2DACCEL_TYPE_GU2		0x0002
183
184   extern int gfx_video_type;
185#define GFX_VIDEO_TYPE_CS5530		0x0001
186#define GFX_VIDEO_TYPE_SC1200		0x0002
187#define GFX_VIDEO_TYPE_REDCLOUD     0x0004
188
189   extern int gfx_vip_type;
190#define GFX_VIP_TYPE_SC1200			0x0001
191
192   extern int gfx_decoder_type;
193#define GFX_DECODER_TYPE_SAA7114	0x0001
194
195   extern int gfx_tv_type;
196#define GFX_TV_TYPE_SC1200			0x0001
197#define GFX_TV_TYPE_FS451			0x0002
198
199   extern int gfx_i2c_type;
200#define GFX_I2C_TYPE_ACCESS			0x0001
201#define GFX_I2C_TYPE_GPIO			0x0002
202
203/* GLOBAL CPU INFORMATION */
204
205   extern unsigned long gfx_cpu_version;
206   extern unsigned long gfx_cpu_frequency;
207   extern unsigned long gfx_vid_version;
208   extern ChipType gfx_chip_revision;
209
210/* ROUTINES IN GFX_INIT.C */
211
212   unsigned long gfx_pci_config_read(unsigned long address);
213   void gfx_pci_config_write(unsigned long address, unsigned long data);
214   unsigned long gfx_get_core_freq(void);
215   unsigned long gfx_detect_cpu(void);
216   unsigned long gfx_detect_video(void);
217   unsigned long gfx_get_cpu_register_base(void);
218   unsigned long gfx_get_graphics_register_base(void);
219   unsigned long gfx_get_frame_buffer_base(void);
220   unsigned long gfx_get_frame_buffer_size(void);
221   unsigned long gfx_get_vid_register_base(void);
222   unsigned long gfx_get_vip_register_base(void);
223
224/* ROUTINES IN GFX_MSR.C */
225
226   int gfx_msr_init(void);
227   DEV_STATUS gfx_id_msr_device(MSR * pDev, unsigned long address);
228   DEV_STATUS gfx_get_msr_dev_address(unsigned int device,
229				      unsigned long *address);
230   DEV_STATUS gfx_get_glink_id_at_address(unsigned int *device,
231					  unsigned long address);
232   DEV_STATUS gfx_msr_read(unsigned int device, unsigned int msrRegister,
233			   Q_WORD * msrValue);
234   DEV_STATUS gfx_msr_write(unsigned int device, unsigned int msrRegister,
235			    Q_WORD * msrValue);
236
237/* ROUTINES IN GFX_DISP.C */
238
239   int gfx_set_display_bpp(unsigned short bpp);
240   int gfx_is_display_mode_supported(int xres, int yres, int bpp, int hz);
241   int gfx_set_display_mode(int xres, int yres, int bpp, int hz);
242   int gfx_set_display_timings(unsigned short bpp, unsigned short flags,
243			       unsigned short hactive,
244			       unsigned short hblank_start,
245			       unsigned short hsync_start,
246			       unsigned short hsync_end,
247			       unsigned short hblank_end,
248			       unsigned short htotal, unsigned short vactive,
249			       unsigned short vblank_start,
250			       unsigned short vsync_start,
251			       unsigned short vsync_end,
252			       unsigned short vblank_end,
253			       unsigned short vtotal,
254			       unsigned long frequency);
255   int gfx_set_vtotal(unsigned short vtotal);
256   void gfx_set_display_pitch(unsigned short pitch);
257   void gfx_set_display_offset(unsigned long offset);
258   int gfx_set_display_palette_entry(unsigned long index,
259				     unsigned long palette);
260   int gfx_set_display_palette(unsigned long *palette);
261   void gfx_video_shutdown(void);
262   void gfx_set_clock_frequency(unsigned long frequency);
263   int gfx_set_crt_enable(int enable);
264   void gfx_set_cursor_enable(int enable);
265   void gfx_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor);
266   void gfx_set_cursor_position(unsigned long memoffset,
267				unsigned short xpos, unsigned short ypos,
268				unsigned short xhotspot,
269				unsigned short yhotspot);
270   void gfx_set_cursor_shape32(unsigned long memoffset,
271			       unsigned long *andmask,
272			       unsigned long *xormask);
273   void gfx_set_cursor_shape64(unsigned long memoffset,
274			       unsigned long *andmask,
275			       unsigned long *xormask);
276   void gfx_set_icon_enable(int enable);
277   void gfx_set_icon_colors(unsigned long color0, unsigned long color1,
278			    unsigned long color2);
279   void gfx_set_icon_position(unsigned long memoffset, unsigned short xpos);
280   void gfx_set_icon_shape64(unsigned long memoffset, unsigned long *andmask,
281			     unsigned long *xormask, unsigned int lines);
282
283   int gfx_set_compression_enable(int enable);
284   int gfx_set_compression_offset(unsigned long offset);
285   int gfx_set_compression_pitch(unsigned short pitch);
286   int gfx_set_compression_size(unsigned short size);
287   void gfx_set_display_priority_high(int enable);
288   int gfx_test_timing_active(void);
289   int gfx_test_vertical_active(void);
290   int gfx_wait_vertical_blank(void);
291   void gfx_delay_milliseconds(unsigned long milliseconds);
292   void gfx_delay_microseconds(unsigned long microseconds);
293   void gfx_enable_panning(int x, int y);
294   int gfx_set_fixed_timings(int panelResX, int panelResY,
295			     unsigned short width, unsigned short height,
296			     unsigned short bpp);
297   int gfx_set_panel_present(int panelResX, int panelResY,
298			     unsigned short width, unsigned short height,
299			     unsigned short bpp);
300   void gfx_reset_timing_lock(void);
301
302/* "READ" ROUTINES IN GFX_DISP.C */
303
304   int gfx_get_display_details(unsigned int mode, int *xres, int *yres,
305			       int *hz);
306   unsigned short gfx_get_display_pitch(void);
307   int gfx_get_vsa2_softvga_enable(void);
308   int gfx_get_sync_polarities(void);
309   unsigned long gfx_get_clock_frequency(void);
310   unsigned long gfx_get_max_supported_pixel_clock(void);
311   int gfx_mode_frequency_supported(int xres, int yres, int bpp,
312				    unsigned long frequency);
313   int gfx_get_refreshrate_from_frequency(int xres, int yres, int bpp,
314					  int *hz, unsigned long frequency);
315   int gfx_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz,
316				     unsigned long frequency);
317   int gfx_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz,
318					  int *frequency);
319   int gfx_get_display_mode_count(void);
320   int gfx_get_display_mode(int *xres, int *yres, int *bpp, int *hz);
321   unsigned long gfx_get_frame_buffer_line_size(void);
322   unsigned short gfx_get_hactive(void);
323   unsigned short gfx_get_hblank_start(void);
324   unsigned short gfx_get_hsync_start(void);
325   unsigned short gfx_get_hsync_end(void);
326   unsigned short gfx_get_hblank_end(void);
327   unsigned short gfx_get_htotal(void);
328   unsigned short gfx_get_vactive(void);
329   unsigned short gfx_get_vline(void);
330   unsigned short gfx_get_vblank_start(void);
331   unsigned short gfx_get_vsync_start(void);
332   unsigned short gfx_get_vsync_end(void);
333   unsigned short gfx_get_vblank_end(void);
334   unsigned short gfx_get_vtotal(void);
335   unsigned short gfx_get_display_bpp(void);
336   unsigned long gfx_get_display_offset(void);
337   int gfx_get_display_palette_entry(unsigned long index,
338				     unsigned long *palette);
339   void gfx_get_display_palette(unsigned long *palette);
340   unsigned long gfx_get_cursor_enable(void);
341   unsigned long gfx_get_cursor_offset(void);
342   unsigned long gfx_get_cursor_position(void);
343   unsigned long gfx_get_cursor_clip(void);
344   unsigned long gfx_get_cursor_color(int color);
345   unsigned long gfx_get_icon_enable(void);
346   unsigned long gfx_get_icon_offset(void);
347   unsigned long gfx_get_icon_position(void);
348   unsigned long gfx_get_icon_color(int color);
349   int gfx_get_compression_enable(void);
350   unsigned long gfx_get_compression_offset(void);
351   unsigned short gfx_get_compression_pitch(void);
352   unsigned short gfx_get_compression_size(void);
353   int gfx_get_display_priority_high(void);
354   int gfx_get_valid_bit(int line);
355
356/* ROUTINES IN GFX_RNDR.C */
357
358   void gfx_set_bpp(unsigned short bpp);
359   void gfx_set_solid_pattern(unsigned long color);
360   void gfx_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor,
361			     unsigned long data0, unsigned long data1,
362			     unsigned char transparency);
363   void gfx_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor,
364			      unsigned long data0, unsigned long data1,
365			      unsigned long data2, unsigned long data3,
366			      unsigned char transparency);
367   void gfx_load_color_pattern_line(short y, unsigned long *pattern_8x8);
368   void gfx_set_solid_source(unsigned long color);
369   void gfx_set_mono_source(unsigned long bgcolor, unsigned long fgcolor,
370			    unsigned short transparent);
371   void gfx_set_pattern_flags(unsigned short flags);
372   void gfx_set_raster_operation(unsigned char rop);
373   void gfx_pattern_fill(unsigned short x, unsigned short y,
374			 unsigned short width, unsigned short height);
375   void gfx_color_pattern_fill(unsigned short x, unsigned short y,
376			       unsigned short width, unsigned short height,
377			       unsigned long *pattern);
378   void gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy,
379				 unsigned short dstx, unsigned short dsty,
380				 unsigned short width, unsigned short height);
381   void gfx_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy,
382				  unsigned short dstx, unsigned short dsty,
383				  unsigned short width, unsigned short height,
384				  unsigned long color);
385   void gfx_color_bitmap_to_screen_blt(unsigned short srcx,
386				       unsigned short srcy,
387				       unsigned short dstx,
388				       unsigned short dsty,
389				       unsigned short width,
390				       unsigned short height,
391				       unsigned char *data, long pitch);
392   void gfx_color_bitmap_to_screen_xblt(unsigned short srcx,
393					unsigned short srcy,
394					unsigned short dstx,
395					unsigned short dsty,
396					unsigned short width,
397					unsigned short height,
398					unsigned char *data, long pitch,
399					unsigned long color);
400   void gfx_mono_bitmap_to_screen_blt(unsigned short srcx,
401				      unsigned short srcy,
402				      unsigned short dstx,
403				      unsigned short dsty,
404				      unsigned short width,
405				      unsigned short height,
406				      unsigned char *data, short pitch);
407   void gfx_text_blt(unsigned short dstx, unsigned short dsty,
408		     unsigned short width, unsigned short height,
409		     unsigned char *data);
410   void gfx_bresenham_line(unsigned short x, unsigned short y,
411			   unsigned short length, unsigned short initerr,
412			   unsigned short axialerr, unsigned short diagerr,
413			   unsigned short flags);
414   void gfx_wait_until_idle(void);
415   int gfx_test_blt_pending(void);
416
417/* SECOND GENERATION RENDERING ROUTINES */
418
419   void gfx2_set_source_stride(unsigned short stride);
420   void gfx2_set_destination_stride(unsigned short stride);
421   void gfx2_set_pattern_origin(int x, int y);
422   void gfx2_set_source_transparency(unsigned long color, unsigned long mask);
423   void gfx2_set_alpha_mode(int mode);
424   void gfx2_set_alpha_value(unsigned char value);
425   void gfx2_pattern_fill(unsigned long dstoffset, unsigned short width,
426			  unsigned short height);
427   void gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width,
428				unsigned short height,
429				unsigned long *pattern);
430   void gfx2_screen_to_screen_blt(unsigned long srcoffset,
431				  unsigned long dstoffset,
432				  unsigned short width, unsigned short height,
433				  int flags);
434   void gfx2_mono_expand_blt(unsigned long srcbase, unsigned short srcx,
435			     unsigned short srcy, unsigned long dstoffset,
436			     unsigned short width, unsigned short height,
437			     int byte_packed);
438   void gfx2_color_bitmap_to_screen_blt(unsigned short srcx,
439					unsigned short srcy,
440					unsigned long dstoffset,
441					unsigned short width,
442					unsigned short height,
443					unsigned char *data, short pitch);
444   void gfx2_mono_bitmap_to_screen_blt(unsigned short srcx,
445				       unsigned short srcy,
446				       unsigned long dstoffset,
447				       unsigned short width,
448				       unsigned short height,
449				       unsigned char *data, short pitch);
450   void gfx2_text_blt(unsigned long dstoffset, unsigned short width,
451		      unsigned short height, unsigned char *data);
452   void gfx2_bresenham_line(unsigned long dstoffset, unsigned short length,
453			    unsigned short initerr, unsigned short axialerr,
454			    unsigned short diagerr, unsigned short flags);
455   void gfx2_sync_to_vblank(void);
456
457/* ROUTINES IN GFX_VID.C */
458
459   int gfx_set_video_enable(int enable);
460   int gfx_set_video_format(unsigned long format);
461   int gfx_set_video_size(unsigned short width, unsigned short height);
462   int gfx_set_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch);
463   int gfx_set_video_offset(unsigned long offset);
464   int gfx_set_video_yuv_offsets(unsigned long yoffset, unsigned long uoffset,
465				 unsigned long voffset);
466   int gfx_set_video_window(short x, short y, unsigned short w,
467			    unsigned short h);
468   int gfx_set_video_left_crop(unsigned short x);
469   int gfx_set_video_upscale(unsigned short srcw, unsigned short srch,
470			     unsigned short dstw, unsigned short dsth);
471   int gfx_set_video_scale(unsigned short srcw, unsigned short srch,
472			   unsigned short dstw, unsigned short dsth);
473   int gfx_set_video_vertical_downscale(unsigned short srch,
474					unsigned short dsth);
475   void gfx_set_video_vertical_downscale_enable(int enable);
476   int gfx_set_video_downscale_config(unsigned short type, unsigned short m);
477   int gfx_set_video_color_key(unsigned long key, unsigned long mask,
478			       int bluescreen);
479   int gfx_set_video_filter(int xfilter, int yfilter);
480   int gfx_set_video_palette(unsigned long *palette);
481   int gfx_set_video_palette_entry(unsigned long index, unsigned long color);
482   int gfx_set_video_downscale_coefficients(unsigned short coef1,
483					    unsigned short coef2,
484					    unsigned short coef3,
485					    unsigned short coef4);
486   int gfx_set_video_downscale_enable(int enable);
487   int gfx_set_video_source(VideoSourceType source);
488   int gfx_set_vbi_source(VbiSourceType source);
489   int gfx_set_vbi_lines(unsigned long even, unsigned long odd);
490   int gfx_set_vbi_total(unsigned long even, unsigned long odd);
491   int gfx_set_video_interlaced(int enable);
492   int gfx_set_color_space_YUV(int enable);
493   int gfx_set_vertical_scaler_offset(char offset);
494   int gfx_set_top_line_in_odd(int enable);
495   int gfx_set_genlock_delay(unsigned long delay);
496   int gfx_set_genlock_enable(int flags);
497   int gfx_set_video_cursor(unsigned long key, unsigned long mask,
498			    unsigned short select_color2,
499			    unsigned long color1, unsigned long color2);
500   int gfx_set_video_cursor_enable(int enable);
501   int gfx_set_video_request(short x, short y);
502
503   int gfx_select_alpha_region(int region);
504   int gfx_set_alpha_enable(int enable);
505   int gfx_set_alpha_window(short x, short y,
506			    unsigned short width, unsigned short height);
507   int gfx_set_alpha_value(unsigned char alpha, char delta);
508   int gfx_set_alpha_priority(int priority);
509   int gfx_set_alpha_color(unsigned long color);
510   int gfx_set_alpha_color_enable(int enable);
511   int gfx_set_no_ck_outside_alpha(int enable);
512   int gfx_disable_softvga(void);
513   int gfx_enable_softvga(void);
514   int gfx_set_macrovision_enable(int enable);
515
516/* READ ROUTINES IN GFX_VID.C */
517
518   int gfx_get_video_enable(void);
519   int gfx_get_video_format(void);
520   unsigned long gfx_get_video_src_size(void);
521   unsigned long gfx_get_video_line_size(void);
522   unsigned long gfx_get_video_xclip(void);
523   unsigned long gfx_get_video_offset(void);
524   void gfx_get_video_yuv_offsets(unsigned long *yoffset,
525				  unsigned long *uoffset,
526				  unsigned long *voffset);
527   void gfx_get_video_yuv_pitch(unsigned long *ypitch,
528				unsigned long *uvpitch);
529   unsigned long gfx_get_video_upscale(void);
530   unsigned long gfx_get_video_scale(void);
531   unsigned long gfx_get_video_downscale_delta(void);
532   int gfx_get_video_vertical_downscale_enable(void);
533   int gfx_get_video_downscale_config(unsigned short *type,
534				      unsigned short *m);
535   void gfx_get_video_downscale_coefficients(unsigned short *coef1,
536					     unsigned short *coef2,
537					     unsigned short *coef3,
538					     unsigned short *coef4);
539   void gfx_get_video_downscale_enable(int *enable);
540   unsigned long gfx_get_video_dst_size(void);
541   unsigned long gfx_get_video_position(void);
542   unsigned long gfx_get_video_color_key(void);
543   unsigned long gfx_get_video_color_key_mask(void);
544   int gfx_get_video_palette_entry(unsigned long index,
545				   unsigned long *palette);
546   int gfx_get_video_color_key_src(void);
547   int gfx_get_video_filter(void);
548   int gfx_get_video_request(short *x, short *y);
549   int gfx_get_video_source(VideoSourceType * source);
550   int gfx_get_vbi_source(VbiSourceType * source);
551   unsigned long gfx_get_vbi_lines(int odd);
552   unsigned long gfx_get_vbi_total(int odd);
553   int gfx_get_video_interlaced(void);
554   int gfx_get_color_space_YUV(void);
555   int gfx_get_vertical_scaler_offset(char *offset);
556   unsigned long gfx_get_genlock_delay(void);
557   int gfx_get_genlock_enable(void);
558   int gfx_get_video_cursor(unsigned long *key, unsigned long *mask,
559			    unsigned short *select_color2,
560			    unsigned long *color1, unsigned short *color2);
561   unsigned long gfx_read_crc(void);
562   unsigned long gfx_read_crc32(void);
563   unsigned long gfx_read_window_crc(int source, unsigned short x,
564				     unsigned short y, unsigned short width,
565				     unsigned short height, int crc32);
566   int gfx_get_macrovision_enable(void);
567
568   void gfx_get_alpha_enable(int *enable);
569   void gfx_get_alpha_size(unsigned short *x, unsigned short *y,
570			   unsigned short *width, unsigned short *height);
571   void gfx_get_alpha_value(unsigned char *alpha, char *delta);
572   void gfx_get_alpha_priority(int *priority);
573   void gfx_get_alpha_color(unsigned long *color);
574
575/* ROUTINES IN GFX_VIP.C */
576
577   int gfx_set_vip_enable(int enable);
578   int gfx_set_vip_capture_run_mode(int mode);
579   int gfx_set_vip_base(unsigned long even, unsigned long odd);
580   int gfx_set_vip_pitch(unsigned long pitch);
581   int gfx_set_vip_mode(int mode);
582   int gfx_set_vbi_enable(int enable);
583   int gfx_set_vbi_mode(int mode);
584   int gfx_set_vbi_base(unsigned long even, unsigned long odd);
585   int gfx_set_vbi_pitch(unsigned long pitch);
586   int gfx_set_vbi_direct(unsigned long even_lines, unsigned long odd_lines);
587   int gfx_set_vbi_interrupt(int enable);
588   int gfx_set_vip_bus_request_threshold_high(int enable);
589   int gfx_set_vip_last_line(int last_line);
590   int gfx_test_vip_odd_field(void);
591   int gfx_test_vip_bases_updated(void);
592   int gfx_test_vip_fifo_overflow(void);
593   int gfx_get_vip_line(void);
594
595/* READ ROUTINES IN GFX_VIP.C */
596
597   int gfx_get_vip_enable(void);
598   unsigned long gfx_get_vip_base(int odd);
599   unsigned long gfx_get_vip_pitch(void);
600   int gfx_get_vip_mode(void);
601   int gfx_get_vbi_enable(void);
602   int gfx_get_vbi_mode(void);
603   unsigned long gfx_get_vbi_base(int odd);
604   unsigned long gfx_get_vbi_pitch(void);
605   unsigned long gfx_get_vbi_direct(int odd);
606   int gfx_get_vbi_interrupt(void);
607   int gfx_get_vip_bus_request_threshold_high(void);
608
609/* ROUTINES IN GFX_DCDR.C */
610
611   int gfx_set_decoder_defaults(void);
612   int gfx_set_decoder_analog_input(unsigned char input);
613   int gfx_set_decoder_brightness(unsigned char brightness);
614   int gfx_set_decoder_contrast(unsigned char contrast);
615   int gfx_set_decoder_hue(char hue);
616   int gfx_set_decoder_saturation(unsigned char saturation);
617   int gfx_set_decoder_input_offset(unsigned short x, unsigned short y);
618   int gfx_set_decoder_input_size(unsigned short width,
619				  unsigned short height);
620   int gfx_set_decoder_output_size(unsigned short width,
621				   unsigned short height);
622   int gfx_set_decoder_scale(unsigned short srcw, unsigned short srch,
623			     unsigned short dstw, unsigned short dsth);
624   int gfx_set_decoder_vbi_format(int start, int end, int format);
625   int gfx_set_decoder_vbi_enable(int enable);
626   int gfx_set_decoder_vbi_upscale(void);
627   int gfx_set_decoder_TV_standard(TVStandardType TVStandard);
628   int gfx_set_decoder_luminance_filter(unsigned char lufi);
629   int gfx_decoder_software_reset(void);
630   int gfx_decoder_detect_macrovision(void);
631   int gfx_decoder_detect_video(void);
632
633/* READ ROUTINES IN GFX_DCDR.C */
634
635   unsigned char gfx_get_decoder_brightness(void);
636   unsigned char gfx_get_decoder_contrast(void);
637   char gfx_get_decoder_hue(void);
638   unsigned char gfx_get_decoder_saturation(void);
639   unsigned long gfx_get_decoder_input_offset(void);
640   unsigned long gfx_get_decoder_input_size(void);
641   unsigned long gfx_get_decoder_output_size(void);
642   int gfx_get_decoder_vbi_format(int line);
643
644/* ROUTINES IN GFX_I2C.C */
645
646   int gfx_i2c_reset(unsigned char busnum, short adr, char freq);
647   int gfx_i2c_write(unsigned char busnum, unsigned char chipadr,
648		     unsigned char subadr, unsigned char bytes,
649		     unsigned char *data);
650   int gfx_i2c_read(unsigned char busnum, unsigned char chipadr,
651		    unsigned char subadr, unsigned char bytes,
652		    unsigned char *data);
653   int gfx_i2c_select_gpio(int clock, int data);
654   int gfx_i2c_init(void);
655   void gfx_i2c_cleanup(void);
656
657/* ROUTINES IN GFX_TV.C */
658
659   int gfx_set_tv_format(TVStandardType format, GfxOnTVType resolution);
660   int gfx_set_tv_output(int output);
661   int gfx_set_tv_enable(int enable);
662   int gfx_set_tv_flicker_filter(int ff);
663   int gfx_set_tv_sub_carrier_reset(int screset);
664   int gfx_set_tv_vphase(int vphase);
665   int gfx_set_tv_YC_delay(int delay);
666   int gfx_set_tvenc_reset_interval(int interval);
667   int gfx_set_tv_cc_enable(int enable);
668   int gfx_set_tv_cc_data(unsigned char data1, unsigned char data2);
669   int gfx_set_tv_display(int width, int height);
670   int gfx_test_tvout_odd_field(void);
671   int gfx_test_tvenc_odd_field(void);
672   int gfx_set_tv_field_status_invert(int enable);
673   int gfx_get_tv_vphase(void);
674   int gfx_get_tv_enable(unsigned int *p_on);
675   int gfx_get_tv_output(void);
676   int gfx_get_tv_mode_count(TVStandardType format);
677   int gfx_get_tv_display_mode(int *width, int *height, int *bpp, int *hz);
678   int gfx_get_tv_display_mode_frequency(unsigned short width,
679					 unsigned short height,
680					 TVStandardType format,
681					 int *frequency);
682   int gfx_is_tv_display_mode_supported(unsigned short width,
683					unsigned short height,
684					TVStandardType format);
685
686   int gfx_get_tv_standard(unsigned long *p_standard);
687   int gfx_get_available_tv_standards(unsigned long *p_standards);
688   int gfx_set_tv_standard(unsigned long standard);
689   int gfx_get_tv_vga_mode(unsigned long *p_vga_mode);
690   int gfx_get_available_tv_vga_modes(unsigned long *p_vga_modes);
691   int gfx_set_tv_vga_mode(unsigned long vga_mode);
692   int gfx_get_tvout_mode(unsigned long *p_tvout_mode);
693   int gfx_set_tvout_mode(unsigned long tvout_mode);
694   int gfx_get_sharpness(int *p_sharpness);
695   int gfx_set_sharpness(int sharpness);
696   int gfx_get_flicker_filter(int *p_flicker);
697   int gfx_set_flicker_filter(int flicker);
698   int gfx_get_overscan(int *p_x, int *p_y);
699   int gfx_set_overscan(int x, int y);
700   int gfx_get_position(int *p_x, int *p_y);
701   int gfx_set_position(int x, int y);
702   int gfx_get_color(int *p_color);
703   int gfx_set_color(int color);
704   int gfx_get_brightness(int *p_brightness);
705   int gfx_set_brightness(int brightness);
706   int gfx_get_contrast(int *p_contrast);
707   int gfx_set_contrast(int constrast);
708   int gfx_get_yc_filter(unsigned int *p_yc_filter);
709   int gfx_set_yc_filter(unsigned int yc_filter);
710   int gfx_get_aps_trigger_bits(unsigned int *p_trigger_bits);
711   int gfx_set_aps_trigger_bits(unsigned int trigger_bits);
712
713/* ROUTINES IN GFX_VGA.C */
714
715   int gfx_get_softvga_active(void);
716   int gfx_vga_test_pci(void);
717   unsigned char gfx_vga_get_pci_command(void);
718   int gfx_vga_set_pci_command(unsigned char command);
719   int gfx_vga_seq_reset(int reset);
720   int gfx_vga_set_graphics_bits(void);
721   int gfx_vga_mode(gfx_vga_struct * vga, int xres, int yres, int bpp,
722		    int hz);
723   int gfx_vga_pitch(gfx_vga_struct * vga, unsigned short pitch);
724   int gfx_vga_save(gfx_vga_struct * vga, int flags);
725   int gfx_vga_restore(gfx_vga_struct * vga, int flags);
726   int gfx_vga_mode_switch(int active);
727   void gfx_vga_clear_extended(void);
728
729/* CLOSE BRACKET FOR C++ COMPLILATION */
730
731#ifdef __cplusplus
732}
733#endif
734
735#endif					/* !_gfx_rtns_h */
736
737/* END OF FILE */
738
739