/*************************************************************************** * Copyright (c) 2003-2006, Broadcom Corporation * All Rights Reserved * Confidential Property of Broadcom Corporation * * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. * * $brcm_Workfile: $ * $brcm_Revision: $ * $brcm_Date: $ * * Module Description: * * Revision History: * * $brcm_Log: $ * ***************************************************************************/ #ifndef BSETTOP_TUNER_H__ #define BSETTOP_TUNER_H__ #include "bsettop_types.h" typedef enum btuner_fec_mode { eFEC_ANNEX_A = 0, eFEC_ANNEX_B = 0x8, } btuner_fec_mode; typedef enum btuner_qam_mode { eQAM_16 = 0x10, eQAM_32 = 0x20, eQAM_64 = 0x30, eQAM_128 = 0x40, eQAM_256 = 0x50, eQAM_512 = 0x60, eQAM_1024 = 0x70, eQAM_2048 = 0x80, eQAM_4096 = 0x90, eQAM_Scan = 0xFF /* Only applies to Annex B */ } btuner_qam_mode; #ifdef CONFIG_ISDB /* * Summary: * Receiver CCI (CoChannel Interference Filter) Mode */ typedef enum btuner_ofdm_cci_mode { btuner_ofdm_cci_mode_none, /* No CCI selected */ btuner_ofdm_cci_mode_auto /* Auto Selection */ }btuner_ofdm_cci_mode; /* * Summary: * * DVB-T can hierarchically encode streams. A low-priority stream can * be embedded within a high priority stream. Receivers with good reception * conditions may be able to receive both streams, but receivers with poor * reception conditions may only be able to receive the high priority stream. * */ typedef enum btuner_ofdm_priority { btuner_ofdm_priority_low, /* match THD defines */ btuner_ofdm_priority_high }btuner_ofdm_priority; /* * Summary: * * ISDB-T is a kind of OFDM modulation technology. It is needed to differentiate * ISDB-T and DVB-T in the channel map. * */ typedef enum btuner_ofdm_mode { btuner_ofdm_mode_dvbt, btuner_ofdm_mode_dvbt2, btuner_ofdm_mode_isdbt }btuner_ofdm_mode; #endif typedef struct btuner_params { btuner_qam_mode qamMode; /* Select what QAM mode the input signal is */ btuner_fec_mode fecMode; /* Select what FEC mode the input signal is */ 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 */ bool wait_for_lock; unsigned timeout; bsettop_callback lock_callback; /* called when the tuner comes in or out of lock. call btuner_get_vsb_status to determine the state. */ void *callback_context; /* passed as parameter to lock_callback */ bsettop_callback cancel_callback; /* Called so higher level software can cancel blocking operation. */ void *cancel_callback_context; /* passed as parameter to lock_callback */ bool cancel; int spectrum; #ifdef CONFIG_ISDB /* OFDM */ btuner_ofdm_cci_mode cci_mode; /* CCI Mode */ btuner_ofdm_priority priority; /* priority */ btuner_ofdm_mode mode; /* OFDM mode: dvbt or isdbt */ #endif } btuner_params; typedef struct btuner_status { unsigned int freq; /* Tuned frequency */ unsigned int snr; /* Signal to noise ratio */ bool lock; /* Locked state */ bool fecLock; bool qamLock; #ifndef CONFIG_ISDB btuner_qam_mode mode; /* Current Qam mode */ #endif btuner_fec_mode fecMode; /* FEC mode the input signal is */ uint32_t goodRsBlockCount; /* reset on every read */ uint32_t berRawCount; /* reset on every read */ int32_t agcIntLevel; /* in 1/10 percent */ int32_t agcExtLevel; /* in 1/10 percent */ int32_t carrierFreqOffset; /* in 1/1000 Hz */ int32_t carrierPhaseOffset; /* in 1/1000 Hz */ uint32_t rxSymbolRate; /* in Baud, received symbol rate */ uint32_t equalizerGain; /* Channel equalizer gain value in dBm */ uint32_t postRsBER;/* Converted floating point fpostRsBER --> uint32_t postRsBER for rMagnum transport: */ /* int ipostRsBER = (int)( log(fpostRsBER) * 1000000.0 ); uint32_t postRsBER = (uint32_t)ipostRsBER; */ /* Host side will need this to convert it back: int ipostRsBER = (int)postRsBER; float fpostRsBER = exp( (float)ipostRsBER/1000000.0 ); */ uint32_t elapsedTimeSec; /* postRsBER over this time */ int32_t power; /* in 10s of dBmV unit; OCAP DPM support for video channels */ bool isSpectrumInverted; /* If 1, Spectrum is inverted relative to the AP bootup. */ #ifndef ACB612 bool get_power; #endif uint32_t correctedCount; uint32_t uncorrectedCount; uint32_t resyncCount; uint32_t reacquireCount; uint32_t PreRS; /* preRS for signal quality */ #ifdef CONFIG_ISDB /* OFDM */ btuner_ofdm_cci_mode cci_mode; /* CCI Mode */ btuner_ofdm_priority priority; /* priority */ btuner_ofdm_mode mode; /* OFDM mode: dvbt or isdbt */ #endif } btuner_status; /* Summary: Handle returned by btuner_open(). */ typedef struct btuner *btuner_t; #ifdef __cplusplus extern "C" { #endif /* Summary: Open a tuner. Description: On most platforms, the tuner_id is simply an index of the tuners. On platforms with more frontend options (e.g. 97038), please see bsettop_ids.txt for documentation on special numbers. */ btuner_t btuner_open( bobject_t tuner_id /* - handle used to identify a particular tuner */ ); /* Summary: Close a tuner. */ void btuner_close( btuner_t tuner /* - handle returned by btuner_open */ ); /* Summary: Required to initialize VSB parameters to defaults */ void btuner_params_init( btuner_params *ds, /* - [out] */ btuner_t tuner /* - required for possible resource-dependent defaults */ ); /* Summary: Tune and acquire a VSB downstream band */ bband_t btuner_tune( btuner_t tuner, unsigned freq, /* - RF center frequency in Hz */ btuner_params *params /* - parameters needed to tune and acquire */ ); /* Summary: Get the status of DS receiver */ bresult btuner_get_status( btuner_t tuner, btuner_status *status /* - [out] Current status of the SDS demod */ ); typedef struct btuner_softdecision { int16_t i; int16_t q; } btuner_softdecision_t; /* * Summary: * Get an arry of soft decision for a constellation * Description: * I and Q range from 32767 to -32768 for all devices */ bresult btuner_get_softdecisions( btuner_t tuner, btuner_softdecision_t *pdec, /* - [out] array of soft decisions */ size_t length /* number of soft decisions to get */ ); /* * Summary: * Clear the tuner's channel status */ bresult btuner_reset_status(btuner_t tuner); #ifdef CONFIG_NXP_TDA182I4 unsigned char NXP_TDA182I4_GetPowerLevel(); void NXP_TDA182I4_SetPowerState(bool onoff); void NXP_TDA182I4_DupReg(unsigned int max); void NXP_TDA182I4_SetScanfreqForTest(unsigned int freq); #endif #ifdef __cplusplus } #endif #endif /* BSETTOP_TUNER_H__ */