1#define USE_DVICHIP
2#ifdef USE_DVICHIP
3#include "ddk750_help.h"
4#include "ddk750_reg.h"
5#include "ddk750_dvi.h"
6#include "ddk750_sii164.h"
7
8
9/* This global variable contains all the supported driver and its corresponding
10   function API. Please set the function pointer to NULL whenever the function
11   is not supported. */
12static dvi_ctrl_device_t g_dcftSupportedDviController[] =
13{
14#ifdef DVI_CTRL_SII164
15    {
16        .pfnInit = sii164InitChip,
17        .pfnGetVendorId = sii164GetVendorID,
18        .pfnGetDeviceId = sii164GetDeviceID,
19#ifdef SII164_FULL_FUNCTIONS
20        .pfnResetChip = sii164ResetChip,
21        .pfnGetChipString = sii164GetChipString,
22        .pfnSetPower = sii164SetPower,
23        .pfnEnableHotPlugDetection = sii164EnableHotPlugDetection,
24        .pfnIsConnected = sii164IsConnected,
25        .pfnCheckInterrupt = sii164CheckInterrupt,
26        .pfnClearInterrupt = sii164ClearInterrupt,
27#endif
28    },
29#endif
30};
31
32
33int dviInit(
34    unsigned char edgeSelect,
35    unsigned char busSelect,
36    unsigned char dualEdgeClkSelect,
37    unsigned char hsyncEnable,
38    unsigned char vsyncEnable,
39    unsigned char deskewEnable,
40    unsigned char deskewSetting,
41    unsigned char continuousSyncEnable,
42    unsigned char pllFilterEnable,
43    unsigned char pllFilterValue
44			)
45{
46	dvi_ctrl_device_t *pCurrentDviCtrl;
47	pCurrentDviCtrl = g_dcftSupportedDviController;
48	if(pCurrentDviCtrl->pfnInit != NULL)
49	{
50		return pCurrentDviCtrl->pfnInit(edgeSelect, busSelect, dualEdgeClkSelect, hsyncEnable,
51                              vsyncEnable, deskewEnable, deskewSetting, continuousSyncEnable,
52                              pllFilterEnable, pllFilterValue);
53	}
54	return -1;//error
55}
56
57
58/*
59 *  dviGetVendorID
60 *      This function gets the vendor ID of the DVI controller chip.
61 *
62 *  Output:
63 *      Vendor ID
64 */
65unsigned short dviGetVendorID(void)
66{
67    dvi_ctrl_device_t *pCurrentDviCtrl;
68
69    //pCurrentDviCtrl = getDviCtrl();
70    pCurrentDviCtrl = g_dcftSupportedDviController;
71    if (pCurrentDviCtrl != (dvi_ctrl_device_t *)0)
72        return pCurrentDviCtrl->pfnGetVendorId();
73
74    return 0x0000;
75}
76
77
78/*
79 *  dviGetDeviceID
80 *      This function gets the device ID of the DVI controller chip.
81 *
82 *  Output:
83 *      Device ID
84 */
85unsigned short dviGetDeviceID(void)
86{
87    dvi_ctrl_device_t *pCurrentDviCtrl;
88
89//    pCurrentDviCtrl = getDviCtrl();
90	pCurrentDviCtrl = g_dcftSupportedDviController;
91    if (pCurrentDviCtrl != (dvi_ctrl_device_t *)0)
92        return pCurrentDviCtrl->pfnGetDeviceId();
93
94    return 0x0000;
95}
96
97#endif
98
99
100