source: svn/trunk/newcon3bcm2_21bu/dta/src/settop_api/bsettop_tuner.h

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

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 7.0 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-2006, 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:  $
11 * $brcm_Revision:  $
12 * $brcm_Date: $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log:  $
19 *
20 ***************************************************************************/
21
22#ifndef BSETTOP_TUNER_H__
23#define BSETTOP_TUNER_H__
24
25#include "bsettop_types.h"
26
27typedef enum btuner_fec_mode
28{
29    eFEC_ANNEX_A = 0,
30    eFEC_ANNEX_B = 0x8,
31} btuner_fec_mode;
32
33typedef enum btuner_qam_mode
34{
35        eQAM_16 = 0x10,
36        eQAM_32 = 0x20,
37        eQAM_64 = 0x30,
38        eQAM_128 = 0x40,
39        eQAM_256 = 0x50,
40        eQAM_512 = 0x60,
41        eQAM_1024 = 0x70,
42        eQAM_2048 = 0x80,
43        eQAM_4096 = 0x90,
44        eQAM_Scan = 0xFF /* Only applies to Annex B */
45} btuner_qam_mode;
46
47#ifdef  CONFIG_ISDB
48/*
49 * Summary:
50 *     Receiver CCI (CoChannel Interference Filter) Mode
51 */
52typedef enum btuner_ofdm_cci_mode
53{
54   btuner_ofdm_cci_mode_none,    /* No CCI selected */
55   btuner_ofdm_cci_mode_auto     /* Auto Selection */
56}btuner_ofdm_cci_mode;
57
58/*
59 * Summary:
60 *
61 *  DVB-T can hierarchically encode streams. A low-priority stream can
62 *  be embedded within a high priority stream. Receivers with good reception
63 *  conditions may be able to receive both streams, but receivers with poor
64 *  reception conditions may only be able to receive the high priority stream.
65 *
66 */
67typedef enum btuner_ofdm_priority
68{
69   btuner_ofdm_priority_low,            /* match THD defines */
70   btuner_ofdm_priority_high
71}btuner_ofdm_priority;
72
73/*
74 * Summary:
75 *
76 * ISDB-T is a kind of OFDM modulation technology. It is needed to differentiate
77 * ISDB-T and DVB-T in the channel map.
78 *
79 */
80typedef enum btuner_ofdm_mode
81{
82   btuner_ofdm_mode_dvbt,
83   btuner_ofdm_mode_dvbt2,
84   btuner_ofdm_mode_isdbt
85}btuner_ofdm_mode;
86
87#endif
88
89typedef struct btuner_params {
90    btuner_qam_mode qamMode; /* Select what QAM mode the input signal is */
91    btuner_fec_mode fecMode; /* Select what FEC mode the input signal is */
92    unsigned symbol_rate; /* If Annex-A mode is selected, this parameter selects the custom symbol rate. If Annex-B mode, the symbol_rate is hardcoded */
93
94    bool wait_for_lock;
95    unsigned timeout;
96    bsettop_callback lock_callback; /* called when the tuner comes in or out
97                                    of lock. call btuner_get_vsb_status to determine
98                                    the state. */
99    void *callback_context;         /* passed as parameter to lock_callback */
100    bsettop_callback cancel_callback; /* Called so higher level software can cancel blocking operation. */
101    void *cancel_callback_context;  /* passed as parameter to lock_callback */
102    bool cancel;
103    int spectrum;
104
105#ifdef CONFIG_ISDB
106    /* OFDM */
107    btuner_ofdm_cci_mode cci_mode;   /* CCI Mode */
108    btuner_ofdm_priority priority;   /* priority */
109    btuner_ofdm_mode mode;           /* OFDM mode: dvbt or isdbt */
110#endif
111
112} btuner_params;
113
114typedef struct btuner_status {
115        unsigned int freq;                                      /* Tuned frequency */
116        unsigned int snr;                                       /* Signal to noise ratio */
117        bool lock;                                                      /* Locked state */
118        bool fecLock;
119        bool qamLock;
120
121#ifndef CONFIG_ISDB
122    btuner_qam_mode mode;               /* Current Qam mode */
123#endif
124
125        btuner_fec_mode fecMode;                        /*  FEC mode the input signal is */
126
127        uint32_t goodRsBlockCount;                      /* reset on every read */
128        uint32_t berRawCount;                           /* reset on every read */
129        int32_t agcIntLevel;                            /* in 1/10 percent */
130        int32_t agcExtLevel;                            /* in 1/10 percent */
131        int32_t carrierFreqOffset;                      /* in 1/1000 Hz */
132        int32_t carrierPhaseOffset;                     /* in 1/1000 Hz */
133        uint32_t rxSymbolRate;                          /* in Baud, received symbol rate */
134        uint32_t equalizerGain;             /* Channel equalizer gain value in dBm */
135    uint32_t postRsBER;/* Converted floating point fpostRsBER --> uint32_t postRsBER for rMagnum transport: */
136                                            /* int ipostRsBER = (int)( log(fpostRsBER) * 1000000.0 ); uint32_t postRsBER = (uint32_t)ipostRsBER; */
137                                            /* Host side will need this to convert it back: int ipostRsBER = (int)postRsBER; float fpostRsBER = exp( (float)ipostRsBER/1000000.0 ); */
138        uint32_t elapsedTimeSec;            /* postRsBER over this time */
139        int32_t power;                                  /* in 10s of dBmV unit; OCAP DPM support for video channels */
140        bool isSpectrumInverted;                        /* If 1, Spectrum is inverted relative to the AP bootup. */
141#ifndef ACB612
142        bool get_power;                                 
143#endif
144        uint32_t correctedCount;
145        uint32_t uncorrectedCount;
146        uint32_t resyncCount;
147        uint32_t reacquireCount;
148    uint32_t PreRS;                                             /* preRS for signal quality */
149
150#ifdef CONFIG_ISDB
151    /* OFDM */
152    btuner_ofdm_cci_mode cci_mode;   /* CCI Mode */
153    btuner_ofdm_priority priority;   /* priority */
154    btuner_ofdm_mode mode;           /* OFDM mode: dvbt or isdbt */
155#endif
156
157} btuner_status;
158
159
160/*
161Summary:
162        Handle returned by btuner_open().
163*/
164typedef struct btuner *btuner_t;
165
166
167#ifdef __cplusplus
168extern "C"
169{
170#endif
171/*
172Summary:
173Open a tuner.
174
175Description:
176On most platforms, the tuner_id is simply an index of the tuners.
177
178On platforms with more frontend options (e.g. 97038), please see bsettop_ids.txt
179for documentation on special numbers.
180       
181*/
182btuner_t btuner_open(
183                                         bobject_t tuner_id     /* - handle used to identify a particular tuner */
184                                        );
185
186/*
187Summary:
188        Close a tuner.
189*/
190void btuner_close(
191                                  btuner_t tuner        /* - handle returned by btuner_open */
192                                 );
193
194/*
195Summary:
196        Required to initialize VSB parameters to defaults
197*/
198void btuner_params_init(
199        btuner_params *ds,      /* - [out] */
200        btuner_t tuner                          /* - required for possible resource-dependent defaults */
201        );
202
203
204
205/*
206Summary:
207        Tune and acquire a VSB downstream band
208*/
209bband_t btuner_tune(
210        btuner_t tuner,
211        unsigned freq,  /* - RF center frequency in Hz */
212        btuner_params *params    /* - parameters needed to tune and acquire */
213        );
214
215
216/*
217Summary:
218        Get the status of DS receiver
219*/
220bresult btuner_get_status(
221        btuner_t tuner,
222        btuner_status *status   /* - [out] Current status of the SDS demod */
223        );
224
225typedef struct btuner_softdecision {
226        int16_t i;     
227        int16_t q;
228} btuner_softdecision_t;
229/*
230 * Summary:
231 * Get an arry of soft decision for a constellation
232 * Description:
233 * I and Q range from 32767 to -32768 for all devices
234 */
235bresult btuner_get_softdecisions(
236        btuner_t tuner, 
237        btuner_softdecision_t *pdec,    /* - [out] array of soft decisions */
238        size_t length                                   /* number of soft decisions to get */
239        );
240
241/*
242 * Summary:
243 *      Clear the tuner's channel status
244 */
245bresult btuner_reset_status(btuner_t tuner);
246
247#ifdef CONFIG_NXP_TDA182I4
248unsigned char NXP_TDA182I4_GetPowerLevel();
249
250void NXP_TDA182I4_SetPowerState(bool onoff);
251void NXP_TDA182I4_DupReg(unsigned int max);
252void NXP_TDA182I4_SetScanfreqForTest(unsigned int       freq);
253
254#endif
255
256#ifdef __cplusplus
257}
258#endif
259
260#endif /* BSETTOP_TUNER_H__ */
Note: See TracBrowser for help on using the repository browser.