source: svn/trunk/newcon3bcm2_21bu/magnum/portinginterface/thd/7552/bthd_api.h

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

first commit

  • Property svn:executable set to *
File size: 31.3 KB
Line 
1/***************************************************************************
2 *     (c)2005-2011 Broadcom Corporation
3 * 
4 *  This program is the proprietary software of Broadcom Corporation and/or its licensors,
5 *  and may only be used, duplicated, modified or distributed pursuant to the terms and
6 *  conditions of a separate, written license agreement executed between you and Broadcom
7 *  (an "Authorized License").  Except as set forth in an Authorized License, Broadcom grants
8 *  no license (express or implied), right to use, or waiver of any kind with respect to the
9 *  Software, and Broadcom expressly reserves all rights in and to the Software and all
10 *  intellectual property rights therein.  IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU
11 *  HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY
12 *  NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. 
13 *   
14 *  Except as expressly set forth in the Authorized License,
15 *   
16 *  1.     This program, including its structure, sequence and organization, constitutes the valuable trade
17 *  secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof,
18 *  and to use this information only in connection with your use of Broadcom integrated circuit products.
19 *   
20 *  2.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
21 *  AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR
22 *  WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
23 *  THE SOFTWARE.  BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES
24 *  OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE,
25 *  LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION
26 *  OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF
27 *  USE OR PERFORMANCE OF THE SOFTWARE.
28 * 
29 *  3.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS
30 *  LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR
31 *  EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR
32 *  USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF
33 *  THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT
34 *  ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE
35 *  LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF
36 *  ANY LIMITED REMEDY.
37 *
38 * $brcm_Workfile: bthd_api.h $
39 * $brcm_Revision: Hydra_Software_Devel/13 $
40 * $brcm_Date: 3/29/12 7:46p $
41 *
42 * [File Description:]
43 *
44 * Revision History:
45 *
46 * $brcm_Log: /magnum/portinginterface/thd/7552/bthd_api.h $
47 *
48 * Hydra_Software_Devel/13   3/29/12 7:46p farshidf
49 * SW7552-239: fix compile
50 *
51 * Hydra_Software_Devel/12   3/29/12 7:40p farshidf
52 * SW7552-239: fix the version
53 *
54 * Hydra_Software_Devel/11   3/27/12 12:03p farshidf
55 * SW3461-1: update to version 4.6
56 *
57 * Hydra_Software_Devel/10   3/27/12 11:50a farshidf
58 * SW7552-207: fix the ews
59 *
60 * Hydra_Software_Devel/9   3/2/12 2:11p farshidf
61 * SW7552-223: implement 7552 THD Frontend PM
62 *
63 * Hydra_Software_Devel/8   2/24/12 12:43p farshidf
64 * SW7552-209: update tHD staus
65 *
66 * Hydra_Software_Devel/7   2/23/12 6:22p farshidf
67 * SW7552-209: remove the flag AAT
68 *
69 * Hydra_Software_Devel/6   2/9/12 2:57p farshidf
70 * SW7552-205: add the new flag
71 *
72 * Hydra_Software_Devel/5   2/8/12 5:14p farshidf
73 * SW7552-205: update to 4.0 release
74 *
75 * Hydra_Software_Devel/4   12/21/11 2:23p farshidf
76 * SW3128-1: remove warning
77 *
78 * Hydra_Software_Devel/3   12/20/11 7:02p farshidf
79 * SW3128-1: remove warning
80 *
81 * Hydra_Software_Devel/2   11/21/11 11:18p farshidf
82 * SW7552-139: adapt to the new THD header API file
83 *
84 * Hydra_Software_Devel/1   10/10/11 2:13p farshidf
85 * SW7552-134: update to 2.0 of 3461 code
86 *
87 * Hydra_Software_Devel/20   10/10/11 1:52p farshidf
88 * SW7552-134: update to match V2_0 of 3461
89 *
90 * Hydra_Software_Devel/19   8/17/11 2:24p farshidf
91 * SW7552-105:  update the frontend with 3461_V1_0_REL  label
92 *
93 * Hydra_Software_Devel/18   8/16/11 6:12p farshidf
94 * SW7552-105: update the frontend with 3461_V1_0_RC0 label
95 *
96 * Hydra_Software_Devel/17   8/16/11 6:04p farshidf
97 * SW7552-105: update the frontend with 3461_V1_0_RC0 label
98 *
99 * Hydra_Software_Devel/16   7/20/11 12:20p farshidf
100 * SWDTV-7620: merge to main
101 *
102 * Hydra_Software_Devel/SWDTV-7620/2   7/20/11 12:15p jchien
103 * SWDTV-7620: Modified RS_SYNC Interrupt logic. Add EWS.
104 *
105 * Hydra_Software_Devel/SWDTV-7620/1   6/21/11 6:54p jchien
106 * SWDTV-7620:  Add EWS Event
107 *
108 * Hydra_Software_Devel/14   6/10/11 2:45p farshidf
109 * SWDTV-7504: update the isdbt compile flag
110 *
111 * Hydra_Software_Devel/13   6/6/11 10:12a farshidf
112 * SW7552-36: fix compile issue
113 *
114 * Hydra_Software_Devel/12   6/3/11 5:15p farshidf
115 * SW7552-36: merge main
116 *
117 * Hydra_Software_Devel/11   6/3/11 4:46p farshidf
118 * SW7552-36: merge to main
119 *
120 * Hydra_Software_Devel/SWDTV-7361/2   6/2/11 4:26p mbsingh
121 * SWDTV-7361: Fix the order of THD status parameters
122 *
123 * Hydra_Software_Devel/SWDTV-7361/1   6/2/11 2:19p mbsingh
124 * SWDTV-7361: Fix the order of THD status parameters
125 *
126 * Hydra_Software_Devel/10   6/1/11 11:45a farshidf
127 * SW7552-36: clean up the code
128 *
129 * Hydra_Software_Devel/9   5/27/11 10:52a farshidf
130 * SW7552-36: compiel fix
131 *
132 * Hydra_Software_Devel/8   5/24/11 2:38p farshidf
133 * SWDTV-7146: merge main
134 *
135 * Hydra_Software_Devel/SWDTV-7146/1   5/19/11 10:31a jchien
136 * SWDTV-7146: add RS_SYNC interrupts for ISDBT
137 *
138 * Hydra_Software_Devel/7   5/6/11 2:20p farshidf
139 * SWDTV-6857: update the auto acquire mode
140 *
141 * Hydra_Software_Devel/6   5/5/11 8:37p farshidf
142 * SWDTV-6857: merge main
143 *
144 * Hydra_Software_Devel/SWDTV-6857/3   5/5/11 8:34p farshidf
145 * SWDTV-6857: fix the event report to nexus
146 *
147 * Hydra_Software_Devel/SWDTV-6857/2   5/5/11 3:15p farshidf
148 * SWDTV-6857: merge main
149 *
150 * Hydra_Software_Devel/5   5/5/11 1:07p farshidf
151 * SWDTV-6857: add ISDB-T
152 *
153 * Hydra_Software_Devel/SWDTV-6857/1   5/3/11 2:56p jchien
154 * SWDTV-6857: add ISDBT changes
155 *
156 * Hydra_Software_Devel/3   4/29/11 10:58a shyi
157 * SWDTV-6190: Changed signature of a private API for initializing
158 * parameters
159 *
160 * Hydra_Software_Devel/2   4/27/11 12:13p farshidf
161 * SWDTV-6190: add the BBS call from Nexus
162 *
163 * Hydra_Software_Devel/1   4/21/11 6:40p farshidf
164 * SWDTV-6191: add the THD code
165 *
166 * 23   4/20/11 4:56p farshidf
167 * SW3461-1: make it host compatible
168 *
169 * 22   4/9/11 10:23a mpovich
170 * SW3461-1: Add Internal HAB commands for THD.
171 *
172 * 21   4/8/11 3:56p farshidf
173 * SW3461-1: merge main
174 *
175 * DVB_3461_1/3   4/7/11 9:32p jputnam
176 * SW3461-1: Initial version of interrupt-based lock detection
177 *
178 * DVB_3461_1/2   4/6/11 4:26p farshidf
179 * SW3461-1: merge main
180 *
181 * 20   4/6/11 4:26p farshidf
182 * SW3461-1: merge main
183 *
184 * DVB_3461_1/1   4/6/11 2:16p jputnam
185 * SW3461-1: Removed obsolete AcqRequest field from Common Acquire Params
186 *
187 * 19   4/6/11 11:50a mpovich
188 * SW3461-1: Add Core-specific HAB power command.  Add call to process THD
189 *  timer event to THD manager/task.
190 *
191 * 18   4/4/11 4:32p mpovich
192 * SW3461-1: Update THD Status HAB command to include missing parameters:
193 *  Acquire Mode, and block counters.
194 *
195 * 17   4/1/11 4:27p farshidf
196 * SW3461-1: merge main
197 *
198 * Rom_Devel_3461/1   3/31/11 4:50p mpovich
199 * SW3461-1: Add support for THD (DVB-T and ISDB-T) HAB commands (Acquire,
200 *  Status, Get Constellation).
201 *
202 * 16   3/8/11 12:39p farshidf
203 * SW3461-1: fix teh THD API
204 *
205 * 15   3/4/11 5:10p farshidf
206 * SW3461-1: add the power seq
207 *
208 * 14   3/4/11 4:52p farshidf
209 * SW3461-1: add the power seq
210 *
211 * 13   2/8/11 11:57a jputnam
212 * SW3461-1: Added spectral inversion field to status
213 *
214 * 12   1/21/11 5:57p farshidf
215 * SW3461-1: update names
216 *
217 * 11   1/20/11 4:22p farshidf
218 * SW3461-1: update the thd/isdbt
219 *
220 * 10   1/7/11 2:27p jputnam
221 * SW3461-1:  Make THD_ResetEvent and THD_EventIsr private - Change
222 *  THD_SetAcqSettings() to THD_InitializeParams()
223 *
224 * 9   1/6/11 10:09a jputnam
225 * SW3461-1: Major cosmetic overhaul - Conform to new API conventions
226 *  common to all demods - Conform to naming conventions for private
227 *  functions and typedefs - Separate DVB-T and ISDB-T params, status,
228 *  functions
229 *
230 * 8   1/3/11 5:36p jputnam
231 * SW3461-1: changed enumerated type and #define names from THD_ to THD_
232 *
233 * 7   12/16/10 6:49p farshidf
234 * SW3461-1: clean up
235 *
236 * 6   12/14/10 1:33p farshidf
237 * SW3461-1: add the new sync IRQ event
238 *
239 * 5   12/3/10 4:48p farshidf
240 * SW3461-1: update api
241 *
242 * 4   11/30/10 10:56a farshidf
243 * SW3461-1: update the thd files
244 *
245 * 3   11/15/10 12:40p farshidf
246 * SW3461-1: compile fix
247 *
248 * 2   9/23/10 5:39p farshidf
249 * SW3461-1: implement the new event flag
250 *
251 * 1   8/17/10 5:11p farshidf
252 * SW3461-1: initial THD code
253 *
254 * Hydra_Software_Devel/8   12/11/09 6:30p farshidf
255 * SW7550-38: code clean uo
256 *
257 *
258 ***************************************************************************/
259
260/***************************************************************************
261 * Definitions
262 ***************************************************************************/
263#ifndef _BTHD_API_H__
264#define _BTHD_API_H__
265
266#if __cplusplus
267extern "C" {
268#endif
269
270#include "bthd_def.h"
271
272#define THD_IQ_CONSTELLATION_VECTORS   30
273#define THD_SignalStrengthCalibrationFactor -6  /* Determined empirically using BCM93461DC */
274/***************************************************************************
275 * Enumerated Type Definitions (General)
276 ***************************************************************************/
277typedef enum THD_Standard
278{
279  THD_Standard_DVBT=0,
280  THD_Standard_ISDBT=1
281} THD_Standard_t;
282
283typedef enum THD_FrontEndMode
284{
285  THD_FrontEndMode_Baseband=0,
286  THD_FrontEndMode_IF=1
287} THD_FrontEndMode_t;
288
289typedef enum THD_ChannelEstimatorMode
290{
291  THD_ChannelEstimatorMode_Fixed=0,
292  THD_ChannelEstimatorMode_Pedestrian=1,
293  THD_ChannelEstimatorMode_Mobile=2,
294  THD_ChannelEstimatorMode_Auto=3
295} THD_ChannelEstimatorMode_t;
296
297typedef enum THD_FFTWindowMode
298{
299  THD_FFTWindowMode_InSpan=0,
300  THD_FFTWindowMode_OutOfSpanPost=1,
301  THD_FFTWindowMode_OutOfSpanPre=2,
302  THD_FFTWindowMode_Auto=3
303} THD_FFTWindowMode_t;
304
305typedef enum THD_CoChannelMode
306{
307  THD_CoChannelMode_None=0,
308  THD_CoChannelMode_Auto=1,
309  THD_CoChannelMode_Other=2
310} THD_CoChannelMode_t;
311
312typedef enum THD_ImpulseMode
313{
314  THD_ImpulseMode_None=0,
315  THD_ImpulseMode_Auto=1,
316  THD_ImpulseMode_Other=2
317} THD_ImpulseMode_t;
318
319typedef enum THD_Spectrum
320{
321  THD_Spectrum_Normal=0,
322  THD_Spectrum_Inverted=1
323} THD_Spectrum_t;
324
325typedef enum THD_TransGuardMode
326{
327  THD_TransGuardMode_Manual=0,
328  THD_TransGuardMode_Auto=1,
329  THD_TransGuardMode_Auto_DVBT=2,
330  THD_TransGuardMode_Auto_ISDBT=3
331} THD_TransGuardMode_t;
332
333typedef enum THD_CarrierRange
334{
335  THD_CarrierRange_Narrow=0,
336  THD_CarrierRange_Wide=1
337} THD_CarrierRange_t;
338
339typedef enum THD_FrequencyInterpolatorMode
340{
341  THD_FrequencyInterpolatorMode_InSpan=0,
342  THD_FrequencyInterpolatorMode_OutOfSpanPost=1,
343  THD_FrequencyInterpolatorMode_OutOfSpanPre_1_4=2,
344  THD_FrequencyInterpolatorMode_OutOfSpanPre_1_8=3,
345  THD_FrequencyInterpolatorMode_OutOfSpanPre_1_16=4
346} THD_FrequencyInterpolatorMode_t;
347
348typedef enum THD_TSMode
349{
350  THD_TSMode_None=0,
351  THD_TSMode_Serial=1,
352  THD_TSMode_Parallel=2
353} THD_TSMode_t;
354
355typedef enum THD_SnooperMode
356{
357  THD_SnooperMode_Ce=0,
358  THD_SnooperMode_CePwr=1,
359  THD_SnooperMode_Ne=2, 
360  THD_SnooperMode_Exp=3,
361  THD_SnooperMode_Fft=4     
362} THD_SnooperMode_t;
363
364typedef enum THD_InterpolatorMode
365{
366  THD_InterpolatorMode_Fi=0,
367  THD_InterpolatorMode_Ti=1
368} THD_InterpolatorMode_t;
369
370#define THD_3x7x_NUM_SPARE_STATUS_PARAMS (8) /* spare internal status */
371
372typedef enum THD_State
373{
374  THD_State_Init=0,
375  THD_State_SP=1,
376  THD_State_FFTTrigger=2,
377  THD_State_TPS=3,
378  THD_State_FEC=4,
379  THD_State_Track=5,
380  THD_State_CheckLock=6,
381  THD_State_ChangeChannelEstimator=7,
382  #ifdef BTHD_ISDBT_SUPPORT
383  THD_State_ChangeFFTWindow=8,
384  #endif
385  THD_State_Done=9
386} THD_State_t;
387
388/***************************************************************************
389 * Parameter Enumerated Type Definitions
390 ***************************************************************************/
391/* TPS/TMCC Parameter, Matches register definition */
392typedef enum THD_Bandwidth
393{
394  THD_Bandwidth_8MHz=0,
395  THD_Bandwidth_7MHz=1,
396  THD_Bandwidth_6MHz=2,
397  THD_Bandwidth_5MHz=3
398} THD_Bandwidth_t;
399
400/* TPS/TMCC Parameter, Matches register definition */
401typedef enum THD_TransmissionMode
402{
403  THD_TransmissionMode_2k=0,
404  THD_TransmissionMode_8k=1,
405  THD_TransmissionMode_4k=2
406} THD_TransmissionMode_t;
407
408/* TPS/TMCC Parameter, Matches register definition */
409typedef enum THD_GuardInterval
410{
411  THD_GuardInterval_1_32=0,
412  THD_GuardInterval_1_16=1,
413  THD_GuardInterval_1_8=2,
414  THD_GuardInterval_1_4=3
415} THD_GuardInterval_t;
416
417/* TPS/TMCC Parameter, Matches register definition */
418typedef enum THD_Qam
419{
420  THD_Qam_Qpsk=0,
421  THD_Qam_16Qam=1,
422  THD_Qam_64Qam=2,
423  THD_Qam_Dqpsk=3
424} THD_Qam_t;
425
426/* TPS/TMCC Parameter, Matches register definition */
427typedef enum THD_CodeRate
428{
429  THD_CodeRate_1_2=0,
430  THD_CodeRate_2_3=1,
431  THD_CodeRate_3_4=2,
432  THD_CodeRate_5_6=3,
433  THD_CodeRate_7_8=4
434} THD_CodeRate_t;
435
436/***************************************************************************
437 * DVB-T Specific Enumerated Type Definitions
438 ***************************************************************************/
439typedef enum THD_DvbtTPSMode
440{
441  THD_DvbtTPSMode_Manual=0,
442  THD_DvbtTPSMode_Auto=1
443} THD_DvbtTPSMode_t;
444
445typedef enum THD_DvbtPriorityMode
446{
447  THD_DvbtPriorityMode_High=0,
448  THD_DvbtPriorityMode_Low=1
449} THD_DvbtPriorityMode_t;
450
451/* TPS Parameter, Matches register definition */
452typedef enum THD_DvbtInterleaving
453{
454  THD_DvbtInterleaving_Native=0,
455  THD_DvbtInterleaving_InDepth=1
456} THD_DvbtInterleaving_t;
457
458/* TPS Parameter, Matches register definition */
459typedef enum THD_DvbtHierarchy
460{
461  THD_DvbtHierarchy_None=0,
462  THD_DvbtHierarchy_1=1,
463  THD_DvbtHierarchy_2=2,
464  THD_DvbtHierarchy_4=3
465} THD_DvbtHierarchy_t;
466
467/***************************************************************************
468 * ISDB-T Specific Enumerated Type Definitions
469 ***************************************************************************/
470typedef enum THD_IsdbtTMCCMode
471{
472  THD_IsdbtTMCCMode_Manual=0,
473  THD_IsdbtTMCCMode_Auto=1
474} THD_IsdbtTMCCMode_t;
475
476/* TMCC Parameter, Matches register definition */
477typedef enum THD_IsdbtTimeInt
478{
479  THD_IsdbtTimeInt_0X=0,
480  THD_IsdbtTimeInt_1X=1,
481  THD_IsdbtTimeInt_2X=2,
482  THD_IsdbtTimeInt_4X=3
483} THD_IsdbtTimeInt_t;
484
485typedef enum THD_IsdbtPr
486{
487  THD_IsdbtPr_Disable=0,
488  THD_IsdbtPr_Enable=1
489} THD_IsdbtPr_t;
490
491
492typedef enum THD_IsdbtEws
493{
494  THD_IsdbtEws_Disable=0,
495  THD_IsdbtEws_Enable=1
496} THD_IsdbtEws_t;
497
498typedef enum THD_IsdbtEwsFlag
499{
500  THD_IsdbtEwsFlag_eLockUpdate = 1,
501  THD_IsdbtEwsFlag_eUnlockStopEWS = 2, /* if this channel is unlock, stop reporting EWS */
502  THD_IsdbtEwsFlag_eLockStartEWS = 4     /* if this channel is lock, start reporting EWS */
503} THD_IsdbtEwsFlag_t;
504
505/***************************************************************************
506 * Miscellaneous Definitions
507 ***************************************************************************/
508typedef enum THD_TransGuardResult
509{
510  THD_TransGuardResult_None=0,
511  THD_TransGuardResult_NoSignal=1,
512  THD_TransGuardResult_CoChannelPresent=2
513} THD_TransGuardResult_t;
514
515typedef enum THD_AcquireResult
516{
517  THD_AcquireResult_Lock=0,
518  THD_AcquireResult_NoSignal=1,
519  THD_AcquireResult_NoOFDMFound=2,
520  THD_AcquireResult_NoFFTLock=3,
521  THD_AcquireResult_NoCarrierLock=4,
522  THD_AcquireResult_NoSPLock=5,
523  THD_AcquireResult_NoTPSLock=6,
524  THD_AcquireResult_NoFECLock=7,
525  THD_AcquireResult_BadBER=8,
526  THD_AcquireResult_InitLockState=9,
527  THD_AcquireResult_NoDVBTSignal=10,
528  THD_AcquireResult_AbortedEarly = 11
529} THD_AcquireResult_t;
530
531typedef enum THD_LockStatusBit
532{
533  THD_LockStatusBit_TPSLock=0,
534  THD_LockStatusBit_VitLock=1,
535  THD_LockStatusBit_FECLock=2,
536  THD_LockStatusBit_SystemLock=3,
537  THD_LockStatusBit_NoDVBTSignal=4
538} THD_LockStatusBit_t;
539
540#define THD_Qam_N           3
541#define THD_GuardInterval_N 4
542#define THD_CodeRate_N      5
543
544#define THD_FrequencyInterpolatorCoefLength   396
545#define THD_SNRAlpha_N 1
546#define THD_SNRAlpha_D 16
547#define THD_StatusFramesForReset 10
548#define THD_ICESpectrumInversionThreshold 8
549
550/*************************************************************************
551 * Summary:
552 *   Enumeration for analog input
553 *
554 * Description:
555 *   This enum specifies analog audio input options for the IFD decoder. This
556 *   only applies to IFD core in cases where this PI controls both ofdm and
557 *   analog video receiver.
558 *
559 * See Also:
560 *   None.
561 *
562 ***************************************************************************/
563typedef enum THD_AnalogInput {
564  THD_AnalogInput_eIf = 0,              /* Audio input with IF signal */
565  THD_AnalogInput_eSif_1 = 0x80 /* Audio input from SIF Channel 1 */
566} THD_AnalogInput;
567
568
569/*************************************************************************
570 * Summary:
571 *   Enumeration for power status
572 *
573 * See Also:
574 *   None.
575 *
576 ***************************************************************************/
577typedef enum THD_PowerStatus
578{
579    THD_ePower_Off = 0,
580    THD_ePower_On  = 1,
581    THD_ePower_Unknown = 0xFF
582}  THD_PowerStatus;
583
584
585/*************************************************************************
586 * Summary:
587 *   Set Param type
588 *
589 * See Also:
590 *   None.
591 *
592 ***************************************************************************/
593typedef enum THD_Params_Request_Type_s
594{
595  THD_eParams_Request_Type_Common =1,
596  THD_eAcquireParams_Request_Type_Common =THD_eParams_Request_Type_Common,
597  THD_eStatus_Request_Type_Common =THD_eParams_Request_Type_Common,
598
599  THD_eParams_Request_Type_Dvbt =2,
600  THD_eAcquireParams_Request_Type_Dvbt =THD_eParams_Request_Type_Dvbt,
601  THD_eStatus_Request_Type_Dvbt =THD_eParams_Request_Type_Dvbt,
602
603  THD_eParams_Request_Type_Isdbt =3,
604  THD_eAcquireParams_Request_Type_Isdbt =THD_eParams_Request_Type_Isdbt,
605  THD_eStatus_Request_Type_Isdbt =THD_eParams_Request_Type_Isdbt,
606
607  THD_eParams_Request_Type_Internal_Dvbt =4,
608  THD_eAcquireParams_Request_Type_Internal_Dvbt =THD_eParams_Request_Type_Internal_Dvbt,
609  THD_eStatus_Request_Type_Internal_Dvbt        =THD_eParams_Request_Type_Internal_Dvbt,
610
611  THD_eParams_Request_Type_Internal_Isdbt =5,
612  THD_eAcquireParams_Request_Type_Internal_Isdbt =THD_eParams_Request_Type_Internal_Isdbt,
613  THD_eStatus_Request_Type_Internal_Isdbt        =THD_eParams_Request_Type_Internal_Isdbt
614
615} THD_Params_Request_Type_t, THD_Status_Request_Type_t, THD_AcquireParams_Request_Type_t;
616
617/*************************************************************************
618 * Summary:
619 *  BBS Enum
620 *
621 * See Also:
622 *   None.
623 *
624 ***************************************************************************/
625
626typedef enum THD_AcquireMode_s
627{
628    THD_AcquireMode_Auto = 1,
629        THD_AcquireMode_Manual = 2,
630        THD_AcquireMode_ResetStatus = 4,
631        THD_AcquireMode_Scan = 8
632} THD_AcquireMode_t;
633
634typedef enum THD_NexusStatusMode
635{
636  THD_NexusStatusMode_EnableStatusForNexus = 1
637} THD_NexusStatusMode_t;
638/*************************************************************************
639 * Summary:
640 *   Structure for chip-specific Acquire Parameters
641 *   
642 * Description:
643 *   This is the chip-specific component of the Thd Acquire command. It maps
644 *   byte for byte to the acquire parameter inside the chip's firmware
645 *     
646 * See Also:
647 *   None.
648 *     
649 ***************************************************************************/
650
651typedef struct THD_DvbtAcquireParam_s
652{
653  THD_DvbtTPSMode_t               TPSMode;
654  THD_DvbtPriorityMode_t          PriorityMode;
655  THD_Qam_t                       Qam;
656  THD_DvbtHierarchy_t             Hierarchy;
657  THD_CodeRate_t                  CodeRateHP;
658  THD_CodeRate_t                  CodeRateLP;
659} THD_DvbtAcquireParam_t;
660
661typedef struct THD_IsdbtAcquireParam_s
662{
663  THD_IsdbtTMCCMode_t             TMCCMode;
664  THD_IsdbtPr_t                   Pr;
665  THD_Qam_t                       Qam[3];
666  THD_CodeRate_t                  CodeRate[3];
667  THD_IsdbtTimeInt_t              TimeInt[3];
668  uint32_t                        Segments[3];
669} THD_IsdbtAcquireParam_t;
670
671typedef struct THD_InternalAcquireParam_s
672{
673  THD_FrontEndMode_t              FrontEndMode;
674  THD_ChannelEstimatorMode_t      ChannelEstimatorMode;
675  THD_FFTWindowMode_t             FFTWindowMode;
676  THD_ImpulseMode_t               ImpulseMode;
677  THD_TSMode_t                    TSMode;
678  uint32_t                         SampleFreq;
679  uint32_t                         TransGuardMaxThreshold;
680  uint32_t                         TransGuardMaxMinRatioThreshold[4];
681  bool                             AllowRsSyncEvent; 
682    bool                             AbortAcquireRequested;  /* Acquire Abort-Early flag */
683  BKNI_EventHandle                 hCurrAbortableEventHandle; /* Event pending/triggered when an Abort-Early condition occurs */
684#ifdef SmartNotchEnabled 
685  bool                                                                                                          SmartNotchPresent;
686#endif
687} THD_InternalAcquireParam_t;
688
689typedef struct THD_InternalStatus_s
690{
691   THD_CoChannelMode_t            CoChannelMode;     
692   THD_FFTWindowMode_t            FFTWindowMode;       
693   THD_ChannelEstimatorMode_t     ChannelEstimatorMode; 
694   uint32_t                        LowICECount;       
695} THD_InternalStatus_t;
696
697
698typedef struct THD_CommonAcquireParam_s
699{
700  volatile THD_AcquireMode_t      AcquireMode;
701  volatile THD_NexusStatusMode_t  NexusStatusMode;
702  THD_Standard_t                  Standard;
703  THD_Bandwidth_t                 Bandwidth;
704  uint32_t                         CenterFreq;
705  THD_TransGuardMode_t            TransGuardMode;
706  THD_TransmissionMode_t          TransmissionMode;
707  THD_GuardInterval_t             GuardInterval;
708  THD_CoChannelMode_t             CoChannelMode;
709  THD_CarrierRange_t              CarrierRange;
710}THD_CommonAcquireParam_t;
711
712#ifdef BTHD_ISDBT_SUPPORT
713typedef struct THD_IsdbtLocalParam_s
714{
715  bool                                  set_a;
716  bool                                  set_b;
717  bool                                  set_c;
718  bool                                  clr_a;
719  bool                                  clr_b;
720  bool                                  clr_c;
721  bool                                  phase;
722/*  bool                                        fallback; */ /* pedestrial fallback flag */ 
723  THD_IsdbtEwsFlag_t    EwsFlag;
724}THD_IsdbtLocalParam_t;
725#endif
726/* This is the acquire params kept by the driver */
727typedef struct THD_3x7x_AcquireParam_s
728{
729  THD_CommonAcquireParam_t   CommonAcquireParam;
730  THD_DvbtAcquireParam_t          DvbtAcquireParam;
731#ifdef BTHD_ISDBT_SUPPORT
732  THD_IsdbtAcquireParam_t         IsdbtAcquireParam;
733  THD_IsdbtLocalParam_t         IsdbtLocaleParam;
734#endif
735} THD_3x7x_AcquireParam_t;
736       
737/***************************************************************************
738 * Summary:
739 *   Structure for THD status
740 *   
741 * Description:
742 *   This structure contains THD status that is return by the chip
743 *     
744 * See Also:
745 *   None.
746 *     
747 ***************************************************************************/
748
749typedef struct THD_DvbtStatus_s
750{
751  THD_Qam_t              Qam;
752  THD_CodeRate_t         CodeRateHP;
753  THD_CodeRate_t         CodeRateLP;
754  THD_DvbtHierarchy_t    Hierarchy;
755  THD_DvbtInterleaving_t Interleaving;
756  THD_DvbtPriorityMode_t Priority;
757  int32_t                 SNRData;
758  uint32_t                CellID;
759  uint32_t                PreVitBER;
760  uint32_t                VitBER;
761  uint32_t                TS_PER;
762  uint32_t                TS_ESR;
763  uint32_t                TS_CERC;
764  uint32_t                TS_UBERC;
765  uint32_t                TS_CBERC;
766  uint32_t                TS_NBERC;
767  uint32_t                TS_TBERC;
768  uint32_t                TS_UFERC;
769  uint32_t                TS_NFERC;
770  uint32_t                TS_TFERC;
771  uint32_t                TS_CERC_ref;
772  uint32_t                TS_UBERC_ref;
773  uint32_t                TS_CBERC_ref;
774  uint32_t                TS_NBERC_ref;
775  uint32_t                TS_TBERC_ref;
776  uint32_t                TS_UFERC_ref;
777  uint32_t                TS_NFERC_ref;
778  uint32_t                TS_TFERC_ref;
779} THD_DvbtStatus_t;
780
781typedef struct THD_IsdbtStatus_s
782{
783  THD_Qam_t              Qam[3];
784  THD_CodeRate_t         CodeRate[3];
785  THD_IsdbtTimeInt_t     TimeInt[3];
786  THD_IsdbtPr_t          Pr;
787  THD_IsdbtEws_t         Ews;
788  uint32_t               Segments[3];
789  int32_t                SNRData[3];
790  uint32_t               TS_UFERC;
791  uint32_t               TS_NFERC;
792  uint32_t               TS_TFERC;
793  uint32_t               TS_UFERC_ref;
794  uint32_t               TS_NFERC_ref;
795  uint32_t               TS_TFERC_ref;
796  uint32_t               TS_ESR;
797  uint32_t               VitBER[3];   
798  uint32_t               TS_PER[3];
799  uint32_t               TS_CERC[3];
800  uint32_t               TS_UBERC[3];
801  uint32_t               TS_CBERC[3];
802  uint32_t               TS_NBERC[3];
803  uint32_t               TS_TBERC[3];
804  uint32_t               TS_CERC_ref[3];
805  uint32_t               TS_UBERC_ref[3];
806  uint32_t               TS_CBERC_ref[3];
807  uint32_t               TS_NBERC_ref[3];
808  uint32_t               TS_TBERC_ref[3];
809} THD_IsdbtStatus_t;
810
811typedef struct THD_3x7x_Status_s
812{
813  THD_AcquireMode_t           AcquireMode;
814  uint32_t                    Lock;
815  THD_Bandwidth_t             Bandwidth;
816  THD_TransmissionMode_t     TransmissionMode;
817  THD_GuardInterval_t        GuardInterval;
818  int32_t                     CarrierOffset;
819  int32_t                     TimingOffset;
820  uint32_t                    RagcGain;
821  uint32_t                    IagcGain;
822  int32_t                     DagcGain;
823  int32_t                     SNR;
824  int32_t                     SNRPilot;
825  uint32_t                    ReacquireCount;
826  uint32_t                    AcquisitionTime;
827  THD_Spectrum_t             Spectrum;
828  THD_ChannelEstimatorMode_t ChannelEstimatorMode;
829  THD_FFTWindowMode_t        FFTWindowMode;
830  THD_CoChannelMode_t        CoChannelMode;
831  uint32_t                    CoChannelPresent;
832  uint32_t                    LowICECount;
833  uint32_t                    ChannelSpan;
834  int32_t                     FFTTriggerOffset;
835  int32_t                     FFTTriggerSlope;
836  uint32_t                    spare[THD_3x7x_NUM_SPARE_STATUS_PARAMS];
837  THD_PowerStatus                         PowerStatus;                     /* channel power (on/off) status */
838  THD_DvbtStatus_t            DvbtStatus;
839  int32_t                     SignalStrength;
840#ifdef BTHD_ISDBT_SUPPORT
841  THD_IsdbtStatus_t          IsdbtStatus;
842#endif
843  int32_t                     FFTTriggerMissed;
844  int32_t                     FFTTriggerOutOfSpan; 
845  int32_t                     FFTTriggerInSpan;       
846  int32_t                     FFTTriggerOnGuard; 
847  uint32_t                    FECLock;
848  uint32_t                    NoSignal;
849  uint32_t                    Ssi;
850  uint32_t                    Sqi;
851} THD_3x7x_Status_t;
852
853
854
855/***************************************************************************
856                                                        Callback from THD to Tuner Info
857****************************************************************************/
858
859
860
861
862/***************************************************************************
863 * Summary:
864 *   Structure for chip-specific THD handle
865 *   
866 * Description:
867 *   This is the chip-specific component of the BTHD_3x7x_Handle.
868 *     
869 * See Also:
870 *   None.
871 *     
872 ***************************************************************************/
873typedef struct BTHD_3x7x_P_Handle
874{
875  BREG_Handle                                   hRegister;         /* handle used to access AP registers */
876  BCHP_Handle                                   hChip;
877  BINT_Handle                                   hInterrupt;
878  THD_3x7x_AcquireParam_t               *pAcquireParam;
879  THD_InternalAcquireParam_t    *pInternalAcquireParam;
880  THD_3x7x_Status_t                             *pStatus;
881  BTMR_Handle                                   hTmr;          /* user settings */
882  BTMR_TimerHandle                              hTimer;
883  BTMR_TimerHandle                              hBBSTimer;
884  THD_AnalogInput                               eAnalogInput;
885  uint32_t                                              ThdLockStatus;
886  uint32_t                                              LockStatusTracking;
887  BTHD_CallbackFunc                             pCallback[BTHD_Callback_eLast];
888  void                                             *pCallbackParam[BTHD_Callback_eLast];
889  bool                                              AutoAcquireMasked;
890
891  /* THD code callbacks */
892  BKNI_EventHandle                              hFwCorrMaxEvent;
893  BKNI_EventHandle                              hFwSyncEvent;
894  BKNI_EventHandle                              hSpSyncEvent;
895  BKNI_EventHandle                              hTpsSyncEvent;
896  BKNI_EventHandle                              hFecSyncEvent;
897  BKNI_EventHandle                              hFbcntZeroEvent;
898  BKNI_EventHandle                              hRsSyncEvent; 
899  BKNI_EventHandle                              hLockEvent; 
900  BKNI_EventHandle                              hEWSEvent;
901  BKNI_EventHandle                              hInterruptEvent;
902  BKNI_EventHandle                              hBBSInterruptEvent;
903#ifdef BTHD_ISDBT_SUPPORT
904  BKNI_EventHandle                              hTmccSyncEvent;
905  BINT_CallbackHandle                   hTmccSyncCallback;
906  BINT_CallbackHandle                   hRsSyncBCallback;
907  BINT_CallbackHandle                   hRsSyncLossBCallback;
908  BINT_CallbackHandle                   hRsSyncCCallback;
909  BINT_CallbackHandle                   hRsSyncLossCCallback;
910  uint32_t                                              *pIsdbtMemory;
911#endif
912  BINT_CallbackHandle                   hFwCorrMaxCallback;
913  BINT_CallbackHandle                   hFwSyncCallback;
914  BINT_CallbackHandle                   hSpSyncCallback;
915  BINT_CallbackHandle                   hTpsSyncCallback;
916  BINT_CallbackHandle                   hFecSyncCallback;
917  BINT_CallbackHandle                   hFbcCntCallback;
918  BINT_CallbackHandle                   hRsSyncCallback;
919  BINT_CallbackHandle                   hRsSyncLossCallback;
920
921} BTHD_3x7x_P_Handle;
922
923typedef struct BTHD_3x7x_P_Handle *BTHD_3x7x_Handle;
924
925/****************************************************************
926 * API function interface
927 ****************************************************************/
928BERR_Code BTHD_3x7x_Open(BTHD_Handle *, BCHP_Handle, void*, BINT_Handle, const struct BTHD_Settings*);
929BERR_Code BTHD_3x7x_Close(BTHD_Handle);
930BERR_Code BTHD_3x7x_InitializeParams(BTHD_Handle, const uint8_t *, uint32_t);
931BERR_Code BTHD_3x7x_Acquire(BTHD_Handle, const BTHD_InbandParams *);
932BERR_Code BTHD_3x7x_GetStatus( BTHD_Handle, BTHD_THDStatus *);
933BERR_Code BTHD_3x7x_GetInterruptEventHandle(BTHD_Handle, BKNI_EventHandle*);
934BERR_Code BTHD_3x7x_GetBBSInterruptEventHandle(BTHD_Handle, BKNI_EventHandle*);
935BERR_Code BTHD_3x7x_GetEWSEventHandle(BTHD_Handle h, BKNI_EventHandle* hEvent);
936BERR_Code BTHD_3x7x_ProcessInterruptEvent(BTHD_Handle);
937BERR_Code BTHD_3x7x_ProcessBBSInterruptEvent(BTHD_Handle);
938BERR_Code BTHD_3x7x_Acquire(BTHD_Handle, const BTHD_InbandParams *);
939BERR_Code BTHD_3x7x_GetLockStatus(BTHD_Handle, BTHD_LockStatus *);
940BERR_Code BTHD_3x7x_ResetStatus(BTHD_Handle);
941BERR_Code BTHD_3x7x_GetLockStateChangeEvent(BTHD_Handle, BKNI_EventHandle*);
942BERR_Code BTHD_3x7x_GetDefaultInbandParams(BTHD_InbandParams *);
943BERR_Code BTHD_3x7x_GetConstellation(BTHD_Handle, int16_t *,int16_t *); 
944BERR_Code BTHD_3x7x_PowerDown(BTHD_Handle);
945BERR_Code BTHD_3x7x_PowerUp(BTHD_Handle h);
946BERR_Code BTHD_3x7x_P_TNR_callback(BTHD_3x7x_Handle h, uint16_t Mode, int16_t *Gain, uint16_t *SmartTune, uint32_t      *RF_Freq);
947BERR_Code BTHD_3x7x_InstallCallback(BTHD_Handle, BTHD_Callback, BTHD_CallbackFunc, void *); 
948                                               
949
950#define BREG_WriteField(h, Register, Field, Data) \
951  BREG_Write32(h, BCHP_##Register, ((BREG_Read32(h, BCHP_##Register) & \
952  ~((uint32_t)BCHP_MASK(Register, Field))) | \
953  BCHP_FIELD_DATA(Register, Field, Data)))
954
955
956#define BREG_ReadField(h, Register, Field) \
957  ((((BREG_Read32(h, BCHP_##Register)) & BCHP_MASK(Register,Field)) >> \
958  BCHP_SHIFT(Register,Field)))
959
960
961/****************************************************************
962 * Internal define and functions calls
963 ***************************************************************/
964/*Event definitions - match THD_CORE_STATUS bit locations  */
965#define THD_EVENT_FFT_SYNC         0
966#define THD_EVENT_SP_SYNC          1
967#define THD_EVENT_TPS_SYNC         3
968#define THD_EVENT_TMCC_SYNC        6
969#define THD_EVENT_VIT_SYNC         9
970#define THD_EVENT_FEC_SYNC        11
971#define THD_EVENT_TS_ONE_PKT      14
972#define THD_EVENT_FSCNT_ZERO      17
973#define THD_EVENT_FBCNT_ZERO      18
974#define THD_EVENT_FW_CORR_MAX_RDY 21
975#define THD_EVENT_RS_SYNC                 32
976#define THD_EVENT_RS_SYNC_LOSS    33
977#define THD_EVENT_RS_SYNC_B               34
978#define THD_EVENT_RS_SYNC_B_LOSS  35
979#define THD_EVENT_RS_SYNC_C               36
980#define THD_EVENT_RS_SYNC_C_LOSS  37
981
982
983
984#ifdef __cplusplus
985}
986#endif
987
988#endif /* THD_API_H__ */
Note: See TracBrowser for help on using the repository browser.