Subversion Repositories shark

Rev

Rev 54 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
54 pj 1
/*
2
 * btdacs.c:
3
 *
4
 * RAMDAC definition for Bt485
5
 *
6
 * NON-FUNCTIONAL
7
 */
8
 
9
#include <stdlib.h>
10
#include <stdio.h>
11
#include "libvga.h"
12
 
13
#include "timing.h"
14
#include "vgaregs.h"
15
#include "driver.h"             /* for __svgalib_driver_report */
16
#include "ramdac.h"
17
 
18
/*
19
 * RAMDAC definition for industry-standard AT&T20C498 DAC with 16-bit
20
 * pixel port, and compatibles.
21
 * Differently rated versions exist, such as 80, 110, 135 and 170 MHz.
22
 * This code assumes the DAC is actually connected with a 16-bit path.
23
 * (an example of a 498-compatible DAC being used with a 8-bit path
24
 * is the Hercules Stingray Pro/V with the IC Works ZoomDAC).
25
 */
26
 
27
#ifdef INCLUDE_BT485_DAC_TEST
28
static int bt485_probe(void)
29
{
30
    return 0;
31
}
32
#else
33
#define bt485_probe 0
34
#endif
35
 
36
#ifdef INCLUDE_BT485_DAC
37
static void bt485_init(void)
38
{
39
    if (__svgalib_driver_report)
81 giacomo 40
        cprintf("svgalib: Using BT485 DAC, 135 MHz rated.\n");
54 pj 41
}
42
 
43
static int bt485_map_clock(int bpp, int pixelclock)
44
{
45
    return pixelclock;
46
 
47
    if (bpp == 8 && pixelclock > 80000)
48
        /* Use 16-bit path, clock doubling at RAMDAC. */
49
        return pixelclock / 2;
50
    if (bpp == 16)
51
        return pixelclock;
52
    if (bpp == 32)
53
        return pixelclock * 2;
54
    return pixelclock;
55
}
56
 
57
static int bt485_map_horizontal_crtc(int bpp, int pixelclock, int htiming)
58
{
59
    return htiming
60
 
61
    /* Not sure. */
62
    if (bpp == 8 && pixelclock > 80000)
63
        /* Use 16-bit path, clock doubling at RAMDAC. */
64
        return htiming / 2;
65
    if (bpp == 32)
66
        return htiming * 2;
67
    return htiming;
68
}
69
 
70
static void bt485_initializestate(unsigned char *regs, int bpp, int colormode,
71
                                      int pixelclock)
72
{
73
    regs[0] = 0;
74
    if (colormode == CLUT8_8)
75
        regs[0] = 0x02;
76
    if (colormode == RGB16_555)
77
        regs[0] = 0x10;
78
    if (colormode == RGB16_565)
79
        regs[0] = 0x30;
80
    if (colormode == RGB32_888_B)
81
        regs[0] = 0x50;
82
}
83
 
84
static void 485_qualify_cardspecs(CardSpecs * cardspecs, int dacspeed)
85
{
86
    dacspeed = __svgalib_setDacSpeed(dacspeed, 135000);
87
    cardspecs->maxPixelClock4bpp = 0;
88
    cardspecs->maxPixelClock8bpp = dacspeed;
89
    cardspecs->maxPixelClock16bpp = dacspeed;
90
    cardspecs->maxPixelClock24bpp = 0;
91
    cardspecs->maxPixelClock32bpp = dacspeed ;
92
    cardspecs->mapClock = bt485_map_clock;
93
    cardspecs->mapHorizontalCrtc = att20c498_map_horizontal_crtc;
94
}
95
 
96
DacMethods __svgalib_BT485_methods =
97
{
98
    BT485,
99
    "BT485 DAC",
100
    0,
101
    bt485_probe,
102
    bt485_init,
103
    bt485_qualify_cardspecs,
104
    __svgalib_Sierra_32K_savestate,
105
    __svgalib_Sierra_32K_restorestate,
106
    bt485_initializestate,
107
    1                           /* State size. */
108
};
109
#endif