source: svn/trunk/zas_dstar/devices/Tuner/Oren_Cascade2B/Cas2BRoutines.h @ 2

Last change on this file since 2 was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
File size: 68.2 KB
Line 
1/*
2 * $Id: Cas2BRoutines.h,v 1.1 2011/07/08 03:43:59 megakiss Exp $
3 * $Revision: 1.1 $
4 * $DateTime: 2005/08/24 19:03:17 $
5 * $Change: 28028 $
6 * $Author: megakiss $
7 */
8
9#ifndef _CASCADE_2B_ROUTINES_H
10#define _CASCADE_2B_ROUTINES_H
11
12#include "Cas2BGeneralDefinitions.h"
13#include "TunerDTT7611.h"
14#include "TdquTuner.h"
15#include "TunerDTT7612.h"
16#include "ThomsonT2000Tuner.h"
17#include "TD6650TTuner.h"
18#include "DTT7600Tuner.h"
19#include "Mt2121Tuner.h"
20#include "TdquTuner.h"
21#include "SN761662Tuner.h"
22#include "VP13HRTuner.h"
23#include "TunerFQD1236.h"
24//-----------------------------------------------------------------------------------------------------------
25// Function name        : Cas2BChannelChange
26// Description      : Performs Channel change operation for the Cascade with all options for VSB,
27//                    QAM Annex B .
28// Return type          : unsigned int: 0 - If CC succeeded, a number greater than zero - if CC did not succeeded - when error in communication or the number
29//                    will indicate the error occured
30//                    cannot read expected mode after CC
31// Argument         : CAS_2B_CHANNEL_CHANGE_PARAMETERS stChannelChangeParameters : This struct holds the channel change specific
32//                                        parameters for a certain receiver. the struct parameters are:
33//                                       
34//                                        - TYPE_RECEIVER_MODE iReceiverMode: Describes to which receiver mode to change if needed.
35//                                        - TYPE_CARRIER_ACQUISITION iCarrierAcquisition: Describes the carrier acquisition - normal, wide.
36//                      this parameter has to be set only for the VSB and QAM Annex B  recievers
37//                                        - TYPE_INVERSE_SPECTRUM iInverseSpectrum: Describes if inverse spectrum is on or off
38//                      this parameter has to be set only for the VSB recievers
39//                                        - TYPE_NTSC_SIGNAL_DETECTION iNtscSignalDetection: Describes if the ntsc signal detection is vsb or ntsc
40//                                              this parameter has to be set only for the VSB and QAM Annex B  recievers                                                               
41//-----------------------------------------------------------------------------------------------------------
42unsigned int __stdcall Cas2BChannelChange(CAS_2B_CHANNEL_CHANGE_PARAMETERS stChannelChangeParameters );
43
44//-----------------------------------------------------------------------------------------------------------
45// Function name        : __stdcall SetChannel
46// Description      : This function sets the tuner PLL frequencyand sends channel change command to the cascade2B DSP right after the
47//                                        tuner freuency was set. This function can perform set tuner PLL frequencyand operation by passing the parameters
48//                                        usDelay = 0 and pstChannelChangeParameters = NULL
49// Return type          : unsigned int - 0 If CC succeeded, a number greater than zero - if CC did not succeeded.
50// Argument         : CAS_2B_TUNER_PARAMETERS stTunerParameters - this struct holds the parameters for the set tuner PLL frequencyand operation
51//                                        The struct fields are:       
52//                                        - TUNER_TYPE iTunerType - set the tuner type TUNER_DTT7611, TUNER_DTT7612, TUNER_THOMSON_T_2000, TUNER_XCEIVE_XC3028,TUNER_DTT760x,TUNER_MT2121 or TUNER_TDQU
53//                                        - TYPE_TUNER_SET_OPTION iTunerSet - Determines how to set the tuner PLL frequency
54//                                          by channel, by center frequency(Khz)  or by picture carrier(Khz).
55//                                        - unsigned long ulSetValue - holds the value to set according to iTunerSet channel, or center frequency(Khz)  or by picture carrier(Khz).
56//                                        - CHANNEL_TABLE_TYPE iChannelTableType - determines which channel table will be selected to get the tuner pll frequency from the channel number.
57//                                              this field in needed only when the iTunerSet = TUNER_SET_CHANNEL is selected (not valid for TUNER_THOMSON_T_2000).     
58//                                        - TYPE_TUNER_AGC_MODE iAgcMode - determines the agc mode can be digital or analog(not valid for TUNER_TDQU).
59//                                        - TYPE_TUNER_INPUT_SELECTION iInputSelection - determines the input selection terrestrial or cable (valid only for TUNER_THOMSON_T_2000).     
60//                                        - BOOLEAN bLoadFirmware - Determines if the tuner will be loaded with the firmware data before the frequency is set. The tuner can only be loaded after a code was loaded the
61//                                          Cascade device and a run flag was sent(valid only for TUNER_XCEIVE_XC3028).
62//                                        - TYPE_TUNER_FIRMAWARE_MODE iFirmwareMode - Determines which firmaware will be loaded to the tuner when bLoadFirmware == TRUE, can be analog or digital(valid only for TUNER_XCEIVE_XC3028).
63//                                        - BOOLEAN bIsFMTrapOn - Used in VP13HR tuner. Usualy TRUE when terrestrial mode and FALSE in Cables. 
64// Argument         : unsigned short usDelay -  this parameter is used determine the delay between the set tuner PLL frequency operation and the cascade2B DSP channel change command.
65//                                                                                              The delay value is multiplied by 10000 and than it is decremented in a loop each time by one until the value reaches to 0. The delay time
66//                                                                                              will be influenced by the processor speed.
67//                                                                                              Set the usDelay value to 0 when only a set tuner PLL frequency operation takes place.   
68// Argument         : CAS_2B_CHANNEL_CHANGE_PARAMETERS* pstChannelChangeParameters - this parameter is a pointer the a struct that holds all the parameters needed for a
69//                                        Cascade2B DSP channel change operation. Set the pstChannelChangeParameters value to NULL when only a set tuner PLL frequency operation takes place.
70//                                        The struct fields are:
71//                                        - TYPE_RECEIVER_MODE iReceiverMode: Describes to which receiver mode to change if needed.
72//                                        - TYPE_CARRIER_ACQUISITION iCarrierAcquisition: Describes the carrier acquisition - normal, wide.
73//                      this parameter has to be set only for the VSB and QAM Annex B  recievers
74//                                        - TYPE_INVERSE_SPECTRUM iInverseSpectrum: Describes if inverse spectrum is on or off
75//                      this parameter has to be set only for the VSB recievers
76//-----------------------------------------------------------------------------------------------------------
77unsigned int __stdcall SetChannel(CAS_2B_TUNER_PARAMETERS stTunerParameters,unsigned short usDelay,CAS_2B_CHANNEL_CHANGE_PARAMETERS* pstChannelChangeParameters);
78
79//-----------------------------------------------------------------------------------------------------------
80// Function name        : IsLocked
81// Description      : This function reads the cascade 2B device transmit register number 0 and
82//                    extracts the lock/unlock flag (bit 8) from it.
83// Return type          : LOCK_STATUS
84// Argument         : int * piError - retrieves  error description if failed
85//-----------------------------------------------------------------------------------------------------------
86LOCK_STATUS __stdcall IsLocked(int * piError);
87
88
89//-----------------------------------------------------------------------------------------------------------
90// Function name   : IsNtscChannelDetected
91// Description     : This function reads the cascade 2B device transmit register number 0 and
92//                    extracts the NTSC channel detection flag (bit 14) from it - only for VSB.
93// Return type     : BOOLEAN __stdcall TRUE NTSC channel is detected
94// Argument        : int * piError - retrieves  error description if failed
95//-----------------------------------------------------------------------------------------------------------
96BOOLEAN __stdcall IsNtscChannelDetected(int * piError);
97
98
99//-----------------------------------------------------------------------------------------------------------
100// Function name        : __stdcall GetMode
101// Description      : This function reads the cascade 2B device transmit register number 0 and
102//                    extracts the Transmitting Method field (bits 0-7) from it.
103// Return type          : unsigned char - the Transmitting Method number
104// Argument         : int * piError - retrieves  error description if failed
105//-----------------------------------------------------------------------------------------------------------
106unsigned char __stdcall GetMode(int * piError);
107
108
109//-----------------------------------------------------------------------------------------------------------
110// Function name        : __stdcall GetRfInverseSpectrum
111// Description      : This function reads the cascade 2B device transmit register number 0 and
112//                    extracts the inverse spectrum field (bit 15) from it.
113// Return type          : unsigned char 0 indicates no inverse RF spectrum 1 indicates inverse RF spectrum
114// Argument         : int * piError retrieves  error description if failed
115//-----------------------------------------------------------------------------------------------------------
116unsigned char __stdcall GetRfInverseSpectrum(int * piError);
117
118
119//-----------------------------------------------------------------------------------------------------------
120// Function name        : GetSymbolRateFrequencyOffset
121// Description      : This function reads the cascade 2B device transmit register number 3 and calculates the symbol rate frequency according to
122//                                        the formula:
123//                                        For VSB8tr - transmit 3 register value * 0.8211
124//                                        For ITUB 64 - transmit 3 register value * 0.77167     
125//                                        For ITUB 256 - transmit 3 register value * 0.81794   
126// Return type          : NUMERATOR_DENOMINATOR __stdcall returns the claculated value as a numerator/denominator value
127//                                        (see the claculation formula above)
128// Argument         : CAS_2B_TYPE_RECEIVER_MODE iReceiverMode can be CAS_2B_RECEIVER_MODE_VSB_8_TR, CAS_2B_RECEIVER_MODE_ITUB_64 or CAS_2B_RECEIVER_MODE_ITUB_256
129// Argument         : int * piError retrieves error description if failed
130//-----------------------------------------------------------------------------------------------------------
131NUMERATOR_DENOMINATOR __stdcall GetSymbolRateFrequencyOffset(CAS_2B_TYPE_RECEIVER_MODE iReceiverMode,int * piError);
132
133
134
135//-----------------------------------------------------------------------------------------------------------
136// Function name        : GetDiMode
137// Description      : This function reads the cascade 2B device transmit register number 0 and
138//                    extracts the di mode fields (bits 10-13) from it. This function is valid only for ITUB receiver mode
139// Return type          : TYPE_ITUB_DE_INTERLEAVER_MODE __stdcall an enum of the di modes
140// Argument         : int * piError retrieves error description if failed
141//-----------------------------------------------------------------------------------------------------------
142TYPE_ITUB_DE_INTERLEAVER_MODE __stdcall GetDiMode(int * piError);
143
144//-----------------------------------------------------------------------------------------------------------
145// Function name        : GetSnrAfterEqualization
146// Description      : This function returns the SNR value after equalization from the cascade device.
147// Return type          : unsigned short returns the snr value
148// Argument         : CAS_2B_TYPE_RECEIVER_MODE iReceiverMode can be CAS_2B_RECEIVER_MODE_VSB_8_TR or CAS_2B_RECEIVER_MODE_ITUB_64 or CAS_2B_RECEIVER_MODE_ITUB_256
149// Argument         : int * piError - retrieves  error description if failed
150//-----------------------------------------------------------------------------------------------------------
151unsigned short __stdcall GetSnrAfterEqualization(CAS_2B_TYPE_RECEIVER_MODE iReceiverMode,int * piError);
152
153//-----------------------------------------------------------------------------------------------------------
154// Function name        : GetPer
155// Description      : This function returns the packet error rate as a ratio value that is inserted in a struct
156//                                        NUMERATOR_DENOMINATOR where the numerator is the number of uncorrected RS packets and the denominator
157//                                        is the number of RS packets                   
158// Return type          : NUMERATOR_DENOMINATOR __stdcall
159// Argument         : CAS_2B_TYPE_RECEIVER_MODE iReceiverMode can be CAS_2B_RECEIVER_MODE_VSB_8_TR or CAS_2B_RECEIVER_MODE_ITUB_64 or CAS_2B_RECEIVER_MODE_ITUB_256
160// Argument         : int * piError - retrieves  error description if failed
161//-----------------------------------------------------------------------------------------------------------
162NUMERATOR_DENOMINATOR __stdcall GetPer(CAS_2B_TYPE_RECEIVER_MODE iReceiverMode,int * piError);
163
164//-----------------------------------------------------------------------------------------------------------
165// Function name        : GetBer
166// Description      : This function returns the BER values from the cascade device the BER calculation is
167//                                        BER = (BERCorrected + 4*7 BERFailed)/(7*122 * BERLimit) where:
168//                                        ERCorrected - 'Corrected' bits counter for BER calculation before RS.
169//                                        BERFailed - 'UnCorrected' RS packets.
170//                                        BERLimit = Total RS packets counter.
171//                                        This function is valid only for ITUB receiver mode
172// Return type          : NUMERATOR_DENOMINATOR __stdcall returns the calculated value as a numerator/denominator value
173//                                        (see the calculation formula above)
174// Argument         : int * piError - retrieves  error description if failed
175//-----------------------------------------------------------------------------------------------------------
176NUMERATOR_DENOMINATOR __stdcall GetBer(int * piError);
177
178//-----------------------------------------------------------------------------------------------------------
179// Function name        : Get1SecSer
180// Description      : This function returns the Segment Error Rate of the last 1 second.
181// Return type          : unsigned char the Segment Error Rate value of the last 1 second.
182// Argument         : int * piError - retrieves  error description if failed
183//-----------------------------------------------------------------------------------------------------------
184unsigned char Get1SecSer(int * piError);
185
186//-----------------------------------------------------------------------------------------------------------
187// Function name        : Get10SecSer
188// Description      : This function returns the Segment Error Rate of the last 10 second.
189// Return type          : unsigned char the Segment Error Rate value of the last 10 second.
190// Argument         : int * piError - retrieves  error description if failed
191//-----------------------------------------------------------------------------------------------------------
192unsigned char Get10SecSer(int * piError);
193
194//-----------------------------------------------------------------------------------------------------------
195// Function name        : __stdcall GetEqualizerFeedForwardTaps
196// Description      : This function returns the feed forward taps vector, the received vector length for
197//                                        VSB is 96(only real data), for ITUB is 96 (48 real 48 image).
198// Return type          : unsigned int - 0 if successful other value indicates an error occurred 
199// Argument         : unsigned short* pusaReceivedFfTaps - A pointer to a buffer that will hold the received data.
200//                                        The buffer memory must be allocated before calling this function
201//-----------------------------------------------------------------------------------------------------------
202unsigned int __stdcall GetEqualizerFeedForwardTaps(unsigned short* pusaReceivedFfTaps);
203
204//-----------------------------------------------------------------------------------------------------------
205// Function name        : __stdcall GetEqualizerFeedBackTaps
206// Description      : This function returns the feed back taps vector, the recieved vector length for
207//                                        VSB is 384(only real data), for ITUB is 96 (48 real 48 image).
208// Return type          : unsigned int - 0 if successful other value indicates an error occurred.
209// Argument         : CAS_2B_TYPE_RECEIVER_MODE iReceiverMode can be CAS_2B_RECEIVER_MODE_VSB_8_TR or CAS_2B_RECEIVER_MODE_ITUB_64 or CAS_2B_RECEIVER_MODE_ITUB_256
210// Argument         : unsigned short* pusaReceivedFbTaps - A pointer to a buffer that will hold the received data.
211//                                        The buffer memory must be allocated before calling this function.
212//-----------------------------------------------------------------------------------------------------------
213unsigned int __stdcall GetEqualizerFeedBackTaps(CAS_2B_TYPE_RECEIVER_MODE iReceiverMode,unsigned short* pusaReceivedFbTaps);
214
215
216//-----------------------------------------------------------------------------------------------------------
217// Function name        : __stdcall GetConstellationSamples
218// Description      : This function returns the constellation samples
219// Return type          : unsigned int - 0 if successful other value indicates an error occurred. 
220// Argument         : unsigned short usNumberOfConstellationSamples - this parameter will hold the pusaConstellationSamples buffer size and will determine how many
221//                                        samples will be retrieved from the chip. The maximum size can be 4096.
222// Argument         : unsigned short* pusaConstellationSamples - A pointer to a buffer that will hold the received data.
223//                                        The buffer memory must be allocated before calling this function.
224//-----------------------------------------------------------------------------------------------------------
225unsigned int __stdcall GetConstellationSamples(unsigned short usNumberOfConstellationSamples,unsigned short* pusaConstellationSamples);
226
227//-----------------------------------------------------------------------------------------------------------
228// Function name        : __stdcall SendVsbMessage
229// Description      : This function sends receive 1 commands for VSB receiver
230// Return type          : unsigned int - 0 if successful other value indicates an error occurred.   
231// Argument         : TYPE_VSB_CHANNEL_CONDITION iVsbChannelCondition -  can be VSB_CHANNEL_CONDITION_AUTO or VSB_CHANNEL_CONDITION_STATIC or VSB_CHANNEL_CONDITION_DYNAMIC
232//                                        or VSB_CHANNEL_CONDITION_FAST_DYNAMIC.
233// Argument         : TYPE_VSB_NTSC_REJECTION_FILTER iVsbNtscRegectionFilter - can be VSB_NTSC_REJECTION_FILTER_AUTO or VSB_NTSC_REJECTION_FILTER_OFF or VSB_NTSC_REJECTION_FILTER_ON.
234// Argument         : TYPE_MPEG_OUTPUT_MODE iMpegOutputMode - can be MPEG_SERIAL_OUTPUT_MODE_PARALLEL or MPEG_SERIAL_OUTPUT_MODE_SERIAL.
235// Argument         : TYPE_TUNER_PHASE_NOISE iTunerPhaseNoise - can be TUNER_PHASE_NOISE_NORMAL or TUNER_PHASE_NOISE_HIGH.
236//-----------------------------------------------------------------------------------------------------------
237unsigned int __stdcall SendVsbMessage(TYPE_VSB_CHANNEL_CONDITION iVsbChannelCondition,TYPE_VSB_NTSC_REJECTION_FILTER iVsbNtscRegectionFilter,TYPE_MPEG_OUTPUT_MODE iMpegOutputMode,TYPE_TUNER_PHASE_NOISE iTunerPhaseNoise);
238
239
240
241//-----------------------------------------------------------------------------------------------------------
242// Function name        : __stdcall SendItubMessage
243// Description      : This function sends receive 1 commands for ITUB receiver
244// Return type          : unsigned int - 0 if successful other value indicates an error occurred.   
245// Argument         : TYPE_ITUB_DE_INTERLEAVER_MODE iItubDeInterlieverMode -  can be ITUB_DE_INTERLEAVER_MODE_AUTOMATIC or
246//                                        ITUB_DE_INTERLEAVER_MODE_X_Y where X Y couples are 128,1 or 128,2 or 64,2 or 128,3 or 32,4 or 128,4 or 16,8 or 8,16   
247// Argument         : TYPE_MPEG_OUTPUT_MODE iMpegOutputMode - can be MPEG_SERIAL_OUTPUT_MODE_PARALLEL or MPEG_SERIAL_OUTPUT_MODE_SERIAL.
248// Argument         : TYPE_TUNER_PHASE_NOISE iTunerPhaseNoise - can be TUNER_PHASE_NOISE_NORMAL or TUNER_PHASE_NOISE_HIGH.
249//-----------------------------------------------------------------------------------------------------------
250unsigned int __stdcall SendItubMessage(TYPE_ITUB_DE_INTERLEAVER_MODE iItubDeInterlieverMode,TYPE_MPEG_OUTPUT_MODE iMpegOutputMode,TYPE_TUNER_PHASE_NOISE iTunerPhaseNoise);
251
252//-----------------------------------------------------------------------------------------------------------
253// Function name        : GetAgcIfCommand
254// Description      : this function returns the Agc IF Command value as a ratio value that is inserted in a struct
255//                                        NUMERATOR_DENOMINATOR where the numerator is the Agc IF Command value and the denominator
256//                                        is 32768             
257// Return type          : NUMERATOR_DENOMINATOR __stdcall struct returns the calculated value as a numerator/denominator value (see the calculation formula above).
258// Argument         : int * piError - retrieves  error description if failed
259//-----------------------------------------------------------------------------------------------------------
260NUMERATOR_DENOMINATOR __stdcall GetAgcIfCommand(int * piError);
261
262
263//-----------------------------------------------------------------------------------------------------------
264// Function name        : GetAGCSensor
265// Description      : this function returns the Agc sensor value as a ratio value that is inserted in a struct
266//                                        NUMERATOR_DENOMINATOR where the numerator is the Agc sensor value and the denominator
267//                                        is 32768             
268// Return type          : NUMERATOR_DENOMINATOR __stdcall struct returns the calculated value as a numerator/denominator value (see the calculation formula above).
269// Argument         : int * piError - retrieves  error description if failed
270//-----------------------------------------------------------------------------------------------------------
271NUMERATOR_DENOMINATOR __stdcall GetAGCSensor(int * piError);
272//-----------------------------------------------------------------------------------------------------------
273// Function name        : GetDSPFirmwareVersion
274// Description      : this function returns the DSP firmware version as an array of 6 numbers
275// Return type          : CAS_2B_CODE_VERSION __stdcall struct that holds the code version numbers.
276// Argument         : int * piError - retrieves  error description if failed
277//-----------------------------------------------------------------------------------------------------------
278CAS_2B_CODE_VERSION __stdcall GetDSPFirmwareVersion(int * piError);
279
280
281//-----------------------------------------------------------------------------------------------------------
282// Function name        : __stdcall GetHardwareVersion
283// Description      : This function returns the hardware version number
284// Return type          : unsigned char - the hardware version number.
285// Argument         : int * piError - retrieves  error description if failed
286//-----------------------------------------------------------------------------------------------------------
287unsigned char __stdcall GetHardwareVersion(int * piError);
288
289//-----------------------------------------------------------------------------------------------------------
290// Function name        : GetCarrierOffset
291// Description      : This function returns the calculated value of the carrier offset according to the formula
292//                                        ((X/32768)*(symbol rate * pow(10,6)/2))/1000
293//                                        X is the value that is retrieved from the cascade device
294//                                        the value is calculated in a proximity way.   
295// Return type          : long __stdcall calculated carrier offset in Khz
296// Argument         : CAS_2B_TYPE_RECEIVER_MODE iReceiverMode - valid only for CAS_2B_RECEIVER_MODE_VSB_8_TR,CAS_2B_RECEIVER_MODE_ITUB_64,CAS_2B_RECEIVER_MODE_ITUB_256.
297// Argument         : int * piError - retrieves  error description if failed
298//-----------------------------------------------------------------------------------------------------------
299long __stdcall GetCarrierOffset(CAS_2B_TYPE_RECEIVER_MODE iReceiverMode,int * piError);
300
301//-----------------------------------------------------------------------------------------------------------
302// Function name        : GetNtscCarrierOffset
303// Description      : This function returns the calculated value of the NTSC carrier offset according to the formula
304//                                        ((X/32768)*(symbol rate * pow(10,6)/2))/1000
305//                                        X is the value that is retrieved from the cascade device
306//                                        the value is calculated in a proximity way.   
307// Return type          : long __stdcall calculated NTSC carrier offset in Khz
308// Argument         : CAS_2B_TYPE_RECEIVER_MODE iReceiverMode - valid only for CAS_2B_RECEIVER_MODE_VSB_8_TR.
309// Argument         : int * piError - retrieves  error description if failed
310//-----------------------------------------------------------------------------------------------------------
311long __stdcall GetNtscCarrierOffset(CAS_2B_TYPE_RECEIVER_MODE iReceiverMode,int * piError);
312
313//-----------------------------------------------------------------------------------------------------------
314// Function name        : GetChecksumFlag
315// Description      : This function returns the checksum flag that was calculated when the code and data were
316//                                        loaded.
317// Return type          : __stdcall CHECKSUM_STATUS CHECKSUM_STATUS_INCORRECT (0) CHECKSUM_STATUS_CORRECT (1)
318// Argument         : int * piError - retrieves  error description if failed
319//-----------------------------------------------------------------------------------------------------------
320CHECKSUM_STATUS __stdcall GetChecksumFlag(int * piError);
321
322
323//-----------------------------------------------------------------------------------------------------------
324// Function name        : __stdcall ResetChecksum
325// Description      : This function sets the checksum register value to 0.
326// Return type          : unsigned int 0 if successful other value indicates an error occurred.
327//-----------------------------------------------------------------------------------------------------------
328unsigned int __stdcall ResetChecksum(void);
329
330
331
332//-----------------------------------------------------------------------------------------------------------
333// Function name        : __stdcall SendCodeAndData
334// Description      : This routine sends code and RAM DATA buffers to the Cascade DSP.
335//                                        in order to send the code and data to the cascade the user must open binary code and data files as binary type
336//                                        and read the file data to a data buffer (type unsigned char).
337//                                        The user must follow the following instruction:
338//                                        1. Allocate a buffer with the size <number of bytes to send + 1>.
339//                                        2. Copy the binary data from the file to the buffer starting from cell index 1.
340//                                        3. The cell in index 0 will be used by the function SendCascadeCodeOrData so the user doesnt have to 
341//                                               set it with a value.
342//
343//                                        This routine also checks compatibility to Cas2B. If the loaded code does not support it will load automatically the
344//                                        the latest code for Cas2B.
345// Return type          : int 0 if successful other value indicates an error occurred.     
346// Argument         : unsigned char * pucCodeToSend A pointer the buffer that holds the code to send (the code starts from cell index 1).
347// Argument         : unsigned long ulCodeBufferSize the code to send size <number of bytes to send>.
348// Argument         : unsigned char * pucDataToSend A pointer the buffer that holds the data to send (the data starts from cell index 1).
349// Argument         : unsigned long ulDataBufferSize the data to send size <number of bytes to send>.
350//-----------------------------------------------------------------------------------------------------------
351int  __stdcall SendCodeAndData(unsigned char * pucCodeToSend,unsigned long ulCodeBufferSize,unsigned char * pucDataToSend,unsigned long ulDataBufferSize);
352
353//----------------------------------------------------------------------------------------------
354// Function name        : SendCas2BRunFlag
355// Description      : This function sends the cascade a run flag which result in the cascade
356//                                        device will start to execute the loaded code                         
357// Return type          : int 0 if successful other value indicates an error occurred.     
358//----------------------------------------------------------------------------------------------
359int __stdcall SendCas2BRunFlag(void);
360
361
362//----------------------------------------------------------------------------------------------
363// Function name        : __stdcall PerformChannelScan
364// Description      : This function performs an automatic channel search. The function tries to lock the cascade device
365//                                        on each of the frequencies that were set by the user, and if it succeeds it gathers information from the
366//                                        cascade device according to the receiver lock.
367// Return type          : unsigned int 0 if successful other value indicates an error occurred.     
368// Argument         : CAS_2B_CHANNEL_SCAN_PARAMETERS stChannelScanParameters - this struct holds all the channel scan settings
369//                                        this struct holds the following fields:
370//                                        - TYPE_CHANNEL_SCAN_RECEIVER_MODE_PRIORITY iReceiverModeFirstPriority - can be vsb or itub the function will try to lock
371//                                          for each checked frequency first on the receiver mode that is stated in iReceiverModeFirstPriority.
372//                                        - TYPE_CHANNEL_SCAN_RECEIVER_MODE_PRIORITY iReceiverModeSecondPriority - can be none vsb or itub the function will try to lock
373//                                          for each checked frequency second on the receiver mode that is stated in iReceiverModeSecondPriority.
374//                                        - BOOLEAN bNtscCheck - if set to TRUE the function will check for each frequency if the NTSC detection flag is set by the cascade device.
375//                                    - TYPE_CHANNEL_SCAN_FREQUENCY_OPTION iChannelScanFrequencyOption - this field will tell the application what frequencies input database
376//                                          to use in the scanning operation there are three options.
377//                                          1. According to preser frequency tables (SCAN_ACCORDING_TO_TABLE)
378//                                          2. According to frequency range that is set by the user (SCAN_ACCORDING_TO_FREQUENCY).
379//                                          3. According to user defined frequency table (SCAN_ACCORDING_TO_INPUT_TABLE).
380//                                        - CHANNEL_TABLE_TYPE iChannelTableType - this field tells the function which frequency table to use. set this field only when
381//                                          the SCAN_ACCORDING_TO_TABLE option is selected.
382//                    - unsigned long ulStartFrequency -  this field will hold the start frequency value (KHz) for the channel scan operation
383//                                          set this field only when the SCAN_ACCORDING_TO_FREQUENCY option is selected.
384//                                        - unsigned long ulEndFrequency - this field will hold the last frequency value (KHz) for the channel scan operation
385//                                          set this field only when the SCAN_ACCORDING_TO_FREQUENCY option is selected.
386//                                        - unsigned long ulStepSize - this field will hold the increment frequency value (KHz) that will be added to the frequenct for each cycle
387//                                              of the channel scan operation. set this field only when the SCAN_ACCORDING_TO_FREQUENCY option is selected.
388//                    - unsigned short usInputFrequencyTableSize - this field will hold the input frequencies data buffer size. set this field
389//                                              only when the SCAN_ACCORDING_TO_INPUT_TABLE option is selected.
390//                    - BOOLEAN bPerformCascadeChannelChange - set this field to TRUE if you want the application to perform channel change
391//                                              operation for the cascade device for eacy channel scan cycle.
392//                                        -     unsigned long ulDelay - this field will be use by the function to create delays between cascade IIC operations, this delay is essential
393//                                              for the application to work correctly. Each time the delay is used it is decremented in a while loop until its value reaches to 0.
394//                                              the delay time will be influenced by the proccessor spped (recomended value is 750000).
395//                                        -     TYPE_CARRIER_ACQUISITION iCarrierAcquisition -  determines the carrier acquisition that will be set by the cascade channel change
396//                                              operation.
397//                                        - TUNER_TYPE iTunerType -  set the tuner type.
398//                                        - unsigned long ulNumberOfTries -  this field determines how many time the application will check the lock status for each frequency (this parameter is
399//                                              used only on vsb and itub receiver modes).
400//                                        - unsigned short usResultsBufferSize - this filed tells the application what is the size of the result buffer pointed by pstaChannelScanResults.
401// Argument         : CAS_2B_CHANNEL_SCAN_RESULT *pstaChannelScanResults -  this struct will hold the data that was read from the cascade device for each checked frequency
402//                                        the struct fileds are:
403//                                        - unsigned long ulFrequency -  holds the checked frequency value in KHz.
404//                                        - long lCarrierOffset - this fields will hold the cascade device carrier offset in KHz. this value will be set only when a signal of vsb or itub was found
405//                                              in the checked frequency.
406//                                        - long lNtscCarrierOffset - this fields will hold the cascade device NTSC carrier offset in KHz. this value will be set only when a signal of NTSC was found
407//                                              in the checked frequency.
408//                                        - unsigned short usSnr -  this field will hold the cascade device SNR value in db. this value will be set only when a signal of vsb or itub was found
409//                                              in the checked frequency.
410//                                        - NUMERATOR_DENOMINATOR stAgcIfCommand - this field will hold the cascade device agc if command value. this value will be set only when a signal of vsb or itub was found
411//                                              in the checked frequency.
412//                                        - BOOLEAN bRfInverseSpectrum - this field will hold the cascade device inverse spectrum (TRUE ==  inverse). this value will be set only when a signal of vsb or itub was found
413//                                              in the checked frequency.
414//                                        - NUMERATOR_DENOMINATOR stSymbolRateoffset - this field will hold the cascade device symbol rate offset value in ppm. this value will be set only when a signal of vsb or itub was found
415//                                              in the checked frequency.
416//                                        - TYPE_ITUB_DE_INTERLEAVER_MODE iDiMode - this field will hold the cascade device de interliever mode. this value will be set only when a signal of itub was found
417//                                              in the checked frequency.
418//                                        - TYPE_CHANNEL_SCAN_RECEIVER_MODE_LOCK iReceiverKodeLock - this field will tell which kind of signal was found for each frequency.
419//                                        - BOOLEAN bNtscSignalDetected - This field is set to TRUE when a NTSC signal is detected by the cascade device.
420// Argument         : unsigned long* pulaInputFrequenciesTable - this pointer will point to the frequencies buffer that were set by the user in SCAN_ACCORDING_TO_INPUT_TABLE mode for other modes set the pointer to NULL.
421//----------------------------------------------------------------------------------------------
422unsigned int __stdcall PerformChannelScan(CAS_2B_CHANNEL_SCAN_PARAMETERS stChannelScanParameters, CAS_2B_CHANNEL_SCAN_RESULT *pstaChannelScanResults,unsigned long* pulaInputFrequenciesTable);
423
424//-----------------------------------------------------------------------------------------------------------
425// Function name        : SetReceiveRegister
426// Description      : This function sets the selected receive register value
427// Return type          : int __stdcall - 0 if successful other value indicates an error occurred.         
428// Argument         : unsigned char usReceiveRegisterNumber - The receive register number (can be 0-7).
429// Argument         : unsigned short usReceiveRegisterValue - The value to set into the selected receive register
430//-----------------------------------------------------------------------------------------------------------
431int __stdcall SetReceiveRegister(unsigned char usReceiveRegisterNumber,unsigned short usReceiveRegisterValue);
432
433//-----------------------------------------------------------------------------------------------------------
434// Function name        : __stdcall GetTransmitRegisterValue
435// Description      : This function returns the value of the selected transmit register (selected by ucTransmitRegiterNumber)
436// Return type          : unsigned short - The value of the selected transmit register.
437// Argument         : unsigned char ucTransmitRegiterNumber - The number of the transmit register which its value is needed (can be 0 -31).
438// Argument         : int * piError - retrieves  error description if failed.
439//-----------------------------------------------------------------------------------------------------------
440unsigned short __stdcall GetTransmitRegisterValue(unsigned char ucTransmitRegiterNumber,int * piError);
441
442
443
444//-----------------------------------------------------------------------------------------------------------
445// Function name        : GetSignalQuality
446// Description      : This function returns the signal quality as a precent value (range 0 - 100), based on the following calculation:
447//                                        For VSB 8tr - SNRSignalQuality = (SNR_value_read_from_the_Cascade2B_device - 10)/20 * 100
448//                                        For ITUB 64- SNRSignalQuality = (SNR_value_read_from_the_Cascade2B_device - 20)/10 * 100
449//                                        For ITUB 256- SNRSignalQuality = (SNR_value_read_from_the_Cascade2B_device - 25)/10 * 100
450//                   
451//                                        SERSignalQuality = (1 - (1_Sec_SER_Value_read_from_the_Cascade2B_device/50))*100
452//                                        SignalQuality = minimum(SNRSignalQuality,SERSignalQuality)
453// Return type          : unsigned char the signal quality as a precent value (range 0 - 100).
454// Argument         : CAS_2B_TYPE_RECEIVER_MODE iReceiverMode - valid only for CAS_2B_RECEIVER_MODE_VSB_8_TR,CAS_2B_RECEIVER_MODE_ITUB_64,CAS_2B_RECEIVER_MODE_ITUB_256
455// Argument         : int * piError retrieves  error description if failed.
456//-----------------------------------------------------------------------------------------------------------
457unsigned char GetSignalQuality(CAS_2B_TYPE_RECEIVER_MODE iReceiverMode,int * piError);
458
459
460//-----------------------------------------------------------------------------------------------------------
461// Function name        : GetSignalStrength
462// Description      : This function returns the signal strength as a precent value (range 0 - 100) only for VSB receiver type, based on the following calculation:
463//                                             
464//                                        For VSB 8tr - if AGC_IF_Command_value_read_from_the_Cascade2B_device > 0.4
465//                                                                              SignalStrength = 20 + ((AGC_IF_Command_value_read_from_the_Cascade2B_device-0.5)/0.2)*80
466//                                                                      else
467//                                                                              SignalStrength = ((AGC_Sensor_value_read_from_the_Cascade2B_device - 0.1)/0.15) * 20
468// Return type          : unsigned char the signal strength as a precent value (range 0 - 100).
469// Argument         : int * piError retrieves  error description if failed.
470//-----------------------------------------------------------------------------------------------------------
471unsigned long GetSignalStrength(int * piError, TYPE_AGC_AMPLIFIER iAGCAmplifierType);
472//-----------------------------------------------------------------------------------------------------------
473// Function name        : Cas2BOOBChannelChange
474// Description      : This routine controls the OOB channel - freq, mode and power down mode.
475// Return type          : unsigned int - zero if success otherwise nonzero
476// Argument         : CAS_2B_OOB_CHANNEL_CHANGE_PARAMETERS stOOBChannelChangeParameters
477//-----------------------------------------------------------------------------------------------------------
478unsigned int __stdcall Cas2BOOBChannelChange(CAS_2B_OOB_CHANNEL_CHANGE_PARAMETERS stOOBChannelChangeParameters);
479
480
481//-----------------------------------------------------------------------------------------------------------
482// Function name        : IsOOBLocked
483// Description      : This function reads the cascade 2B device transmit register number 18 and
484//                    extracts the lock/unlock flag (bit 2) from it.
485// Return type          : LOCK_STATUS
486// Argument         : int * piError - retrieves  error description if failed
487//-----------------------------------------------------------------------------------------------------------
488LOCK_STATUS __stdcall IsOOBLocked(int * piError);
489
490//-----------------------------------------------------------------------------------------------------------
491// Function name        : GetOOBAgcIfCommand
492// Description      : this function returns the OOB Agc IF Command value as a ratio value that is inserted in a struct
493//                                        NUMERATOR_DENOMINATOR where the numerator is the OOB Agc IF Command value and the denominator
494//                                        is 256               
495// Return type          : NUMERATOR_DENOMINATOR __stdcall struct returns the calculated value as a numerator/denominator value.
496// Argument         : int * piError - retrieves  error description if failed
497//-----------------------------------------------------------------------------------------------------------
498NUMERATOR_DENOMINATOR __stdcall GetOOBAgcIfCommand(int * piError);
499
500//-----------------------------------------------------------------------------------------------------------
501// Function name        : GetOOBCarrierOffset
502// Description      : This function returns the calculated value of the carrier offset according to the formula
503//                                        ((X/32768)*(symbol rate * pow(10,6)/2))/1000
504//                                        X is the value that is retrieved from the cascade device
505//                                        the value is calculated in a proximity way.   
506// Return type          : long __stdcall calculated carrier offset in Khz
507// Argument         : TYPE_FDC_MODE iFDCMode - valid only for   OOB_FDC_MODE_3_088,     OOB_FDC_MODE_1_544, OOB_FDC_MODE_2_048
508// Argument         : int * piError - retrieves  error description if failed
509//-----------------------------------------------------------------------------------------------------------
510long __stdcall GetOOBCarrierOffset(TYPE_FDC_MODE iFDCMode, int * piError);
511
512
513//-----------------------------------------------------------------------------------------------------------
514// Function name        : GetOOBSnr
515// Description      : This function returns the OOB SNR value from the cascade device.
516// Return type          : unsigned short returns the snr value
517// Argument         : int * piError - retrieves  error description if failed
518//-----------------------------------------------------------------------------------------------------------
519unsigned short __stdcall GetOOBSnr(int * piError);
520
521
522//-----------------------------------------------------------------------------------------------------------
523// Function name   : GetAudioChannelState
524// Description     : This function returns the left or right channel state
525// Return type     : TYPE_AUDIO_CHANNEL_STATE - the channel state can be mono, left, right, mono-2 or mute.
526// Argument        : TYPE_AUDIO_CHANNEL iAudioChannel - the channel type can be left or right.
527// Argument        : int * piError- retrieves  error description if failed.
528//-----------------------------------------------------------------------------------------------------------
529TYPE_AUDIO_CHANNEL_STATE __stdcall GetAudioChannelState(TYPE_AUDIO_CHANNEL iAudioChannel,int * piError);
530
531
532//-----------------------------------------------------------------------------------------------------------
533// Function name   : IsStereoDetected
534// Description     : This function checks whether the device has a stereo detection indication.
535// Return type     : BOOLEAN - TRUE stereo is detected, FALSE stereo in not detected.
536// Argument        : int * piError- retrieves  error description if failed.
537//-----------------------------------------------------------------------------------------------------------
538BOOLEAN __stdcall IsStereoDetected(int * piError);
539
540
541//-----------------------------------------------------------------------------------------------------------
542// Function name   : IsBilingualSapDetected
543// Description     : This function checks whether the device has a Bilingual/SAP detection indication.
544// Return type     : BOOLEAN - TRUE Bilingual/SAP is detected, FALSE Bilingual/SAP in not detected.
545// Argument        : int * piError- retrieves  error description if failed.
546//-----------------------------------------------------------------------------------------------------------
547BOOLEAN __stdcall IsBilingualSapDetected(int * piError);
548
549
550//-----------------------------------------------------------------------------------------------------------
551// Function name   : GetDeviationSensitivityMode
552// Description     : This function returns the deviation/sensitivity mode.
553// Return type     : TYPE_AUDIO_DEVIATION_SENSITIVITY_MODE can be very high deviation,high deviation, normal
554//                                       or low deviation.
555// Argument        : int * piError - retrieves  error description if failed.
556//-----------------------------------------------------------------------------------------------------------
557TYPE_AUDIO_DEVIATION_MODE __stdcall GetDeviationSensitivityMode(int * piError);
558
559
560//-----------------------------------------------------------------------------------------------------------
561// Function name   : GetAudioStandard
562// Description     : This function returns the detected audio standard.
563// Return type     : TYPE_AUDIO_STANDARD can be BTC, Korea or Radio FM.
564// Argument        : int * piError - retrieves  error description if failed.
565//-----------------------------------------------------------------------------------------------------------
566TYPE_AUDIO_STANDARD __stdcall GetAudioStandard(int * piError);
567
568
569//-----------------------------------------------------------------------------------------------------------
570// Function name   : GetMasterSlaveMode
571// Description     : this fumction returns the master/slave mode
572// Return type     : TYPE_AUDIO_MASTER_SLAVE_MODE __stdcall can be TYPE_AUDIO_SLAVE_MODE or TYPE_AUDIO_MASTER_MODE
573// Argument        : int * piError - retrieves  error description if failed.
574//-----------------------------------------------------------------------------------------------------------
575TYPE_AUDIO_MASTER_SLAVE_MODE __stdcall GetMasterSlaveMode(int * piError);
576
577//-----------------------------------------------------------------------------------------------------------
578// Function name   : GetSclToWsRatio
579// Description     : this function returns the Scl To Ws Ratio
580// Return type     : TYPE_SCL_TO_WS_RATIOcan be TYPE_SCL_TO_WS_RATIO_32, TYPE_SCL_TO_WS_RATIO_48, TYPE_SCL_TO_WS_RATIO_64, TYPE_SCL_TO_WS_RATIO_UNDEFINED
581// Argument        : int * piError - retrieves  error description if failed.
582//-----------------------------------------------------------------------------------------------------------
583TYPE_SCL_TO_WS_RATIO __stdcall GetSclToWsRatio(int * piError);
584
585//-----------------------------------------------------------------------------------------------------------
586// Function name   : GetIISOuputRate
587// Description     : this function returns the IIS Ouput Rate
588// Return type     : TYPE_IIS_OUT_RATE can be TYPE_IIS_OUT_RATE_48, TYPE_IIS_OUT_RATE_96, TYPE_IIS_OUT_RATE_44_1, TYPE_IIS_OUT_RATE_88_2, TYPE_IIS_OUT_RATE_32, TYPE_IIS_OUT_RATE_UNDEFINED
589// Argument        : int * piError - retrieves  error description if failed.
590//-----------------------------------------------------------------------------------------------------------
591TYPE_IIS_OUT_RATE __stdcall GetIISOuputRate(int * piError);
592
593//-----------------------------------------------------------------------------------------------------------
594// Function name   : GetIISMode
595// Description     : this function returns the IIS mode
596// Return type     : TYPE_IIS_MODE can be TYPE_IIS_MODE_IIS, TYPE_IIS_MODE_LJ, TYPE_IIS_MODE_RJ
597// Argument        : int * piError - retrieves  error description if failed.
598//-----------------------------------------------------------------------------------------------------------
599TYPE_IIS_MODE __stdcall GetIISMode(int * piError);
600
601//-----------------------------------------------------------------------------------------------------------
602// Function name   : GetSoundCh1AGC
603// Description     : this function returns the Sound Ch1 AGC command
604// Return type     : NUMERATOR_DENOMINATOR - struct returns the calculated value as a numerator/denominator value.
605// Argument        : int * piError - retrieves  error description if failed.
606//-----------------------------------------------------------------------------------------------------------
607NUMERATOR_DENOMINATOR __stdcall GetSoundCh1AGC(int * piError);
608
609//-----------------------------------------------------------------------------------------------------------
610// Function name   : GetSoundLeftOutputGain
611// Description     : this function gets the left output gain
612// Return type     : NUMERATOR_DENOMINATOR - struct returns the calculated value as a numerator/denominator value.
613// Argument        : int * piError - retrieves  error description if failed.
614//-----------------------------------------------------------------------------------------------------------
615NUMERATOR_DENOMINATOR __stdcall GetSoundLeftOutputGain(int * piError);
616
617//-----------------------------------------------------------------------------------------------------------
618// Function name   : GetSoundRightOutputGain
619// Description     : this function gets the right output gain
620// Return type     : NUMERATOR_DENOMINATOR - struct returns the calculated value as a numerator/denominator value.
621// Argument        : int * piError - retrieves  error description if failed.
622//-----------------------------------------------------------------------------------------------------------
623NUMERATOR_DENOMINATOR __stdcall GetSoundRightOutputGain(int * piError);
624
625
626//-----------------------------------------------------------------------------------------------------------
627// Function name   : SendAudioMessage
628// Description     : This function sends the audio message parameters to the appropriate receive register.
629//                                       It is advisable to call the InitAudioMessageStructToDefault before calling this function in order to
630//                                       initialize the stAudiomessageParameters fields to default values and than change the appropriate struct fields
631// Return type     : int __stdcall the error description if failed.
632// Argument        : unsigned char ucReceiveRegisterNumber - can be 1-4.
633// Argument        : CAS_2B_AUDIO_MESSAGE_PARAMETERS stAudiomessageParameters this struct holds the message
634//                                       parameters that needs to be set for each receive register:
635//                                       For receive1 set the following fields:
636//                                       bAudioLeftChannelMute, bAudioRightChannelMute, bAudioForcedMonoMode, iNRSwithc, iStereoMode
637//                               iBilingualMode, bDeEmphasisOn, bDbxOn,iHighDeviationMode,bCh1PllPiIntegratorReset,bCh2PllPiIntegratorReset.
638//                                       For receive2 set the following fields:
639//                                       usLeftOutputGain, usRightOutputGain.
640//                                       For receive3 set the following fields:
641//                                       iSclToWsDivisionFactor, iIisOutRate, iIisMode, iMasterSlaveMode.
642//-----------------------------------------------------------------------------------------------------------
643int __stdcall SendAudioMessage(unsigned char ucReceiveRegisterNumber, CAS_2B_AUDIO_MESSAGE_PARAMETERS stAudiomessageParameters);
644
645
646//-----------------------------------------------------------------------------------------------------------
647// Function name   : InitAudioMessageStructToDefault
648// Description     : This function initializes the audio message parameters struct fields to default values.
649// Return type     : void __stdcall
650// Argument        : CAS_2B_AUDIO_MESSAGE_PARAMETERS* pstAudiomessageParameters a pointer to the audio message parameters struct.
651//-----------------------------------------------------------------------------------------------------------
652void __stdcall InitAudioMessageStructToDefault(CAS_2B_AUDIO_MESSAGE_PARAMETERS* pstAudiomessageParameters);
653
654
655//-----------------------------------------------------------------------------------------------------------
656//-----------------------------------------------------------------------------------------------------------
657//-----------------------------------------------------------------------------------------------------------
658//
659//internal usage functions
660//
661//-----------------------------------------------------------------------------------------------------------
662//-----------------------------------------------------------------------------------------------------------
663//-----------------------------------------------------------------------------------------------------------
664unsigned char _stdcall CalcLog(unsigned short usReceivedWord);
665unsigned char _stdcall GetLogFromTable(unsigned char ucValueToLog);
666
667
668
669
670//-----------------------------------------------------------------------------------------------------------
671// Function name        : SetTunerDTT760xATSC
672// Description      : controls the Thomson DTT760xATSC tuner
673// Return type          : int: CASCADE_SUCCESS - if setting the tuner succeded. other values indicate about the failure reason.
674// Argument         : TYPE_TUNERDTT760xATSC_SET_OPTION TunerSet: Determines how to set the tuner PLL frequency
675//                    by channel, by center frequency(Khz) or by picture carrier(Khz).
676// Argument         : void* pvTunerSet: The value to set according to TunerSet.
677// Argument         : TYPE_TUNERDTT760xATSC_REF_DIVIDER_RATIO TunerSet: Determines the reference divider ratio for the tuner
678//                    the default value is TUNERDTT760xATSC_REF_DIVIDER_RATIO_62_5
679// Argument         : TYPE_TUNERDTT760xATSC_AGC iAgc: Determines the AGC value for the tuner, the default value is TUNERDTT760xATSC_AGC_94
680// Argument         : BOOLEAN bUseExternalAgc: Determines if the tuner will use external AGC (TRUE) or not (FALSE)
681//                                        the default value is FALSE   
682// Argument         : TYPE_TUNERDTT760xATSC_CHARGE_PUMP iChargePump: Determines the charge pump value the default value is
683//                                        TUNERDTT760xATSC_CHARGE_PUMP_60
684// Argument         : TYPE_TUNERDTT760xATSC_AGC_TIME_CONSTANT iAgcTimeConstant: Determines the AGC time constant value, the default
685//                    value is TUNERDTT760xATSC_AGC_TIME_CONSTANT_50_MS
686//-----------------------------------------------------------------------------------------------------------
687int  SetTunerDTT760xATSC(TYPE_TUNER_SET_OPTION TunerSet, void* pvTunerSet, 
688                CHANNEL_TABLE_TYPE iChannelTable,
689                TYPE_TUNERDTT760xATSC_REF_DIVIDER_RATIO iRefDividerRatio ,
690                TYPE_TUNERDTT760xATSC_AGC iAgc,
691                BOOLEAN bUseExternalAgc,
692                TYPE_TUNERDTT760xATSC_CHARGE_PUMP iChargePump,
693                TYPE_TUNERDTT760xATSC_AGC_TIME_CONSTANT iAgcTimeConstant);
694
695
696//-----------------------------------------------------------------------------------------------------------
697// Function name        : SetTunerDTT7611
698// Description      : controls the Thomson DTT7611 tuner
699// Return type          : INT: 0 - Succeeded to set the tuner, other value - Did not succeed to set the tuner
700// Argument         : TYPE_TUNER_SET_OPTION TunerSet: Determines how to set the tuner PLL frequency
701//                    by channel, by center frequency(Khz)  or by picture carrier(Khz).
702// Argument         : void* pvTunerSet: The value to set according to TunerSet.
703// Argument                     : CHANNEL_TABLE_TYPE iChannelTableType - determines which channel table will be selected to get the tuner pll frequency from the channel number.
704// Argument         : TYPE_TUNERDTT7611_REF_DIVIDER_RATIO: Determines the reference divider ratio for the tuner
705// Argument         : TYPE_TUNERDTT7611_AGC: Determines the AGC value for the tuner
706// Argument         : TYPE_TUNER_AGC_MODE: Determines if the tuner will internal AGC digital or analog
707//                                        the default value is TUNERDTT7611_AGC_MODE_EXTERNAL   
708// Argument         : CHARGE_PUMP: Determines the charge pump value
709// Argument         : TYPE_TUNERDTT7611_AGC_TIME_CONSTANT: Determines the AGC time constant value,
710//-----------------------------------------------------------------------------------------------------------
711int __stdcall SetTunerDTT7611(TYPE_TUNER_SET_OPTION TunerSet, void* pvTunerSet, 
712                                        CHANNEL_TABLE_TYPE iChannelTable,
713                                        TYPE_TUNERDTT7611_REF_DIVIDER_RATIO iRefDividerRatio,
714                                        TYPE_TUNERDTT7611_AGC iAgc,
715                                        TYPE_TUNER_AGC_MODE iAgcMode,
716                                        CHARGE_PUMP iChargePump,
717                                        TYPE_TUNERDTT7611_AGC_TIME_CONSTANT iAgcTimeConstant);
718
719//-----------------------------------------------------------------------------------------------------------
720// Function name        : SetTunerDTT7612
721// Description      : controls the Thomson DTT7612 tuner
722// Return type          : INT: 0 - Succeeded to set the tuner, other value - Did not succeed to set the tuner
723// Argument         : TYPE_TUNER_SET_OPTION TunerSet: Determines how to set the tuner PLL frequency
724//                    by channel, by center frequency(Khz)  or by picture carrier(Khz).
725// Argument         : void* pvTunerSet: The value to set according to TunerSet.
726// Argument                     : CHANNEL_TABLE_TYPE iChannelTableType - determines which channel table will be selected to get the tuner pll frequency from the channel number.
727// Argument         : TYPE_TUNERDTT7612_REF_DIVIDER_RATIO: Determines the reference divider ratio for the tuner
728// Argument         : TYPE_TUNERDTT7612_AGC: Determines the AGC value for the tuner
729// Argument         : TYPE_TUNER_AGC_MODE: Determines if the tuner will internal AGC digital or analog
730// Argument         : CHARGE_PUMP: Determines the charge pump value
731// Argument         : TYPE_TUNERDTT7612_AGC_TIME_CONSTANT: Determines the AGC time constant value,
732//-----------------------------------------------------------------------------------------------------------
733int __stdcall SetTunerDTT7612(TYPE_TUNER_SET_OPTION TunerSet, void* pvTunerSet, 
734                                        CHANNEL_TABLE_TYPE iChannelTable,
735                                        TYPE_TUNERDTT7612_REF_DIVIDER_RATIO iRefDividerRatio,
736                                        TYPE_TUNERDTT7612_AGC iAgc,
737                                        TYPE_TUNER_AGC_MODE iAgcMode,
738                                        CHARGE_PUMP iChargePump,
739                                        TYPE_TUNERDTT7612_AGC_TIME_CONSTANT iAgcTimeConstant);
740
741
742//-----------------------------------------------------------------------------------------------------------
743// Function name   : SetTunerThomsonT2000
744// Description     : Controls the Thomson T2000 tuner
745// Return type     : int __stdcall 0 - Succeeded to set the tuner, other value - Did not succeed to set the tuner
746// Argument        : TYPE_TUNER_THOMSON_T2000_SET_OPTION iTunerSet Determines how to set the tuner PLL frequency
747//                                       by channel, by center frequency or by picture carrier.
748// Argument        : void* pvTunerSet The value to set according to TunerSet.
749// Argument        : TYPE_TUNER_THOMSON_T2000_AGC_SELECTION iAgcSelection can be internal or external
750// Argument        : TYPE_TUNER_THOMSON_T2000_INPUT_SELECTION iInput terrestrial or cable
751// Argument        : TYPE_THOMSON_T2000_REF_DIVIDER_RATIO iRefDividerRatio can be 166.6 or 62.5 or 50
752// Argument        : TYPE_TUNER_THOMSON_T2000_MODE iMode can be digital or analog
753//-----------------------------------------------------------------------------------------------------------
754int __stdcall SetTunerThomsonT2000(     TYPE_TUNER_SET_OPTION iTunerSet, void* pvTunerSet, 
755                                TYPE_TUNER_THOMSON_T2000_AGC_SELECTION iAgcSelection,
756                                TYPE_TUNER_THOMSON_T2000_INPUT_SELECTION iInput,
757                                TYPE_THOMSON_T2000_REF_DIVIDER_RATIO iRefDividerRatio,
758                                TYPE_TUNER_THOMSON_T2000_MODE iMode
759                                );
760
761
762//-----------------------------------------------------------------------------------------------------------
763// Function name   : SetTunerTD6650T
764// Description     : Controls the Philips TD6650T tuner
765// Return type     : int __stdcall 0 - Succeeded to set the tuner, other value - Did not succeed to set the tuner
766// Argument         : TYPE_TUNER_SET_OPTION TunerSet: Determines how to set the tuner PLL frequency
767//                    by channel, by center frequency(Khz)  or by picture carrier(Khz).
768// Argument         : void* pvTunerSet: The value to set according to TunerSet.
769// Argument                     : CHANNEL_TABLE_TYPE iChannelTableType - determines which channel table will be selected to get the tuner pll frequency from the channel number.
770// Argument        : TYPE_TD6650T_REF_DIVIDER_RATIO iReferenceDividerRatio - Determines the reference divider ratio for the tuner.
771// Argument        : TYPE_TD6650T_AGC_TOP iAGCTakeOverPoint - Determines the AGC value for the tuner.
772// Argument        : TYPE_TD6650T_ATC iAtc - Determines the AGC time constant value value for the tuner.
773//-----------------------------------------------------------------------------------------------------------
774int __stdcall SetTunerTD6650T(TYPE_TUNER_SET_OPTION TunerSet, void* pvTunerSet,
775                                        CHANNEL_TABLE_TYPE iChannelTable,                 
776                                        TYPE_TD6650T_REF_DIVIDER_RATIO iReferenceDividerRatio ,
777                                        TYPE_TD6650T_AGC_TOP iAGCTakeOverPoint,
778                                        TYPE_TD6650T_ATC iAtc);
779
780
781//-----------------------------------------------------------------------------------------------------------
782// Function name   : SetTunerXC3028
783// Description     : Controls the Exeive XC3028 tuner.
784//                                       PAY ATTENTION - 1. If you have chosen to load the tuner firmaware the function sends 3 data buffers XC3028Init0,
785//                                                                          XC3028Init1 and XC3028Dtv6Oren1 for digital mode or XC3028MnNtscPal for analog mode.
786//                                                                          When the XC3028Dtv6Oren1 or XC3028MnNtscPal data buffer is loaded, the delay between setting
787//                                                                          the CLOCK to low and setting the CLOCK to high in I2C acknoledge routine (between the 8'th and 9'th of each byte)
788//                                                                          , must be to at least 1 milli second.
789//                                                                       2. When setting the tuner frequency  the delay between setting the CLOCK to low and setting the CLOCK to high
790//                                                                              in I2C acknoledge routine (between the 8'th and 9'th of each byte) , must be to at least 1 milli second.
791// Return type     : int __stdcall 0 - Succeeded to set the tuner, other value - Did not succeed to set the tuner
792// Argument         : TYPE_TUNER_SET_OPTION TunerSet: Determines how to set the tuner PLL frequency
793//                    by channel, by center frequency(Khz)  or by picture carrier(Khz).
794// Argument         : void* pvTunerSet: The value to set according to TunerSet.
795// Argument                     : BOOLEAN bLoadFirmware - Determines if the tuner will be loaded with the firmware data before the frequency is set. The tuner can only be loaded after a code was loaded the
796//                                        Cascade device and a run flag was sent.       
797// Argument        : TYPE_TUNER_FIRMAWARE_MODE iFirmwareMode - Determines which firmware will be loaded to the tuner when bLoadFirmware == TRUE, can be analog or digital.
798//-----------------------------------------------------------------------------------------------------------
799int __stdcall SetTunerXC3028(TYPE_TUNER_SET_OPTION TunerSet, void* pvTunerSet,BOOLEAN bLoadFirmware,TYPE_TUNER_FIRMAWARE_MODE iFirmwareMode);
800
801//-----------------------------------------------------------------------------------------------------------
802// Function name   : SetTunerMT2121
803// Description     : Controls the Philips MT2121 tuner
804// Return type     : int __stdcall 0 - Succeeded to set the tuner, other value - Did not succeed to set the tuner
805// Argument        : TYPE_TUNER_SET_OPTION TunerSet: Determines how to set the tuner PLL frequency
806//                    by channel, by center frequency(Khz)  or by picture carrier(Khz).
807// Argument        : unsigned long ulTunerSet: The value to set according to TunerSet.
808// Argument                : CHANNEL_TABLE_TYPE iChannelTableType - determines which channel table will be selected to get the tuner pll frequency from the channel number.
809// Argument        : TYPE_TUNER_MT2121_REF_DIVIDER_RATIO iReferenceDividerRatio - Determines the reference divider ratio for the tuner (31.25,50,62.5).
810//-----------------------------------------------------------------------------------------------------------
811int __stdcall SetTunerMT2121(TYPE_TUNER_SET_OPTION TunerSet, unsigned long ulTunerSet,
812                                        CHANNEL_TABLE_TYPE iChannelTable,                 
813                                        TYPE_TUNER_MT2121_REF_DIVIDER_RATIO iReferenceDividerRatio);
814
815
816//-----------------------------------------------------------------------------------------------------------
817// Function name   : SetTunerTdqu
818// Description     : Controls the Alps TDQU tuner
819// Return type     : int __stdcall 0 - Succeeded to set the tuner, other value - Did not succeed to set the tuner
820// Argument        : TYPE_TUNER_SET_OPTION TunerSet: Determines how to set the tuner PLL frequency
821//                    by channel, by center frequency(Khz)  or by picture carrier(Khz).
822// Argument        : unsigned long ulTunerSet: The value to set according to TunerSet.
823// Argument                : CHANNEL_TABLE_TYPE iChannelTableType - determines which channel table will be selected to get the tuner pll frequency from the channel number.
824// Argument        : TYPE_TUNER_TDQU_REF_DIVIDER_RATIO iReferenceDividerRatio - According to the enum parameters of  TYPE_TUNER_TDQU_REF_DIVIDER_RATIO
825// Argument        : TYPE_TUNER_TDQU_CHARGE_PUMP iChargePump - According to the enum parameters of TYPE_TUNER_TDQU_CHARGE_PUMP.
826// Argument        : TYPE_TUNER_TDQU_AGST iAgst - According to the enum parameters of TYPE_TUNER_TDQU_AGST.
827//-----------------------------------------------------------------------------------------------------------
828int __stdcall SetTunerTdqu(TYPE_TUNER_SET_OPTION TunerSet, unsigned long ulTunerSet,
829                                        CHANNEL_TABLE_TYPE iChannelTable,
830                                        TYPE_TUNER_TDQU_REF_DIVIDER_RATIO iReferenceDividerRatio,TYPE_TUNER_TDQU_CHARGE_PUMP iChargePump,TYPE_TUNER_TDQU_AGST iAgst);
831
832
833
834//-----------------------------------------------------------------------------------------------------------
835// Function name   : SetTunerSN761662
836// Description     : Controls the Alps TDQU tuner
837// Return type     : int __stdcall 0 - Succeeded to set the tuner, other value - Did not succeed to set the tuner
838// Argument        : TYPE_TUNER_SET_OPTION TunerSet: Determines how to set the tuner PLL frequency
839//                    by channel, by center frequency(Khz)  or by picture carrier(Khz).
840// Argument        : unsigned long ulTunerSet: The value to set according to TunerSet.
841// Argument                : CHANNEL_TABLE_TYPE iChannelTableType - determines which channel table will be selected to get the tuner pll frequency from the channel number.
842// Argument        : TYPE_TUNER_SN761662TUNER_REF_DIVIDER_RATIO iReferenceDividerRatio - According to the enum parameters of  TYPE_TUNER_TDQU_REF_DIVIDER_RATIO
843// Argument        : TYPE_SN761662TUNER_ATC iATC - According to the enum parameters of TYPE_SN761662TUNER_ATC.
844// Argument        : TYPE_SN761662TUNER_CP iCP - According to the enum parameters of TYPE_SN761662TUNER_CP.
845// Argument        : TYPE_SN761662TUNER_IFOSW iIFOSW - According to the enum parameters of TYPE_SN761662TUNER_IFOSW.
846// Argument        : TYPE_SN761662TUNER_AGC_TOP_LEVEL_0_LEVEL_1 iAGCTop - According to the enum parameters of TYPE_SN761662TUNER_AGC_TOP_LEVEL_0_LEVEL_1.
847// Argument        : TYPE_SN761662TUNER_RFAGC_SHIFT_XTALOUT_CONTROL iRFAGCShiftXtalOut - According to the enum parameters of TYPE_SN761662TUNER_RFAGC_SHIFT_XTALOUT_CONTROL.
848//-----------------------------------------------------------------------------------------------------------
849int __stdcall SetTunerSN761662(TYPE_TUNER_SET_OPTION TunerSet, unsigned long ulTunerSet,
850                                        CHANNEL_TABLE_TYPE iChannelTable,
851                                        TYPE_SN761662TUNER_REF_DIVIDER_RATIO iRefDividerRatio,TYPE_SN761662TUNER_ATC iATC, TYPE_SN761662TUNER_CP iCP,TYPE_SN761662TUNER_IFOSW iIFOSW,TYPE_SN761662TUNER_AGC_TOP_LEVEL_0_LEVEL_1 iAGCTop, TYPE_SN761662TUNER_RFAGC_SHIFT_XTALOUT_CONTROL iRFAGCShiftXtalOut);
852
853
854
855//-----------------------------------------------------------------------------------------------------------
856// Function name   : SetTunerVP13HR
857// Description     : Controls the VP13HR tuner
858// Return type     : int __stdcall 0 - Succeeded to set the tuner, other value - Did not succeed to set the tuner
859// Argument        : TYPE_TUNER_SET_OPTION TunerSet: Determines how to set the tuner PLL frequency
860//                    by channel, by center frequency(Khz)  or by picture carrier(Khz).
861// Argument        : unsigned long ulTunerSet: The value to set according to TunerSet.
862// Argument                : CHANNEL_TABLE_TYPE iChannelTableType - determines which channel table will be selected to get the tuner pll frequency from the channel number.
863// Argument        : TYPE_TUNER_VP13HR_REF_DIVIDER_RATIO iReferenceDividerRatio - According to the enum parameters of  TYPE_TUNER_TDQU_REF_DIVIDER_RATIO
864// Argument        : BOOLEAN bIsFMTrap - FM trap mode - TRUE only in analog mode.
865//-----------------------------------------------------------------------------------------------------------
866int __stdcall SetTunerVP13HR(TYPE_TUNER_SET_OPTION TunerSet, unsigned long ulTunerSet,
867                                        CHANNEL_TABLE_TYPE iChannelTable,
868                                        TYPE_TUNER_VP13HR_REF_DIVIDER_RATIO iRefDividerRatio, BOOLEAN bIsFMTrap, BOOLEAN bIsAFTReq);
869
870
871int __stdcall GetChipData(TYPE_CHANNEL_SCAN_RECEIVER_MODE_PRIORITY iReceiverModePriority,LOCK_TYPE iLockType,CAS_2B_CHANNEL_SCAN_RESULT* pstChannelScanResult);
872
873
874//-----------------------------------------------------------------------------------------------------------
875// Function name        : CheckIfLocked
876// Description      : this function checks if the cascade device is locked on the signal it tries to lock for ulNumberofTries
877// Return type          : LOCK_TYPE returns lock type can be unlocked,digital,analog or digital and analog
878// Argument         : unsigned long ulNumberofTries the number of times that the function will try to check if the device is locked
879// Argument         : BOOLEAN bWithNtscCheck check if the device has NTSC signal detection
880//-----------------------------------------------------------------------------------------------------------
881LOCK_TYPE  __stdcall CheckIfLocked(unsigned long ulNumberOfTries,BOOLEAN bWithNtscCheck, unsigned long ulDelay);
882
883
884//-----------------------------------------------------------------------------------------------------------
885// Function name   : BeforeTunerSendBytes
886// Description     : Opens the i2c bus so the tuner gets the bytes that are sent on the i2c bus
887// Return type     : BOOLEAN TRUE if succeeded to open the i2c bus
888//-----------------------------------------------------------------------------------------------------------
889BOOLEAN BeforeTunerSendBytes(void);
890
891//-----------------------------------------------------------------------------------------------------------
892// Function name   : AfterTunerSendBytes
893// Description     : Closes the i2c bus so the tuner doesnt gets the bytes that are sent on the i2c bus
894// Return type     : BOOLEAN TRUE if succeeded to open the i2c bus
895//-----------------------------------------------------------------------------------------------------------
896BOOLEAN AfterTunerSendBytes(void);
897
898
899CAS_2B_TYPE_RECEIVER_MODE GetReceiveMode(int *piError);
900
901LOCK_STATUS __stdcall IsFECLocked(int * piError);
902
903unsigned short __stdcall GetStatusReg(int *piError);
904unsigned short __stdcall GetChecksum(int *piError);
905
906#endif
Note: See TracBrowser for help on using the repository browser.