summaryrefslogtreecommitdiffstats
path: root/api/Integrant_ITD3020.c
blob: e1fcc0d31854383b1ca36dc84552a0aecc7ee9a3 (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
/**
 * @(#)Integrant_ITD3020_EXT.cpp
 *
 * ==========================================================
 * Version: 2.0
 * Date:    2008.07.02
 * ==========================================================
 *
 * ==========================================================
 * History:
 *
 * Date         Author      Description
 * ----------------------------------------------------------
 *
 * 2008.07.02   Tom Lin     added tuner version
 * ==========================================================
 *
 * Copyright 2005 Afatech, Inc. All rights reserved.
 *
 */


//#include <stdio.h> //for Linux
#include "type.h"
#include "error.h"
#include "user.h"
#include "register.h"
#include "standard.h"
#include "ITD30x0.h"
#include "Integrant_ITD3020_Script.h"


Demodulator* Integrant_ITD3020_EXT_demodulator;
Byte Integrant_ITD3020_EXT_chip;


Dword ITD3020_open (
	IN  Demodulator*	demodulator,
	IN  Byte			chip
) {
	Dword error = Error_NO_ERROR;
	Ganymede* ganymede;

	ganymede = (Ganymede*) demodulator;
	Integrant_ITD3020_EXT_demodulator = demodulator;
	Integrant_ITD3020_EXT_chip = chip;

	AGCMODE = 1;	/** If this value = 0, Internal AGC mode.  */
					/** If this value = 1, External AGC mode   */

	TUNER_IF = ganymede->tunerDescription->ifFrequency / 1000;
	TUNER_RF = 88000;
	TUNER_REFCLK = REF_CLK16_384M; 

	ITD30x0MP_Tuner_Init();

	return (error);
}


Dword ITD3020_close (
	IN  Demodulator*	demodulator,
	IN  Byte			chip
) {
    return (Error_NO_ERROR);
}


Dword ITD3020_set (
	IN  Demodulator*	demodulator,
	IN  Byte			chip,
	IN  Word			bandwidth,
	IN  Dword			frequency
) {
	Dword error = Error_NO_ERROR;
	Ganymede* ganymede;

	ganymede = (Ganymede*) demodulator;
	Integrant_ITD3020_EXT_demodulator = demodulator;
	Integrant_ITD3020_EXT_chip = chip;

	AGCMODE = 1;	/** If this value = 0, Internal AGC mode.  */
					/** If this value = 1, External AGC mode   */

	TUNER_IF = ganymede->tunerDescription->ifFrequency / 1000;
	TUNER_RF = frequency;
	TUNER_REFCLK = REF_CLK16_384M; 

	SetFreq(TUNER_RF);

	return (error);
}


TunerDescription tuner_ITD3020 = {
    ITD3020_open,
    ITD3020_close,
    ITD3020_set,
    ITD3020_scripts,
    ITD3020_scriptSets,
    ITD3020_ADDRESS,                /** tuner i2c address */
    1,                              /** length of tuner register address */
    850000,                         /** tuner if */
    True,                           /** spectrum inverse */
    0x24,                           /** tuner id */
};