source: svn/trunk/newcon3bcm2_21bu/magnum/portinginterface/vsb/bvsb.h

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

first commit

  • Property svn:executable set to *
File size: 75.3 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2004-2010, Broadcom Corporation
3 *     All Rights Reserved
4 *     Confidential Property of Broadcom Corporation
5 *
6 *  THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE
7 *  AGREEMENT  BETWEEN THE USER AND BROADCOM.  YOU HAVE NO RIGHT TO USE OR
8 *  EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
9 *
10 * $brcm_Workfile: bvsb.h $
11 * $brcm_Revision: Hydra_Software_Devel/39 $
12 * $brcm_Date: 4/6/10 10:12a $
13 *
14 * [File Description:]
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/portinginterface/vsb/bvsb.h $
19 *
20 * Hydra_Software_Devel/39   4/6/10 10:12a dliu
21 * SW3548-2803: Add bit to allow IFD control of AGC pins in SIF mode
22 *
23 * Hydra_Software_Devel/38   3/17/10 10:58a dliu
24 * SW3548-2803: Allow app to set agc pins to delta sigma mode after close
25 *
26 * Hydra_Software_Devel/37   3/3/10 12:13p dliu
27 * SW3548-2803: Add option to change delta sigma to open drain mode
28 *
29 * Hydra_Software_Devel/36   6/9/09 2:01p dliu
30 * PR55857: Add error code for sending wrong status command
31 *
32 * Hydra_Software_Devel/35   5/19/09 11:04a dliu
33 * PR55183: Add OOB lock interrupts
34 *
35 * Hydra_Software_Devel/34   5/15/09 4:18p dliu
36 * PR53570: Add option for fast/slow acquisition
37 *
38 * Hydra_Software_Devel/33   3/24/09 3:37p dliu
39 * PR53219: Add OOB control for 3520
40 *
41 * Hydra_Software_Devel/32   2/17/09 4:33p dliu
42 * PR52131: Add medium deviation
43 *
44 * Hydra_Software_Devel/31   1/12/09 2:19p dliu
45 * PR50693: Change arguments to SetPgaGain
46 *
47 * Hydra_Software_Devel/30   11/24/08 4:31p dliu
48 * PR49627: Add high deviation
49 *
50 * Hydra_Software_Devel/29   11/12/08 6:05p dliu
51 * PR47770: prepend e in front of the enum
52 *
53 * Hydra_Software_Devel/28   11/12/08 6:02p dliu
54 * PR47770: Change from Pga_Gain to PgaGain
55 *
56 * Hydra_Software_Devel/27   11/12/08 5:25p dliu
57 * PR47770: Add interface for PGA gain
58 *
59 * Hydra_Software_Devel/26   10/23/08 3:49p dliu
60 * PR48016: Move IFD code to MIPS
61 *
62 * Hydra_Software_Devel/25   10/20/08 11:31a dliu
63 * PR47770: PR47770:Add PGA interface
64 *
65 * Hydra_Software_Devel/PR47770/1   10/10/08 7:38p jerryy
66 * PR47770:Add PGA interface
67 *
68 * Hydra_Software_Devel/24   9/29/08 4:48p dliu
69 * PR46516: Add dynamic power management function
70 *
71 * Hydra_Software_Devel/23   5/7/08 4:49p dliu
72 * PR38953: Modify Jon's new changes base on Beijing's team's feedback
73 *
74 * Hydra_Software_Devel/22   5/1/08 6:11p dliu
75 * PR38953: Pull in changes from 3563 branches
76 *
77 * Hydra_Software_Devel/21   1/24/07 1:06p dliu
78 * PR27326: Added QAM128 and QAM 512 Modes
79 *
80 * Hydra_Software_Devel/20   11/28/06 4:29p dliu
81 * PR23867: Update change from 3563
82 *
83 * Hydra_Software_Devel/19   11/14/06 11:24a dliu
84 * PR25214: Added BCHP_GetChipRevision function header
85 *
86 * Hydra_Software_Devel/18   7/5/06 7:28p vle
87 * PR 22314, PR 19529: Add symbol rate into Inband params for QAM Annex A
88 *
89 * Hydra_Software_Devel/17   6/23/06 2:40p dliu
90 * PR22314: Added Symbolrate to QAM input parameters
91 *
92 * Hydra_Software_Devel/16   4/14/06 11:53a dliu
93 * PR20936: Add weak/noisy signal status in NTSC Status
94 *
95 * Hydra_Software_Devel/15   4/14/06 11:44a dliu
96 * PR20936: Minor bug fixes from adding audio status
97 *
98 * Hydra_Software_Devel/14   4/14/06 11:42a dliu
99 * PR20936: Added audio status to NTSCStatus
100 *
101 * Hydra_Software_Devel/13   10/6/05 4:14p dliu
102 * PR17430: Added IF AGC/SNR control for video kill
103 *
104 * Hydra_Software_Devel/12   9/28/05 1:09p dliu
105 * PR 17253: Added IFD weak signal detection and chroma kill
106 *
107 * Hydra_Software_Devel/11   5/23/05 10:23a enavarro
108 * PR 15567: changed units for if_agc/rf_agc to 1/10 percent
109 *
110 * Hydra_Software_Devel/10   3/29/05 9:50a enavarro
111 * PR 14240: renamed ifFreq in BVSB_NtscStatus struct to pixCarrFreq
112 *
113 * Hydra_Software_Devel/9   3/5/05 9:07a enavarro
114 * PR 14005: added BVSB_GetSettings() and BVSB_SetSettings()
115 *
116 * Hydra_Software_Devel/8   2/1/05 2:40p enavarro
117 * PR 14005: fixed function names ResetOobStatus and SetBtscVolume
118 *
119 * Hydra_Software_Devel/7   2/1/05 10:20a enavarro
120 * PR 14005: added comments
121 *
122 * Hydra_Software_Devel/6   2/1/05 9:42a enavarro
123 * PR 14005: pass in BINT_Handle to BVSB_Open()
124 *
125 * Hydra_Software_Devel/5   1/26/05 11:58a enavarro
126 * PR 13901: added bBypassFEC to BVSB_OobSettings struct
127 *
128 * Hydra_Software_Devel/4   10/21/04 4:22p erickson
129 * PR12857: separated BVSB_Settings from typedef to avoid compile warnings
130 * due to circular reference
131 *
132 * Hydra_Software_Devel/3   10/20/04 4:17p enavarro
133 * PR 12857: updates to OOB_STATUS HAB command format
134 *
135 * Hydra_Software_Devel/2   10/1/04 3:25p brianlee
136 * PR12857: Modified code to comform to magnum coding convention.
137 *
138 ***************************************************************************/
139
140/*================== Module Overview =====================================
141<verbatim>
142The BVSB portinginterface controls the front-end block on any Broadcom chip
143that has a VSB core, such as BCM3520 and BCM3560.  BVSB PI may also decode
144other signals such as QAM, NTSC, and/or OOB, depending on the capabilities
145of the VSB chip.  The VSB core contains an Acquisition Processor (AP) that
146is responsible for channel acquisition and status.  The BVSB PI controls
147the AP by writing commands to an internal dual-access Host Access Buffer
148(HAB).  The AP services the HAB command and returns any response data back
149onto the HAB.
150
151The magnum/portinginterface/vsb/bvsb.h header file defines a standard VSB
152front-end API for all Broadcom VSB chips.  The implementation of the API for
153each chip is in the magnum/portinginterface/vsb/<chip> directory. 
154
155
156Interrupt Requirements
157The application needs to call BVSB_HandleInterrupt_isr() when it receives
158the VSB L1 interrupt.
159
160
161Sample Code
162//
163// NOTE: This is sample code for a system that contains dual-channel VSB
164//       using BCM3560 and BCM3520.  This code does not do any error
165//       checking.
166//
167#include "bvsb.h"
168#include "bvsb_3520.h"
169#include "bvsb_3560.h"
170
171static BVSB_Handle      hVSB1;  // handle for BCM3560 VSB core
172static BVSB_Handle      hVSB2;  // handle for BCM3520 VSB core
173static BCHP_Handle      hCHP;
174static BREG_I2C_Handle  hReg;
175
176// These are pointers to AP microcode used in BCM3560/BCM3520. 
177// The microcode will vary depending on chip/board/customer, so it is not
178// part of the BVSB PI.
179extern const uint8_t *pBcm3520ApImage;
180extern const uint8_t *pBcm3560ApImage;
181
182void main(void)
183{
184   BVSB_Settings     settings1, settings2;
185   BVSB_InbandParams inbandParams;
186
187   // do initialization
188   // (get BCHP_Handle, BREG_I2C_Handle, etc)
189   ...
190
191   // BVSB initialization for BCM3560
192   BVSB_3560_GetDefaultSettings(&settings1);
193   BVSB_Open(&hVSB, hChip, hReg, &settings);
194
195   // enable the BCM3560 VSB host interrupt and map that interrupt to a function
196   // that will call the BVSB PI function BVSB_HandleInterrupt_isr()
197   ...
198
199   // BVSB initialization for BCM3520
200   BVSB_3520_GetDefaultSettings(&settings2);
201   settings2.i2c.chipAddr = BCM3520_I2C_ADDR;
202   settings2.i2c.interruptEnableFunc = bcm3520_enable_irq;
203   settings2.i2c.interruptEnableFuncParam = NULL;
204
205   // enable the BCM3520 host interrupt and map that interrupt to a function
206   // that will call the BVSB PI function BVSB_HandleInterrupt_isr()
207   ...
208
209   // start a thread that runs bcm3520_background()
210   ...
211
212   // download the BCM3520 microcode and run the AP
213   BVSB_InitAp(hVSB1, pBcm3560ApImage);
214   BVSB_InitAp(hVSB2, pBcm3520ApImage);
215
216   // tune the tuner
217   ...
218
219   // acquire 8VSB on BCM3560
220   inbandParams1.mode = BVSB_InbandMode_e8VSB;
221   inbandParams1.symbolRateOffset = 0;
222   inbandParams1.ifFreqOffset = 0;
223   BVSB_AcquireInband(hVSB1, &inbandParams1);
224   
225   // acquire 64-QAM Annex B on BCM3520
226   inbandParams1.mode = BVSB_InbandMode_e64QAM_B;
227   inbandParams1.symbolRateOffset = 0;
228   inbandParams1.ifFreqOffset = 0;   
229   BVSB_AcquireInband(hVSB2, &inbandParams2);
230
231   ...
232
233   close_vsb:
234   // disable VSB L1 interrupts
235   // terminate bcm3520_background task
236   ...
237   BVSB_Close(hVSB1);
238   BVSB_Close(hVSB2);
239
240   program_done:
241   ...
242}
243
244// The application must call BVSB_ProcessInterruptEvent() every time the VSB
245// interrupt event is set.
246void bcm3520_background()
247{
248   // get handle to the BCM3520 interrupt event
249   BVSB_GetInterruptEventHandle(hVSB, &event);
250
251   while (1)
252   {
253      BKNI_WaitForEvent(event, BKNI_INFINTE);
254      BVSB_ProcessInterruptEvent(hVSB);
255   }
256}
257
258
259// This is an example of a callback function for enabling/disabling the L1
260// interrupt.
261void vsb_enable_irq(bool b, void *p)
262{
263   if (b)
264      CPUINT1_Enable(VSB_IRQ);   // enable the L1 interrupt
265   else
266      CPUINT1_Disable(VSB_IRQ);  // disable the L1 interrupt
267}
268</verbatim>
269========================================================================*/
270
271#ifndef BVSB_H__
272#define BVSB_H__
273
274#ifdef __cplusplus
275extern "C" {
276#endif
277
278#include "bchp.h"
279#include "bkni.h"
280#include "bint.h"
281#include "btmr.h"
282#include "berr_ids.h"
283#include "bfmt.h"
284
285
286/***************************************************************************
287Summary:
288        BVSB error codes
289
290Description:
291
292See Also:
293
294****************************************************************************/
295#define BVSB_ERR_AP_FAIL       BERR_MAKE_CODE(BERR_VSB_ID, 0)  /* This is a BERR_Code to indicate that host was unable to reset/idle/run the AP. */
296#define BVSB_ERR_HOST_XFER     BERR_MAKE_CODE(BERR_VSB_ID, 1)  /* This is a BERR_Code to indicate a host transfer error (underrun/overrun). */
297#define BVSB_ERR_IOMB_XFER     BERR_MAKE_CODE(BERR_VSB_ID, 2)  /* This is a BERR_Code to indicate an IO Mailbox ISB transfer error. */
298#define BVSB_ERR_MEMAV         BERR_MAKE_CODE(BERR_VSB_ID, 3)  /* This is a BERR_Code to indicate a memory access violation. */
299#define BVSB_ERR_AP_EEPROM     BERR_MAKE_CODE(BERR_VSB_ID, 4)  /* This is a BERR_Code to indicate no i2c ack from EEPROM. */
300#define BVSB_ERR_AP_NOT_INIT   BERR_MAKE_CODE(BERR_VSB_ID, 5)  /* This is a BERR_Code to indicate that the AP has failed to initialize. */
301#define BVSB_ERR_HABAV         BERR_MAKE_CODE(BERR_VSB_ID, 6)  /* This is a BERR_Code to indicate an HAB access violation. */
302#define BVSB_ERR_HAB_NOT_AVAIL BERR_MAKE_CODE(BERR_VSB_ID, 7)  /* This is a BERR_Code to indicate that the HAB is busy. */
303#define BVSB_ERR_HAB_ERR       BERR_MAKE_CODE(BERR_VSB_ID, 8)  /* This is a BERR_Code to indicate an HAB command format error. */
304#define BVSB_ERR_HAB_NO_ACK    BERR_MAKE_CODE(BERR_VSB_ID, 9)  /* This is a BERR_Code to indicate that the HAB command was not processed by AP. */
305#define BVSB_ERR_HAB_FAIL      BERR_MAKE_CODE(BERR_VSB_ID, 10) /* This is a BERR_Code to indicate bad/unexpected HAB data read. */
306#define BVSB_ERR_AP_HABAV      BERR_MAKE_CODE(BERR_VSB_ID, 11) /* This is a BERR_Code to indicate an AP-internal error. */
307#define BVSB_ERR_AP_COPY       BERR_MAKE_CODE(BERR_VSB_ID, 12) /* This is a BERR_Code to indicate an AP-internal error. */
308#define BVSB_ERR_AP_IRQ        BERR_MAKE_CODE(BERR_VSB_ID, 13) /* This is a BERR_Code to indicate an AP-internal error. */
309#define BVSB_ERR_AP_SCR        BERR_MAKE_CODE(BERR_VSB_ID, 14) /* This is a BERR_Code to indicate an AP-internal error. */
310#define BVSB_ERR_AP_ISB        BERR_MAKE_CODE(BERR_VSB_ID, 15) /* This is a BERR_Code to indicate an AP-internal error. */
311#define BVSB_ERR_AP_WD         BERR_MAKE_CODE(BERR_VSB_ID, 16) /* This is a BERR_Code to indicate an AP-internal error. */
312#define BVSB_ERR_AP_STACK      BERR_MAKE_CODE(BERR_VSB_ID, 17) /* This is a BERR_Code to indicate an AP-internal error. */
313#define BVSB_ERR_AP_BSC        BERR_MAKE_CODE(BERR_VSB_ID, 18) /* This is a BERR_Code to indicate an AP-internal error. */
314#define BVSB_ERR_IOMB_BUSY     BERR_MAKE_CODE(BERR_VSB_ID, 19) /* This is a BERR_Code to indicate the IO MBOX was busy. */
315#define BVSB_ERR_HAB_TIMEOUT   BERR_MAKE_CODE(BERR_VSB_ID, 20) /* This is a BERR_Code to indicate an HAB timeout. */
316#define BVSB_ERR_AP_UNKNOWN    BERR_MAKE_CODE(BERR_VSB_ID, 21) /* This is a BERR_Code to indicate an AP-internal error. */
317#define BVSB_ERR_MI2C_NO_ACK   BERR_MAKE_CODE(BERR_VSB_ID, 22) /* This is a BERR_Code to indicate no ack from i2c slave device (e.g. tuner). */
318#define BVSB_ERR_POWER_DOWN   BERR_MAKE_CODE(BERR_VSB_ID, 23) /* This is a BERR_Code to indicate that an API was called while cores are powered down */
319#define BVSB_ERR_INVALID_ANALOG_MODES   BERR_MAKE_CODE(BERR_THD_ID, 0x18) /* This is a BERR_Code to indicate the video and audio modes selected is not valid */ 
320#define BVSB_ERR_INVALID_STATUS_CALL    BERR_MAKE_CODE(BERR_THD_ID, 0x19) /* This is a BERR_Code to indicate the caller is requesting a status for a mode that is different the one the receiver is currently in */
321
322
323
324/***************************************************************************
325Summary:
326        The handle for vsb module.
327
328Description:
329        This is an opaque handle that is used to access the BVSB API.
330
331See Also:
332        BVSB_Open()
333
334****************************************************************************/
335typedef struct BVSB_P_Handle *BVSB_Handle;
336
337/***************************************************************************
338Summary:
339        Enumeration for phase loop bandwidth
340
341Description:
342        This enum specifies the phase tracking loop bandwidth.
343
344See Also:
345        None.
346
347****************************************************************************/
348typedef enum BVSB_PhaseLoopBw
349{
350   BVSB_PhaseLoopBw_eLow,     /* lower loop bandwidth */
351   BVSB_PhaseLoopBw_eMedium,  /* medium loop bandwidth */
352   BVSB_PhaseLoopBw_eHigh     /* higher loop bandwidth */
353} BVSB_PhaseLoopBw;
354
355
356/***************************************************************************
357Summary:
358        Enumeration for QAM interleave depth.
359
360Description:
361        This enum specifies the interleaver depth in the QAM receiver.
362
363See Also:
364        None.
365
366****************************************************************************/
367typedef enum BVSB_IDepth
368{
369   BVSB_IDepth_e204_1 = 0,  /* (204,1) */
370   BVSB_IDepth_e102_2,      /* (102,2) */
371   BVSB_IDepth_e68_3,       /* (68,3)  */
372   BVSB_IDepth_e51_4,       /* (51,4)  */
373   BVSB_IDepth_e34_6,       /* (34,6)  */
374   BVSB_IDepth_e17_12,      /* (17,12) */
375   BVSB_IDepth_e12_17,      /* (12,17) */
376   BVSB_IDepth_e6_34,       /* (6,34)  */
377   BVSB_IDepth_e4_51,       /* (4,51)  */
378   BVSB_IDepth_e3_68,       /* (3,68)  */
379   BVSB_IDepth_e2_102,      /* (2,102) */
380   BVSB_IDepth_e1_204       /* (1,204) */
381} BVSB_IDepth;
382
383/***************************************************************************
384Summary:
385        Enumeration for QAM Nyquist filter rolloff.
386
387Description:
388        This enum specifies the QAM receiver's Nyquist filter rolloff.
389
390See Also:
391        None.
392
393****************************************************************************/
394typedef enum BVSB_NyquistFilter
395{
396   BVSB_NyquistFilter_e12, /* 12% Nyquist filter */
397   BVSB_NyquistFilter_e15, /* 15% Nyquist filter */
398   BVSB_NyquistFilter_e18  /* 18% Nyquist filter */
399} BVSB_NyquistFilter;
400/***************************************************************************
401Summary:
402        Enumeration for NTSC pull-in range.
403
404Description:
405        This enum specifies the pull-in range of IFD.
406
407See Also:
408        None.
409
410****************************************************************************/
411typedef enum BVSB_Ifd_PullInRange
412{
413   BVSB_PullInRange_eWide,     /* Normal wide pull-in range mode*/
414   BVSB_PullInRange_e282KHz,   /* +/- 250 + 32 KHz mode*/
415   BVSB_PullInRange_e32kHz,     /* +/- 32 KHz mode*/
416   BVSB_PullInRange_e250kHz= BVSB_PullInRange_e282KHz ,
417   BVSB_PullInRange_e500kHz,
418   BVSB_PullInRange_e750kHz,
419   BVSB_PullInRange_e1000kHz,
420   BVSB_PullInRange_e1100kHz = BVSB_PullInRange_eWide
421} BVSB_Ifd_PullInRange;
422
423/***************************************************************************
424Summary:
425        Enumeration for analog mode.
426
427Description:
428        This enum specifies the analog mode: NTSC/PAL-D/PAL-I/PAL-BGH.
429
430See Also:
431        None.
432
433****************************************************************************/
434typedef enum BVSB_AnalogMode
435{
436   BVSB_AnalogMode_eNTSC,
437   BVSB_AnalogMode_ePalD,
438   BVSB_AnalogMode_ePalI,
439   BVSB_AnalogMode_ePalBGH
440} BVSB_AnalogMode;
441
442
443
444/***************************************************************************
445Summary:
446    Define different country code.
447Description:
448    This enum specifies the country code for BTSC.
449See Also:
450    BVSB_NtscSettings
451****************************************************************************/
452typedef enum BVSB_BtscCountry
453{
454    BVSB_BtscCountry_eUS,                       /* BTSC US */
455    BVSB_BtscCountry_eUS_High_Deviation,        /* BTSC US high deviation */
456    BVSB_BtscCountry_eKorea                     /* BTSC Korea */
457} BVSB_BtscCountry;
458
459/***************************************************************************
460Summary:
461        Enumeration for pga gain.
462
463Description:
464        This enum specifies the pga gain.
465
466See Also:
467        None.
468
469****************************************************************************/
470typedef enum BVSB_PgaGain
471{
472   BVSB_PgaGain_e0dB,     
473   BVSB_PgaGain_e1dB,   /* This option is not available on 3563,3520 */ 
474   BVSB_PgaGain_e2dB,   /* This option is not available on 3563,3520 */ 
475   BVSB_PgaGain_e3dB, 
476   BVSB_PgaGain_e4dB,   /* This option is not available on 3563,3520 */     
477   BVSB_PgaGain_e5dB,   /* This option is not available on 3563,3520 */ 
478   BVSB_PgaGain_e6dB, 
479   BVSB_PgaGain_e9dB,   /* This option is not available on 3549 */
480   BVSB_PgaGain_e12dB,  /* This option is not available on 3549 */
481   BVSB_PgaGain_e15dB   /* This is option not available on 3549 */
482} BVSB_PgaGain;
483
484/***************************************************************************
485Summary:
486        Enumeration for analog video modes
487
488Description:
489        This enum specifies analog video mode options for the IFD decoder. This
490        only applies to IFD core in cases where this PI controls both ofdm and
491        analog video receiver.
492
493See Also:
494        None.
495
496****************************************************************************/
497typedef enum BVSB_AnalogVideoMode {
498        BVSB_AnalogVideoMode_eNtsc_M,   /* NTSC-M mode. can be combined with BTSC or A2 audio */
499        BVSB_AnalogVideoMode_eNtsc_N,   /* NTSC-N mode, can be combined with only BTSC audio */
500        BVSB_AnalogVideoMode_ePal_M,    /* PAL-M mode, can be combined with only BTSC audio */
501        BVSB_AnalogVideoMode_ePal_N,    /* PAL-N mode, can be combined with only BTSC audio */
502        BVSB_AnalogVideoMode_ePal_I,    /* PAL-I mode, can be combined with only NICAM audio */
503        BVSB_AnalogVideoMode_ePal_BGH,  /* PAL-B/G/H mode, can be combined with A2 or NICAM audio */
504        BVSB_AnalogVideoMode_ePal_DK,   /* PAL-D/K mode, can be combined with NICAM audio only */
505        BVSB_AnalogVideoMode_ePal_DK1,  /* PAL-D/K1 mode, can be combined with A2 audio only */
506        BVSB_AnalogVideoMode_ePal_DK2,  /* PAL-D/K2 mode, can be combined with A2 audio only */
507        BVSB_AnalogVideoMode_ePal_DK3,  /* PAL-D/K3 mode, can be combined with A2 audio only */
508        BVSB_AnalogVideoMode_eSecam_BGH,/* SECAM-B/G/H mode, can be combined with A2 or NICAM audio */
509        BVSB_AnalogVideoMode_eSecam_DK, /* SECAM-D/K mode, can be combined with only NICAM audio */
510        BVSB_AnalogVideoMode_eSecam_L   /* SECAM-L mode, can be combined with onl y NICAM audio */
511} BVSB_AnalogVideoMode;
512
513/***************************************************************************
514Summary:
515        Enumeration for analog audio modes
516
517Description:
518        This enum specifies second audio carrier mode options for the IFD decoder.
519        This only applies to IFD core in cases where this PI controls both ofdm
520        an analog video receiver. Not all video/audio combo are valid, refer to
521        each video mode for more options
522
523See Also:
524        BVSB_AnalogVideoMode
525
526****************************************************************************/
527typedef enum BVSB_AnalogAudioMode {
528        BVSB_AnalogAudioMode_eBtsc,             /* Selects BTSC audio */
529        BVSB_AnalogAudioMode_eA2,               /* Selects A2 audio */
530        BVSB_AnalogAudioMode_eNicam             /* Selects NICAM audio */
531} BVSB_AnalogAudioMode;
532
533/***************************************************************************
534Summary:
535        Enumeration for IFD acquire mode
536
537Description:
538        This enum specifies whether IFD acquistion will spend extra time to
539    improve acquisition robustness
540
541See Also:
542        BVSB_AnalogVideoMode
543
544****************************************************************************/
545typedef enum BVSB_IfdAcquisitionMode
546{
547    BVSB_IfdAcquisitionMode_eSlow,
548    BVSB_IfdAcquisitionMode_eFast
549} BVSB_IfdAcquisitionMode;
550
551
552/***************************************************************************
553Summary:
554        Structure for VSB settings.
555
556Description:
557        This structure contains settings for inband VSB acquisitions.
558
559See Also:
560        None.
561
562****************************************************************************/
563typedef struct BVSB_VsbSettings
564{
565   BVSB_PhaseLoopBw bw; /* phase tracking loop bandwidth setting           */ 
566   bool bAutoAcq;   /* auto reacquisition: false=disabled, true=enabled    */
567   bool bFastAcq;   /* fast acquisition: false=disabled, true=enabled      */
568   bool bTei;       /* xport error indicator: false=disabled, true=enabled */
569   bool bTerr;      /* receiver mode: true=terrestrial, false=cable        */
570   bool bNtscSweep; /* NTSC filter sweep: false=disabled, true=enabled     */
571   bool bRfiSweep;  /* RFI filter sweep: false=disabled, true=enabled      */
572   BVSB_PgaGain pgaGain;  /* pga gain in dB */
573} BVSB_VsbSettings;
574
575/***************************************************************************
576Summary:
577        Structure for QAM settings.
578
579Description:
580        This structure contains settings for inband QAM acquisitions.
581
582See Also:
583        None.
584
585****************************************************************************/
586typedef struct BVSB_QamSettings
587{
588   BVSB_PhaseLoopBw   bw; /* phase tracking loop bandwidth setting */ 
589   BVSB_IDepth        idepth;   /* interleaver depth (Annex A only) */
590   BVSB_NyquistFilter nyquist; /* specifies Nyquist filter rolloff */
591   bool bAutoAcq; /* auto reacquisition: false=disabled, true=enabled */
592   bool bFastAcq; /* fast acquisition: false=disabled, true=enabled */
593   bool bTerr;    /* receiver mode: true=terrestrial, false=cable */
594   bool bEq;      /* equalizer size: false=24-tap FFE and 24-tap DFE, true=192-tap FFE and 132-tap DFE */
595   bool bCh;      /* false=use 6MHz channelization, true=use 8MHz channelization */
596   bool bTei;     /* transport error indicator: false=disabled, true=enabled */
597   bool bSpinv;   /* auto invert spectrum: false=disabled, true=enabled */ 
598   bool bDavic;   /* true=select DAVIC unmapper, false=select DVB unmapper */
599   BVSB_PgaGain pgaGain;  /* pga gain in dB */
600} BVSB_QamSettings;
601
602
603/***************************************************************************
604Summary:
605        Structure for NTSC settings.
606
607Description:
608        This structure contains settings for inband NTSC acquisitions.
609
610See Also:
611        None.
612
613****************************************************************************/
614typedef struct BVSB_NtscSettings
615{
616   BVSB_PhaseLoopBw bw; /* phase tracking loop bandwidth setting         */ 
617   bool bFastAcq;  /* fast acquisition: false=disabled, true=enabled     */
618   bool bTerr;     /* receiver mode: true=terrestrial, false=cable       */
619   bool bAutoAcq;  /* auto reacquisition: false=disabled, true=enabled   */
620   BVSB_Ifd_PullInRange ifd_pullin_range;  /* IFD pull in range settings: BVSB_PullInRange_eWide = +/- 1.15MHz, BVSB_PullInRange_e282KHz = +/- 282KHz, BVSB_PullInRange_e32KHz = +/- 32KHz*/
621   unsigned ifd_picture_carrier;  /* IFD picture carrier frequency (Hz) */
622   BVSB_AnalogMode analog_mode;
623   BVSB_BtscCountry btsc_country; /* BTSC country code */
624   BVSB_PgaGain pgaGain;  /* pga gain in dB */
625#ifdef NOT_USED
626   uint8_t delay;          /* Delay in ms that the acquisition script will wait for the AGC hardware to settle */
627   uint8_t rfBandwidth;    /* RF AGC band width */
628   uint8_t ifBandwidth;    /* IF AGC band width */     
629   uint16_t top;           /* tuner TOP point */
630   bool bSpectrumInvert; /* Invert input spectrum, only used in SECAM-L mode to get SECAM-L' */
631#endif
632
633   
634} BVSB_NtscSettings;
635
636/***************************************************************************
637Summary:
638        Structure for out of band settings.
639
640Description:
641        This structure contains settings for inband out of band acquisitions.
642
643See Also:
644        None.
645
646****************************************************************************/
647typedef struct BVSB_OobSettings
648{
649   BVSB_PhaseLoopBw bw; /* phase tracking loop bandwidth setting          */ 
650   bool bAutoAcq;   /* auto reacquisition: false=disabled, true=enabled   */
651   bool bSpinv;     /* auto invert spectrum: false=disabled, true=enabled */ 
652   bool bBypassFEC; /* bypass FEC for POD applications: true=bypass the FEC, false=use DVS-167 or DVS-178 FEC */
653} BVSB_OobSettings;
654
655
656/***************************************************************************
657Summary:
658        Structure for inband output interface
659
660Description:
661        This structure contains settings for inband output interface.
662
663See Also:
664        None.
665
666****************************************************************************/
667typedef struct BVSB_InbandOiSettings
668{
669   bool bHead4;   /* parallel: 0=sync is 1 byte wide, 1=sync is 4 bytes wide; serial: see bSync1 */
670   bool bSync1;   /* serial only: 1=sync is 1 bit wide; 0=sync is 32 bits wide if bHead4 is true else sync is 8 bits wide */
671   bool bXBERT;   /* false=DS_PS_CLK runs continuously, true=DS_PS_CLK suppressed when DS_PS_SYNC active */
672   bool bErrinv;  /* false=DS_PS_ERR is normal, true=DS_PS_ERR is inverted */
673   bool bSyncinv; /* false=DS_PS_SYNC is normal, true=DS_PS_SYNC is inverted */
674   bool bVldinv;  /* false=DS_PS_VALID is normal, true=DS_PS_VALID is inverted */
675   bool bClksup;  /* false=DS_PS_CLK runs continuously, true=DS_PS_CLK suppressed when PS_VALID not active */
676   bool bClkinv;  /* false=DS_PS_CLK is normal, true=DS_PS_CLK is inverted */
677   bool bSerial;  /* true=serial data out, false=parallel data out */
678} BVSB_InbandOiSettings;
679
680/***************************************************************************
681Summary:
682        Enum for BTSC output
683
684Description:
685        This enum specifies the BTSC output mode.
686
687See Also:
688        None.
689
690****************************************************************************/
691typedef enum BVSB_BtscDecodeMode
692{
693   BVSB_BtscDecodeMode_eMono,      /* Mono     */
694   BVSB_BtscDecodeMode_eStereo,    /* Stereo   */
695   BVSB_BtscDecodeMode_eSAP,       /* SAP      */
696   BVSB_BtscDecodeMode_eSAP_Mono   /* SAP/Mono */
697} BVSB_BtscDecodeMode;
698
699/***************************************************************************
700Summary:
701        Enum for audio sample rate
702
703Description:
704        This enum specifies the audio sample rate.
705
706See Also:
707        None.
708
709****************************************************************************/
710typedef enum BVSB_BtscSampleRate
711{
712   BVSB_BtscSampleRate_e32KHz,      /* 32 KHz   */
713   BVSB_BtscSampleRate_e44_1KHz,    /* 44.1 KHz */
714   BVSB_BtscSampleRate_e48KHz       /* 48 KHz   */
715} BVSB_BtscSampleRate;
716
717/***************************************************************************
718Summary:
719        Enum for audio DAC pads
720
721Description:
722        This enum specifies the data source to the Audio DAC pads.
723
724See Also:
725        None.
726
727****************************************************************************/
728typedef enum BVSB_BtscDacSelect
729{
730   BVSB_BtscDacSelect_eAudDac,   /* Audio DAC */
731   BVSB_BtscDacSelect_eHiFiDac   /* HiFi DAC  */
732} BVSB_BtscDacSelect;
733
734/***************************************************************************
735Summary:
736        Structure for BTSC configuration
737
738Description:
739        This structure contains BTSC configuration parameters.
740
741See Also:
742        None.
743
744****************************************************************************/
745typedef struct BVSB_BtscSettings
746{
747   BVSB_BtscDecodeMode decodeMode; /* decode mode for the BTSC receiver */
748   BVSB_BtscSampleRate sampleRate; /* audio sample rate                 */
749   bool                bI2sOut;    /* primary i2s output selection: true=pads used for i2s output, false=pads used for audio DAC */
750} BVSB_BtscSettings;
751
752/***************************************************************************
753Summary:
754        Structure for I2C configuration
755
756Description:
757        This structure contains the settings for I2C control.
758
759See Also:
760        None.
761
762****************************************************************************/
763typedef struct BVSB_I2cSettings
764{
765   uint16_t chipAddr;  /* BCM3520 i2c chip address (i2c) */
766   void     (*interruptEnableFunc)(bool, void*); /* callback function for enabling/disabling L1 interrupt */
767   void     *interruptEnableFuncParam; /* parameter passed to interruptEnableFunc */
768} BVSB_I2cSettings;
769
770/***************************************************************************
771Summary:
772        Typedef for status information
773
774Description:
775        This typedef contains AP status information
776
777See Also:
778        None.
779
780****************************************************************************/
781typedef uint32_t BVSB_ApStatus;
782
783/* bit definitions for BVSB_ApStatus */
784#define BVSB_APSTATUS_RESET      0x00000001 /* AP is in reset state */
785#define BVSB_APSTATUS_IDLE       0x00000002 /* AP is in idle state */
786#define BVSB_APSTATUS_RUN        0x00000000 /* AP is running */
787#define BVSB_APSTATUS_RUN_MASK   0x00000003 /* AP execution state mask */
788#define BVSB_APSTATUS_HAB_DONE   0x00000400 /* HAB done */
789#define BVSB_APSTATUS_HAB_ERR    0x00001000 /* HAB access violation */
790#define BVSB_APSTATUS_MEM_ERR    0x00002000 /* memory access violation */
791#define BVSB_APSTATUS_IOMB_ERR   0x00004000 /* io_mbox isb transfer error */
792#define BVSB_APSTATUS_H_ERR      0x00008000 /* host transfer error */
793#define BVSB_APSTATUS_INIT_DONE  0x00800000 /* AP init done */
794#define BVSB_APSTATUS_LOCK       0x00400000 /* inband lock status */
795#define BVSB_APSTATUS_HAB_MASK   0x00800403 /* HAB available condition mask */
796#define BVSB_APSTATUS_HAB_READY  0x00800400 /* HAB available condition */
797#define BVSB_APSTATUS_HABCMD_ERR 0x00080000 /* HAB command syntax error */
798#define BVSB_APSTATUS_AP_ERR     0x00040000 /* internal AP error */
799
800/***************************************************************************
801Summary:
802        Enum for signal detect type
803
804Description:
805        This enum specifies the type for signal detect
806
807See Also:
808        None.
809
810****************************************************************************/
811typedef enum BVSB_DetectType
812{
813   BVSB_DetectType_ePresent,              /* For only Signal/No Signal */
814   BVSB_DetectType_eVSB,                    /* For Signal/No Signal + VSB */
815   BVSB_DetectType_eNTSC,                  /* For Signal/No Signal + NTSC */
816   BVSB_DetectType_eNTSC_VSB,           /* For Signal/No Signal + NTSC + VSB */
817   BVSB_DetectType_eQAM,                   /* For Signal/No Signal + QAM */
818   BVSB_DetectType_eNTSC_QAM,          /* For Signal/No Signal + NTSC + QAM */
819   BVSB_DetectType_eNTSC_VSB_QAM   /* For Signal/No Signal + NTSC + VSB + QAM */
820} BVSB_DetectType;
821
822/***************************************************************************
823Summary:
824        Enum for signal detect mode
825
826Description:
827        This enum specifies the mode for signal detect
828
829See Also:
830        None.
831
832****************************************************************************/
833typedef enum BVSB_SignalMode
834{
835   BVSB_SignalMode_eVSB,                /*VSB */
836   BVSB_SignalMode_eQAM,                /* QAM */
837   BVSB_SignalMode_eQAM_64,     /* QAM 64*/
838   BVSB_SignalMode_eQAM_256,    /* QAM 256*/
839   BVSB_SignalMode_eNTSC,               /* NTSC */
840   BVSB_SignalMode_eUnknown,
841   BVSB_SignalMode_eNoSignal
842} BVSB_SignalMode;
843
844/***************************************************************************
845Summary:
846        Enumeration for NICAM audio recevier current encoder mode
847
848Description:
849        This enum specifies the NICAM encoder modes
850
851See Also:
852        None.
853
854****************************************************************************/
855typedef enum BVSB_NicamEncoderMode
856{
857        BVSB_Stereo_BackupFm=1,
858        BVSB_DualMono_BackupFm=5,
859        BVSB_Stereo_NoBackup=0,
860        BVSB_DualMono_NoBackup=4,
861        BVSB_MonoData_NoBackup=8,
862        BVSB_MonoData_BackupFm=9,
863        BVSB_Data_NoBackup=12,
864        BVSB_Data_BackupFm=13
865} BVSB_NicamEncoderMode;
866
867/***************************************************************************
868Summary:
869        Enum for IFD deviation modes
870
871Description:
872        This enum specifies deviation mode for the IFD core
873
874See Also:
875        None.
876
877****************************************************************************/
878typedef enum BVSB_AnalogAudioDeviation
879{
880    BVSB_AnalogAudioDeviation_eNormal,
881    BVSB_AnalogAudioDeviation_eMedium,
882    BVSB_AnalogAudioDeviation_eHigh
883} BVSB_AnalogAudioDeviation;
884
885/***************************************************************************
886Summary:
887        Enum for inband mode
888
889Description:
890        This enum specifies the mode for the inband receiver
891
892See Also:
893        None.
894
895****************************************************************************/
896typedef enum BVSB_InbandMode
897{
898   BVSB_InbandMode_e8VSB,      /* 8-VSB */
899   BVSB_InbandMode_e16VSB,     /* 16-VSB */
900   BVSB_InbandMode_e1024QAM_B, /* 1024-QAM Annex B */
901   BVSB_InbandMode_e512QAM_B, /* 512-QAM Annex B */
902   BVSB_InbandMode_e256QAM_B,  /* 256-QAM Annex B */
903   BVSB_InbandMode_e128QAM_B,  /* 128-QAM Annex B */
904   BVSB_InbandMode_e64QAM_B,   /* 64-QAM Annex B  */
905   BVSB_InbandMode_e64_256QAM_B, /* Automatic 64/256-QAM Annex B (This is not available on all chipsets) */
906   BVSB_InbandMode_e256QAM_A,  /* 256-QAM Annex A */
907   BVSB_InbandMode_e128QAM_A,  /* 128-QAM Annex A */
908   BVSB_InbandMode_e64QAM_A,   /* 64-QAM Annex A  */
909   BVSB_InbandMode_e32QAM_A,   /* 32-QAM Annex A  */
910   BVSB_InbandMode_e16QAM_A,   /* 16-QAM Annex A  */
911   BVSB_InbandMode_eAnalog,
912   BVSB_InbandMode_eNTSC = BVSB_InbandMode_eAnalog,
913   BVSB_InbandMode_eAnalog_SIF,
914   BVSB_InbandMode_eNTSC_SIF = BVSB_InbandMode_eAnalog_SIF,
915   BVSB_InbandMode_eUnknown
916} BVSB_InbandMode;
917
918/***************************************************************************
919Summary:
920        Structure for inband acquisition
921
922Description:
923        This structure contains parameters used for an inband channel acquisition.
924
925See Also:
926        None.
927
928****************************************************************************/
929typedef struct BVSB_InbandParams
930{
931   BVSB_InbandMode mode; 
932   int32_t         ifFreqOffset;     /* IF frequency offset in Hz; for IFD, this parameter is the pix carrier offset */
933   int32_t         symbolRateOffset; /* symbol rate offset in sym/sec for VSB and QAM; not applicable in IFD */
934   int32_t                 symbolRate;  /* symbol rate for QAM Annex A*/
935
936   BVSB_AnalogVideoMode eVideoMode;             /* Selects analog video standards. Only applies when analog mode is used */
937   BVSB_AnalogAudioMode eAudioMode;     /* Selects analog audio standards. Only applies when analog mode is used */
938   BVSB_AnalogAudioDeviation eAnalogAudioDeviation;      /* Selects deviation mode for analog audio */
939   BVSB_IfdAcquisitionMode   eAcquisitionMode;           /* Select IFD acquisition mode */
940   bool                      ifdAgcControl; /* Gives control of AGC pins to IFD only applies when using SIF mode */
941   
942} BVSB_InbandParams;
943
944/***************************************************************************
945Summary:
946        Structure for VSB status
947
948Description:
949        This structure contains VSB status
950
951See Also:
952        None.
953
954****************************************************************************/
955typedef struct BVSB_VsbStatus
956{
957   BVSB_InbandParams acqParams;       /* input parameters from most recent acquisition */
958   BVSB_VsbSettings  acqSettings;     /* VSB acquisition settings */
959   bool              bFecLocked;      /* true if the FEC is locked */
960   bool              bPllLocked;      /* true if the receiver output PLL is locked */
961   bool              bNtscEngaged;    /* true if NTSC co-channel has been detected and the NTSC filter has been engaged */ 
962   bool              bRfiEngaged;     /* true if RFI has been detected and the RFI filter has been engaged */
963   uint32_t          ifFreq;          /* standard IF frequency in Hz */
964   int32_t           ifFreqError;     /* IF frequency error in Hz */
965   uint32_t          symbolRate;      /* standard symbol rate in sym/sec */
966   int32_t           symbolRateError; /* symbol rate error in sym/sec */
967   uint32_t          corrErrCount;    /* accumulated correctable bit errors by FEC */
968   uint32_t          corrBlockCount;  /* accumulated correctable RS blocks */
969   uint32_t          ucorrBlockCount; /* accumulated uncorrectable RS blocks */
970   uint32_t          cleanBlockCount; /* accumulated clean RS blocks */
971   uint32_t          berCount;        /* accumulated internal BERT error count */
972   uint32_t          reacqCount;      /* number of reacquisitions performed by AP */
973   uint32_t          rf_agc;          /* AGT_DELTA_SIGMA level in units of 1/10 percent */
974   uint32_t          if_agc;          /* AGI_DELTA_SIGMA level in units of 1/10 percent */
975   uint16_t          snr;             /* SNR in 1/256 dB */
976   int16_t           agf;             /* int AGC gain in 1/256 dB */
977   uint32_t                      PreRS;                   /* Pre RS vaule */
978   uint32_t                      PostRS;                  /* Post RS vaule */
979   uint32_t                      BER;                     /* BER value */
980} BVSB_VsbStatus;
981
982/***************************************************************************
983Summary:
984        Structure for QAM status
985
986Description:
987        This structure contains QAM status
988
989See Also:
990        None.
991
992****************************************************************************/
993typedef struct BVSB_QamStatus
994{
995   BVSB_InbandParams acqParams;       /* input parameters from most recent acquisition */
996   BVSB_QamSettings  acqSettings;     /* QAM acquisition settings */
997   bool              bFecLocked;      /* true if the FEC is locked */
998   bool              bPllLocked;      /* true if the receiver output PLL is locked */
999   bool              bSpinv;          /* true if spectrum inverted */
1000   uint32_t          ifFreq;          /* standard IF frequency in Hz */
1001   int32_t           ifFreqError;     /* IF frequency error in Hz */
1002   uint32_t          symbolRate;      /* standard symbol rate in sym/sec */
1003   int32_t           symbolRateError; /* symbol rate error in sym/sec */
1004   uint32_t          corrErrCount;    /* accumulated correctable bit errors by FEC */
1005   uint32_t          corrBlockCount;  /* accumulated correctable RS blocks */
1006   uint32_t          ucorrBlockCount; /* accumulated uncorrectable RS blocks */
1007   uint32_t          cleanBlockCount; /* accumulated clean RS blocks */
1008   uint32_t          berCount;        /* accumulated internal BERT error count */
1009   uint32_t          reacqCount;      /* number of reacquisitions performed by AP */   
1010   uint32_t          rf_agc;          /* AGT_DELTA_SIGMA level in units of 1/10 percent */
1011   uint32_t          if_agc;          /* AGI_DELTA_SIGMA level in units of 1/10 percent */
1012   uint16_t          snr;             /* SNR in 1/256 dB */
1013   int16_t           agf;             /* int AGC gain in 1/256 dB */
1014   uint32_t          BER;                         /* BER value */
1015} BVSB_QamStatus;
1016
1017/***************************************************************************
1018Summary:
1019        Structure for NTSC status
1020
1021Description:
1022        This structure contains NTSC status
1023
1024See Also:
1025        None.
1026
1027****************************************************************************/
1028typedef struct BVSB_NtscStatus
1029{   
1030   BVSB_InbandParams   acqParams;       /* input parameters from most recent acquisition */
1031   BVSB_NtscSettings   acqSettings;     /* NTSC acquisition settings */
1032   bool                bHsyncLocked;    /* true if HSYNC is locked    */
1033   uint32_t            pixCarrFreq;     /* pix carrier freq in Hz */   
1034   int32_t             pixCarrFreqError;/* pix carrier error in Hz */
1035   uint32_t            rf_agc;          /* AGT_DELTA_SIGMA level in units of 1/10 percent */
1036   uint32_t            if_agc;          /* AGI_DELTA_SIGMA level in units of 1/10 percent */
1037
1038   bool                        bNicamLock;      /* True if NICAM is locked */
1039   uint32_t                ulNicamSnr;          /* NICAM slicer SNR */
1040   uint32_t                    ulNicamParityError;  /* Number of parity errors in the current frame */
1041   uint32_t                    ulNicamErrorCount;   /* Number of bit errors in the last 128 frames */
1042   BVSB_NicamEncoderMode eNicamEncoderMode; /* Current NICAM encoder mode */
1043   uint32_t            ulAVRatio1Hi;    /* AV Ratio in linear units (upper 32 bits) */
1044   uint32_t            ulAVRatio1Lo;    /* AV Ratio in linear units (lower 32 bits) */
1045   uint32_t            ulAVRatio2Hi;    /* AV Ratio for 2nd audio carrioer in linear units (upper 32 bits) */
1046   uint32_t            ulAVRatio2Lo;    /* AV Ratio for 2nd audio carrioer in linear units (lower 32 bits) */
1047   uint32_t           ulAudioCarrier2Variance;  /*  Carrier Average Or Variance Read of 2nd audio carrier */
1048   
1049} BVSB_NtscStatus;
1050
1051/***************************************************************************
1052Summary:
1053        Structure for IFD audio settings
1054
1055Description:
1056        This structure is used to change the audio carrier frequency control
1057    word. Since there is only a finite set of possible carrier frequency
1058    we use the video/audio mode as index to the look up table
1059
1060See Also:
1061        None.
1062
1063****************************************************************************/
1064typedef struct BVSB_IfdAudioSettings
1065{
1066    BVSB_AnalogVideoMode        eVideoMode;             /* Selects analog video standards */
1067    BVSB_AnalogAudioMode    eAudioMode;     /* Selects analog audio standards */
1068    uint32_t ulCarrier2DecimationRatio; 
1069} BVSB_IfdAudioSettings;
1070
1071/***************************************************************************
1072Summary:
1073        Structure for BTSC status
1074
1075Description:
1076        This structure contains BTSC status
1077
1078See Also:
1079        None.
1080
1081****************************************************************************/
1082typedef struct BVSB_BtscStatus
1083{
1084   BVSB_BtscDecodeMode decodeMode;      /* decode mode                */
1085   BVSB_BtscSampleRate sampleRate;      /* audio sample rate          */
1086   bool                bI2sOut;         /* primary i2s output selection: true=pads used for i2s output, false=pads used for audio DAC */
1087   bool                bSapDetected;    /* true if SAP is detected    */
1088   bool                bStereoDetected; /* true if stereo is detected */
1089   bool                bBtscMute;       /* true if BTSC mute is on    */
1090   uint8_t             btscLeftVolume;  /* volume level for left channel  */
1091   uint8_t             btscRightVolume; /* volume level for right channel */
1092} BVSB_BtscStatus;
1093
1094
1095/***************************************************************************
1096Summary:
1097        Enum for out of band mode
1098
1099Description:
1100        This enum is for out of band mode
1101
1102See Also:
1103        None.
1104
1105****************************************************************************/
1106typedef enum BVSB_OobMode
1107{
1108   BVSB_OobMode_eDs178,     /* DS-178 mode (1024000 sym/sec)          */
1109   BVSB_OobMode_eDs167_A,   /* DS-167 mode, Grade A (772000 sym/sec)  */
1110   BVSB_OobMode_eDs167_B,   /* DS-167 mode, Grade B (1544000 sym/sec) */
1111   BVSB_OobMode_eUnknown
1112} BVSB_OobMode;
1113
1114/***************************************************************************
1115Summary:
1116        Enum for out of band clock suppression
1117
1118Description:
1119    This enum is for out of band clock suppression mode
1120
1121See Also:
1122        None.
1123
1124****************************************************************************/
1125typedef enum BVSB_OobClockSuppression
1126{
1127    BVSB_OobClockSuppression_eContinuous,
1128    BVSB_OobClockSuppression_eSuppressed
1129} BVSB_OobClockSuppression;
1130
1131/***************************************************************************
1132Summary:
1133        Enum for out of band clock inversion
1134
1135Description:
1136    This enum is to invert out of band FEC clock.
1137
1138See Also:
1139        None.
1140
1141****************************************************************************/
1142typedef enum BVSB_OobClock
1143{
1144    BVSB_OobClock_eNormal,
1145    BVSB_OobClock_eInverted
1146} BVSB_OobClock;
1147
1148/***************************************************************************
1149Summary:
1150        Enumeration for Agc Pin Mode
1151
1152Description:
1153        This enum specifies the voltage swing of the AGC pin
1154
1155See Also:
1156        None.
1157
1158****************************************************************************/
1159typedef enum BVSB_AgcPinMode
1160{
1161    BVSB_AgcPinMode_e33V, /* indicates AGC pin goes from 0 to 3.3V */
1162    BVSB_AgcPinMode_e25V  /* indicates AGC pin goes from 0 to 2.5V */
1163} BVSB_AgcPinMode;
1164
1165/***************************************************************************
1166Summary:
1167        Structure for out of band parameters
1168
1169Description:
1170   This structure contains parameters used for an out of band channel
1171   acquisition.
1172
1173See Also:
1174        None.
1175
1176****************************************************************************/
1177typedef struct BVSB_OobParams
1178{   
1179   BVSB_OobMode mode;         /* oob mode */
1180} BVSB_OobParams;
1181
1182
1183/***************************************************************************
1184Summary:
1185        Structure for out of band status
1186
1187Description:
1188   This structure contains status for out of band
1189
1190See Also:
1191        None.
1192
1193****************************************************************************/
1194typedef struct BVSB_OobStatus
1195{
1196   BVSB_OobParams    acqParams;       /* input parameters from most recent acquisition */
1197   BVSB_OobSettings  acqSettings;     /* OOB acquisition settings */
1198   bool              bRcvrLocked;     /* true if the OOB receiver is locked */
1199   bool              bFecLocked;      /* true if the OOB FEC is locked */
1200   bool              bSpinv;          /* true if the OOB receiver has inverted the spectrum to acquire the signal */   
1201   uint32_t          ifFreq;          /* standard IF frequency in Hz */
1202   int32_t           ifFreqError;     /* IF frequency error in Hz */
1203   uint32_t          loFreq;          /* LO frequency */
1204   uint32_t          symbolRate;      /* standard symbol rate in sym/sec */
1205   int32_t           symbolRateError; /* symbol rate error in sym/sec */
1206   uint32_t          corrBlockCount;  /* accumulated correctable RS blocks */
1207   uint32_t          ucorrBlockCount; /* accumulated uncorrectable RS blocks */
1208   uint32_t          berCount;        /* accumulated internal BERT error count */   
1209   uint32_t          reacqCount;      /* number of reacquisitions performed by AP */   
1210   uint16_t          snr;             /* SNR in 1/256 dB */
1211   uint16_t          oob_agc;         /* OOB_DELTA_SIGMA level (0000=min level, FFFF=max level) */
1212   uint16_t          ext_agc;         /* external AGC level (0000=min level, FFFF=max level) */
1213   uint32_t          atm_cell_total_count; /* accumulated ATM cell count */
1214   uint32_t          atm_cell_loss_count;  /* accumulated ATM cell loss count */
1215} BVSB_OobStatus;
1216
1217/***************************************************************************
1218Summary:
1219        Structure for Signal Detection Settings
1220
1221Description:
1222   These settings will adjust the
1223
1224See Also:
1225        None.
1226
1227****************************************************************************/
1228typedef struct BVSB_DetectionSettings
1229{
1230    uint32_t qamParam4;
1231    uint16_t agf;
1232    uint16_t agc;
1233} BVSB_DetectionSettings;
1234
1235/**
1236Declare BVSB_Settings typedef because of circular reference
1237of BVSB_ApiFunctTable.
1238**/
1239
1240typedef struct BVSB_Settings BVSB_Settings;
1241
1242/***************************************************************************
1243Summary:
1244        Structure for API function table
1245
1246Description:
1247   This structure contains pointers to all public BVSB functions.
1248
1249See Also:
1250        None.
1251
1252****************************************************************************/
1253typedef struct BVSB_ApiFunctTable
1254{
1255   BERR_Code (*Open)(BVSB_Handle *, BCHP_Handle, void*, BINT_Handle, const BVSB_Settings *pDefSettings);
1256   BERR_Code (*Close)(BVSB_Handle);
1257   BERR_Code (*InitAp)(BVSB_Handle, const uint8_t *);
1258   BERR_Code (*GetApStatus)(BVSB_Handle, BVSB_ApStatus *);
1259   BERR_Code (*GetApVersion)(BVSB_Handle, uint16_t*, uint16_t*, uint8_t*, uint8_t*, uint8_t*);
1260   BERR_Code (*ReadRegister)(BVSB_Handle, uint32_t, uint32_t*);
1261   BERR_Code (*WriteRegister)(BVSB_Handle, uint32_t, uint32_t*);
1262   BERR_Code (*Mi2cWrite)(BVSB_Handle, uint8_t, uint8_t*, uint8_t);
1263   BERR_Code (*Mi2cRead)(BVSB_Handle, uint8_t, uint8_t*, uint8_t, uint8_t*, uint8_t);
1264   BERR_Code (*AcquireInband)(BVSB_Handle, const BVSB_InbandParams*);
1265   BERR_Code (*GetVsbStatus)(BVSB_Handle, BVSB_VsbStatus *);
1266   BERR_Code (*GetQamStatus)(BVSB_Handle, BVSB_QamStatus *);
1267   BERR_Code (*GetNtscStatus)(BVSB_Handle, BVSB_NtscStatus *);
1268   BERR_Code (*ResetInbandStatus)(BVSB_Handle);
1269   BERR_Code (*AcquireOob)(BVSB_Handle, const BVSB_OobParams*);
1270   BERR_Code (*GetOobStatus)(BVSB_Handle, BVSB_OobStatus *);
1271   BERR_Code (*ResetOobStatus)(BVSB_Handle);
1272   BERR_Code (*SetBtscConfig)(BVSB_Handle, BVSB_BtscSettings *);
1273   BERR_Code (*SetBtscVolume)(BVSB_Handle, uint8_t, uint8_t, bool);
1274   BERR_Code (*GetBtscStatus)(BVSB_Handle, BVSB_BtscStatus *);
1275   BERR_Code (*SetInbandOi)(BVSB_Handle, BVSB_InbandOiSettings *);
1276   BERR_Code (*GetSoftDecisionBuf)(BVSB_Handle, int16_t*, int16_t*);
1277   BERR_Code (*GetOobSoftDecisionBuf)(BVSB_Handle, int16_t*, int16_t*);
1278   BERR_Code (*SetTmConfig)(BVSB_Handle, void*);
1279   BERR_Code (*GetTmConfig)(BVSB_Handle, void*);
1280   BERR_Code (*WriteConfig)(BVSB_Handle, uint16_t, uint8_t*, uint8_t);
1281   BERR_Code (*ReadConfig)(BVSB_Handle, uint16_t, uint8_t*, uint8_t);
1282   BERR_Code (*GetLockStateChangeEventHandle)(BVSB_Handle, BKNI_EventHandle*);
1283   BERR_Code (*GetOobLockStateChangeEventHandle)(BVSB_Handle, BKNI_EventHandle*);
1284   BERR_Code (*GetAntennaEventHandle)(BVSB_Handle, BKNI_EventHandle*);
1285   BERR_Code (*GetInterruptEventHandle)(BVSB_Handle, BKNI_EventHandle*);
1286   BERR_Code (*HandleInterrupt_isr)(BVSB_Handle);
1287   BERR_Code (*ProcessInterruptEvent)(BVSB_Handle);
1288   BERR_Code (*GetChipRevision)(BVSB_Handle, uint8_t*);
1289   BERR_Code (*DetectChannelSignal)(BVSB_Handle, BVSB_DetectType, BVSB_SignalMode*);
1290   BERR_Code (*GetUnlockstatusEventHandle)(BVSB_Handle, BKNI_EventHandle* );
1291   BERR_Code (*GetLockstatusEventHandle)(BVSB_Handle, BKNI_EventHandle* );
1292   BERR_Code (*SetInbandIfFreq)(BVSB_Handle, uint32_t);
1293   BERR_Code (*SetIfdPullInRange)(BVSB_Handle, BVSB_Ifd_PullInRange);
1294   BERR_Code (*PowerDown)(BVSB_Handle);
1295   BERR_Code (*SetPgaGain)(BVSB_Handle, BVSB_InbandMode, BVSB_PgaGain);
1296   BERR_Code (*SetOobInterfaceControl)(BVSB_Handle, BVSB_OobClockSuppression, BVSB_OobClock);
1297} BVSB_ApiFunctTable;
1298
1299/***************************************************************************
1300Summary:
1301        Structure for VSB settings
1302
1303Description:
1304   This structure contains the settings for the BVSB PI.
1305
1306See Also:
1307        None.
1308
1309****************************************************************************/
1310struct BVSB_Settings
1311{
1312   BVSB_I2cSettings       i2c;      /* i2c settings */
1313   BVSB_VsbSettings       vsb;      /* VSB acquisition settings */
1314   BVSB_QamSettings       qam;      /* QAM acquisition settings */
1315   BVSB_NtscSettings      ntsc;     /* NTSC acquisition settings */
1316   BVSB_BtscSettings      btsc;     /* BTSC initial settings */
1317   BVSB_OobSettings       oob;      /* OOB acquisition settings */
1318   BVSB_InbandOiSettings  inbandOi; /* Inband xport output interface settings */
1319   BVSB_DetectionSettings detect;   /* DetectChannelSignal settings */
1320   BVSB_ApiFunctTable     api;
1321   BTMR_Handle            hTmr;     /* Timer used for IFD acqusition, not need in 3520 */
1322   bool                  bRfDeltaSigmaInvert; /* Inverts RF delta sigma pin */
1323   bool                  bIfDeltaSigmaInvert; /* Inverts IF delta sigma pin */
1324   BVSB_AgcPinMode       IfAgcPinMode; /* specifis the voltage swing of RF delta sigma pin */
1325   bool                  bIfAgcZero;   /* Turns off IF AGC in the chip */
1326   bool                  bRfAgcZero;   /* Turns off RF AGC in the chip */
1327   bool                  bRfDeltaSigmaOpenDrain; /* Set RF delta sigame to open drain mode */
1328   bool                  bIfDeltaSigmaOpenDrain; /* Set IF delta sigame to open drain mode */
1329   bool                  bOpenDrainPinsOnClose; /* Sets AGC pins to open drain mode when the module is closed */
1330};
1331
1332
1333/******************************************************************************
1334Summary:
1335   Initializes the BVSB API.
1336Description:
1337   This function must be called first to get a BVSB_Handle.  This handle is
1338   used by all other function calls in the BVSB API.
1339Returns:
1340   BERR_Code
1341******************************************************************************/
1342BERR_Code BVSB_Open(
1343   BVSB_Handle *h,       /* [out] BVSB handle */
1344   BCHP_Handle hChip,    /* [in] chip handle */
1345   void        *pReg,    /* [in] pointer to register or i2c handle */
1346   BINT_Handle hInterrupt, /* [in] interrupt handle */
1347   const BVSB_Settings *pDefSettings /* [in] default settings */
1348);
1349
1350
1351/******************************************************************************
1352Summary:
1353   Closes the BVSB API.
1354Description:
1355   This function releases all the resources allocated by BVSB API and disables
1356   BCM3520 host interrupts.
1357Returns:
1358   BERR_Code
1359******************************************************************************/
1360BERR_Code BVSB_Close(
1361   BVSB_Handle h   /* [in] BVSB handle */
1362);
1363
1364
1365/******************************************************************************
1366Summary:
1367   Downloads the microcode and runs the AP.
1368Description:
1369   This function downloads the microcode to the AP RAM and then starts running
1370   the AP.
1371Returns:
1372   BERR_Code : BERR_SUCCESS = AP is running and successfully initialized
1373******************************************************************************/
1374BERR_Code BVSB_InitAp(
1375   BVSB_Handle   h,       /* [in] BVSB handle */
1376   const uint8_t *pImage  /* [in] pointer to AP microcode image */
1377);
1378
1379
1380/******************************************************************************
1381Summary:
1382   Returns status of the AP.
1383Description:
1384   The state of the AP and the HAB are returned in this function.
1385Returns:
1386   BERR_Code
1387******************************************************************************/
1388BERR_Code BVSB_GetApStatus(
1389   BVSB_Handle   hVSB,      /* [in] VSB device handle */
1390   BVSB_ApStatus *pStatus   /* [out] AP status */
1391);
1392
1393
1394/******************************************************************************
1395Summary:
1396   Returns AP version information.
1397Description:
1398   This function returns the chip revision, AP microcode revision, acquisition
1399   script version, and configuration version.
1400Returns:
1401   BERR_Code
1402******************************************************************************/
1403BERR_Code BVSB_GetApVersion(
1404   BVSB_Handle h,             /* [in] BVSB handle */
1405   uint16_t       *pChipId,   /* [out] VSB chip id */
1406   uint16_t       *pChipVer,  /* [out] chip revision number */
1407   uint8_t        *pApVer,    /* [out] AP microcode version */
1408   uint8_t        *pScrVer,   /* [out] acquisition script version */
1409   uint8_t        *pCfgVer    /* [out] host configuration version */
1410);
1411
1412
1413/******************************************************************************
1414Summary:
1415   Reads a register.
1416Description:
1417   This function reads a register.  This function is normally used for
1418   non-memory mapped BVSB devices, such as BCM3520.
1419Returns:
1420   BERR_Code
1421******************************************************************************/
1422BERR_Code BVSB_ReadRegister(
1423   BVSB_Handle hVSB,  /* [in] BVSB handle */
1424   uint32_t    reg,   /* [in] address of register to read */
1425   uint32_t    *val   /* [in] contains data that was read */
1426);
1427
1428
1429/******************************************************************************
1430Summary:
1431   Writes a register.
1432Description:
1433   This function writes to a register.  This function is normally used for
1434   non-memory mapped BVSB devices, such as BCM3520.
1435Returns:
1436   BERR_Code
1437******************************************************************************/
1438BERR_Code BVSB_WriteRegister(
1439   BVSB_Handle hVSB,  /* [in] BVSB handle */
1440   uint32_t    reg,   /* [in] address of register to write */
1441   uint32_t    *val   /* [in] contains data to write */
1442);
1443
1444
1445/******************************************************************************
1446Summary:
1447   Initiates an I2C write transaction from the front end device's I2C
1448   controller.
1449Description:
1450   This function programs the front end device's master i2c controller to
1451   transmit the data given in buf[].  If there is no master i2c controller on
1452   the front end device, this function will return BERR_NOT_SUPPORTED.
1453Returns:
1454   BERR_Code
1455******************************************************************************/
1456BERR_Code BVSB_Mi2cWrite(
1457   BVSB_Handle h,      /* [in] BVSB handle */
1458   uint8_t slave_addr, /* [in] address of the i2c slave device */
1459   uint8_t *buf,       /* [in] specifies the data to transmit */
1460   uint8_t n           /* [in] number of bytes to transmit after the i2c slave address */
1461);
1462
1463
1464/******************************************************************************
1465Summary:
1466   Initiates an I2C read transaction from the front end device's I2C
1467   controller.
1468Description:
1469   This function programs the front end device's master i2c controller to
1470   transmit the data given in buf[].  If there is no master i2c controller on
1471   the front end device, this function will return BERR_NOT_SUPPORTED.
1472Returns:
1473   BERR_Code
1474******************************************************************************/
1475BERR_Code BVSB_Mi2cRead(
1476   BVSB_Handle h,      /* [in] BVSB handle */
1477   uint8_t slave_addr, /* [in] address of the i2c slave device */
1478   uint8_t *out_buf,   /* [in] specifies the data to transmit before the i2c restart condition */
1479   uint8_t out_n,      /* [in] number of bytes to transmit before the i2c restart condition not including the i2c slave address */
1480   uint8_t *in_buf,    /* [out] holds the data read */
1481   uint8_t in_n        /* [in] number of bytes to read after the i2c restart condition not including the i2c slave address */
1482);
1483
1484
1485/******************************************************************************
1486Summary:
1487   Acquire the inband channel.
1488Description:
1489   Tells the BCM3520 to start inband channel acquisition.
1490Returns:
1491   BERR_Code
1492******************************************************************************/
1493BERR_Code BVSB_AcquireInband(
1494   BVSB_Handle h,                    /* [in] BVSB handle */
1495   const BVSB_InbandParams *pParams  /* [in] inband acquisition parameters */
1496);
1497
1498
1499
1500/******************************************************************************
1501Summary:
1502   Gets VSB status.
1503Description:
1504   This function returns VSB status information.
1505Returns:
1506   BERR_Code
1507******************************************************************************/
1508BERR_Code BVSB_GetVsbStatus(
1509   BVSB_Handle h,           /* [in] BVSB handle */
1510   BVSB_VsbStatus *pStatus  /* [out] VSB status   */
1511);
1512
1513
1514/******************************************************************************
1515Summary:
1516   Gets QAM status.
1517Description:
1518   This function returns QAM status information.
1519Returns:
1520   BERR_Code
1521******************************************************************************/
1522BERR_Code BVSB_GetQamStatus(
1523   BVSB_Handle h,           /* [in] BVSB handle */
1524   BVSB_QamStatus *pStatus  /* [out] QAM status   */
1525);
1526
1527
1528/******************************************************************************
1529Summary:
1530   Gets NTSC status.
1531Description:
1532   This function is used to get NTSC status information.  This function returns
1533   BERR_NOT_SUPPORTED if NTSC/BTSC is not available or not controlled by this
1534   front end device.
1535Returns:
1536   BERR_Code
1537******************************************************************************/
1538BERR_Code BVSB_GetNtscStatus(
1539   BVSB_Handle h,           /* [in] BVSB handle */
1540   BVSB_NtscStatus *pStatus /* [out] NTSC/BTSC status   */
1541);
1542
1543
1544/******************************************************************************
1545Summary:
1546   Resets inband FEC bit error and block counters.
1547Description:
1548   This function clears the following counters in BVSB_VsbStatus/BVSB_QamStatus:
1549   corrErrCount, corrBlockCount, ucorrBlockCount, cleanBlockCount, and berCount
1550Returns:
1551   BERR_Code
1552******************************************************************************/
1553BERR_Code BVSB_ResetInbandStatus(
1554   BVSB_Handle h  /* [in] BVSB handle */
1555);
1556
1557
1558/******************************************************************************
1559Summary:
1560   Acquire the out of band channel.
1561Description:
1562   Tells the BCM3520 to start OOB channel acquisition.
1563Returns:
1564   BERR_Code
1565******************************************************************************/
1566BERR_Code BVSB_AcquireOob(
1567   BVSB_Handle h,           /* [in] BVSB handle */
1568   BVSB_OobParams *pParams  /* [in] acquisition parameters */
1569);
1570
1571
1572/******************************************************************************
1573Summary:
1574   Gets OOB status.
1575Description:
1576   This function is used to get OOB status information.  This function returns
1577   BERR_NOT_SUPPORTED if OOB is not available or not controlled by this front
1578   end device.
1579Returns:
1580   BERR_Code
1581******************************************************************************/
1582BERR_Code BVSB_GetOobStatus(
1583   BVSB_Handle h,           /* [in] BVSB handle */
1584   BVSB_OobStatus *pStatus  /* [out] OOB status   */
1585);
1586
1587
1588/******************************************************************************
1589Summary:
1590   Resets block counters in BVSB_OobStatus.
1591Description:
1592   This function clears the corrBlockCount and ucorrBlockCount counters in
1593   BVSB_OobStatus.  This function returns BERR_NOT_SUPPORTED if OOB is not
1594   available or not controlled by this front end device.
1595Returns:
1596   BERR_Code
1597******************************************************************************/
1598BERR_Code BVSB_ResetOobStatus(
1599   BVSB_Handle h   /* [in] BVSB handle */
1600);
1601
1602
1603/******************************************************************************
1604Summary:
1605   Configure BTSC.
1606Description:
1607   This function configures the sample rate, decode mode, and primary I2S
1608   output of the BTSC decoder.  This function returns BERR_NOT_SUPPORTED if
1609   BTSC is not available or not controlled by this BVSB device.
1610Returns:
1611   BERR_Code
1612******************************************************************************/
1613BERR_Code BVSB_SetBtscConfig(
1614   BVSB_Handle h,             /* [in] BVSB handle                */
1615   BVSB_BtscSettings *pParams /* [in] BTSC configuration parameters */
1616);
1617
1618
1619/******************************************************************************
1620Summary:
1621   Sets the volume level of the BTSC decoder.
1622Description:
1623   This function controls the BTSC volume level for left and right channels.
1624   The left_volume and right_volume parameters are attenuation in units of dB. 
1625   The volume level of 0 corresponds to no attenuation or full volume.  The
1626   valid range for the volume levels are 0 to 95 dB.  This function returns
1627   BERR_NOT_SUPPORTED if BTSC is not available or not supported by this BVSB
1628   device.
1629Returns:
1630   BERR_Code
1631******************************************************************************/
1632BERR_Code BVSB_SetBtscVolume(
1633   BVSB_Handle h,     /* [in] BVSB handle                              */
1634   uint8_t left_volume,  /* [in] left volume attenuation in dB (0 to 95 dB)  */
1635   uint8_t right_volume, /* [in] right volume attenuation in dB (0 to 95 dB) */
1636   bool    bMute         /* [in] BTSC mute control: 0=not muted, 1=muted     */
1637);
1638
1639
1640/******************************************************************************
1641Summary:
1642   Gets BTSC status.
1643Description:
1644   This function is used to get BTSC status information.  This function returns
1645   BERR_NOT_SUPPORTED if BTSC is not available or not controlled by this BVSB
1646   device.
1647Returns:
1648   BERR_Code
1649******************************************************************************/
1650BERR_Code BVSB_GetBtscStatus(
1651   BVSB_Handle h,            /* [in] BVSB handle */
1652   BVSB_BtscStatus *pStatus  /* [out] BTSC status   */
1653);
1654
1655
1656/******************************************************************************
1657Summary:
1658   Reconfigures the inband transport output interface.
1659Description:
1660   This function configures the inband transport output interface.  The
1661   settings will not take effect until the next call to BVSB_AcquireInband().
1662Returns:
1663   BERR_Code
1664******************************************************************************/
1665BERR_Code BVSB_SetInbandOi(
1666   BVSB_Handle           h,         /* [in] BVSB handle */
1667   BVSB_InbandOiSettings *pInbandOi /* [in] inband transport output interface settings */
1668);
1669
1670
1671/******************************************************************************
1672Summary:
1673   Gets I/Q soft decisions for QAM/VSB.
1674Description:
1675   This function is mainly used for inband QAM/VSB constellation display.  This
1676   function returns 30 pairs of I/Q values.
1677Returns:
1678   BERR_Code
1679******************************************************************************/
1680BERR_Code BVSB_GetSoftDecisionBuf(
1681   BVSB_Handle h,  /* [in] BVSB handle */
1682   int16_t *pI,    /* [out] 30 I-values */
1683   int16_t *pQ     /* [out] 30 Q-values */
1684);
1685
1686
1687/******************************************************************************
1688Summary:
1689   Gets I/Q soft decisions for OOB
1690Description:
1691   This function is mainly used for OOB constellation display.  This function
1692   returns 30 pairs of I/Q values.
1693Returns:
1694   BERR_Code
1695******************************************************************************/
1696BERR_Code BVSB_GetOobSoftDecisionBuf(
1697   BVSB_Handle h,  /* [in] BVSB handle */
1698   int16_t *pI,    /* [out] 30 I-values */
1699   int16_t *pQ     /* [out] 30 Q-values */
1700);
1701
1702
1703/******************************************************************************
1704Summary:
1705   Reconfigures the output pads.
1706Description:
1707   This function reconfigures the output pads.  This function returns
1708   BERR_NOT_SUPPORTED if pad configuration is not controlled by this BVSB
1709   device (e.g. BCM3560).
1710Returns:
1711   BERR_Code
1712******************************************************************************/
1713BERR_Code BVSB_SetTmConfig(
1714   BVSB_Handle h,     /* [in] BVSB handle */
1715   void        *pCfg  /* [in] pad configuration parameters */
1716);
1717
1718
1719/******************************************************************************
1720Summary:
1721   Returns the output pads configuration settings.
1722Description:
1723   This function returns pad configuration settings.  This function returns
1724   BERR_NOT_SUPPORTED if pad configuration is not controlled by this BVSB
1725   device (e.g. BCM3560).
1726Returns:
1727   BERR_Code
1728******************************************************************************/
1729BERR_Code BVSB_GetTmConfig(
1730   BVSB_Handle h,     /* [in] BVSB handle */
1731   void        *pCfg  /* [out] pad configuration parameters */
1732);
1733
1734
1735/******************************************************************************
1736Summary:
1737   Writes to the host configuration space.
1738Description:
1739   This function writes to the host configuration space on the front end device.
1740Returns:
1741   BERR_Code
1742******************************************************************************/
1743BERR_Code BVSB_WriteConfig(
1744   BVSB_Handle h,     /* [in] BVSB handle */
1745   uint16_t offset,   /* [in] 16-bit offset within the host configuration space */
1746   uint8_t *buf,      /* [in] data to write */
1747   uint8_t len        /* [in] number of bytes to write */
1748);
1749
1750
1751/******************************************************************************
1752Summary:
1753   Reads from the host configuration space.
1754Description:
1755   This function reads the host configuration space on the front end device.
1756Returns:
1757   BERR_Code
1758******************************************************************************/
1759BERR_Code BVSB_ReadConfig(
1760   BVSB_Handle h,  /* [in] BVSB handle */
1761   uint16_t offset,   /* [in] 16-bit offset within the host configuration space */
1762   uint8_t *buf,      /* [in] buffer to hold the read data */
1763   uint8_t len        /* [in] number of bytes to read */
1764);
1765
1766
1767/******************************************************************************
1768Summary:
1769   Gets the currents settings for the BVSB PI.
1770Description:
1771   This function returns the current settings being used on the BVSB PI.
1772Returns:
1773   BERR_Code
1774******************************************************************************/
1775BERR_Code BVSB_GetSettings(
1776   BVSB_Handle h,           /* [in] BVSB handle */
1777   BVSB_Settings *pSettings /* [out] current BVSB settings */
1778);
1779
1780
1781/******************************************************************************
1782Summary:
1783   Modifies the currents settings for the BVSB PI.
1784Description:
1785   This function modifies the current settings for the BVSB PI.
1786Returns:
1787   BERR_Code
1788******************************************************************************/
1789BERR_Code BVSB_SetSettings(
1790   BVSB_Handle h,           /* [in] BVSB handle */
1791   BVSB_Settings *pSettings /* [in] new BVSB settings */
1792);
1793
1794/******************************************************************************
1795Summary:
1796   Returns the Lock State Change event handle.
1797Description:
1798   If the application wants to know when the inband channel goes in lock or out
1799   of lock, it should use this function to get a handle to the Lock State
1800   Change event.  This event is set whenever the inband channel lock status
1801   changes.
1802Returns:
1803   BERR_Code
1804******************************************************************************/
1805BERR_Code BVSB_GetLockStateChangeEventHandle(
1806   BVSB_Handle h,            /* [in] BVSB handle */
1807   BKNI_EventHandle *hEvent  /* [out] lock event handle */
1808);
1809
1810/******************************************************************************
1811Summary:
1812   Returns the Out-of-Band Lock State Change event handle.
1813Description:
1814   If the application wants to know when the out of band channel goes in lock or out
1815   of lock, it should use this function to get a handle to the Lock State
1816   Change event.  This event is set whenever the OOB channel lock status
1817   changes.
1818Returns:
1819   BERR_Code
1820******************************************************************************/
1821BERR_Code BVSB_GetOobLockStateChangeEventHandle(
1822   BVSB_Handle h,            /* [in] BVSB handle */
1823   BKNI_EventHandle *hEvent  /* [out] lock event handle */
1824);
1825
1826/******************************************************************************
1827Summary:
1828   Returns the lock/unlock event handle.
1829Description:
1830   If the application wants to know when the inband channel goes in lock or out
1831   of lock, it should use this function to get a handle to the Lock State
1832   Change event.  This event is set whenever the inband channel lock status
1833   changes.
1834Returns:
1835   BERR_Code
1836******************************************************************************/
1837BERR_Code BVSB_GetUnlockEventHandle(
1838   BVSB_Handle h,            /* [in] BVSB handle */
1839   BKNI_EventHandle *hEvent  /* [out] lock event handle */
1840);
1841
1842/******************************************************************************
1843Summary:
1844   Returns the lock/unlock event handle.
1845Description:
1846   If the application wants to know when the inband channel goes in lock or out
1847   of lock, it should use this function to get a handle to the Lock State
1848   Change event.  This event is set whenever the inband channel lock status
1849   changes.
1850Returns:
1851   BERR_Code
1852******************************************************************************/
1853BERR_Code BVSB_GetLockEventHandle(
1854   BVSB_Handle h,            /* [in] BVSB handle */
1855   BKNI_EventHandle *hEvent  /* [out] lock event handle */
1856);
1857
1858/******************************************************************************
1859Summary:
1860   Returns the Antenna interrupt event handle.
1861Description:
1862   This event is set whenever an interrupt is received from the Antenna core.
1863   This function will return BERR_NOT_SUPPORTED if the Antenna core is not
1864   present in this BVSB device.
1865Returns:
1866   BERR_Code
1867******************************************************************************/
1868BERR_Code BVSB_GetAntennaEventHandle(
1869   BVSB_Handle h,            /* [in] BVSB handle */
1870   BKNI_EventHandle *hEvent  /* [out] lock event handle */
1871);
1872
1873
1874/******************************************************************************
1875Summary:
1876   This function returns the BVSB interrupt event handle.
1877Description:
1878   This function is used for an i2c-controlled BVSB device only.  The
1879   application will need to call this function to get the event handle
1880   for BVSB interrupts.  The application will wait on this interrupt event.
1881   When this event is signalled, the application must call
1882   BVSB_ProcessInterruptEvent().  For memory-mapped BVSB devices, this function
1883   will return BERR_NOT_SUPPORTED.
1884Returns:
1885   BERR_Code
1886******************************************************************************/
1887BERR_Code BVSB_GetInterruptEventHandle(
1888   BVSB_Handle h,            /* [in] BVSB handle */
1889   BKNI_EventHandle *phEvent /* [out] event handle */
1890);
1891
1892
1893
1894/******************************************************************************
1895Summary:
1896   Handle BVSB interrupts.
1897Description:
1898   This function must be called when the host receives an interrupt from the
1899   BVSB device.
1900Returns:
1901   BERR_Code
1902******************************************************************************/
1903BERR_Code BVSB_HandleInterrupt_isr(
1904   BVSB_Handle h   /* [in] BVSB handle */
1905);
1906
1907
1908/******************************************************************************
1909Summary:
1910   This function processes BVSB interrupt events.
1911Description:
1912   This function is used for an i2c-controlled BVSB device only.  The
1913   application calls this function when a BVSB interrupt event has been
1914   signalled.  This function will decode the interrupt and set approriate
1915   events.  For memory-mapped BVSB devices, this function will return
1916   BERR_NOT_SUPPORTED.
1917Returns:
1918   BERR_Code
1919******************************************************************************/
1920BERR_Code BVSB_ProcessInterruptEvent(
1921   BVSB_Handle hVSB  /* [in] VSB device handle */
1922);
1923
1924/******************************************************************************
1925Summary:
1926   This function reads the chip id
1927Description:
1928   This function is used to figure out which chip revision is the software
1929   connected to. The revision is important information as it determines which
1930   hexfile to download
1931Returns:
1932   BERR_Code
1933******************************************************************************/
1934BERR_Code BVSB_GetChipRevision(
1935   BVSB_Handle hVSB,  /* [in] VSB device handle */
1936   uint8_t* revision /* [out] Chip revision */
1937);
1938
1939/******************************************************************************
1940Summary:
1941   This function detect certain signal.
1942Description:
1943   This function is used for detect certain signal, based on parameters setup
1944   in BVSB_DetectionSettings.  If a signal is found, this routine will return
1945   BERR_SUCCSESS.  At that point, the signal is locked and more details of the
1946   signal can be found by calling the appropriate BVSB_GetXxxStatus routine for
1947   the signal type found.  For example, the user could distinguish what QAM
1948   modulation was found, it can call BVSB_GetQamStatus() if BVSB_SignalMode_eQAM
1949   was returned as the signal mode.
1950
1951   Note: This routine is not available on all chipsets.
1952Returns:
1953   BERR_Code
1954******************************************************************************/
1955BERR_Code BVSB_DetectChannelSignal(
1956        BVSB_Handle h,  /* [in] VSB device handle */
1957        BVSB_DetectType eDetectType,   /* [in] signal detect type */
1958        BVSB_SignalMode* peSignalMode /* [out] signal mode */
1959);
1960
1961
1962/******************************************************************************
1963Summary:
1964   Configure Inband IF frequency.
1965Description:
1966   This function configures the inband if frequency of demod
1967Returns:
1968   BERR_Code
1969******************************************************************************/
1970BERR_Code BVSB_SetInbandIfFreq(
1971   BVSB_Handle h,             /* [in] BVSB handle                */
1972   uint32_t uIfFreq_hz        /* [in] IF freq in Hz configuration parameters */
1973);
1974
1975/******************************************************************************
1976Summary:
1977   Set the Pull-in range when acquiring analog.
1978Description:
1979   This function set the pull-in range of NTSC/PAL acquiring
1980Returns:
1981   BERR_Code
1982******************************************************************************/
1983BERR_Code BVSB_SetIfdPullInRange(
1984        BVSB_Handle h,     
1985        BVSB_Ifd_PullInRange if_pulling_range
1986);
1987
1988/******************************************************************************
1989Summary:
1990   Power down all frontend related cores
1991Description:
1992   This function disables power to DS and IFD core. To bring back power, application can call either BVSB_InitAp function or any of the acquire functions
1993Returns:
1994   BERR_Code
1995******************************************************************************/
1996BERR_Code BVSB_PowerDown(
1997    BVSB_Handle h           /* [in] BVSB handle */
1998);
1999
2000/******************************************************************************
2001Summary:
2002   Change the way out of band clock works
2003Description:
2004   This function all caller to change the behaviour of the OOB FEC clock output.
2005   Only valid on 3520
2006Returns:
2007   BERR_Code
2008******************************************************************************/
2009BERR_Code BVSB_SetOobInterfaceControl(
2010   BVSB_Handle  h,    /* [in] BVSB handle */
2011   BVSB_OobClockSuppression clockSuppression,
2012   BVSB_OobClock clock
2013);
2014
2015
2016
2017
2018
2019
2020
2021#ifdef __cplusplus
2022}
2023#endif
2024
2025#endif /* BVSB_H__ */
2026
Note: See TracBrowser for help on using the repository browser.