summaryrefslogtreecommitdiff
path: root/src/gfx/gfx_rtns.h
blob: db60ac39c86cccf06065f7cd9e308339789e97ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_rtns.h,v 1.1 2002/12/10 15:12:25 alanh Exp $ */
/*
 * $Workfile: gfx_rtns.h $
 *
 * This header file defines the Durango routines and variables used
 * to access the memory mapped regions.
 *
 * NSC_LIC_ALTERNATIVE_PREAMBLE
 *
 * Revision 1.0
 *
 * National Semiconductor Alternative GPL-BSD License
 *
 * National Semiconductor Corporation licenses this software 
 * ("Software"):
 *
 *      Durango
 *
 * under one of the two following licenses, depending on how the 
 * Software is received by the Licensee.
 * 
 * If this Software is received as part of the Linux Framebuffer or
 * other GPL licensed software, then the GPL license designated 
 * NSC_LIC_GPL applies to this Software; in all other circumstances 
 * then the BSD-style license designated NSC_LIC_BSD shall apply.
 *
 * END_NSC_LIC_ALTERNATIVE_PREAMBLE */

/* NSC_LIC_BSD
 *
 * National Semiconductor Corporation Open Source License for Durango
 *
 * (BSD License with Export Notice)
 *
 * Copyright (c) 1999-2001
 * National Semiconductor Corporation.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without 
 * modification, are permitted provided that the following conditions 
 * are met: 
 *
 *   * Redistributions of source code must retain the above copyright 
 *     notice, this list of conditions and the following disclaimer. 
 *
 *   * Redistributions in binary form must reproduce the above 
 *     copyright notice, this list of conditions and the following 
 *     disclaimer in the documentation and/or other materials provided 
 *     with the distribution. 
 *
 *   * Neither the name of the National Semiconductor Corporation nor 
 *     the names of its contributors may be used to endorse or promote 
 *     products derived from this software without specific prior 
 *     written permission. 
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE,
 * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
 * OF SUCH DAMAGE.
 *
 * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 
 * YOUR JURISDICTION. It is licensee's responsibility to comply with 
 * any export regulations applicable in licensee's jurisdiction. Under 
 * CURRENT (2001) U.S. export regulations this software 
 * is eligible for export from the U.S. and can be downloaded by or 
 * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 
 * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 
 * Syria, Sudan, Afghanistan and any other country to which the U.S. 
 * has embargoed goods and services. 
 *
 * END_NSC_LIC_BSD */

/* NSC_LIC_GPL
 *
 * National Semiconductor Corporation Gnu General Public License for Durango
 *
 * (GPL License with Export Notice)
 *
 * Copyright (c) 1999-2001
 * National Semiconductor Corporation.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without 
 * modification, are permitted 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  
 *
 * In addition to the terms of the GNU General Public License, neither 
 * the name of the National Semiconductor Corporation nor the names of 
 * its contributors may be used to endorse or promote products derived 
 * from this software without specific prior written permission. 
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, 
 * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
 * OF SUCH DAMAGE. See the GNU General Public License for more details. 
 *
 * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 
 * YOUR JURISDICTION. It is licensee's responsibility to comply with 
 * any export regulations applicable in licensee's jurisdiction. Under 
 * CURRENT (2001) U.S. export regulations this software 
 * is eligible for export from the U.S. and can be downloaded by or 
 * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 
 * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 
 * Syria, Sudan, Afghanistan and any other country to which the U.S. 
 * has embargoed goods and services. 
 *
 * You should have received a copy of the GNU General Public License 
 * along with this file; if not, write to the Free Software Foundation, 
 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
 *
 * END_NSC_LIC_GPL */

#ifndef _gfx_rtns_h
#define _gfx_rtns_h

/* INCLUDE DURANGO DEFINITIONS */
/* These definitions are placed in another file to allow their inclusion      */
/* in a user application.  Such applications generally work through driver    */
/* shell routines that simply pass their parameters to Durango routines.      */
/* An external file provides an easy way to provide the definitions for these */
/* parameters without the applications gaining any Durango visisbility.       */

#include "gfx_type.h"

/* COMPILER OPTION FOR C++ PROGRAMS */

#ifdef __cplusplus
extern "C" {
#endif

/* DURANGO MEMORY POINTERS */

    extern unsigned char *gfx_virt_regptr;
    extern unsigned char *gfx_virt_fbptr;
    extern unsigned char *gfx_virt_vidptr;
    extern unsigned char *gfx_virt_vipptr;
    extern unsigned char *gfx_virt_spptr;
    extern unsigned char *gfx_virt_gpptr;

    extern unsigned char *gfx_phys_regptr;
    extern unsigned char *gfx_phys_fbptr;
    extern unsigned char *gfx_phys_vidptr;
    extern unsigned char *gfx_phys_vipptr;
    extern unsigned char *gfx_phys_spptr;
    extern unsigned char *gfx_phys_gpptr;

/* DURANGO VARIBLES FOR RUNTIME SELECTION AND POSSIBLE VALUES */

    extern int gfx_display_type;
#define GFX_DISPLAY_TYPE_GU1		0x0001
#define GFX_DISPLAY_TYPE_GU2		0x0002

    extern int gfx_init_type;
#define GFX_INIT_TYPE_GU1           0x0001
#define GFX_INIT_TYPE_GU2           0x0002

    extern int gfx_msr_type;
#define GFX_MSR_TYPE_REDCLOUD       0x0001

    extern int gfx_2daccel_type;
#define GFX_2DACCEL_TYPE_GU1		0x0001
#define GFX_2DACCEL_TYPE_GU2		0x0002

    extern int gfx_video_type;
#define GFX_VIDEO_TYPE_CS5530		0x0001
#define GFX_VIDEO_TYPE_SC1200		0x0002
#define GFX_VIDEO_TYPE_REDCLOUD     0x0004

    extern int gfx_vip_type;
#define GFX_VIP_TYPE_SC1200			0x0001

    extern int gfx_decoder_type;
#define GFX_DECODER_TYPE_SAA7114	0x0001

    extern int gfx_tv_type;
#define GFX_TV_TYPE_SC1200			0x0001
#define GFX_TV_TYPE_FS451			0x0002

    extern int gfx_i2c_type;
#define GFX_I2C_TYPE_ACCESS			0x0001
#define GFX_I2C_TYPE_GPIO			0x0002

/* GLOBAL CPU INFORMATION */

    extern unsigned long gfx_cpu_version;
    extern unsigned long gfx_cpu_frequency;
    extern unsigned long gfx_vid_version;
    extern ChipType gfx_chip_revision;

/* ROUTINES IN GFX_INIT.C */

    unsigned long gfx_pci_config_read(unsigned long address);
    void gfx_pci_config_write(unsigned long address, unsigned long data);
    unsigned long gfx_get_core_freq(void);
    unsigned long gfx_detect_cpu(void);
    unsigned long gfx_detect_video(void);
    unsigned long gfx_get_cpu_register_base(void);
    unsigned long gfx_get_graphics_register_base(void);
    unsigned long gfx_get_frame_buffer_base(void);
    unsigned long gfx_get_frame_buffer_size(void);
    unsigned long gfx_get_vid_register_base(void);
    unsigned long gfx_get_vip_register_base(void);

/* ROUTINES IN GFX_MSR.C */

    int gfx_msr_init(void);
    DEV_STATUS gfx_id_msr_device(MSR * pDev, unsigned long address);
    DEV_STATUS gfx_get_msr_dev_address(unsigned int device,
                                       unsigned long *address);
    DEV_STATUS gfx_get_glink_id_at_address(unsigned int *device,
                                           unsigned long address);
    DEV_STATUS gfx_msr_read(unsigned int device, unsigned int msrRegister,
                            Q_WORD * msrValue);
    DEV_STATUS gfx_msr_write(unsigned int device, unsigned int msrRegister,
                             Q_WORD * msrValue);

/* ROUTINES IN GFX_DISP.C */

    int gfx_set_display_bpp(unsigned short bpp);
    int gfx_is_display_mode_supported(int xres, int yres, int bpp, int hz);
    int gfx_set_display_mode(int xres, int yres, int bpp, int hz);
    int gfx_set_display_timings(unsigned short bpp, unsigned short flags,
                                unsigned short hactive,
                                unsigned short hblank_start,
                                unsigned short hsync_start,
                                unsigned short hsync_end,
                                unsigned short hblank_end,
                                unsigned short htotal, unsigned short vactive,
                                unsigned short vblank_start,
                                unsigned short vsync_start,
                                unsigned short vsync_end,
                                unsigned short vblank_end,
                                unsigned short vtotal, unsigned long frequency);
    int gfx_set_vtotal(unsigned short vtotal);
    void gfx_set_display_pitch(unsigned short pitch);
    void gfx_set_display_offset(unsigned long offset);
    int gfx_set_display_palette_entry(unsigned long index,
                                      unsigned long palette);
    int gfx_set_display_palette(unsigned long *palette);
    void gfx_video_shutdown(void);
    void gfx_set_clock_frequency(unsigned long frequency);
    int gfx_set_crt_enable(int enable);
    void gfx_set_cursor_enable(int enable);
    void gfx_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor);
    void gfx_set_cursor_position(unsigned long memoffset,
                                 unsigned short xpos, unsigned short ypos,
                                 unsigned short xhotspot,
                                 unsigned short yhotspot);
    void gfx_set_cursor_shape32(unsigned long memoffset,
                                unsigned long *andmask, unsigned long *xormask);
    void gfx_set_cursor_shape64(unsigned long memoffset,
                                unsigned long *andmask, unsigned long *xormask);
    void gfx_set_icon_enable(int enable);
    void gfx_set_icon_colors(unsigned long color0, unsigned long color1,
                             unsigned long color2);
    void gfx_set_icon_position(unsigned long memoffset, unsigned short xpos);
    void gfx_set_icon_shape64(unsigned long memoffset, unsigned long *andmask,
                              unsigned long *xormask, unsigned int lines);

    int gfx_set_compression_enable(int enable);
    int gfx_set_compression_offset(unsigned long offset);
    int gfx_set_compression_pitch(unsigned short pitch);
    int gfx_set_compression_size(unsigned short size);
    void gfx_set_display_priority_high(int enable);
    int gfx_test_timing_active(void);
    int gfx_test_vertical_active(void);
    int gfx_wait_vertical_blank(void);
    void gfx_delay_milliseconds(unsigned long milliseconds);
    void gfx_delay_microseconds(unsigned long microseconds);
    void gfx_enable_panning(int x, int y);
    int gfx_set_fixed_timings(int panelResX, int panelResY,
                              unsigned short width, unsigned short height,
                              unsigned short bpp);
    int gfx_set_panel_present(int panelResX, int panelResY,
                              unsigned short width, unsigned short height,
                              unsigned short bpp);
    void gfx_reset_timing_lock(void);

/* "READ" ROUTINES IN GFX_DISP.C */

    int gfx_get_display_details(unsigned int mode, int *xres, int *yres,
                                int *hz);
    unsigned short gfx_get_display_pitch(void);
    int gfx_get_vsa2_softvga_enable(void);
    int gfx_get_sync_polarities(void);
    unsigned long gfx_get_clock_frequency(void);
    unsigned long gfx_get_max_supported_pixel_clock(void);
    int gfx_mode_frequency_supported(int xres, int yres, int bpp,
                                     unsigned long frequency);
    int gfx_get_refreshrate_from_frequency(int xres, int yres, int bpp,
                                           int *hz, unsigned long frequency);
    int gfx_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz,
                                      unsigned long frequency);
    int gfx_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz,
                                           int *frequency);
    int gfx_get_display_mode_count(void);
    int gfx_get_display_mode(int *xres, int *yres, int *bpp, int *hz);
    unsigned long gfx_get_frame_buffer_line_size(void);
    unsigned short gfx_get_hactive(void);
    unsigned short gfx_get_hblank_start(void);
    unsigned short gfx_get_hsync_start(void);
    unsigned short gfx_get_hsync_end(void);
    unsigned short gfx_get_hblank_end(void);
    unsigned short gfx_get_htotal(void);
    unsigned short gfx_get_vactive(void);
    unsigned short gfx_get_vline(void);
    unsigned short gfx_get_vblank_start(void);
    unsigned short gfx_get_vsync_start(void);
    unsigned short gfx_get_vsync_end(void);
    unsigned short gfx_get_vblank_end(void);
    unsigned short gfx_get_vtotal(void);
    unsigned short gfx_get_display_bpp(void);
    unsigned long gfx_get_display_offset(void);
    int gfx_get_display_palette_entry(unsigned long index,
                                      unsigned long *palette);
    void gfx_get_display_palette(unsigned long *palette);
    unsigned long gfx_get_cursor_enable(void);
    unsigned long gfx_get_cursor_offset(void);
    unsigned long gfx_get_cursor_position(void);
    unsigned long gfx_get_cursor_clip(void);
    unsigned long gfx_get_cursor_color(int color);
    unsigned long gfx_get_icon_enable(void);
    unsigned long gfx_get_icon_offset(void);
    unsigned long gfx_get_icon_position(void);
    unsigned long gfx_get_icon_color(int color);
    int gfx_get_compression_enable(void);
    unsigned long gfx_get_compression_offset(void);
    unsigned short gfx_get_compression_pitch(void);
    unsigned short gfx_get_compression_size(void);
    int gfx_get_display_priority_high(void);
    int gfx_get_valid_bit(int line);

/* ROUTINES IN GFX_RNDR.C */

    void gfx_set_bpp(unsigned short bpp);
    void gfx_set_solid_pattern(unsigned long color);
    void gfx_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor,
                              unsigned long data0, unsigned long data1,
                              unsigned char transparency);
    void gfx_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor,
                               unsigned long data0, unsigned long data1,
                               unsigned long data2, unsigned long data3,
                               unsigned char transparency);
    void gfx_load_color_pattern_line(short y, unsigned long *pattern_8x8);
    void gfx_set_solid_source(unsigned long color);
    void gfx_set_mono_source(unsigned long bgcolor, unsigned long fgcolor,
                             unsigned short transparent);
    void gfx_set_pattern_flags(unsigned short flags);
    void gfx_set_raster_operation(unsigned char rop);
    void gfx_pattern_fill(unsigned short x, unsigned short y,
                          unsigned short width, unsigned short height);
    void gfx_color_pattern_fill(unsigned short x, unsigned short y,
                                unsigned short width, unsigned short height,
                                unsigned long *pattern);
    void gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy,
                                  unsigned short dstx, unsigned short dsty,
                                  unsigned short width, unsigned short height);
    void gfx_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy,
                                   unsigned short dstx, unsigned short dsty,
                                   unsigned short width, unsigned short height,
                                   unsigned long color);
    void gfx_color_bitmap_to_screen_blt(unsigned short srcx,
                                        unsigned short srcy,
                                        unsigned short dstx,
                                        unsigned short dsty,
                                        unsigned short width,
                                        unsigned short height,
                                        unsigned char *data, long pitch);
    void gfx_color_bitmap_to_screen_xblt(unsigned short srcx,
                                         unsigned short srcy,
                                         unsigned short dstx,
                                         unsigned short dsty,
                                         unsigned short width,
                                         unsigned short height,
                                         unsigned char *data, long pitch,
                                         unsigned long color);
    void gfx_mono_bitmap_to_screen_blt(unsigned short srcx,
                                       unsigned short srcy,
                                       unsigned short dstx,
                                       unsigned short dsty,
                                       unsigned short width,
                                       unsigned short height,
                                       unsigned char *data, short pitch);
    void gfx_text_blt(unsigned short dstx, unsigned short dsty,
                      unsigned short width, unsigned short height,
                      unsigned char *data);
    void gfx_bresenham_line(unsigned short x, unsigned short y,
                            unsigned short length, unsigned short initerr,
                            unsigned short axialerr, unsigned short diagerr,
                            unsigned short flags);
    void gfx_wait_until_idle(void);
    int gfx_test_blt_pending(void);

/* SECOND GENERATION RENDERING ROUTINES */

    void gfx2_set_source_stride(unsigned short stride);
    void gfx2_set_destination_stride(unsigned short stride);
    void gfx2_set_pattern_origin(int x, int y);
    void gfx2_set_source_transparency(unsigned long color, unsigned long mask);
    void gfx2_set_alpha_mode(int mode);
    void gfx2_set_alpha_value(unsigned char value);
    void gfx2_pattern_fill(unsigned long dstoffset, unsigned short width,
                           unsigned short height);
    void gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width,
                                 unsigned short height, unsigned long *pattern);
    void gfx2_screen_to_screen_blt(unsigned long srcoffset,
                                   unsigned long dstoffset,
                                   unsigned short width, unsigned short height,
                                   int flags);
    void gfx2_mono_expand_blt(unsigned long srcbase, unsigned short srcx,
                              unsigned short srcy, unsigned long dstoffset,
                              unsigned short width, unsigned short height,
                              int byte_packed);
    void gfx2_color_bitmap_to_screen_blt(unsigned short srcx,
                                         unsigned short srcy,
                                         unsigned long dstoffset,
                                         unsigned short width,
                                         unsigned short height,
                                         unsigned char *data, short pitch);
    void gfx2_mono_bitmap_to_screen_blt(unsigned short srcx,
                                        unsigned short srcy,
                                        unsigned long dstoffset,
                                        unsigned short width,
                                        unsigned short height,
                                        unsigned char *data, short pitch);
    void gfx2_text_blt(unsigned long dstoffset, unsigned short width,
                       unsigned short height, unsigned char *data);
    void gfx2_bresenham_line(unsigned long dstoffset, unsigned short length,
                             unsigned short initerr, unsigned short axialerr,
                             unsigned short diagerr, unsigned short flags);
    void gfx2_sync_to_vblank(void);

/* ROUTINES IN GFX_VID.C */

    int gfx_set_video_enable(int enable);
    int gfx_set_video_format(unsigned long format);
    int gfx_set_video_size(unsigned short width, unsigned short height);
    int gfx_set_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch);
    int gfx_set_video_offset(unsigned long offset);
    int gfx_set_video_yuv_offsets(unsigned long yoffset, unsigned long uoffset,
                                  unsigned long voffset);
    int gfx_set_video_window(short x, short y, unsigned short w,
                             unsigned short h);
    int gfx_set_video_left_crop(unsigned short x);
    int gfx_set_video_upscale(unsigned short srcw, unsigned short srch,
                              unsigned short dstw, unsigned short dsth);
    int gfx_set_video_scale(unsigned short srcw, unsigned short srch,
                            unsigned short dstw, unsigned short dsth);
    int gfx_set_video_vertical_downscale(unsigned short srch,
                                         unsigned short dsth);
    void gfx_set_video_vertical_downscale_enable(int enable);
    int gfx_set_video_downscale_config(unsigned short type, unsigned short m);
    int gfx_set_video_color_key(unsigned long key, unsigned long mask,
                                int bluescreen);
    int gfx_set_video_filter(int xfilter, int yfilter);
    int gfx_set_video_palette(unsigned long *palette);
    int gfx_set_video_palette_entry(unsigned long index, unsigned long color);
    int gfx_set_video_downscale_coefficients(unsigned short coef1,
                                             unsigned short coef2,
                                             unsigned short coef3,
                                             unsigned short coef4);
    int gfx_set_video_downscale_enable(int enable);
    int gfx_set_video_source(VideoSourceType source);
    int gfx_set_vbi_source(VbiSourceType source);
    int gfx_set_vbi_lines(unsigned long even, unsigned long odd);
    int gfx_set_vbi_total(unsigned long even, unsigned long odd);
    int gfx_set_video_interlaced(int enable);
    int gfx_set_color_space_YUV(int enable);
    int gfx_set_vertical_scaler_offset(char offset);
    int gfx_set_top_line_in_odd(int enable);
    int gfx_set_genlock_delay(unsigned long delay);
    int gfx_set_genlock_enable(int flags);
    int gfx_set_video_cursor(unsigned long key, unsigned long mask,
                             unsigned short select_color2,
                             unsigned long color1, unsigned long color2);
    int gfx_set_video_cursor_enable(int enable);
    int gfx_set_video_request(short x, short y);

    int gfx_select_alpha_region(int region);
    int gfx_set_alpha_enable(int enable);
    int gfx_set_alpha_window(short x, short y,
                             unsigned short width, unsigned short height);
    int gfx_set_alpha_value(unsigned char alpha, char delta);
    int gfx_set_alpha_priority(int priority);
    int gfx_set_alpha_color(unsigned long color);
    int gfx_set_alpha_color_enable(int enable);
    int gfx_set_no_ck_outside_alpha(int enable);
    int gfx_disable_softvga(void);
    int gfx_enable_softvga(void);
    int gfx_set_macrovision_enable(int enable);

/* READ ROUTINES IN GFX_VID.C */

    int gfx_get_video_enable(void);
    int gfx_get_video_format(void);
    unsigned long gfx_get_video_src_size(void);
    unsigned long gfx_get_video_line_size(void);
    unsigned long gfx_get_video_xclip(void);
    unsigned long gfx_get_video_offset(void);
    void gfx_get_video_yuv_offsets(unsigned long *yoffset,
                                   unsigned long *uoffset,
                                   unsigned long *voffset);
    void gfx_get_video_yuv_pitch(unsigned long *ypitch, unsigned long *uvpitch);
    unsigned long gfx_get_video_upscale(void);
    unsigned long gfx_get_video_scale(void);
    unsigned long gfx_get_video_downscale_delta(void);
    int gfx_get_video_vertical_downscale_enable(void);
    int gfx_get_video_downscale_config(unsigned short *type, unsigned short *m);
    void gfx_get_video_downscale_coefficients(unsigned short *coef1,
                                              unsigned short *coef2,
                                              unsigned short *coef3,
                                              unsigned short *coef4);
    void gfx_get_video_downscale_enable(int *enable);
    unsigned long gfx_get_video_dst_size(void);
    unsigned long gfx_get_video_position(void);
    unsigned long gfx_get_video_color_key(void);
    unsigned long gfx_get_video_color_key_mask(void);
    int gfx_get_video_palette_entry(unsigned long index,
                                    unsigned long *palette);
    int gfx_get_video_color_key_src(void);
    int gfx_get_video_filter(void);
    int gfx_get_video_request(short *x, short *y);
    int gfx_get_video_source(VideoSourceType * source);
    int gfx_get_vbi_source(VbiSourceType * source);
    unsigned long gfx_get_vbi_lines(int odd);
    unsigned long gfx_get_vbi_total(int odd);
    int gfx_get_video_interlaced(void);
    int gfx_get_color_space_YUV(void);
    int gfx_get_vertical_scaler_offset(char *offset);
    unsigned long gfx_get_genlock_delay(void);
    int gfx_get_genlock_enable(void);
    int gfx_get_video_cursor(unsigned long *key, unsigned long *mask,
                             unsigned short *select_color2,
                             unsigned long *color1, unsigned short *color2);
    unsigned long gfx_read_crc(void);
    unsigned long gfx_read_crc32(void);
    unsigned long gfx_read_window_crc(int source, unsigned short x,
                                      unsigned short y, unsigned short width,
                                      unsigned short height, int crc32);
    int gfx_get_macrovision_enable(void);

    void gfx_get_alpha_enable(int *enable);
    void gfx_get_alpha_size(unsigned short *x, unsigned short *y,
                            unsigned short *width, unsigned short *height);
    void gfx_get_alpha_value(unsigned char *alpha, char *delta);
    void gfx_get_alpha_priority(int *priority);
    void gfx_get_alpha_color(unsigned long *color);

/* ROUTINES IN GFX_VIP.C */

    int gfx_set_vip_enable(int enable);
    int gfx_set_vip_capture_run_mode(int mode);
    int gfx_set_vip_base(unsigned long even, unsigned long odd);
    int gfx_set_vip_pitch(unsigned long pitch);
    int gfx_set_vip_mode(int mode);
    int gfx_set_vbi_enable(int enable);
    int gfx_set_vbi_mode(int mode);
    int gfx_set_vbi_base(unsigned long even, unsigned long odd);
    int gfx_set_vbi_pitch(unsigned long pitch);
    int gfx_set_vbi_direct(unsigned long even_lines, unsigned long odd_lines);
    int gfx_set_vbi_interrupt(int enable);
    int gfx_set_vip_bus_request_threshold_high(int enable);
    int gfx_set_vip_last_line(int last_line);
    int gfx_test_vip_odd_field(void);
    int gfx_test_vip_bases_updated(void);
    int gfx_test_vip_fifo_overflow(void);
    int gfx_get_vip_line(void);

/* READ ROUTINES IN GFX_VIP.C */

    int gfx_get_vip_enable(void);
    unsigned long gfx_get_vip_base(int odd);
    unsigned long gfx_get_vip_pitch(void);
    int gfx_get_vip_mode(void);
    int gfx_get_vbi_enable(void);
    int gfx_get_vbi_mode(void);
    unsigned long gfx_get_vbi_base(int odd);
    unsigned long gfx_get_vbi_pitch(void);
    unsigned long gfx_get_vbi_direct(int odd);
    int gfx_get_vbi_interrupt(void);
    int gfx_get_vip_bus_request_threshold_high(void);

/* ROUTINES IN GFX_DCDR.C */

    int gfx_set_decoder_defaults(void);
    int gfx_set_decoder_analog_input(unsigned char input);
    int gfx_set_decoder_brightness(unsigned char brightness);
    int gfx_set_decoder_contrast(unsigned char contrast);
    int gfx_set_decoder_hue(char hue);
    int gfx_set_decoder_saturation(unsigned char saturation);
    int gfx_set_decoder_input_offset(unsigned short x, unsigned short y);
    int gfx_set_decoder_input_size(unsigned short width, unsigned short height);
    int gfx_set_decoder_output_size(unsigned short width,
                                    unsigned short height);
    int gfx_set_decoder_scale(unsigned short srcw, unsigned short srch,
                              unsigned short dstw, unsigned short dsth);
    int gfx_set_decoder_vbi_format(int start, int end, int format);
    int gfx_set_decoder_vbi_enable(int enable);
    int gfx_set_decoder_vbi_upscale(void);
    int gfx_set_decoder_TV_standard(TVStandardType TVStandard);
    int gfx_set_decoder_luminance_filter(unsigned char lufi);
    int gfx_decoder_software_reset(void);
    int gfx_decoder_detect_macrovision(void);
    int gfx_decoder_detect_video(void);

/* READ ROUTINES IN GFX_DCDR.C */

    unsigned char gfx_get_decoder_brightness(void);
    unsigned char gfx_get_decoder_contrast(void);
    char gfx_get_decoder_hue(void);
    unsigned char gfx_get_decoder_saturation(void);
    unsigned long gfx_get_decoder_input_offset(void);
    unsigned long gfx_get_decoder_input_size(void);
    unsigned long gfx_get_decoder_output_size(void);
    int gfx_get_decoder_vbi_format(int line);

/* ROUTINES IN GFX_I2C.C */

    int gfx_i2c_reset(unsigned char busnum, short adr, char freq);
    int gfx_i2c_write(unsigned char busnum, unsigned char chipadr,
                      unsigned char subadr, unsigned char bytes,
                      unsigned char *data);
    int gfx_i2c_read(unsigned char busnum, unsigned char chipadr,
                     unsigned char subadr, unsigned char bytes,
                     unsigned char *data);
    int gfx_i2c_select_gpio(int clock, int data);
    int gfx_i2c_init(void);
    void gfx_i2c_cleanup(void);

/* ROUTINES IN GFX_TV.C */

    int gfx_set_tv_format(TVStandardType format, GfxOnTVType resolution);
    int gfx_set_tv_output(int output);
    int gfx_set_tv_enable(int enable);
    int gfx_set_tv_flicker_filter(int ff);
    int gfx_set_tv_sub_carrier_reset(int screset);
    int gfx_set_tv_vphase(int vphase);
    int gfx_set_tv_YC_delay(int delay);
    int gfx_set_tvenc_reset_interval(int interval);
    int gfx_set_tv_cc_enable(int enable);
    int gfx_set_tv_cc_data(unsigned char data1, unsigned char data2);
    int gfx_set_tv_display(int width, int height);
    int gfx_test_tvout_odd_field(void);
    int gfx_test_tvenc_odd_field(void);
    int gfx_set_tv_field_status_invert(int enable);
    int gfx_get_tv_vphase(void);
    int gfx_get_tv_enable(unsigned int *p_on);
    int gfx_get_tv_output(void);
    int gfx_get_tv_mode_count(TVStandardType format);
    int gfx_get_tv_display_mode(int *width, int *height, int *bpp, int *hz);
    int gfx_get_tv_display_mode_frequency(unsigned short width,
                                          unsigned short height,
                                          TVStandardType format,
                                          int *frequency);
    int gfx_is_tv_display_mode_supported(unsigned short width,
                                         unsigned short height,
                                         TVStandardType format);

    int gfx_get_tv_standard(unsigned long *p_standard);
    int gfx_get_available_tv_standards(unsigned long *p_standards);
    int gfx_set_tv_standard(unsigned long standard);
    int gfx_get_tv_vga_mode(unsigned long *p_vga_mode);
    int gfx_get_available_tv_vga_modes(unsigned long *p_vga_modes);
    int gfx_set_tv_vga_mode(unsigned long vga_mode);
    int gfx_get_tvout_mode(unsigned long *p_tvout_mode);
    int gfx_set_tvout_mode(unsigned long tvout_mode);
    int gfx_get_sharpness(int *p_sharpness);
    int gfx_set_sharpness(int sharpness);
    int gfx_get_flicker_filter(int *p_flicker);
    int gfx_set_flicker_filter(int flicker);
    int gfx_get_overscan(int *p_x, int *p_y);
    int gfx_set_overscan(int x, int y);
    int gfx_get_position(int *p_x, int *p_y);
    int gfx_set_position(int x, int y);
    int gfx_get_color(int *p_color);
    int gfx_set_color(int color);
    int gfx_get_brightness(int *p_brightness);
    int gfx_set_brightness(int brightness);
    int gfx_get_contrast(int *p_contrast);
    int gfx_set_contrast(int constrast);
    int gfx_get_yc_filter(unsigned int *p_yc_filter);
    int gfx_set_yc_filter(unsigned int yc_filter);
    int gfx_get_aps_trigger_bits(unsigned int *p_trigger_bits);
    int gfx_set_aps_trigger_bits(unsigned int trigger_bits);

/* ROUTINES IN GFX_VGA.C */

    int gfx_get_softvga_active(void);
    int gfx_vga_test_pci(void);
    unsigned char gfx_vga_get_pci_command(void);
    int gfx_vga_set_pci_command(unsigned char command);
    int gfx_vga_seq_reset(int reset);
    int gfx_vga_set_graphics_bits(void);
    int gfx_vga_mode(gfx_vga_struct * vga, int xres, int yres, int bpp, int hz);
    int gfx_vga_pitch(gfx_vga_struct * vga, unsigned short pitch);
    int gfx_vga_save(gfx_vga_struct * vga, int flags);
    int gfx_vga_restore(gfx_vga_struct * vga, int flags);
    int gfx_vga_mode_switch(int active);
    void gfx_vga_clear_extended(void);

/* CLOSE BRACKET FOR C++ COMPLILATION */

#ifdef __cplusplus
}
#endif
#endif                          /* !_gfx_rtns_h */
/* END OF FILE */