| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 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: $ |
|---|
| 11 | * $brcm_Revision: $ |
|---|
| 12 | * $brcm_Date: $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: $ |
|---|
| 19 | * |
|---|
| 20 | ***************************************************************************/ |
|---|
| 21 | |
|---|
| 22 | #ifndef BSETTOP_AOB_TUNER_H__ |
|---|
| 23 | #define BSETTOP_AOB_TUNER_H__ |
|---|
| 24 | |
|---|
| 25 | #include "bsettop_types.h" |
|---|
| 26 | #include "btmr.h" |
|---|
| 27 | |
|---|
| 28 | typedef enum btuner_aob_qpsk_mode |
|---|
| 29 | { |
|---|
| 30 | eDvs167Qpsk, /*Annex A*/ |
|---|
| 31 | eDvs178Qpsk, /*Annex B, default*/ |
|---|
| 32 | ePod_Dvs167Qpsk, |
|---|
| 33 | ePod_Dvs178Qpsk, |
|---|
| 34 | } btuner_aob_qpsk_mode; |
|---|
| 35 | |
|---|
| 36 | typedef enum btuner_aob_SpectrumMode |
|---|
| 37 | { |
|---|
| 38 | SpectrumMode_eAuto, |
|---|
| 39 | SpectrumMode_eNoInverted, /* default? */ |
|---|
| 40 | SpectrumMode_eInverted |
|---|
| 41 | } btuner_aob_SpectrumMode; |
|---|
| 42 | |
|---|
| 43 | typedef enum btuner_aob_BerInputSrc |
|---|
| 44 | { |
|---|
| 45 | BerInputSrc_eRcvIChOutput, /* BERT input source is the receiver I-channel output */ |
|---|
| 46 | BerInputSrc_eRcvQChOutput, /* BERT input source is the receiver Q-channel output */ |
|---|
| 47 | BerInputSrc_eRcvIQChOutputIntrlv, /* BERT input source is the receiver I-channel and Q-channel output interleaved */ |
|---|
| 48 | BerInputSrc_eFecOutput /* BERT input source is the FEC output, default? */ |
|---|
| 49 | } btuner_aob_BerInputSrc; |
|---|
| 50 | |
|---|
| 51 | typedef struct btuner_aob_params { |
|---|
| 52 | btuner_aob_qpsk_mode mode; |
|---|
| 53 | unsigned symbol_rate; |
|---|
| 54 | btuner_aob_SpectrumMode spectrum; |
|---|
| 55 | btuner_aob_BerInputSrc ber_input_src; |
|---|
| 56 | bool auto_acquire; |
|---|
| 57 | bool no_signal; |
|---|
| 58 | |
|---|
| 59 | bool wait_for_lock; |
|---|
| 60 | unsigned timeout; |
|---|
| 61 | /* TODO, may not need these callbacks */ |
|---|
| 62 | bsettop_callback lock_callback; /* called when the tuner comes in or out of lock. call btuner_aob_get_status to determine |
|---|
| 63 | the state. */ |
|---|
| 64 | void *callback_context; /* passed as parameter to lock_callback */ |
|---|
| 65 | bsettop_callback cancel_callback; /* Called so higher level software can cancel blocking operation. */ |
|---|
| 66 | void *cancel_callback_context; /* passed as parameter to lock_callback */ |
|---|
| 67 | bool cancel; |
|---|
| 68 | } btuner_aob_params; |
|---|
| 69 | |
|---|
| 70 | typedef struct btuner_aob_status { |
|---|
| 71 | bool lock; /* Locked state */ |
|---|
| 72 | btuner_aob_qpsk_mode mode; /* Current QPSK mode */ |
|---|
| 73 | uint32_t snr; /* converted from snrEstimate / 256 */ |
|---|
| 74 | |
|---|
| 75 | bool isPowerSaverEnabled; /* Enable=1, Disable=0 */ |
|---|
| 76 | //BAOB_ModulationType modType; /* Modulation Type */ |
|---|
| 77 | uint32_t sysXtalFreq; /* in Hertz, Sys. Xtal freq. */ |
|---|
| 78 | uint32_t symbolRate; /* in Baud */ |
|---|
| 79 | bool isFecLock; /* lock=1, unlock=0 */ |
|---|
| 80 | bool isQamLock; /* lock=1, unlock=0 */ |
|---|
| 81 | int32_t snrEstimate; /* in 1/256 db */ |
|---|
| 82 | int32_t agcIntLevel; /* in 1/10 percent */ |
|---|
| 83 | int32_t agcExtLevel; /* in 1/10 percent */ |
|---|
| 84 | int32_t carrierFreqOffset; /* in 1/1000 Hz */ |
|---|
| 85 | int32_t carrierPhaseOffset; /* in 1/1000 Hz */ |
|---|
| 86 | uint32_t uncorrectedCount; /* not self-clearing */ |
|---|
| 87 | uint32_t correctedCount; /* not self-clearing*/ |
|---|
| 88 | uint32_t berErrorCount; /* not self-clearing */ |
|---|
| 89 | } btuner_aob_status; |
|---|
| 90 | |
|---|
| 91 | typedef struct btuner_aob *btuner_aob_t; |
|---|
| 92 | |
|---|
| 93 | #ifdef __cplusplus |
|---|
| 94 | extern "C" |
|---|
| 95 | { |
|---|
| 96 | #endif |
|---|
| 97 | |
|---|
| 98 | /* |
|---|
| 99 | Summary: |
|---|
| 100 | Open an AOB tuner. |
|---|
| 101 | |
|---|
| 102 | Description: |
|---|
| 103 | On most platforms, the tuner_id is simply an index of the tuners. |
|---|
| 104 | |
|---|
| 105 | On platforms with more frontend options (e.g. 97038), please see bsettop_ids.txt |
|---|
| 106 | for documentation on special numbers. |
|---|
| 107 | |
|---|
| 108 | */ |
|---|
| 109 | btuner_aob_t btuner_aob_open( bobject_t tuner_id /* - handle used to identify a particular tuner */); |
|---|
| 110 | |
|---|
| 111 | /* |
|---|
| 112 | Summary: |
|---|
| 113 | Close an AOB tuner. |
|---|
| 114 | */ |
|---|
| 115 | void btuner_aob_close( btuner_aob_t tuner_aob /* - handle returned by btuner_open */); |
|---|
| 116 | |
|---|
| 117 | /* |
|---|
| 118 | Summary: |
|---|
| 119 | Required to initialize VSB parameters to defaults |
|---|
| 120 | */ |
|---|
| 121 | void btuner_aob_params_init( |
|---|
| 122 | btuner_aob_t tuner_aob, /* - required for possible resource-dependent defaults */ |
|---|
| 123 | btuner_aob_params *aob_params /* - [out] */ |
|---|
| 124 | ); |
|---|
| 125 | |
|---|
| 126 | /* |
|---|
| 127 | Summary: |
|---|
| 128 | Tune and acquire an OOB channel |
|---|
| 129 | */ |
|---|
| 130 | bband_t btuner_aob_tune( |
|---|
| 131 | btuner_aob_t tuner_aob, |
|---|
| 132 | unsigned int freq, |
|---|
| 133 | btuner_aob_params *aob_params /* - parameters needed to tune and acquire */ |
|---|
| 134 | ); |
|---|
| 135 | |
|---|
| 136 | /* |
|---|
| 137 | Summary: |
|---|
| 138 | Get the status of OOB receiver |
|---|
| 139 | */ |
|---|
| 140 | bresult btuner_aob_get_status( |
|---|
| 141 | btuner_aob_t tuner_aob, |
|---|
| 142 | btuner_aob_status *status /* - [out] Current status of the OOB */ |
|---|
| 143 | ); |
|---|
| 144 | |
|---|
| 145 | typedef struct btuner_aob_softdecision { |
|---|
| 146 | int16_t i; |
|---|
| 147 | int16_t q; |
|---|
| 148 | } btuner_aob_softdecision_t; |
|---|
| 149 | |
|---|
| 150 | /* |
|---|
| 151 | * Summary: |
|---|
| 152 | * Get an arry of soft decision for a constellation for OOB channel |
|---|
| 153 | * Description: |
|---|
| 154 | * I and Q range from 32767 to -32768 for all devices |
|---|
| 155 | */ |
|---|
| 156 | bresult btuner_aob_get_softdecisions( |
|---|
| 157 | btuner_aob_t tuner_aob, |
|---|
| 158 | btuner_aob_softdecision_t *pdec, /* - [out] array of soft decisions */ |
|---|
| 159 | size_t length /* number of soft decisions to get */ |
|---|
| 160 | ); |
|---|
| 161 | |
|---|
| 162 | /* enable TUNER_AOB_TEST to compile test function in */ |
|---|
| 163 | #ifdef TUNER_AOB_TEST |
|---|
| 164 | void btuner_aob_tune_test(unsigned int freq, int mode); |
|---|
| 165 | #endif |
|---|
| 166 | |
|---|
| 167 | /* |
|---|
| 168 | * Summary: |
|---|
| 169 | * get tuned frequency |
|---|
| 170 | * Description: |
|---|
| 171 | * get tuned frequency |
|---|
| 172 | */ |
|---|
| 173 | uint32_t btuner_aob_get_frequency(btuner_aob_t tuner_aob); |
|---|
| 174 | |
|---|
| 175 | /* |
|---|
| 176 | * Summary: |
|---|
| 177 | * reset OOB tuner status |
|---|
| 178 | * Description: |
|---|
| 179 | * reset OOB tuner status |
|---|
| 180 | */ |
|---|
| 181 | bresult btuner_aob_reset_status(btuner_aob_t tuner_aob); |
|---|
| 182 | |
|---|
| 183 | #ifdef __cplusplus |
|---|
| 184 | } |
|---|
| 185 | #endif |
|---|
| 186 | |
|---|
| 187 | #endif /* BSETTOP_AOB_TUNER_H__ */ |
|---|