| 1 | /* |
|---|
| 2 | * $Id: Cas2ARoutines.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_2A_ROUTINES_H |
|---|
| 10 | #define _CASCADE_2A_ROUTINES_H |
|---|
| 11 | |
|---|
| 12 | #include "Cas2AGeneralDefinitions.h" |
|---|
| 13 | #include "TunerDTT7611.h" |
|---|
| 14 | #include "TunerDTT7612.h" |
|---|
| 15 | #include "TdquTuner.h" |
|---|
| 16 | |
|---|
| 17 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 18 | // Function name : Cas2AChannelChange |
|---|
| 19 | // Description : Performs Channel change operation for the Cascade with all options for VSB, |
|---|
| 20 | // QAM Annex B . |
|---|
| 21 | // 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 |
|---|
| 22 | // will indicate the error occured |
|---|
| 23 | // cannot read expected mode after CC |
|---|
| 24 | // Argument : CAS_2A_CHANNEL_CHANGE_PARAMETERS stChannelChangeParameters : This struct holds the channel change specific |
|---|
| 25 | // parameters for a certain receiver. the struct parameters are: |
|---|
| 26 | // |
|---|
| 27 | // - TYPE_RECEIVER_MODE iReceiverMode: Describes to which receiver mode to change if needed. |
|---|
| 28 | // - TYPE_CARRIER_ACQUISITION iCarrierAcquisition: Describes the carrier acquisition - normal, wide. |
|---|
| 29 | // this parameter has to be set only for the VSB and QAM Annex B recievers |
|---|
| 30 | // - TYPE_INVERSE_SPECTRUM iInverseSpectrum: Describes if inverse spectrum is on or off |
|---|
| 31 | // this parameter has to be set only for the VSB recievers |
|---|
| 32 | // - TYPE_NTSC_SIGNAL_DETECTION iNtscSignalDetection: Describes if the ntsc signal detection is vsb or ntsc |
|---|
| 33 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 34 | unsigned int Cas2AChannelChange(CAS_2A_CHANNEL_CHANGE_PARAMETERS stChannelChangeParameters ); |
|---|
| 35 | |
|---|
| 36 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 37 | // Function name : SetChannel |
|---|
| 38 | // Description : This function sets the tuner PLL frequencyand sends channel change command to the cascade2A DSP right after the |
|---|
| 39 | // tuner freuency was set. This function can perform set tuner PLL frequencyand operation by passing the parameters |
|---|
| 40 | // usDelay = 0 and pstChannelChangeParameters = NULL |
|---|
| 41 | // Return type : unsigned int - 0 If CC succeeded, a number greater than zero - if CC did not succeeded. |
|---|
| 42 | // Argument : CAS_2A_TUNER_PARAMETERS stTunerParameters - this struct holds the parameters for the set tuner PLL frequencyand operation |
|---|
| 43 | // The struct fields are: |
|---|
| 44 | // - TUNER_TYPE iTunerType - set the tuner type TUNER_DTT7611, or TUNER_DTT7612 |
|---|
| 45 | // - TYPE_TUNER_SET_OPTION iTunerSet - Determines how to set the tuner PLL frequency |
|---|
| 46 | // by channel, by center frequency(Khz) or by picture carrier(Khz). |
|---|
| 47 | // - unsigned long ulSetValue - holds the value to set according to iTunerSet channel, or center frequency(Khz) or by picture carrier(Khz). |
|---|
| 48 | // - CHANNEL_TABLE_TYPE iChannelTableType - determines which channel table will be selected to get the tuner pll frequency from the channel number. |
|---|
| 49 | // this field in needed only when the iTunerSet = TUNER_SET_CHANNEL is selected. |
|---|
| 50 | // - TYPE_TUNER_AGC_MODE iAgcMode - determines which channel table will be selected to get the tuner pll frequency from the channel number. |
|---|
| 51 | // |
|---|
| 52 | // Argument : unsigned short usDelay - this parameter is used determine the delay between the set tuner PLL frequency operation and the cascade2A DSP channel change command. |
|---|
| 53 | // 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 |
|---|
| 54 | // will be influenced by the processor speed. |
|---|
| 55 | // Set the usDelay value to 0 when only a set tuner PLL frequency operation takes place. |
|---|
| 56 | // Argument : CAS_2A_CHANNEL_CHANGE_PARAMETERS* pstChannelChangeParameters - this parameter is a pointer the a struct that holds all the parameters needed for a |
|---|
| 57 | // Cascade2A DSP channel change operation. Set the pstChannelChangeParameters value to NULL when only a set tuner PLL frequency operation takes place. |
|---|
| 58 | // The struct fields are: |
|---|
| 59 | // - TYPE_RECEIVER_MODE iReceiverMode: Describes to which receiver mode to change if needed. |
|---|
| 60 | // - TYPE_CARRIER_ACQUISITION iCarrierAcquisition: Describes the carrier acquisition - normal, wide. |
|---|
| 61 | // this parameter has to be set only for the VSB and QAM Annex B recievers |
|---|
| 62 | // - TYPE_INVERSE_SPECTRUM iInverseSpectrum: Describes if inverse spectrum is on or off |
|---|
| 63 | // this parameter has to be set only for the VSB recievers |
|---|
| 64 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 65 | unsigned int SetChannel(CAS_2A_TUNER_PARAMETERS stTunerParameters,unsigned short usDelay,CAS_2A_CHANNEL_CHANGE_PARAMETERS* pstChannelChangeParameters); |
|---|
| 66 | |
|---|
| 67 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 68 | // Function name : IsLocked |
|---|
| 69 | // Description : This function reads the cascade 2A device transmit register number 0 and |
|---|
| 70 | // extracts the lock/unlock flag (bit 8) from it. |
|---|
| 71 | // Return type : LOCK_STATUS |
|---|
| 72 | // Argument : int * piError - retrives error description if failed |
|---|
| 73 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 74 | LOCK_STATUS IsLocked(int * piError); |
|---|
| 75 | |
|---|
| 76 | |
|---|
| 77 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 78 | // Function name : GetMode |
|---|
| 79 | // Description : This function reads the cascade 2A device transmit register number 0 and |
|---|
| 80 | // extracts the Transmitting Method field (bits 0-7) from it. |
|---|
| 81 | // Return type : unsigned char - the Transmitting Method number |
|---|
| 82 | // Argument : int * piError - retrives error description if failed |
|---|
| 83 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 84 | unsigned char GetMode(int * piError); |
|---|
| 85 | |
|---|
| 86 | |
|---|
| 87 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 88 | // Function name : GetRfInverseSpectrum |
|---|
| 89 | // Description : This function reads the cascade 2A device transmit register number 0 and |
|---|
| 90 | // extracts the inverse spectrum field (bit 15) from it. |
|---|
| 91 | // Return type : unsigned char 0 indicates no inverse RF spectrum 1 indicates inverse RF spectrum |
|---|
| 92 | // Argument : int * piError retrives error description if failed |
|---|
| 93 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 94 | unsigned char GetRfInverseSpectrum(int * piError); |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 98 | // Function name : GetSymbolRateFrequencyOffset |
|---|
| 99 | // Description : |
|---|
| 100 | // Return type : NUMERATOR_DENOMINATOR |
|---|
| 101 | // Argument : CAS_2A_TYPE_RECEIVER_MODE iReceiverMode |
|---|
| 102 | // Argument : int * piError retrives error description if failed |
|---|
| 103 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 104 | NUMERATOR_DENOMINATOR GetSymbolRateFrequencyOffset(CAS_2A_TYPE_RECEIVER_MODE iReceiverMode,int * piError); |
|---|
| 105 | |
|---|
| 106 | |
|---|
| 107 | |
|---|
| 108 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 109 | // Function name : GetDiMode |
|---|
| 110 | // Description : returns the de interleaver mode |
|---|
| 111 | // Return type : TYPE_ITUB_DE_INTERLEAVER_MODE |
|---|
| 112 | // Argument : int * piError retrives error description if failed |
|---|
| 113 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 114 | TYPE_ITUB_DE_INTERLEAVER_MODE GetDiMode(int * piError); |
|---|
| 115 | |
|---|
| 116 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 117 | // Function name : GetSnrAfterEqualization |
|---|
| 118 | // Description : This function returns the SNR values from the cascade device it can return the SNR value |
|---|
| 119 | // before and after equalization. |
|---|
| 120 | // Return type : unsigned short returns the snr value |
|---|
| 121 | // Argument : CAS_2A_TYPE_RECEIVER_MODE iReceiverMode can be CAS_2A_RECEIVER_MODE_VSB_8_TR or CAS_2A_RECEIVER_MODE_ITUB_64 or CAS_2A_RECEIVER_MODE_ITUB_256 |
|---|
| 122 | // Argument : int * piError - retrives error description if failed |
|---|
| 123 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 124 | unsigned short GetSnrAfterEqualization(CAS_2A_TYPE_RECEIVER_MODE iReceiverMode,int * piError); |
|---|
| 125 | |
|---|
| 126 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 127 | // Function name : GetPer |
|---|
| 128 | // Description : This function returns the packet error rate as a ratio value that is inserted in a struct |
|---|
| 129 | // NUMERATOR_DENOMINATOR where the numerator is the number of uncorrected RS packets and the denominator |
|---|
| 130 | // is the number of RS packets |
|---|
| 131 | // Return type : NUMERATOR_DENOMINATOR |
|---|
| 132 | // Argument : CAS_2A_TYPE_RECEIVER_MODE iReceiverMode can be CAS_2A_RECEIVER_MODE_VSB_8_TR or CAS_2A_RECEIVER_MODE_ITUB_64 or CAS_2A_RECEIVER_MODE_ITUB_256 |
|---|
| 133 | // Argument : int * piError - retrives error description if failed |
|---|
| 134 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 135 | NUMERATOR_DENOMINATOR GetPer(CAS_2A_TYPE_RECEIVER_MODE iReceiverMode,int * piError); |
|---|
| 136 | |
|---|
| 137 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 138 | // Function name : GetBer |
|---|
| 139 | // Description : This function returns the BER values from the cascade device the BER calculation is |
|---|
| 140 | // BER = (BERCorrected + 4*7 BERFailed)/(7*122 * BERLimit) where: |
|---|
| 141 | // ERCorrected - 'Corrected' bits counter for BER calculation before RS. |
|---|
| 142 | // BERFailed - 'UnCorrected' RS packets. |
|---|
| 143 | // BERLimit = Total RS packets counter. |
|---|
| 144 | // This function is valid only for ITUB receiver mode |
|---|
| 145 | // Return type : NUMERATOR_DENOMINATOR returns the claculated value as a denominator/numerator value |
|---|
| 146 | // (see the claculation formula above) |
|---|
| 147 | // Argument : int * piError - retrives error description if failed |
|---|
| 148 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 149 | NUMERATOR_DENOMINATOR GetBer(int * piError); |
|---|
| 150 | |
|---|
| 151 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 152 | // Function name : Get1SecSer |
|---|
| 153 | // Description : This function returns the Segment Error Rate of the last 1 second; |
|---|
| 154 | // Return type : unsigned char the Segment Error Rate value of the last 1 second. |
|---|
| 155 | // Argument : int * piError - retrives error description if failed |
|---|
| 156 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 157 | unsigned char Get1SecSer(int * piError); |
|---|
| 158 | |
|---|
| 159 | |
|---|
| 160 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 161 | // Function name : GetEqualizerFeedForwardTaps |
|---|
| 162 | // Description : This function returns the feed forward taps vector, the recieved vector length for |
|---|
| 163 | // VSB is 96(only real data), for ITUB is 96 (48 real 48 image). |
|---|
| 164 | // Return type : unsigned int - 0 if successful other value indicates an error occured |
|---|
| 165 | // Argument : unsigned short* pusaReceivedFfTaps - A pointer to a buffer that will hold the received data. |
|---|
| 166 | // The buffer memory must be allocated before calling this function |
|---|
| 167 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 168 | unsigned int GetEqualizerFeedForwardTaps(unsigned short* pusaReceivedFfTaps); |
|---|
| 169 | |
|---|
| 170 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 171 | // Function name : GetEqualizerFeedBackTaps |
|---|
| 172 | // Description : This function returns the feed back taps vector, the recieved vector length for |
|---|
| 173 | // VSB is 384(only real data), for ITUB is 96 (48 real 48 image). |
|---|
| 174 | // Return type : unsigned int - 0 if successful other value indicates an error occured |
|---|
| 175 | // Argument : CAS_2A_TYPE_RECEIVER_MODE iReceiverMode can be CAS_2A_RECEIVER_MODE_VSB_8_TR or CAS_2A_RECEIVER_MODE_ITUB_64 or CAS_2A_RECEIVER_MODE_ITUB_256 |
|---|
| 176 | // Argument : unsigned short* pusaReceivedFbTaps - A pointer to a buffer that will hold the received data. |
|---|
| 177 | // The buffer memory must be allocated before calling this function. |
|---|
| 178 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 179 | unsigned int GetEqualizerFeedBackTaps(CAS_2A_TYPE_RECEIVER_MODE iReceiverMode,unsigned short* pusaReceivedFbTaps); |
|---|
| 180 | |
|---|
| 181 | |
|---|
| 182 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 183 | // Function name : GetConstellationSamples |
|---|
| 184 | // Description : This function returns the constellation samples |
|---|
| 185 | // Return type : unsigned int - 0 if successful other value indicates an error occured |
|---|
| 186 | // Argument : unsigned short usNumberOfConstellationSamples - this parameter will hold the pusaConstellationSamples buffer size and will determine how mny |
|---|
| 187 | // samples will be retrieved from the chip. The maximum size can be 4096. |
|---|
| 188 | // Argument : unsigned short* pusaConstellationSamples - A pointer to a buffer that will hold the received data. |
|---|
| 189 | // The buffer memory must be allocated before calling this function. |
|---|
| 190 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 191 | unsigned int GetConstellationSamples(unsigned short usNumberOfConstellationSamples,unsigned short* pusaConstellationSamples); |
|---|
| 192 | |
|---|
| 193 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 194 | // Function name : SendVsbMessage |
|---|
| 195 | // Description : This function sends receive 1 commands for VSB receiver |
|---|
| 196 | // Return type : unsigned int - 0 if successful other value indicates an error occured |
|---|
| 197 | // Argument : TYPE_VSB_CHANNEL_CONDITION iVsbChannelCondition - can be VSB_CHANNEL_CONDITION_AUTO or VSB_CHANNEL_CONDITION_STATIC or VSB_CHANNEL_CONDITION_DYNAMIC |
|---|
| 198 | // or VSB_CHANNEL_CONDITION_FAST_DYNAMIC. |
|---|
| 199 | // 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. |
|---|
| 200 | // Argument : TYPE_MPEG_OUTPUT_MODE iMpegOutputMode - can be MPEG_SERIAL_OUTPUT_MODE_PARALLEL or MPEG_SERIAL_OUTPUT_MODE_SERIAL. |
|---|
| 201 | // Argument : TYPE_TUNER_PHASE_NOISE iTunerPhaseNoise - can be TUNER_PHASE_NOISE_NORMAL or TUNER_PHASE_NOISE_HIGH. |
|---|
| 202 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 203 | unsigned int SendVsbMessage(TYPE_VSB_CHANNEL_CONDITION iVsbChannelCondition,TYPE_VSB_NTSC_REJECTION_FILTER iVsbNtscRegectionFilter,TYPE_MPEG_OUTPUT_MODE iMpegOutputMode,TYPE_TUNER_PHASE_NOISE iTunerPhaseNoise); |
|---|
| 204 | |
|---|
| 205 | |
|---|
| 206 | |
|---|
| 207 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 208 | // Function name : SendItubMessage |
|---|
| 209 | // Description : This function sends receive 1 commands for ITUB receiver |
|---|
| 210 | // Return type : unsigned int |
|---|
| 211 | // Argument : TYPE_ITUB_DE_INTERLEAVER_MODE iItubDeInterlieverMode - can be ITUB_DE_INTERLEAVER_MODE_AUTOMATIC or |
|---|
| 212 | // 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 |
|---|
| 213 | // Argument : TYPE_MPEG_OUTPUT_MODE iMpegOutputMode - can be MPEG_SERIAL_OUTPUT_MODE_PARALLEL or MPEG_SERIAL_OUTPUT_MODE_SERIAL. |
|---|
| 214 | // Argument : TYPE_TUNER_PHASE_NOISE iTunerPhaseNoise - can be TUNER_PHASE_NOISE_NORMAL or TUNER_PHASE_NOISE_HIGH. |
|---|
| 215 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 216 | unsigned int SendItubMessage(TYPE_ITUB_DE_INTERLEAVER_MODE iItubDeInterlieverMode,TYPE_MPEG_OUTPUT_MODE iMpegOutputMode,TYPE_TUNER_PHASE_NOISE iTunerPhaseNoise); |
|---|
| 217 | |
|---|
| 218 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 219 | // Function name : GetAgcIfCommand |
|---|
| 220 | // Description : this function returns the Agc IF Command value as a ratio value that is inserted in a struct |
|---|
| 221 | // NUMERATOR_DENOMINATOR where the numerator is the Agc IF Command value and the denominator |
|---|
| 222 | // is 32768 |
|---|
| 223 | // Return type : NUMERATOR_DENOMINATOR |
|---|
| 224 | // Argument : int * piError - retrives error description if failed |
|---|
| 225 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 226 | NUMERATOR_DENOMINATOR GetAgcIfCommand(int * piError); |
|---|
| 227 | |
|---|
| 228 | |
|---|
| 229 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 230 | // Function name : GetDSPFirmwareVersion |
|---|
| 231 | // Description : this function returns the DSP firmware version as an array of 6 numbers |
|---|
| 232 | // Return type : CAS_2A_CODE_VERSION |
|---|
| 233 | // Argument : int * piError - retrives error description if failed |
|---|
| 234 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 235 | CAS_2A_CODE_VERSION GetDSPFirmwareVersion(int * piError); |
|---|
| 236 | |
|---|
| 237 | |
|---|
| 238 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 239 | // Function name : GetHardwareVersion |
|---|
| 240 | // Description : returns the hardware version number |
|---|
| 241 | // Return type : unsigned char - the hardware version number. |
|---|
| 242 | // Argument : int * piError - retrives error description if failed |
|---|
| 243 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 244 | unsigned char GetHardwareVersion(int * piError); |
|---|
| 245 | |
|---|
| 246 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 247 | // Function name : GetCarrierOffset |
|---|
| 248 | // Description : This function returns the calculated value of the carrier offset according to the formaula |
|---|
| 249 | // ((X/32768)*(symbol rate * pow(10,6)/2))/1000 |
|---|
| 250 | // X is the value that is retrieved from the cascade device |
|---|
| 251 | // the value is calculated in a proximity way. |
|---|
| 252 | // Return type : long calculated carrier offset in Khz |
|---|
| 253 | // Argument : CAS_2A_TYPE_RECEIVER_MODE iReceiverMode |
|---|
| 254 | // Argument : int * piError - retrives error description if failed |
|---|
| 255 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 256 | long GetCarrierOffset(CAS_2A_TYPE_RECEIVER_MODE iReceiverMode,int * piError); |
|---|
| 257 | |
|---|
| 258 | |
|---|
| 259 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 260 | // Function name : GetChecksumFlag |
|---|
| 261 | // Description : returns the checksum flag that was calculated when the code and data were |
|---|
| 262 | // loaded. |
|---|
| 263 | // Return type : CHECKSUM_STATUS CHECKSUM_STATUS_INCORRECT (0) CHECKSUM_STATUS_CORRECT (1) |
|---|
| 264 | // Argument : int * piError - retrives error description if failed |
|---|
| 265 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 266 | CHECKSUM_STATUS GetChecksumFlag(int * piError); |
|---|
| 267 | |
|---|
| 268 | |
|---|
| 269 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 270 | // Function name : ResetChecksum |
|---|
| 271 | // Description : this function sets the checksum register value to 0. |
|---|
| 272 | // Return type : unsigned int |
|---|
| 273 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 274 | unsigned int ResetChecksum(); |
|---|
| 275 | |
|---|
| 276 | |
|---|
| 277 | |
|---|
| 278 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 279 | // Function name : SendCodeAndData |
|---|
| 280 | // Description : this function sends a compiled DSP code file and compiled RAM DATA file (these files are binary type files |
|---|
| 281 | // that are supplied by Oren Semiconductor will be named Xc.iic (for code) Xd.iic (for data) ) |
|---|
| 282 | // in order to send the code or data to the cascade the user must open these files as binary files |
|---|
| 283 | // and read the file data to a data buffer (type unsigned char). |
|---|
| 284 | // the user must follow the following instruction: |
|---|
| 285 | // 1. Allocate a buffer with the size <number of bytes to send + 1>. |
|---|
| 286 | // 2. Copy the binary data from the file to the buffer starting from cell index 1. |
|---|
| 287 | // 3. The cell in index 0 will be used by the function SendCascadeCodeOrData so the user doesnt have to. |
|---|
| 288 | // fill it with a value. |
|---|
| 289 | // Return type : int 0 if successful other value indicates an error occured |
|---|
| 290 | // Argument : unsigned char * pucCodeToSend A pointer the buffer that holds the code to send (the code starts from cell index 1). |
|---|
| 291 | // Argument : unsigned long ulCodeBufferSize the code to send size <number of bytes to send>. |
|---|
| 292 | // Argument : unsigned char * pucDataToSend A pointer the buffer that holds the data to send (the data starts from cell index 1). |
|---|
| 293 | // Argument : unsigned long ulDataBufferSize the data to send size <number of bytes to send>. |
|---|
| 294 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 295 | int SendCodeAndData(unsigned char * pucCodeToSend,unsigned long ulCodeBufferSize,unsigned char * pucDataToSend,unsigned long ulDataBufferSize); |
|---|
| 296 | |
|---|
| 297 | //---------------------------------------------------------------------------------------------- |
|---|
| 298 | // Function name : SendCas2ARunFlag |
|---|
| 299 | // Description : this function sends the cascade a run flag which result in the cascade |
|---|
| 300 | // device will start to execute the loaded code |
|---|
| 301 | // Return type : int 0 if successful other value indicates an error occured |
|---|
| 302 | //---------------------------------------------------------------------------------------------- |
|---|
| 303 | int SendCas2ARunFlag(); |
|---|
| 304 | |
|---|
| 305 | |
|---|
| 306 | //---------------------------------------------------------------------------------------------- |
|---|
| 307 | // Function name : PerformChannelScan |
|---|
| 308 | // Description : This function performs an automatic channel search. the function tries to lock the cascade device |
|---|
| 309 | // on each of the frequencies that were set by the user. and if it succeeds it gathers information from the |
|---|
| 310 | // cascade device according to the receiver lock. |
|---|
| 311 | // Return type : unsigned int 0 if successful other value indicates an error occured |
|---|
| 312 | // Argument : CAS_2A_CHANNEL_SCAN_PARAMETERS stChannelScanParameters - this file holds all the channel scan settings |
|---|
| 313 | // this struct holds the following fields: |
|---|
| 314 | // - TYPE_CHANNEL_SCAN_RECEIVER_MODE_PRIORITY iReceiverModeFirstPriority - can be vsb itub or ntsc the function will try to lock |
|---|
| 315 | // for each checked frequency first on the receiver mode that is stated in iReceiverModeFirstPriority. |
|---|
| 316 | // - TYPE_CHANNEL_SCAN_RECEIVER_MODE_PRIORITY iReceiverModeSecondPriority - can be none vsb itub or ntsc the function will try to lock |
|---|
| 317 | // for each checked frequency second on the receiver mode that is stated in iReceiverModeSecondPriority. |
|---|
| 318 | // - TYPE_CHANNEL_SCAN_RECEIVER_MODE_PRIORITY iReceiverModeThirdPriority - can be none vsb itub or ntsc the function will try to lock |
|---|
| 319 | // for each checked frequency third on the receiver mode that is stated in iReceiverModeThirdPriority. |
|---|
| 320 | // - TYPE_CHANNEL_SCAN_FREQUENCY_OPTION iChannelScanFrequencyOption - this field will tell the application what frequencies input database |
|---|
| 321 | // to use in the scanning operation there are three options. |
|---|
| 322 | // 1. according to preser frequency tables (SCAN_ACCORDING_TO_TABLE) |
|---|
| 323 | // 2. according to frequency range that is set by the user (SCAN_ACCORDING_TO_FREQUENCY). |
|---|
| 324 | // 3. according to user defined frequency table (SCAN_ACCORDING_TO_INPUT_TABLE). |
|---|
| 325 | // - CHANNEL_TABLE_TYPE iChannelTableType - this field tells the function which frequency table to use. set this field only when |
|---|
| 326 | // the SCAN_ACCORDING_TO_TABLE option is selected. |
|---|
| 327 | // - unsigned long ulStartFrequency - this field will hold the start frequency value (KHz) for the channel scan operation |
|---|
| 328 | // set this field only when the SCAN_ACCORDING_TO_FREQUENCY option is selected. |
|---|
| 329 | // - unsigned long ulEndFrequency - this field will hold the last frequency value (KHz) for the channel scan operation |
|---|
| 330 | // set this field only when the SCAN_ACCORDING_TO_FREQUENCY option is selected. |
|---|
| 331 | // - unsigned long ulStepSize - this field will hold the increment frequency value (KHz) that will be added to the frequenct for each cycle |
|---|
| 332 | // of the channel scan operation. set this field only when the SCAN_ACCORDING_TO_FREQUENCY option is selected. |
|---|
| 333 | // - unsigned short usInputFrequencyTableSize - this field will hold the input frequencies data buffer size. set this field |
|---|
| 334 | // only when the SCAN_ACCORDING_TO_INPUT_TABLE option is selected. |
|---|
| 335 | // - BOOLEAN bPerformCascadeChannelChange - set this field to TRUE if you want the application to perform channel change |
|---|
| 336 | // operation for the cascade device for eacy channel scan cycle. |
|---|
| 337 | // - unsigned long ulDelay - this field will be use by the function to create delays between cascade IIC operations. this delay is eesential |
|---|
| 338 | // for the application to work correctly. the each time the delay is used it is decremented in a while loop until its value reaches to 0. |
|---|
| 339 | // the delay time will be influenced by the proccessor spped (recomended value is 750000). |
|---|
| 340 | // - TYPE_CARRIER_ACQUISITION iCarrierAcquisition - determines the carrier acquisition that will be set by the cascade channel change |
|---|
| 341 | // operation. |
|---|
| 342 | // - TUNER_TYPE iTunerType - set the tuner type. |
|---|
| 343 | // - unsigned long ulNumberOfTries - this field determines how many time the application will check the lock status for each frequency (this parameter is |
|---|
| 344 | // used only on vsb and itub receiver modes). |
|---|
| 345 | // - unsigned short usResultsBufferSize - this filed tells the application what is the size of the result buffer pointed by pstaChannelScanResults. |
|---|
| 346 | // Argument : CAS_2A_CHANNEL_SCAN_RESULT *pstaChannelScanResults - this struct will hold the data that was read from the cascade device for each checked frequency |
|---|
| 347 | // the struct fileds are: |
|---|
| 348 | // - unsigned long ulFrequency - holds the checked frequency value in KHz. |
|---|
| 349 | // - long lCarrierOffset - this fields will hold the cascade device carrier offset in KHz. this value will be set only when a signal of vsb ot itub was found |
|---|
| 350 | // in the checked frequency. |
|---|
| 351 | // - 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 ot itub was found |
|---|
| 352 | // in the checked frequency. |
|---|
| 353 | // - 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 ot itub was found |
|---|
| 354 | // in the checked frequency. |
|---|
| 355 | // - BOOLEAN bRfInverseSpectrum - this field will hold the cascade device inverse spectrum (TRUE == inverse). this value will be set only when a signal of vsb ot itub was found |
|---|
| 356 | // in the checked frequency. |
|---|
| 357 | // - NUMERATOR_DENOMINATOR stSymbolRateoffset - this field will hold the cascade device isymbol rate offset value in ppm. this value will be set only when a signal of vsb ot itub was found |
|---|
| 358 | // in the checked frequency. |
|---|
| 359 | // - 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 |
|---|
| 360 | // in the checked frequency. |
|---|
| 361 | // - TYPE_CHANNEL_SCAN_RECEIVER_MODE_LOCK iReceiverKodeLock - this field will tell which kind of signal was found for each frequency. |
|---|
| 362 | // 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. |
|---|
| 363 | //---------------------------------------------------------------------------------------------- |
|---|
| 364 | unsigned int PerformChannelScan(CAS_2A_CHANNEL_SCAN_PARAMETERS stChannelScanParameters, CAS_2A_CHANNEL_SCAN_RESULT *pstaChannelScanResults,unsigned long* pulaInputFrequenciesTable); |
|---|
| 365 | |
|---|
| 366 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 367 | // Function name : SetReceiveRegister |
|---|
| 368 | // Description : This function sets the selected recieve register value |
|---|
| 369 | // Return type : int - 0 if successful other value indicates an error occured |
|---|
| 370 | // Argument : unsigned char usReceiveRegisterNumber - The receivee register number (can be 0-7). |
|---|
| 371 | // Argument : unsigned short usReceiveRegisterValue - The value to set into the selected recive register |
|---|
| 372 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 373 | int SetReceiveRegister(unsigned char usReceiveRegisterNumber,unsigned short usReceiveRegisterValue); |
|---|
| 374 | |
|---|
| 375 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 376 | |
|---|
| 377 | // Function name : GetTransmitRegisterValue |
|---|
| 378 | // Description : This function returns the value of the selected transmit register (selected by ucTransmitRegiterNumber) |
|---|
| 379 | // Return type : unsigned short - The value of the seleceted transmit register |
|---|
| 380 | // Argument : unsigned char ucTransmitRegiterNumber - The number of the transmit register which its value is needed (can be 0 -31) |
|---|
| 381 | // Argument : int * piError - retrives error description if failed |
|---|
| 382 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 383 | unsigned short GetTransmitRegisterValue(unsigned char ucTransmitRegiterNumber,int * piError); |
|---|
| 384 | |
|---|
| 385 | |
|---|
| 386 | |
|---|
| 387 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 388 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 389 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 390 | // |
|---|
| 391 | //internal usage functions |
|---|
| 392 | // |
|---|
| 393 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 394 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 395 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 396 | unsigned char CalcLog(unsigned short usReceivedWord); |
|---|
| 397 | unsigned char GetLogFromTable(unsigned char ucValueToLog); |
|---|
| 398 | |
|---|
| 399 | |
|---|
| 400 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 401 | // Function name : SetTunerDTT7611 |
|---|
| 402 | // Description : controls the Thomson DTT7611 tuner |
|---|
| 403 | // Return type : INT: 0 - Succeeded to set the tuner, other value - Did not succeed to set the tuner |
|---|
| 404 | // Argument : TYPE_TUNER_SET_OPTION TunerSet: Determines how to set the tuner PLL frequency |
|---|
| 405 | // by channel, by center frequency(Khz) or by picture carrier(Khz). |
|---|
| 406 | // Argument : void* pvTunerSet: The value to set according to TunerSet. |
|---|
| 407 | // Argument : CHANNEL_TABLE_TYPE iChannelTableType - determines which channel table will be selected to get the tuner pll frequency from the channel number. |
|---|
| 408 | // Argument : TYPE_TUNERDTT7611_REF_DIVIDER_RATIO: Determines the reference divider ratio for the tuner |
|---|
| 409 | // Argument : TYPE_TUNERDTT7611_AGC: Determines the AGC value for the tuner |
|---|
| 410 | // Argument : TYPE_TUNER_AGC_MODE: Determines if the tuner will internal AGC digital or analog |
|---|
| 411 | // the default value is TUNERDTT7611_AGC_MODE_EXTERNAL |
|---|
| 412 | // Argument : CHARGE_PUMP: Determines the charge pump value |
|---|
| 413 | // Argument : TYPE_TUNERDTT7611_AGC_TIME_CONSTANT: Determines the AGC time constant value, |
|---|
| 414 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 415 | int SetTunerDTT7611(TYPE_TUNER_SET_OPTION TunerSet, void* pvTunerSet, |
|---|
| 416 | CHANNEL_TABLE_TYPE iChannelTable, |
|---|
| 417 | TYPE_TUNERDTT7611_REF_DIVIDER_RATIO iRefDividerRatio, |
|---|
| 418 | TYPE_TUNERDTT7611_AGC iAgc, |
|---|
| 419 | TYPE_TUNER_AGC_MODE iAgcMode, |
|---|
| 420 | CHARGE_PUMP iChargePump, |
|---|
| 421 | TYPE_TUNERDTT7611_AGC_TIME_CONSTANT iAgcTimeConstant); |
|---|
| 422 | |
|---|
| 423 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 424 | // Function name : SetTunerDTT7612 |
|---|
| 425 | // Description : controls the Thomson DTT7612 tuner |
|---|
| 426 | // Return type : INT: 0 - Succeeded to set the tuner, other value - Did not succeed to set the tuner |
|---|
| 427 | // Argument : TYPE_TUNER_SET_OPTION TunerSet: Determines how to set the tuner PLL frequency |
|---|
| 428 | // by channel, by center frequency(Khz) or by picture carrier(Khz). |
|---|
| 429 | // Argument : void* pvTunerSet: The value to set according to TunerSet. |
|---|
| 430 | // Argument : CHANNEL_TABLE_TYPE iChannelTableType - determines which channel table will be selected to get the tuner pll frequency from the channel number. |
|---|
| 431 | // Argument : TYPE_TUNERDTT7612_REF_DIVIDER_RATIO: Determines the reference divider ratio for the tuner |
|---|
| 432 | // Argument : TYPE_TUNERDTT7612_AGC: Determines the AGC value for the tuner |
|---|
| 433 | // Argument : TYPE_TUNER_AGC_MODE: Determines if the tuner will internal AGC digital or analog |
|---|
| 434 | // Argument : CHARGE_PUMP: Determines the charge pump value |
|---|
| 435 | // Argument : TYPE_TUNERDTT7612_AGC_TIME_CONSTANT: Determines the AGC time constant value, |
|---|
| 436 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 437 | int SetTunerDTT7612(TYPE_TUNER_SET_OPTION TunerSet, void* pvTunerSet, |
|---|
| 438 | CHANNEL_TABLE_TYPE iChannelTable, |
|---|
| 439 | TYPE_TUNERDTT7612_REF_DIVIDER_RATIO iRefDividerRatio, |
|---|
| 440 | TYPE_TUNERDTT7612_AGC iAgc, |
|---|
| 441 | TYPE_TUNER_AGC_MODE iAgcMode, |
|---|
| 442 | CHARGE_PUMP iChargePump, |
|---|
| 443 | TYPE_TUNERDTT7612_AGC_TIME_CONSTANT iAgcTimeConstant); |
|---|
| 444 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 445 | |
|---|
| 446 | |
|---|
| 447 | int SetTunerTdqu(TYPE_TUNER_SET_OPTION TunerSet, unsigned long ulTunerSet, |
|---|
| 448 | CHANNEL_TABLE_TYPE iChannelTable, |
|---|
| 449 | TYPE_TUNER_TDQU_REF_DIVIDER_RATIO iReferenceDividerRatio,TYPE_TUNER_TDQU_CHARGE_PUMP iChargePump,TYPE_TUNER_TDQU_AGST iAgst); |
|---|
| 450 | |
|---|
| 451 | |
|---|
| 452 | int GetChipData(unsigned int iReceiverModePriority, CAS_2A_CHANNEL_SCAN_RESULT* pstChannelScanResult); |
|---|
| 453 | |
|---|
| 454 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 455 | // Function name : CheckIfLocked |
|---|
| 456 | // Description : this function checks if the cascade device is locked on the signal it tries to lock for ulNumberofTries |
|---|
| 457 | // Return type : BOOLEAN returns TRUE if the cascade device is locked |
|---|
| 458 | // Argument : unsigned long ulNumberofTries the number of times that the function will try to check if the device is locked |
|---|
| 459 | //----------------------------------------------------------------------------------------------------------- |
|---|
| 460 | BOOLEAN CheckIfLocked(unsigned long ulNumberofTries); |
|---|
| 461 | #endif |
|---|