1 /*
2  * normal.c:
3  *
4  * RAMDAC definition for normal VGA DAC.
5  * Max dot clock is set at 80 MHz.
6  */
7 
8 #include <stdlib.h>
9 #include <stdio.h>
10 #include "libvga.h"
11 
12 #include "timing.h"
13 #include "vgaregs.h"
14 #include "driver.h"		/* for __svgalib_driver_report */
15 #include "ramdac.h"
16 
17 #ifdef INCLUDE_NORMAL_DAC_TEST
normal_dac_probe(void)18 static int normal_dac_probe(void)
19 {
20     return 1;
21 }
22 #else
23 #define normal_dac_probe 0
24 #endif
25 
26 #ifdef INCLUDE_NORMAL_DAC
normal_dac_init(void)27 static void normal_dac_init(void)
28 {
29     if (__svgalib_driver_report)
30 	printf("svgalib: Using Normal VGA RAMDAC.\n");
31 }
32 
normal_dac_map_clock(int bpp,int pixelclock)33 static int normal_dac_map_clock(int bpp, int pixelclock)
34 {
35     return pixelclock;
36 }
37 
normal_dac_map_horizontal_crtc(int bpp,int pixelclock,int htiming)38 static int normal_dac_map_horizontal_crtc(int bpp, int pixelclock, int htiming)
39 {
40     return htiming;
41 }
42 
normal_dac_savestate(unsigned char * regs)43 static void normal_dac_savestate(unsigned char *regs)
44 {
45 }
46 
normal_dac_restorestate(const unsigned char * regs)47 static void normal_dac_restorestate(const unsigned char *regs)
48 {
49 }
50 
normal_dac_initializestate(unsigned char * regs,int bpp,int colormode,int pixelclock)51 static void normal_dac_initializestate(unsigned char *regs, int bpp, int colormode,
52 				       int pixelclock)
53 {
54     /* Nothing to do. */
55 }
56 
normal_dac_qualify_cardspecs(CardSpecs * cardspecs,int dacspeed)57 static void normal_dac_qualify_cardspecs(CardSpecs * cardspecs, int dacspeed)
58 {
59     dacspeed = __svgalib_setDacSpeed(dacspeed, 80000);
60     cardspecs->maxPixelClock4bpp = dacspeed;
61     cardspecs->maxPixelClock8bpp = dacspeed;
62     cardspecs->maxPixelClock16bpp = 0;
63     cardspecs->maxPixelClock24bpp = 0;
64     cardspecs->maxPixelClock32bpp = 0;
65     cardspecs->mapClock = normal_dac_map_clock;
66     cardspecs->mapHorizontalCrtc = normal_dac_map_horizontal_crtc;
67 }
68 
69 DacMethods __svgalib_normal_dac_methods =
70 {
71     NORMAL_DAC,
72     "Normal VGA DAC",
73     0,
74     normal_dac_probe,
75     normal_dac_init,
76     normal_dac_qualify_cardspecs,
77     normal_dac_savestate,
78     normal_dac_restorestate,
79     normal_dac_initializestate,
80     0				/* State size. */
81 };
82 #endif
83