source: svn/trunk/newcon3bcm2_21bu/magnum/portinginterface/aob/7552/baob_utils.c

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: 18.2 KB
Line 
1/******************************************************************************
2 *    (c)2011-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 * Except as expressly set forth in the Authorized License,
15 * 
16 * 1.     This program, including its structure, sequence and organization, constitutes the valuable trade
17 * secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof,
18 * and to use this information only in connection with your use of Broadcom integrated circuit products.
19 * 
20 * 2.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
21 * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR
22 * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
23 * THE SOFTWARE.  BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES
24 * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE,
25 * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION
26 * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF
27 * USE OR PERFORMANCE OF THE SOFTWARE.
28 *
29 * 3.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS
30 * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR
31 * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR
32 * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF
33 * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT
34 * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE
35 * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF
36 * ANY LIMITED REMEDY.
37 *
38 * $brcm_Workfile: baob_utils.c $
39 * $brcm_Revision: 17 $
40 * $brcm_Date: 2/9/12 12:45p $
41 *
42 * Module Description:
43 *
44 * Revision History:
45 *
46 * $brcm_Log: /AP/ctfe/core/aob/baob_utils.c $
47 *
48 * 17   2/9/12 12:45p farshidf
49 * SW3128-1: merge to main
50 *
51 * Fw_Integration_Devel/6   2/9/12 12:19p farshidf
52 * SW3128-1: merge to integ
53 *
54 * Fw_Integration_Devel/AP_V3_0_AOB_DEV/8   2/8/12 4:11p dorothyl
55 * SW3128-1 : bug in fec
56 *
57 * Fw_Integration_Devel/AP_V3_0_AOB_DEV/7   2/8/12 2:05p dorothyl
58 * SW3128-1: oob bert
59 *
60 * Fw_Integration_Devel/AP_V3_0_AOB_DEV/6   2/3/12 1:56p dorothyl
61 * SW3128-1 : clean up comments
62 *
63 * Fw_Integration_Devel/AP_V3_0_AOB_DEV/5   1/5/12 9:41a dorothyl
64 * SW3128-1: oob fix
65 *
66 * Fw_Integration_Devel/AP_V3_0_AOB_DEV/4   12/14/11 2:13p mpovich
67 * SW3128-1: Add changes per Dorothy Lew on 12/14/2011, 2pm.
68 *
69 * Fw_Integration_Devel/AP_V3_0_AOB_DEV/3   12/14/11 2:03p mpovich
70 * SW3128-1: Merge to Fw Integ. and to the Sys. devl. branch.
71 *
72 * Fw_Integration_Devel/3   12/14/11 2:02p mpovich
73 * SW3128-1: Merge to Fw Integ. and to the Sys. devl. branch.
74 *
75 * 14   12/14/11 11:27a farshidf
76 * SW7552-170: fix for 7552
77 *
78 * 13   12/13/11 5:06p mpovich
79 * SW3128-1: Merge to Fw devel. branch.
80 *
81 * Fw_Integration_Devel/2   12/13/11 5:05p mpovich
82 * SW3128-1: Merge to Fw devel. branch.
83 *
84 * Fw_Integration_Devel/AP_V3_0_AOB_DEV/2   12/13/11 4:50p mpovich
85 * SW3128-1: Take Dorothy's OOB changes on 12/12/2011.
86 *
87 * Fw_Integration_Devel/AP_V3_0_AOB_DEV/1   12/13/11 12:27p mpovich
88 * SW3128-69: Add lock/unlock IRQs and status for Out of Band.
89 *
90 * 12   12/13/11 4:41p mpovich
91 * SW3128-1: merge to main branch.
92 *
93 * Fw_Integration_Devel/1   12/13/11 12:13p mpovich
94 * SW3128-69: Add lock/unlock IRQs and status for Out of Band.
95 *
96 * Fw_Integration_Devel/AP_V3_0_AOB_DEV/SW3128-69/1   12/12/11 9:38p mpovich
97 * SW3128-69: Support for lock/unlock Host IRQs for Out of Band.
98 *
99 * 11   11/9/11 4:39p farshidf
100 * SW7552-139: adapt the code for magnum support
101 *
102 * 9   4/18/11 5:33p farshidf
103 * SW3128-1: update to make it work with host chip
104 *
105 * 8   4/12/11 11:47a farshidf
106 * SW3128-1: fix warning
107 *
108 * 7   4/5/11 3:24p farshidf
109 * SW3461-1: merge  main
110 *
111 * AOB_3128_1/9   4/5/11 10:54a dorothyl
112 * SW3128-1: OOB UPDATE
113 *
114 * AOB_3128_1/8   3/31/11 11:32a dorothyl
115 * SW3128-1: oob status fix
116 *
117 * AOB_3128_1/7   3/28/11 2:34p dorothyl
118 * SW3128-1: OOB FIX
119 *
120 * AOB_3128_1/6   3/25/11 11:29a dorothyl
121 * SW3128-1: fix oob
122 *
123 * 4   3/22/11 5:05p mpovich
124 * SW3128-1: Add latest AOB driver changes.
125 *
126 * AOB_3128_1/4   3/21/11 6:26p farshidf
127 * SW3461-1: update naming
128 *
129 * AOB_3128_1/3   3/17/11 8:49p cbrooks
130 * sw4128-1:removed Range_Check
131 *
132 * AOB_3128_1/2   3/17/11 8:39p cbrooks
133 * sw3128-1:Worked on AOB status
134 *
135 * AOB_3128_1/1   3/17/11 6:16p cbrooks
136 * sw3128-1:Added OOB code
137 *
138 * 3   3/11/11 3:58p farshidf
139 * SW3128-1: compile fix
140 *
141 * 2   3/11/11 3:49p farshidf
142 * SW3128-1: latest chnages from Charlie
143 *
144 *****************************************************************************/
145
146
147#include "bstd.h"
148#include "bkni.h"
149#include "bkni_multi.h"
150#include "btmr.h"
151#include "bmth.h"
152
153#ifdef LEAP_BASED_CODE
154#include "bwfe_global_clk.h"
155#include "baob_api.h"
156#include "bchp_leap_ctrl.h"
157#else
158#include "baob.h"
159BDBG_MODULE(baob_utils);
160#define POWER2_24 16777216
161#define POWER2_26 67108864
162#define POWER2_18 262144
163#define Twos_Complement32(x) ((uint32_t)((x ^ 0xFFFFFFFF) + 1))
164#endif
165#include "baob_struct.h"
166#include "baob_acquire.h"
167#include "baob_status.h"
168#include "baob_utils.h"
169#include "baob_priv.h"
170#include "bchp_oob.h"
171
172
173
174
175/********************************************************************************************
176 *BAOB_P_Set_CFL_Frequency() determines the value to program in the front mixer                 
177        *Only 0 is supported for now                                                                     
178 ********************************************************************************************/
179void BAOB_P_Set_CFL_Frequency(BAOB_3x7x_Handle h, int32_t CFL_Frequency)
180{
181        /*Detect if CFL_Frequency is NON zero*/
182        if (CFL_Frequency != 0)
183        {
184                                BDBG_ERR(("CFL_Frequency is not 0 in BADS_P_Set_CFL_Frequency()"));
185        }
186
187        /*Program the  Carrier Loop Frequency Control Word*/
188        BREG_Write32(h->hRegister, BCHP_OOB_STDRI, 0);
189}
190
191/********************************************************************************************
192 *BAOB_P_Get_CFL_FrequencyError() determin front mixer freqency error                                                               
193 ********************************************************************************************/
194int32_t BAOB_P_Get_CFL_FrequencyError(BAOB_3x7x_Handle h)
195{
196        bool RegIsNegative;
197        uint32_t ReadReg;
198        int32_t CFL_Error;
199        uint32_t        ulMultA, ulMultB, ulNrmHi, ulNrmLo, ulDivisor;
200
201        /*Read the Carrier Loop Frequency Integrator*/
202        /*Carrier Offset = LDDRI/(2^24) * F_HS*/
203        ReadReg = BREG_Read32(h->hRegister, BCHP_OOB_LDDRI);
204        RegIsNegative=false;
205        /*This is a 24 bit 2's complement register MSB justified, if negative, clamp, sign extend and twos complement*/
206        ReadReg = ReadReg/256;
207        if ((ReadReg & 0x00800000) != 0)
208        {
209                RegIsNegative = true;
210                ReadReg = ReadReg | 0xFF000000; /*sign extend*/
211                ReadReg = (ReadReg == 0xFF800000) ? Twos_Complement32(0xFF800001) : Twos_Complement32(ReadReg);
212        }
213
214        ulMultA = ReadReg;
215        ulMultB = F_HS;/*POWER2_24;*/
216        ulDivisor = POWER2_24;/*F_HS;*/
217        /*BDBG_ERR(("%x, freq err=%d",ReadReg,ReadReg/POWER2_24));*/
218        BMTH_HILO_32TO64_Mul(ulMultA, ulMultB, &ulNrmHi, &ulNrmLo);
219        BMTH_HILO_64TO64_Div32(ulNrmHi, ulNrmLo, ulDivisor, &ulNrmHi, &ulNrmLo);
220
221        /*If result should be negative, take twos complement of output*/
222        ulNrmLo = (RegIsNegative == true) ? Twos_Complement32(ulNrmLo) : ulNrmLo;
223       
224        CFL_Error = (int32_t)ulNrmLo;
225        return  CFL_Error;
226}
227
228/********************************************************************************************
229 *BAOB_P_Set_CFL_BW() sets BW for carrier recovery loop                                                                 
230 ********************************************************************************************/
231void BAOB_P_Set_CFL_BW(BAOB_3x7x_Handle h, BW_Sel_t BW_Sel)
232{
233       
234        uint8_t  BPS_Index, PLBW_Index;
235        uint32_t BW_Reg32L, BW_Reg32I;
236
237        switch (h->pAcqParam->BAOB_Acquire_Params.AA)
238        {
239                case BAOB_Acquire_Params_BPS_eDVS178:
240                        BPS_Index = 0;
241                        break;
242                case BAOB_Acquire_Params_BPS_eDVS167:
243                        if(h->pAcqParam->BAOB_Acquire_Params.BPS==BAOB_Acquire_Params_BPS_eDVS_167_GradeA) 
244                        {
245                        BPS_Index = 1;         
246                        }
247                        else
248                        {
249                        BPS_Index = 2;
250                        }               
251                        break;
252                default:
253                        BPS_Index = 0;
254                        BDBG_ERR(("UNKNOWN BAOB_Acquire_Params.AA in BAOB_P_Set_CFL_BW()"));
255                        break;
256        }
257
258#if TRUE /*currently fix it to medium*/
259        PLBW_Index = 1; 
260#else
261        switch (h->pAcqParam->BAOB_Acquire_Params.PLBW)
262        {
263                case BAOB_Acquire_Params_PLBW_eLow:
264                        PLBW_Index = 0;
265                        break;
266                case BAOB_Acquire_Params_PLBW_eMed:
267                        PLBW_Index = 1;
268                        break;
269                case BAOB_Acquire_Params_PLBW_eHigh:
270                        PLBW_Index = 2;
271                        break;
272                default:
273                        PLBW_Index = 0;
274                        BDBG_ERR(("UNKNOWN BAOB_Acquire_Params.PLBW in BAOB_P_Set_CFL_BW()"));
275                        break;
276        }
277#endif
278
279        /*Select Acquisition or Tracking BW*/
280        if (BW_Sel == BW_Sel_eAcquisition_BW)
281        {
282                BW_Reg32L = BAOB_PhaseLoopBw_Table[BPS_Index][PLBW_Index][0].Lin_PhaseLoopBw;
283                BW_Reg32I = BAOB_PhaseLoopBw_Table[BPS_Index][PLBW_Index][0].Int_PhaseLoopBw;
284        }
285        else
286        {
287                BW_Reg32L = BAOB_PhaseLoopBw_Table[BPS_Index][PLBW_Index][1].Lin_PhaseLoopBw;
288                BW_Reg32I = BAOB_PhaseLoopBw_Table[BPS_Index][PLBW_Index][1].Int_PhaseLoopBw;
289        }
290
291        /*shift to 24 MSB's*/
292        BW_Reg32L = (BW_Reg32L << 24) & 0xFF000000;
293        BW_Reg32I = (BW_Reg32I << 24) & 0xFF000000;
294
295
296        /*Program the Phase Loop BW Word*/
297        BREG_Write32(h->hRegister, BCHP_OOB_STDRLC, BW_Reg32L); 
298        BREG_Write32(h->hRegister, BCHP_OOB_STDRIC, BW_Reg32I);
299}
300
301
302/****************************************************************************************************
303 *BAOB_P_Set_TL_Frequency() determines the value to program in the VID                               
304 *Calculate the Timing Loop Frequency Control Word a 24 bit 2's complement number                   
305 *STBFOS = (4*2^24*BaudRate)/F_HS  or STBFOS = (2^26*BaudRate/F_HS)                                     
306 ****************************************************************************************************/
307void BAOB_P_Set_TL_Frequency(BAOB_3x7x_Handle h, uint32_t Symbol_Rate)
308{
309
310        uint32_t        ulMultA, ulMultB, ulNrmHi, ulNrmLo, ulDivisor;
311       
312        /*Check to make sure symbol rate is in range*/
313        if ((Symbol_Rate < 100000) || (Symbol_Rate >= F_HS/4))
314        {
315                BDBG_ERR(("SymbolRate out of range in BAOB_P_Set_TL_Frequency()"));
316        }
317
318  ulMultA = POWER2_26;
319        ulMultB = Symbol_Rate;
320        ulDivisor = F_HS;
321        BMTH_HILO_32TO64_Mul(ulMultA, ulMultB, &ulNrmHi, &ulNrmLo);
322        BMTH_HILO_64TO64_Div32(ulNrmHi, ulNrmLo, ulDivisor, &ulNrmHi, &ulNrmLo);
323
324        /*shift to 24 MSB's*/
325        ulNrmLo = (ulNrmLo << 8) & 0xFFFFFF00;
326
327        /*Program the Timing Loop Frequency Control Word*/
328        BREG_Write32(h->hRegister, BCHP_OOB_STBFOS, ulNrmLo);   
329
330}
331
332/****************************************************************************************************
333 *BAOB_P_Get_SymbolRate() determines the value in the VID                                   
334 *Calculate the Timing Loop Frequency Control Word a 24 bit 2's complement number                   
335 *STBFOS = (4*2^24*BaudRate)/F_HS  or STBFOS = (2^26*BaudRate/F_HS)     BaudRate =  STBFOS*F_HS/2^26                                 
336 ****************************************************************************************************/
337uint32_t BAOB_P_Get_SymbolRate(BAOB_3x7x_Handle h)
338{
339        uint32_t  ReadReg;
340        uint32_t  ulMultA, ulMultB, ulNrmHi, ulNrmLo, ulDivisor;
341       
342        /*Read the Timing Loop Frequency Integrator*/
343        ReadReg = BREG_Read32(h->hRegister, BCHP_OOB_STBFOS);
344        ReadReg = ReadReg/256;
345         /*BDBG_MSG(("symbolrate = %d", ReadReg));*/
346    ulMultA = ReadReg;
347        ulMultB = F_HS;
348        ulDivisor = POWER2_26;
349        BMTH_HILO_32TO64_Mul(ulMultA, ulMultB, &ulNrmHi, &ulNrmLo);
350        BMTH_HILO_64TO64_Div32(ulNrmHi, ulNrmLo, ulDivisor, &ulNrmHi, &ulNrmLo);
351       
352        return ulNrmLo;
353}
354
355/********************************************************************************************
356 *BAOB_P_Get_TL_FrequencyError() determine fromt mixer freqency error                                                               
357 ********************************************************************************************/
358int32_t BAOB_P_Get_TL_FrequencyError(BAOB_3x7x_Handle h)
359{
360        bool RegIsNegative;
361        uint32_t ReadReg;
362        int32_t TL_Error;
363        uint32_t        ulMultA, ulMultB, ulNrmHi, ulNrmLo, ulDivisor;
364       
365        RegIsNegative = false;
366
367        /*Read the Timing Loop Frequency Integrator*/
368        /*Timing Offset = LDBRFO/(2^26) * F_HS - symbol rate*/
369        ReadReg = BREG_Read32(h->hRegister, BCHP_OOB_LDBRFO);
370
371        /*This is a 32 bit 2's complement register, if negative, clamp, sign extend and twos complement*/
372        ReadReg = ReadReg/256;
373        if ((ReadReg & 0x00800000) != 0)
374        {
375                RegIsNegative = true;
376                BDBG_ERR(("IS Negative %d", RegIsNegative));
377                ReadReg = ReadReg | 0xFF000000; /*sign extend*/
378                ReadReg = (ReadReg == 0xff800000) ? Twos_Complement32(0xff800001) : Twos_Complement32(ReadReg);
379        }
380
381        ulMultA = POWER2_18;   /*supposed to be 2^18*/
382        ulMultB = F_HS;
383        ulDivisor = ReadReg;
384        /*BDBG_MSG(("%x, integrator err %d %x",ReadReg,(2^18*ReadReg/F_HS),(2^18*ReadReg/F_HS)));*/
385        BMTH_HILO_32TO64_Mul(ulMultA, ulMultB, &ulNrmHi, &ulNrmLo);
386        BMTH_HILO_64TO64_Div32(ulNrmHi, ulNrmLo, ulDivisor, &ulNrmHi, &ulNrmLo);
387
388        /* BDBG_MSG(("final = %x", ulNrmLo));*/
389        /*If result should be negative, take twos complement of output*/
390        ulNrmLo = (RegIsNegative == true) ? Twos_Complement32(ulNrmLo) : ulNrmLo;
391       
392         /*BDBG_MSG(("err = %d %d", ulNrmLo, BAOB_P_Get_SymbolRate(h)));*/
393        TL_Error = (int32_t)ulNrmLo;
394        return  TL_Error;
395}
396
397
398/****************************************************************************************************
399 *BAOB_P_Set_TL_BW() determines the loop bandwidth to program in the VID                                     
400 ****************************************************************************************************/
401 void BAOB_P_Set_TL_BW(BAOB_3x7x_Handle h, BW_Sel_t BW_Sel)
402 {
403        uint8_t  BPS_Index;
404  uint32_t BW_Reg32L, BW_Reg32I;
405
406        switch (h->pAcqParam->BAOB_Acquire_Params.AA)
407        {
408                case BAOB_Acquire_Params_BPS_eDVS178:
409                        BPS_Index = 0;
410                        break;
411                case BAOB_Acquire_Params_BPS_eDVS167:
412                        if(h->pAcqParam->BAOB_Acquire_Params.BPS==BAOB_Acquire_Params_BPS_eDVS_167_GradeB)
413                        {
414                        BPS_Index = 1;         
415                        }
416                        else
417                        {
418                        BPS_Index = 2;
419                        }
420                        break;
421                default:
422                        BPS_Index = 0;
423                        BDBG_ERR(("UNKNOWN BAOB_Acquire_Params.AA in BAOB_P_Set_TL_BW()"));
424        }
425
426        /*Select Acquisition or Tracking BW*/
427        if (BW_Sel == BW_Sel_eAcquisition_BW)
428        {
429                BW_Reg32L = BAOB_TimingLoopBW_Table[BPS_Index][0].Lin_TimingLoopBw;
430                BW_Reg32I = BAOB_TimingLoopBW_Table[BPS_Index][0].Int_TimingLoopBw;
431        }
432        else
433        {
434                BW_Reg32L = BAOB_TimingLoopBW_Table[BPS_Index][1].Lin_TimingLoopBw;
435                BW_Reg32I = BAOB_TimingLoopBW_Table[BPS_Index][1].Int_TimingLoopBw;
436        }
437
438        /*Program the Phase Loop BW Word*/
439        BREG_Write32(h->hRegister, BCHP_OOB_STBRLC, BW_Reg32L); 
440        BREG_Write32(h->hRegister, BCHP_OOB_STBRIC, BW_Reg32I);
441}
442
443/****************************************************************************************************
444 *BAOB_P_Set_FEC() determines the FEC programming                                   
445 ****************************************************************************************************/
446 void BAOB_P_Set_FEC(BAOB_3x7x_Handle h)
447 {
448         uint8_t  AA_Index;
449   uint32_t BW_Reg32H, BW_Reg32L;
450         
451         switch (h->pAcqParam->BAOB_Acquire_Params.BPS) /*FEC*/
452        {
453                case BAOB_Acquire_Params_BPS_eDVS178:
454                        AA_Index = 0;
455                        break;
456                case BAOB_Acquire_Params_BPS_eDVS_167_GradeA:
457                        AA_Index = 1;           
458                        break;
459                case BAOB_Acquire_Params_BPS_eDVS_167_GradeB:
460                        AA_Index = 1;           
461                        break;
462                case BAOB_Acquire_Params_BPS_eBERT_TEST_MODE:
463                        if(h->pAcqParam->BAOB_Acquire_Params.AA==BAOB_Acquire_Params_BPS_eDVS167)
464                        {       
465                                AA_Index = 3;
466                        }
467                        else
468                        {
469                                AA_Index = 2;
470                        }
471                        break;
472                default:
473                        /*AA_Index = 0;*/
474                        AA_Index = 2;
475                        BDBG_ERR(("UNKNOWN BAOB_Acquire_Params.BPS in BAOB_P_Set_FEC()"));
476        }
477       
478
479         BDBG_MSG(("BPS= %d, AA Index = %d", h->pAcqParam->BAOB_Acquire_Params.BPS,AA_Index));
480        /*Select FEC parameters*/
481        BW_Reg32L = BAOB_FEC_Table[AA_Index].STFECL;
482        BW_Reg32H = BAOB_FEC_Table[AA_Index].STFECH;
483
484        /*Program the FEC*/
485        BREG_Write32(h->hRegister, BCHP_OOB_STFECL, BW_Reg32L); 
486        BREG_Write32(h->hRegister, BCHP_OOB_STFECH, BW_Reg32H);
487 
488 }     
489
490 /****************************************************************************************************
491 *BAOB_P_Set_SNR() determines the SNR threshold programming                                 
492 ****************************************************************************************************/
493 void BAOB_P_Set_SNR(BAOB_3x7x_Handle h)
494 {
495         uint32_t ReadReg;
496
497        /*SNR estimator setup and control*/
498        /*set SNR estimator convergence time to roughly 10 ms*/
499        BREG_Write32(h->hRegister, BCHP_OOB_STSNRC, 0x03000000);
500
501        /*set STSNRC to indicate this is to set the SNR Low threshold*/
502        /*This is hardcoded to SNR = 10 db, STSNRT = 10.0 ^ ((124.47 - SNR) / 20.0)*/
503        ReadReg = BREG_Read32(h->hRegister, BCHP_OOB_STSNRC);   
504        ReadReg = ReadReg & 0xFBFFFFFF;
505        BREG_Write32(h->hRegister, BCHP_OOB_STSNRC, ReadReg);   
506        BREG_Write32(h->hRegister, BCHP_OOB_STSNRT, 0x08129E00);       
507       
508        /*next write to stsnrt is low error thres, 10 ms conv*/
509        /*next write to stsnrt is low error thres, 10 ms conv*/
510        BREG_Write32(h->hRegister, BCHP_OOB_STSNRC, 0x07000000);
511       
512        /*set STSNRC to indicate this is to set the SNR High threshold*/
513        /*STSNRT = 10.0 ^ ((124.47 - SNR) / 20.0)*/
514
515        ReadReg = BREG_Read32(h->hRegister, BCHP_OOB_STSNRC);   
516        ReadReg = ReadReg | 0x04000000;
517        BREG_Write32(h->hRegister, BCHP_OOB_STSNRC, ReadReg);   
518        /*BREG_Write32(h->hRegister, BCHP_OOB_STSNRT, 0x00826500);*/   
519        /*BREG_Write32(h->hRegister, BCHP_OOB_STSNRT, 0x00535000); 37dB*/
520        /*BREG_Write32(h->hRegister, BCHP_OOB_STSNRT, 0x003A3F00); 41dB*/
521        /*BREG_Write32(h->hRegister, BCHP_OOB_STSNRT, 0x001d3100); 47dB*/
522          BREG_Write32(h->hRegister, BCHP_OOB_STSNRT, 0x0014aa00); /*50dB*/
523
524
525
526 }
Note: See TracBrowser for help on using the repository browser.