| 1 | /************************************************************************* |
|---|
| 2 | * (c)2005-2012 Broadcom Corporation |
|---|
| 3 | * |
|---|
| 4 | * This program is the proprietary software of Broadcom Corporation and/or its licensors, |
|---|
| 5 | * and may only be used, duplicated, modified or distributed pursuant to the terms and |
|---|
| 6 | * conditions of a separate, written license agreement executed between you and Broadcom |
|---|
| 7 | * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants |
|---|
| 8 | * no license (express or implied), right to use, or waiver of any kind with respect to the |
|---|
| 9 | * Software, and Broadcom expressly reserves all rights in and to the Software and all |
|---|
| 10 | * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU |
|---|
| 11 | * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY |
|---|
| 12 | * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. |
|---|
| 13 | * |
|---|
| 14 | * $brcm_Workfile: btnr_callback.c $ |
|---|
| 15 | * $brcm_Revision: 9 $ |
|---|
| 16 | * $brcm_Date: 3/23/12 2:49p $ |
|---|
| 17 | * |
|---|
| 18 | * [File Description:] |
|---|
| 19 | * |
|---|
| 20 | * Revision History: |
|---|
| 21 | * |
|---|
| 22 | * $brcm_Log: /AP/ctfe/core/tnr/btnr_callback.c $ |
|---|
| 23 | * |
|---|
| 24 | * 9 3/23/12 2:49p farshidf |
|---|
| 25 | * SW3128-125: FW version 4.6 |
|---|
| 26 | * |
|---|
| 27 | * SW3461-173/1 3/16/12 3:03p farshidf |
|---|
| 28 | * SW3461-1: add power protection for tuner callback from demod |
|---|
| 29 | * |
|---|
| 30 | * 8 2/15/12 5:38p farshidf |
|---|
| 31 | * SW3461-1: merge to integ |
|---|
| 32 | * |
|---|
| 33 | * Fw_Integration_Devel/7 2/15/12 5:37p farshidf |
|---|
| 34 | * SW3461-1: merge to integ |
|---|
| 35 | * |
|---|
| 36 | * Fw_Integration_Devel/AP_V4_0_TNR_DEV/1 2/9/12 11:48a cbrooks |
|---|
| 37 | * sw3461-1:fixed baud rate droppouts |
|---|
| 38 | * |
|---|
| 39 | * 7 8/12/11 3:14p farshidf |
|---|
| 40 | * SW3461-1: merge to main |
|---|
| 41 | * |
|---|
| 42 | * Fw_Integration_Devel/5 8/12/11 2:17p farshidf |
|---|
| 43 | * SW3461-1: remove printf |
|---|
| 44 | * |
|---|
| 45 | * Fw_Integration_Devel/4 8/2/11 6:19p farshidf |
|---|
| 46 | * SW3461-1: merge to integ |
|---|
| 47 | * |
|---|
| 48 | * Fw_Integration_Devel/AP_V0_6_TNR_DEV/9 8/2/11 6:11p farshidf |
|---|
| 49 | * SW3461-1: update the tuner structure |
|---|
| 50 | * |
|---|
| 51 | * Fw_Integration_Devel/AP_V0_6_TNR_DEV/8 7/27/11 1:33p farshidf |
|---|
| 52 | * SW3461-1: magnum compatible |
|---|
| 53 | * |
|---|
| 54 | * Fw_Integration_Devel/AP_V0_6_TNR_DEV/7 7/27/11 1:19p farshidf |
|---|
| 55 | * SW3461-1: magnum compatible |
|---|
| 56 | * |
|---|
| 57 | * Fw_Integration_Devel/AP_V0_6_TNR_DEV/6 7/27/11 1:17p farshidf |
|---|
| 58 | * SW3461-1: make it magnum compatible |
|---|
| 59 | * |
|---|
| 60 | * Fw_Integration_Devel/AP_V0_6_TNR_DEV/5 7/14/11 5:36p cbrooks |
|---|
| 61 | * sw3461-1:removed print statements |
|---|
| 62 | * |
|---|
| 63 | * Fw_Integration_Devel/AP_V0_6_TNR_DEV/4 7/14/11 5:20p cbrooks |
|---|
| 64 | * sw3461-1:callback support |
|---|
| 65 | * |
|---|
| 66 | * Fw_Integration_Devel/AP_V0_6_TNR_DEV/3 7/7/11 5:22p farshidf |
|---|
| 67 | * SW3461-17: add the tuner callback function |
|---|
| 68 | * |
|---|
| 69 | * Fw_Integration_Devel/AP_V0_6_TNR_DEV/2 7/7/11 4:47p cbrooks |
|---|
| 70 | * SW3461-1:working on callbacak functions and status |
|---|
| 71 | * |
|---|
| 72 | * Fw_Integration_Devel/AP_V0_6_TNR_DEV/1 7/1/11 3:19p cbrooks |
|---|
| 73 | * sw3461-1:added ADS callback support |
|---|
| 74 | * |
|---|
| 75 | * 4 7/20/11 11:36a farshidf |
|---|
| 76 | * SW7552-60: mereg the latest tuner code |
|---|
| 77 | * |
|---|
| 78 | * Fw_Integration_Devel/1 6/29/11 12:39p farshidf |
|---|
| 79 | * SW3461-13: merge to integration branch |
|---|
| 80 | * |
|---|
| 81 | * Fw_Integration_Devel/Tnr_Fw_Devel_Rc05/2 6/22/11 6:47p cbrooks |
|---|
| 82 | * sw3461-1:added callback support |
|---|
| 83 | * |
|---|
| 84 | * Fw_Integration_Devel/Tnr_Fw_Devel_Rc05/1 6/21/11 5:15p cbrooks |
|---|
| 85 | * sw3461-1:Changed Callback Function |
|---|
| 86 | * |
|---|
| 87 | * 3 6/9/11 6:39p mpovich |
|---|
| 88 | * SW3461-1: Merge Ver 0.4 Integ. onto main branch. |
|---|
| 89 | * |
|---|
| 90 | * SW_System_4_Integ_Test/1 6/6/11 2:10p mpovich |
|---|
| 91 | * SW3461-1: Merge disparate branches for test purposes. |
|---|
| 92 | * |
|---|
| 93 | * Tnr_Fw_Devel_4/1 5/25/11 10:03a farshidf |
|---|
| 94 | * SW3461-6: add the timer Interrupt |
|---|
| 95 | * |
|---|
| 96 | * 2 5/20/11 6:42a mpovich |
|---|
| 97 | * SW3461-1: rename UFE (BUFE) module to TNR (BTNR). |
|---|
| 98 | * |
|---|
| 99 | * TNR_3461_1/1 5/19/11 5:11p mpovich |
|---|
| 100 | * SW3461-1: Change BUFE module prefix to BTNR |
|---|
| 101 | * |
|---|
| 102 | * 1 5/17/11 5:13p farshidf |
|---|
| 103 | * SW3461-1: add the callbacks |
|---|
| 104 | * |
|---|
| 105 | * 1 5/17/11 1:40p farshidf |
|---|
| 106 | * SW3128-1: add the new callbacks |
|---|
| 107 | * |
|---|
| 108 | ***************************************************************************/ |
|---|
| 109 | |
|---|
| 110 | #include "bstd.h" |
|---|
| 111 | #include "bkni.h" |
|---|
| 112 | #include "btmr.h" |
|---|
| 113 | #ifdef LEAP_BASED_CODE |
|---|
| 114 | #include "btnr_api.h" |
|---|
| 115 | #else |
|---|
| 116 | #include "btnr.h" |
|---|
| 117 | #include "bdbg.h" |
|---|
| 118 | #include "btnr_priv.h" |
|---|
| 119 | #include "btnr_3x7x_priv.h" |
|---|
| 120 | BDBG_MODULE(btnr_callback); |
|---|
| 121 | #endif |
|---|
| 122 | #include "btnr_tune.h" |
|---|
| 123 | #include "btnr_init.h" |
|---|
| 124 | |
|---|
| 125 | /********************************************************************************************/ |
|---|
| 126 | /*Function to program the RF offset for the ADS channel scan */ |
|---|
| 127 | /********************************************************************************************/ |
|---|
| 128 | BERR_Code BTNR_P_Set_RF_Offset(BTNR_3x7x_Handle hTnr, int32_t RF_Offset, uint32_t Symbol_Rate) |
|---|
| 129 | { |
|---|
| 130 | BERR_Code retCode = BERR_SUCCESS; |
|---|
| 131 | |
|---|
| 132 | if (hTnr->pTunerStatus->PowerStatus != BTNR_ePower_On) |
|---|
| 133 | { |
|---|
| 134 | BDBG_ERR(("BTNR_P_Set_RF_Offset: power is still off ")); |
|---|
| 135 | return BERR_NOT_INITIALIZED; |
|---|
| 136 | } |
|---|
| 137 | |
|---|
| 138 | /*These two parameters come from the BADS_Acquire() to program the front end for 1-7 MBaud and freq offsets*/ |
|---|
| 139 | /*RF_Offset is an int32_t*/ |
|---|
| 140 | /*Symbol_Rate is an uint32_t*/ |
|---|
| 141 | hTnr->pTunerParams->BTNR_Local_Params.RF_Offset = RF_Offset; |
|---|
| 142 | |
|---|
| 143 | BTNR_P_Program_Back_DDFS(hTnr); |
|---|
| 144 | if (Symbol_Rate != 1) |
|---|
| 145 | { |
|---|
| 146 | hTnr->pTunerParams->BTNR_Local_Params.Symbol_Rate = Symbol_Rate; |
|---|
| 147 | BTNR_P_Program_VID_CIC_HB_SAW(hTnr); |
|---|
| 148 | } |
|---|
| 149 | return retCode; |
|---|
| 150 | } |
|---|
| 151 | |
|---|
| 152 | /********************************************************************************************/ |
|---|
| 153 | /*Function to get the RF status for the ADS channel scan */ |
|---|
| 154 | /********************************************************************************************/ |
|---|
| 155 | BERR_Code BTNR_P_Get_RF_Status(BTNR_3x7x_Handle hTnr) |
|---|
| 156 | { |
|---|
| 157 | BERR_Code retCode = BERR_SUCCESS; |
|---|
| 158 | |
|---|
| 159 | if (hTnr->pTunerStatus->PowerStatus != BTNR_ePower_On) |
|---|
| 160 | { |
|---|
| 161 | BDBG_ERR(("BTNR_P_Get_RF_Status: power is still off ")); |
|---|
| 162 | return BERR_NOT_INITIALIZED; |
|---|
| 163 | } |
|---|
| 164 | /*get LNA status registers*/ |
|---|
| 165 | #ifdef LEAP_BASED_CODE |
|---|
| 166 | BLNA_P_Read_Registers(hTnr->pLna); |
|---|
| 167 | #endif |
|---|
| 168 | |
|---|
| 169 | /*These three parameters come from the BTNR_P_TunerStatus()*/ |
|---|
| 170 | /*hTnr->pTunerStatus->Tuner_RF_Freq is an uint32_t*/ |
|---|
| 171 | /*hTnr->pTunerStatus->Tuner_PreADC_Gain_x256db is an int16_t*/ |
|---|
| 172 | /*hTnr->pTunerStatus->External_Gain_x256db is an int16_t*/ |
|---|
| 173 | BTNR_P_TunerStatus(hTnr); |
|---|
| 174 | |
|---|
| 175 | /*These four parameters come from the BTNR_P_InitStatus()*/ |
|---|
| 176 | /*hTnr->pTunerParams->BTNR_Local_Params.RF_Offset is an int32_t */ |
|---|
| 177 | /*hTnr->pTunerParams->BTNR_Local_Params.Symbol_Rate is an uint32_t*/ |
|---|
| 178 | /*hTnr->pTunerParams->BTNR_Local_Params.Total_Mix_After_ADC is an int32_t*/ |
|---|
| 179 | /*hTnr->pTunerParams->BTNR_Local_Params.PostADC_Gain_x256db is an int16_t*/ |
|---|
| 180 | BTNR_P_InitStatus(hTnr); |
|---|
| 181 | |
|---|
| 182 | return retCode; |
|---|
| 183 | } |
|---|
| 184 | |
|---|
| 185 | /********************************************************************************************/ |
|---|
| 186 | /*Function to set the Tuner power mode */ |
|---|
| 187 | /********************************************************************************************/ |
|---|
| 188 | BERR_Code BTNR_P_LNA_AGC_Power(BTNR_3x7x_Handle hTnr, uint16_t Mode) |
|---|
| 189 | { |
|---|
| 190 | |
|---|
| 191 | if (hTnr->pTunerStatus->PowerStatus != BTNR_ePower_On) |
|---|
| 192 | { |
|---|
| 193 | BDBG_ERR(("BTNR_P_LNA_AGC_Power: power is still off ")); |
|---|
| 194 | return BERR_NOT_INITIALIZED; |
|---|
| 195 | } |
|---|
| 196 | |
|---|
| 197 | BSTD_UNUSED(Mode); |
|---|
| 198 | /*BDBG_MSG(("BTNR_P_LNA_AGC_Power and the mode is %d", Mode)); */ |
|---|
| 199 | |
|---|
| 200 | return BERR_SUCCESS; |
|---|
| 201 | |
|---|
| 202 | |
|---|
| 203 | } |
|---|