source: svn/newcon3bcm2_21bu/magnum/portinginterface/tnr/btnr.h @ 66

Last change on this file since 66 was 66, checked in by megakiss, 11 years ago

키패드 기능 연결

전원키 누르고 리모콘 누르면 학습
CH+ 간격 1초 증가 MAX:15
CH- 간격 1초 감소 MIN :1

  • Property svn:executable set to *
File size: 20.6 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-2012, 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: btnr.h $
11 * $brcm_Revision: Hydra_Software_Devel/38 $
12 * $brcm_Date: 1/26/12 11:51a $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/portinginterface/tnr/btnr.h $
19 *
20 * Hydra_Software_Devel/38   1/26/12 11:51a atanugul
21 * SW3461-131: remove BTNR_RfInputMode_eInternalLnaDaisy
22 *
23 * Hydra_Software_Devel/37   1/16/12 6:20p atanugul
24 * SW3461-131: Add new BTNR_RfInputMode to set the mode to internal LNA
25 * and enable daisy out
26 *
27 * Hydra_Software_Devel/36   1/10/12 4:56p atanugul
28 * SW3128-107:Enable HAB CRC Check in PI
29 *
30 * Hydra_Software_Devel/35   12/22/11 3:37p atanugul
31 * SW3128-100: Check for power status before sending HAB commands
32 *
33 * Hydra_Software_Devel/34   5/27/11 2:17p atanugul
34 * SW3461-3: Converted BTNR_LpfBandwidth enum into unsigned integer
35 *
36 * Hydra_Software_Devel/33   5/24/11 5:36p atanugul
37 * SW3461-3: Modify BTNR_LpfBandwidth, BTNR_Standard according to the
38 * naming convention
39 *
40 * Hydra_Software_Devel/32   5/24/11 3:29p atanugul
41 * SW3461-3: Add BTNR_RfInputMode and agcVal to BTNR_Settings structure
42 * and remore BTNR_PowerMode enum
43 *
44 * Hydra_Software_Devel/31   5/5/11 4:11p atanugul
45 * SW3128-2: Remove BTNR_TunerApplication
46 *
47 * Hydra_Software_Devel/30   5/4/11 4:22p atanugul
48 * SW7231-32: Reverting back to version 28
49 *
50 * Hydra_Software_Devel/29   5/3/11 11:51a vishk
51 * SW7231-32: Implement the Nexus code to support the 3461 frontend chip.
52 * Undo the changes done since version 26.
53 *
54 * Hydra_Software_Devel/28   4/19/11 12:32p atanugul
55 * SW3461-3: Implement BTNR_SetSettings(), Powermode for 3461 TNR and
56 * update BHAB_3461_P_DecodeInterrupt()
57 *
58 * Hydra_Software_Devel/27   4/11/11 5:15p atanugul
59 * SW3128-2: Add Get_Settings and SetSettings support to 3128 TNR PI
60 *
61 * Hydra_Software_Devel/26   11/8/10 5:13p haisongw
62 * SW7125-717: add Docsis scan control support
63 *
64 * Hydra_Software_Devel/25   6/22/10 6:14p vishk
65 * SW7420-839: Add support to program AGC gain to 31xx TNR PI
66 *
67 * Hydra_Software_Devel/24   11/18/09 10:18a farshidf
68 * SW7550-38: add the last changes
69 *
70 * Hydra_Software_Devel/23   11/12/09 6:57p farshidf
71 * SW7550-40: update the tuner files
72 *
73 * Hydra_Software_Devel/22   11/10/09 7:11p farshidf
74 * 7550-38: add the tuner code
75 *
76 * Hydra_Software_Devel/21   8/21/09 6:20p vishk
77 * PR 57484: Bcm31xx: Add Power Management support for TNR
78 *
79 * Hydra_Software_Devel/20   9/12/07 12:54p vishk
80 * PR 29024: To create PI for BCM3420 tuner.
81 *
82 * Hydra_Software_Devel/19   6/7/05 8:35a dlwin
83 * PR 14682: Added additional functions for Docsis and general use.  New
84 * function 'BTNR_GetInfo()' returns additional informtion for the tuner.
85 *
86 * Hydra_Software_Devel/18   4/1/05 5:25p dlwin
87 * PR 14682: Added semi-private functions for QamCm to use to AGC
88 * readings.  This required for Docsis integration.
89 *
90 * Hydra_Software_Devel/17   12/2/03 9:27a dlwin
91 * Updated sample code to use NULL instead of hChip3250.
92 *
93 * Hydra_Software_Devel/16   10/7/03 8:52a dlwin
94 * Removed the need to call a create generic tuner  handle.
95 *
96 * Hydra_Software_Devel/15   9/29/03 7:59p dlwin
97 * Added first pass of test plan documentation.
98 *
99 * Hydra_Software_Devel/14   9/18/03 2:43p dlwin
100 * Remvoed any warning from '-Wall' option.
101 *
102 * Hydra_Software_Devel/13   9/9/03 8:43a dlwin
103 * Updated API function parameter comment for DocJet.
104 *
105 * Hydra_Software_Devel/12   8/29/03 7:32a dlwin
106 * Updated comments.
107 *
108 * Hydra_Software_Devel/11   8/26/03 2:18p dlwin
109 * Updated comment and sample code.
110 *
111 * Hydra_Software_Devel/10   8/26/03 11:09a dlwin
112 * Newly updated API, using a similar design model as BREG_I2C and BREG.
113 *
114 * Hydra_Software_Devel/9   8/22/03 9:11a dlwin
115 * Updated sample code.
116 *
117 * Hydra_Software_Devel/8   8/20/03 6:19p dlwin
118 * Updated to be more DocJet happy.
119 *
120 * Hydra_Software_Devel/7   8/20/03 4:15p dlwin
121 * Update sample code.
122 *
123 * Hydra_Software_Devel/6   8/18/03 9:23a dlwin
124 * Added interrupt requirement.
125 *
126 * Hydra_Software_Devel/5   8/14/03 8:37a dlwin
127 * Updated sample code.
128 *
129 * Hydra_Software_Devel/4   8/1/03 7:11p dlwin
130 * Added much more comments, plus changed BTNR_SetTunerFreq() to
131 * BTNR_SetTunerRfFreq() and BTNR_GetTunerFreq() to
132 * BTNR_GetTunerRfFreq().
133 *
134 * Hydra_Software_Devel/3   6/25/03 4:43p dlwin
135 * Updated comments.
136 *
137 * Hydra_Software_Devel/2   6/12/03 5:43p dlwin
138 * Added more comments.
139 *
140 * Hydra_Software_Devel/1   6/3/03 4:03p dlwin
141 * Initial version
142 *
143 ***************************************************************************/
144
145/*= Module Overview *********************************************************
146<verbatim>
147
148Overview
149Tuner module represents a generalize representatiion of a tuner.  The
150basic function of a tuner is for downconverting Radio Frequency (RF) signal to
151a Intermediate Frequency (IF) signal.  For InBand downstream, the tuner module
152is responsible for downconverting RF frequencies of 130MHz-860MHz to an
153IF signal.  For most reference design, IF frequency is either 43.75 MHz for
154Annex B or 36.125 MHz for Annex A.  Annex A support requires a H/W tuner
155with 8MHz SAW filter.  Annex B support requires a H/W tuner with 6MHz SAW filter.
156For OutOfBand downstream, the tuner module is responsible for downconverting
157RF frequencies of 70MHz-130MHz to an IF signal.  For most reference design,
158IF frequency for OutOfBand is 44MHz.
159To support the numerous tuners that may appear on for system, the Tuner module
160has been designed to allow for customization by the S/W board designer yet
161provide a common interface for controlling the operation of the tuner.  To
162accomplish the above goals, the Tuner module API is divided into two parts.
163First section (called Custom) deals with customization while the other section
164(called General) provides control over the operation of a tuner.  The Custom
165section API consists of Open/Close/Create.  The General section API provides
166GetRfFreq/SetRfFreq,
167
168
169Design
170The design for BQDS PI API is broken into two parts.
171
172o Part 1 (open/close/configuration/create):
173
174    These APIs are used for opening and closing a specific BTNR device.  Also
175    included in this section is an API to create a general BTNR device handle.
176
177o Part 2 (get/set):
178
179    These APIs are used for getting and setting runtime attributes of BTNR
180    using a general BTNR device handle.
181
182
183Usage
184The usage of BTNR involves the following:
185
186   * Configure/Open/Create of BTNR
187
188      * Configure BTNR device for the target system
189      * Open BTNR device
190
191   * Tune device channel
192
193      * Set RF frequency using general BTNR handle
194
195
196Interrupt Requirements:
197None
198
199
200Sample Code
201//
202// NOTE: The following sample code does not do any error checking.
203//
204// In this example, the target H/W board contains two tuners. One is a
205// Bcm3418 tuner configuried for Annex B application, with IF Frequency
206// of 43.75 MHz.  The other tuner is an Alps TDDE tuner, so used Annex B
207// application.
208//
209
210#include "btnr_3418.h"
211#include "btnr_alpstdde.h"
212
213static BTNR_AlpsTdde_Handle hTnrAlpsTdde;
214static BTNR_Handle hTnrDev1;
215static BTNR_Handle hTnrDev2;
216static BCHP_Handle hChip3250;
217static BREG_Handle hReg3250;
218static BREG_I2C_Handle hBcm7038I2C;
219
220
221main( void )
222{
223    BTNR_3418_Settings tnr3418DevSettings;
224    BTNR_AlpsTdde_Settings tnrAlpsTddeDevSettings;
225
226
227    // Initialize hChip3250, hReg3250, hInt3250, and hBcm7038I2C . . .
228
229
230    // *************************************************************************
231    // Start of H/W board specific configuration for BTNR
232    // *************************************************************************
233    // Configure first tuner, Bcm3418 Device
234    BTNR_3418_GetDefaultSettings( &tnr3418DevSettings, hChip3250 );
235    // Now initialize Bcm3418 specific data, Bcm3418 needs to know the
236    //   If Freq. to use, 43.75 MHz
237    //   I2C address of Bcm3418 device, addr=0x10
238    tnr3418DevSettings.ifFreq = 43750000;
239    tnr3418DevSettings.i2cAddr = 0x10;
240    // Open first tuner, Bcm3418 Device
241    BTNR_3418_Open( &hTnrDev1, NULL, hBcm7038I2C, &tnr3418DevSettings );
242
243    // Configure second tuner, Alps TDDE Device
244    BTNR_AlpsTdde_GetDefaultSettings( &tnrAlpsTddeDevSettings, hChip3250 );
245    // Now initialize Alps TDDE specific data
246    tnrAlpsTddeDevSettings.ifFreq = 43750000;
247    // Open second tuner, Alps TDDE Device
248    BTNR_AlpsTdde_Open( &hTnrDev2, NULL, hBcm7038I2C, &tnrAlpsTddeDevSettings );
249
250    // *************************************************************************
251    // End of H/W board specific configuration for BTNR
252    // *************************************************************************
253
254    // Set the first tuner to 777,000,000 Hz (777 Mhz) for a digital channel
255    // using general BTNR handle.
256    BTNR_SetTunerRfFreq( hTnrDev1, 777000000, BTNR_TunerMode_eDigital );
257    // Set the first tuner to 600,000,000 Hz (600 Mhz) for a analog channel
258    // using general BTNR handle.
259    BTNR_SetTunerRfFreq( hTnrDev1, 600000000, BTNR_TunerMode_eAnalog );
260
261    // Set the second tuner to 500,000,000 Hz (500 Mhz) for a digital channel
262    // using general BTNR handle.
263    BTNR_SetTunerRfFreq( hTnrDev2, 500000000, BTNR_TunerMode_eDigital );
264}
265
266</verbatim>
267***************************************************************************/
268
269/****************************************************************************
270    Test Plan
271
272Purpose
273    The purpose of this test script is to test Tuner PI as described in the
274    Design Requirements in Twiki.
275
276Requirement
277    1 Shall use Device Porting Interface device model, supporting 1 or more device channels
278    2 Shall use Set/Get Porting Interface change model
279    3 Shall provide support for Bcm3418 tuner
280    4 Shall provide support for Out-of-Band Bcm3250 tuner
281    5 Shall support configurable board specific Tuner component per device channel
282    6 Shall provide programmable RF Frequency per device channel
283    7 Shall provide programmable Analog/Digital RF signal per device channel
284
285Test Setup
286    See QDS and QOB Test Plans, which tests this PI.
287
288
289Test Procedure
290    See QDS and QOB Test Plans, which tests this PI.
291
292
293***************************************************************************/
294
295#ifndef BTNR_H__
296#define BTNR_H__
297
298#include "bchp.h"
299#include "berr_ids.h"
300
301#ifdef __cplusplus
302extern "C" {
303#endif
304
305/***************************************************************************
306Summary:
307    Error Codes specific to BTNR
308
309Description:
310
311See Also:
312
313****************************************************************************/
314#define BTNR_ERR_POWER_DOWN       BERR_MAKE_CODE(BERR_TNR_ID, 0)
315#define BTNR_ERR_INVALID_CRC      BERR_MAKE_CODE(BERR_TNR_ID, 1)
316
317/***************************************************************************
318Summary:
319    The handle for Tuner module
320
321Description:
322    An opaque handle for BTNR device.
323
324See Also:
325    BTNR_xxx_CreateTunerHandle(), 'xxx' is specific to a tuner, for example
326    BTNR_3418_CreateTunerHandle() for Bcm3418 tuner.
327
328****************************************************************************/
329typedef struct BTNR_P_Handle                *BTNR_Handle;
330
331/***************************************************************************
332Summary:
333    Enumeration for Tuner mode
334
335Description:
336    This enumeration defines the tuner mode for Qam Upstream.
337
338See Also:
339    BTNR_SetTunerRfFreq(), BTNR_GetTunerRfFreq()
340
341****************************************************************************/
342typedef enum BTNR_TunerMode
343{
344    BTNR_TunerMode_eDigital,
345    BTNR_TunerMode_eAnalog,
346    BTNR_TunerMode_eDocsis,   
347    BTNR_TunerMode_eLast
348} BTNR_TunerMode;
349
350/***************************************************************************
351Summary:
352    Enumeration for Tuner Application
353
354Description:
355    This field controls the target application.
356
357See Also:
358    BTNR_SetSettings(), BTNR_GetSettings()
359
360****************************************************************************/
361typedef enum BTNR_TunerApplication
362{
363  BTNR_TunerApplication_eCable,
364  BTNR_TunerApplication_eTerrestrial,
365  BTNR_TunerApplication_eLast
366} BTNR_TunerApplication;
367
368/***************************************************************************
369Summary:
370    Enumeration for modulation standard
371
372Description:
373    This field controls modulation standard to be received.
374
375See Also:
376    BTNR_SetSettings(), BTNR_GetSettings()
377
378****************************************************************************/
379typedef enum BTNR_Standard
380{
381  BTNR_Standard_eDvbt,
382  BTNR_Standard_eIsdbt,
383  BTNR_Standard_eQam,
384  BTNR_Standard_eDvbt2,
385  BTNR_Standard_eLast
386} BTNR_Standard;
387
388/***************************************************************************
389Summary:
390    Enumeration for TNR Input Mode
391
392Description:
393    This field specifies the Input mode for TNR.
394
395See Also:
396    BTNR_SetSettings(), BTNR_GetSettings()
397
398****************************************************************************/
399typedef enum BTNR_RfInputMode
400{
401  BTNR_RfInputMode_eOff, /* Tuner is off. */
402  BTNR_RfInputMode_eExternalLna,  /* Tuner Rf input through UHF path. This Rf path does not use internal LNA. */
403  BTNR_RfInputMode_eInternalLna, /* Tuner Rf input through VHF path. This Rf path uses internal LNA. */
404  BTNR_RfInputMode_eStandardIf,  /* 44 MHz or 36 MHz */
405  BTNR_RfInputMode_eLowIf,  /*4 MHz to 5 MHz. */
406  BTNR_RfInputMode_eBaseband,
407  BTNR_RfInputMode_eLast
408} BTNR_RfInputMode;
409
410/***************************************************************************
411Summary:
412    Structure for Tuner Information
413
414Description:
415    This defines the tuner information.
416
417See Also:
418    BTNR_GetInfo()
419
420****************************************************************************/
421#define BRCM_TUNER_MAKER_ID             (1)
422typedef struct BTNR_TunerInfo
423{
424    unsigned int tunerMaker;            /* 0=unknown, 1=BRCM Tuner */
425    unsigned int tunerId;
426    unsigned int tunerMajorVer;
427    unsigned int tunerMinorVer;
428} BTNR_TunerInfo;
429
430/***************************************************************************
431Summary:
432    Structure to set tuner into power saver mode.
433
434Description:
435    Structure to set tuner into power saver mode.
436
437See Also:
438    BTNR_GetInfo()
439
440****************************************************************************/
441typedef struct BTNR_PowerSaverSettings
442{
443    bool enable; /* 1 =  enable power saver, 0 = disable power saver. */
444} BTNR_PowerSaverSettings;
445
446/***************************************************************************
447Summary:
448    Structure to set tuner settings.
449
450Description:
451    Structure to set tuner settings.
452
453See Also:
454    BTNR_GetInfo()
455
456****************************************************************************/
457typedef struct BTNR_Settings
458{
459    BTNR_Standard std;
460    BTNR_TunerApplication tnrApplication;
461    uint32_t bandwidth; /* low pass filter bandwidth in units of Hz */
462    BTNR_RfInputMode rfInputMode; /* TNR RF input mode */
463    uint32_t agcVal; /* AGC value */
464} BTNR_Settings;
465
466/***************************************************************************
467Summary:
468    This function sets the Tuner to the requested frequency.
469
470Description:
471    This function is responsible for setting Tuner to a frequency.
472
473    This function will call the tuner specific SetRfFreq function.
474   
475Returns:
476    TODO:
477
478See Also:
479    BTNR_GetTunerRfFreq()
480
481****************************************************************************/
482BERR_Code BTNR_SetTunerRfFreq(
483    BTNR_Handle hDev,                   /* [in] Device handle */
484    uint32_t freq,                      /* [in] Requested tuner freq., in Hertz */
485    BTNR_TunerMode tunerMode            /* [in] Requested tuner mode */
486    );
487
488/***************************************************************************
489Summary:
490    This function gets the current Tuner tuned frequency.
491
492Description:
493    This function is responsible for getting the current Tuner tuned frequency.
494
495    This function will call the tuner specific GetRfFreq function.
496   
497Returns:
498    TODO:
499
500See Also:
501    BTNR_SetTunerRfFreq()
502
503****************************************************************************/
504BERR_Code BTNR_GetTunerRfFreq(
505    BTNR_Handle hDev,                   /* [in] Device handle */
506    uint32_t *freq,                     /* [out] Returns tuner freq., in Hertz */
507    BTNR_TunerMode *tunerMode           /* [out] Returns tuner mode */
508    );
509
510/***************************************************************************
511Summary:
512    This function gets the Tuner Information.
513
514Description:
515    This function is responsible for getting Tuner Information.
516   
517Returns:
518    TODO:
519
520See Also:
521
522****************************************************************************/
523BERR_Code BTNR_GetInfo(
524    BTNR_Handle hDev,                   /* [in] Device handle */
525    BTNR_TunerInfo *tnrInfo             /* [out] Tuner information */
526    );
527
528/***************************************************************************
529Summary:
530    This function closes Tuner module.
531
532Description:
533    This function is responsible for closing Tuner module.
534   
535Returns:
536    TODO:
537
538See Also:
539    BTNR_xxxx_Open()
540
541****************************************************************************/
542BERR_Code BTNR_Close(
543    BTNR_Handle hDev                    /* [in] Device handle */
544    );
545
546/***************************************************************************
547Summary:
548    This function gets the power-saver mode.
549
550Description:
551    This function returns the current power-saver mode.
552   
553Returns:
554    TODO:
555
556See Also:
557    BTNR_xxxx_Open()
558
559****************************************************************************/
560BERR_Code BTNR_GetPowerSaver(
561    BTNR_Handle hDev,                   /* [in] Device handle */
562    BTNR_PowerSaverSettings *pwrSettings /* [out] Power saver settings. */
563    );
564
565/***************************************************************************
566Summary:
567    This function sets the power-saver mode.
568
569Description:
570    This function is responsible for enabling/disabling the downstream tuner
571    power-saver mode.  When the power-saver mode is enabled, the
572    Qam In-Band Downstream tuner is shutdown.
573   
574Returns:
575    TODO:
576
577See Also:
578    BTNR_xxxx_Open()
579
580****************************************************************************/
581BERR_Code BTNR_SetPowerSaver(
582    BTNR_Handle hDev,                   /* [in] Device handle */
583    BTNR_PowerSaverSettings *pwrSettings /* [in] Power saver settings. */
584    );
585
586/***************************************************************************
587Summary:
588    This function gets the Tuner's AGC register value.
589
590Description:
591    This function is responsible for getting the AGC register value using
592    register offset.
593   
594Returns:
595    TODO:
596
597See Also:
598    BTNR_xxxx_Open()
599
600****************************************************************************/
601BERR_Code BTNR_P_GetTunerAgcRegVal(
602    BTNR_Handle hDev,                   /* [in] Device handle */
603    uint32_t regOffset,                 /* [in] AGC register offset */
604    uint32_t *agcVal                    /* [out] output value */
605    );
606
607/***************************************************************************
608Summary:
609    This function sets the Tuner's AGC register value.
610
611Description:
612    This function is responsible for setting the AGC register value using
613    register offset.
614   
615Returns:
616    TODO:
617
618See Also:
619    BTNR_xxxx_Open()
620
621****************************************************************************/
622BERR_Code BTNR_SetTunerAgcRegVal(
623    BTNR_Handle hDev,                   /* [in] Device handle */
624    uint32_t regOffset,                 /* [in] AGC register offset */
625    uint32_t *agcVal                    /* [in] input value */
626    );
627
628/***************************************************************************
629Summary:
630    This function gets TNR settings.
631
632Description:
633    This function returns the current TNR Settings.
634   
635Returns:
636    TODO:
637
638See Also:
639    BTNR_xxxx_Open()
640
641****************************************************************************/
642BERR_Code BTNR_GetSettings(
643    BTNR_Handle hDev,           /* [in] Device handle */
644    BTNR_Settings *settings     /* [out] TNR settings. */
645    );
646   
647/***************************************************************************
648Summary:
649    This function sets TNR settings.
650
651Description:
652    This function sets the current TNR Settings.
653   
654Returns:
655    TODO:
656
657See Also:
658    BTNR_xxxx_Open()
659
660****************************************************************************/
661BERR_Code BTNR_SetSettings(
662    BTNR_Handle hDev,           /* [in] Device handle */
663    BTNR_Settings *settings     /* [in] TNR settings. */
664    );
665   
666#ifdef __cplusplus
667}
668#endif
669 
670#endif
Note: See TracBrowser for help on using the repository browser.