source: svn/newcon3bcm2_21bu/magnum/portinginterface/ads/bads.c @ 76

Last change on this file since 76 was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 31.4 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2005-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: bads.c $
11 * $brcm_Revision: Hydra_Software_Devel/21 $
12 * $brcm_Date: 2/14/12 10:42a $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/portinginterface/ads/bads.c $
19 *
20 * Hydra_Software_Devel/21   2/14/12 10:42a atanugul
21 * SW3128-119: Update SetAcquireParams API to make the second parameter as
22 * const
23 *
24 * Hydra_Software_Devel/20   2/8/12 5:14p atanugul
25 * SW3128-119: Implement new apis for SetAcquireParams, GetAcquireParams
26 * and GetDefaultAcquireParams
27 *
28 * Hydra_Software_Devel/19   12/8/11 3:12p atanugul
29 * SW3128-89: Add PI support for Spectrum Analyzer Data retrieval
30 *
31 * Hydra_Software_Devel/18   11/16/11 4:23p atanugul
32 * SW3461-79: Add No Signal to GetLockStatus()
33 *
34 * Hydra_Software_Devel/17   9/15/11 3:19p atanugul
35 * SW3128-50: Add BADS_GetScanStatus()
36 *
37 * Hydra_Software_Devel/16   8/31/11 5:41p nickh
38 * SW7425-1129: Expose 3255 RPC call that returns the number of bonded
39 * channels reserved for Docsis
40 *
41 * Hydra_Software_Devel/15   5/6/11 4:23p farshidf
42 * SWDTV-6857: waring fix
43 *
44 * Hydra_Software_Devel/14   5/6/11 2:22p farshidf
45 * SWDTV-6857: merge main
46 *
47 * Hydra_Software_Devel/SWDTV-6857/1   5/6/11 2:00p farshidf
48 * SWDTV-6857: add the scan structure and Calls
49 *
50 * Hydra_Software_Devel/13   11/24/10 8:07p agin
51 * SW7405-5021:  Allow 7405 host to control LNA via 31xx tuner/demod
52 * chips.
53 *
54 * Hydra_Software_Devel/12   10/21/10 6:55p vishk
55 * SW7420-1020: Request for non-blocking call support in Nexus frontend
56 *
57 * Hydra_Software_Devel/11   10/5/10 7:30p VISHK
58 * SW7405-4915: Add nexus api to control power saver mode in downstream
59 * demod and tuner, out of banddemod and tuner and upstream. Also add
60 * nexus api to control daisy chaining of the frontends.
61 *
62 * Hydra_Software_Devel/10   8/30/10 3:58p farshidf
63 * SW7550-543: merge to main branch
64 *
65 * Hydra_Software_Devel/9   8/24/10 11:30a VISHK
66 * SW7405-4808 : Connect reset status api for ADS and AOB to nexus api.
67 * $brcm_Log: /magnum/portinginterface/ads/bads.c $
68 *
69 * Hydra_Software_Devel/21   2/14/12 10:42a atanugul
70 * SW3128-119: Update SetAcquireParams API to make the second parameter as
71 * const
72 *
73 * Hydra_Software_Devel/20   2/8/12 5:14p atanugul
74 * SW3128-119: Implement new apis for SetAcquireParams, GetAcquireParams
75 * and GetDefaultAcquireParams
76 *
77 * Hydra_Software_Devel/19   12/8/11 3:12p atanugul
78 * SW3128-89: Add PI support for Spectrum Analyzer Data retrieval
79 *
80 * Hydra_Software_Devel/18   11/16/11 4:23p atanugul
81 * SW3461-79: Add No Signal to GetLockStatus()
82 *
83 * Hydra_Software_Devel/17   9/15/11 3:19p atanugul
84 * SW3128-50: Add BADS_GetScanStatus()
85 *
86 * Hydra_Software_Devel/16   8/31/11 5:41p nickh
87 * SW7425-1129: Expose 3255 RPC call that returns the number of bonded
88 * channels reserved for Docsis
89 *
90 * Hydra_Software_Devel/15   5/6/11 4:23p farshidf
91 * SWDTV-6857: waring fix
92 *
93 * Hydra_Software_Devel/14   5/6/11 2:22p farshidf
94 * SWDTV-6857: merge main
95 *
96 * Hydra_Software_Devel/SWDTV-6857/1   5/6/11 2:00p farshidf
97 * SWDTV-6857: add the scan structure and Calls
98 *
99 * Hydra_Software_Devel/13   11/24/10 8:07p agin
100 * SW7405-5021:  Allow 7405 host to control LNA via 31xx tuner/demod
101 * chips.
102 *
103 * Hydra_Software_Devel/12   10/21/10 6:55p vishk
104 * SW7420-1020: Request for non-blocking call support in Nexus frontend
105 *
106 * Hydra_Software_Devel/11   10/5/10 7:30p VISHK
107 * SW7405-4915: Add nexus api to control power saver mode in downstream
108 * demod and tuner, out of banddemod and tuner and upstream. Also add
109 * nexus api to control daisy chaining of the frontends.
110 *
111 * Hydra_Software_Devel/10   8/30/10 3:58p farshidf
112 * SW7550-543: merge to main branch
113 *
114 * Hydra_Software_Devel/SW7550-543/2   8/30/10 3:27p farshidf
115 * SW7550-543: change the stopTimer to untune
116 *
117 * Hydra_Software_Devel/SW7550-543/1   8/27/10 4:50p pinglong
118 * SW7550-543: support channel switch between QAM and OFDM on bcm97590
119 *
120 * Hydra_Software_Devel/8   2/12/10 2:46p mward
121 * SW7550-262: Warning about newline at end of file.
122 *
123 * Hydra_Software_Devel/7   2/11/10 11:02a farshidf
124 * SW7550-262: add the re-acquire feature for 7550 QAM code
125 *
126 * Hydra_Software_Devel/6   12/18/09 2:31p VISHK
127 * SW7405-3580: BADS_ResetStatus checks the wrong function pointer.
128 *
129 * Hydra_Software_Devel/5   11/5/09 1:47p VISHK
130 * SW7405-3210: BADS_31xx_GetStatus not returning values for
131 * correctedCount, uncorrectedCount and berRawCount
132 *
133 * Hydra_Software_Devel/4   8/25/09 11:19a vishk
134 * SW7405-2839: Bcm31xx: Add Power Management support for ADS
135 *
136 * Hydra_Software_Devel/3   8/24/09 3:44p vishk
137 * SW7405-2839: Bcm31xx: Add Power Management support for ADS
138 *
139 * Hydra_Software_Devel/3   8/21/09 6:26p vishk
140 * PR 57482: Bcm31xx: Add Power Management support for ADS
141 *
142 * Hydra_Software_Devel/3   8/21/09 6:24p vishk
143 * PR 57482: Bcm31xx: Add Power Management support for ADS
144 *
145 * Hydra_Software_Devel/3   8/21/09 6:23p vishk
146 * PR 57482: Bcm31xx: Add Power Management support for ADS
147 *
148 * Hydra_Software_Devel/2   4/11/06 4:53p dlwin
149 * PR 19978: Merge 3255 support.
150 *
151 * Hydra_Software_Devel/PROD_DSG_REFSW_Devel/1   4/3/06 4:19p haisongw
152 * PR 19978:add  tuner Settop API support on BCM97455 platform
153 *
154 * Hydra_Software_Devel/1   12/13/05 2:56p dlwin
155 * PR 18598: Add new ADS for 3255
156 *
157 ***************************************************************************/
158
159#include "bstd.h"
160#include "bads.h"
161#include "bads_priv.h"
162
163
164BDBG_MODULE(bads);
165
166
167
168#define CHK_RETCODE( rc, func )             \
169do {                                        \
170    if( (rc = BERR_TRACE(func)) != BERR_SUCCESS ) \
171    {                                       \
172        goto done;                          \
173    }                                       \
174} while(0)
175
176
177#define DEV_MAGIC_ID            ((BERR_ADS_ID<<16) | 0xFACE)
178
179
180
181
182/*******************************************************************************
183*
184*   Private Module Handles
185*
186*******************************************************************************/
187
188
189
190/*******************************************************************************
191*
192*   Default Module Settings
193*
194*******************************************************************************/
195
196
197/*******************************************************************************
198*
199*   Private Module Data
200*
201*******************************************************************************/
202
203
204
205/*******************************************************************************
206*
207*   Private Module Functions
208*
209*******************************************************************************/
210
211
212
213/*******************************************************************************
214*
215*   Public Module Functions
216*
217*******************************************************************************/
218BERR_Code BADS_Open(
219    BADS_Handle *pAds,                  /* [out] Returns handle */
220    BCHP_Handle hChip,                  /* [in] Chip handle */
221    BREG_Handle hRegister,              /* [in] Register handle */
222    BINT_Handle hInterrupt,             /* [in] Interrupt handle */
223    const BADS_Settings *pDefSettings   /* [in] Default settings */
224    )
225{
226    BERR_Code retCode = BERR_SUCCESS;
227
228
229    BDBG_ENTER(BADS_Open);
230   
231    if( pDefSettings->funcPtr.Open != NULL )
232    {
233        retCode = pDefSettings->funcPtr.Open(pAds, hChip, hRegister, hInterrupt, pDefSettings );
234    }
235    else
236    {
237        *pAds = NULL;
238        BDBG_WRN(("BADS_Open: Funtion Ptr is NULL"));
239    }
240
241    return( retCode );
242}
243
244BERR_Code BADS_Close(
245    BADS_Handle hDev                    /* [in] Device handle */
246    )
247{
248    BERR_Code retCode = BERR_SUCCESS;
249
250
251    BDBG_ENTER(BADS_Close);
252    BDBG_ASSERT( hDev );
253    BDBG_ASSERT( hDev->magicId == DEV_MAGIC_ID );
254
255    if( hDev->settings.funcPtr.Close != NULL )
256    {
257        retCode = hDev->settings.funcPtr.Close( hDev );
258    }
259    else
260    {
261        BDBG_WRN(("BADS_Close: Funtion Ptr is NULL"));
262    }
263
264    BDBG_LEAVE(BADS_Close);
265    return( retCode );
266}
267
268BERR_Code BADS_Init(
269    BADS_Handle hDev                    /* [in] Device handle */
270    )
271{
272    BERR_Code retCode = BERR_SUCCESS;
273
274
275    BDBG_ENTER(BADS_Init);
276    BDBG_ASSERT( hDev );
277   
278    BDBG_ASSERT( hDev->magicId == DEV_MAGIC_ID );
279
280    if( hDev->settings.funcPtr.Init != NULL )
281    {
282        retCode = hDev->settings.funcPtr.Init( hDev );
283    }
284    else
285    {
286        BDBG_WRN(("BADS_Init: Funtion Ptr is NULL"));
287    }
288
289    BDBG_LEAVE(BADS_Init);
290    return( retCode );
291}
292
293BERR_Code BADS_GetVersion(
294    BADS_Handle hDev,                   /* [in] Device handle */
295    BADS_Version *pVersion              /* [out] Returns version */
296    )
297{
298    BERR_Code retCode = BERR_SUCCESS;
299
300
301    BDBG_ENTER(BADS_GetVersion);
302    BDBG_ASSERT( hDev );
303    BDBG_ASSERT( hDev->magicId == DEV_MAGIC_ID );
304
305    if( hDev->settings.funcPtr.GetVersion != NULL )
306    {
307        retCode = hDev->settings.funcPtr.GetVersion( hDev, pVersion );
308    }
309    else
310    {
311        BDBG_WRN(("BADS_GetVersion: Funtion Ptr is NULL"));
312    }
313
314    BDBG_LEAVE(BADS_GetVersion);
315    return( retCode );
316}
317
318BERR_Code BADS_GetBondingCapability(
319    BADS_Handle hDev,                   /* [in] Device handle */
320    unsigned int *bondedChannels         /* [out] Returns the number of bonded channels stored & reserved for Docsis */
321    )
322{
323    BERR_Code retCode = BERR_SUCCESS;
324
325
326    BDBG_ENTER(BADS_GetBondingCapability);
327    BDBG_ASSERT( hDev );
328    BDBG_ASSERT( hDev->magicId == DEV_MAGIC_ID );
329
330    if( hDev->settings.funcPtr.GetBondingCapability != NULL )
331    {
332        retCode = hDev->settings.funcPtr.GetBondingCapability( hDev, bondedChannels );
333    }
334    else
335    {
336        BDBG_WRN(("BADS_GetTotalChannels: Funtion Ptr is NULL"));
337    }
338
339    BDBG_LEAVE(BADS_GetBondingCapability);
340    return( retCode );
341}
342
343BERR_Code BADS_GetTotalChannels(
344    BADS_Handle hDev,                   /* [in] Device handle */
345    unsigned int *totalChannels         /* [out] Returns total number downstream channels supported */
346    )
347{
348    BERR_Code retCode = BERR_SUCCESS;
349
350
351    BDBG_ENTER(BADS_GetTotalChannels);
352    BDBG_ASSERT( hDev );
353    BDBG_ASSERT( hDev->magicId == DEV_MAGIC_ID );
354
355    if( hDev->settings.funcPtr.GetTotalChannels != NULL )
356    {
357        retCode = hDev->settings.funcPtr.GetTotalChannels( hDev, totalChannels );
358    }
359    else
360    {
361        BDBG_WRN(("BADS_GetTotalChannels: Funtion Ptr is NULL"));
362    }
363
364    BDBG_LEAVE(BADS_GetTotalChannels);
365    return( retCode );
366}
367
368BERR_Code BADS_GetChannelDefaultSettings(
369    BADS_Handle hDev,                   /* [in] Device handle */
370    unsigned int channelNo,             /* [in] Channel number to default setting for */
371    BADS_ChannelSettings *pChnDefSettings /* [out] Returns channel default setting */
372    )
373{
374    BERR_Code retCode = BERR_SUCCESS;
375
376
377    BDBG_ENTER(BADS_GetChannelDefaultSettings);
378    BDBG_ASSERT( hDev );
379    BDBG_ASSERT( hDev->magicId == DEV_MAGIC_ID );
380
381    if( hDev->settings.funcPtr.GetChannelDefaultSettings != NULL )
382    {
383        retCode = hDev->settings.funcPtr.GetChannelDefaultSettings( hDev, channelNo, pChnDefSettings );
384    }
385    else
386    {
387        BDBG_WRN(("BADS_GetChannelDefaultSettings: Funtion Ptr is NULL"));
388    }
389
390    BDBG_LEAVE(BADS_GetChannelDefaultSettings);
391    return( retCode );
392}
393
394BERR_Code BADS_OpenChannel(
395    BADS_Handle hDev,                   /* [in] Device handle */
396    BADS_ChannelHandle *phChn,          /* [out] Returns channel handle */
397    unsigned int channelNo,             /* [in] Channel number to open */
398    const BADS_ChannelSettings *pChnDefSettings /* [in] Channel default setting */
399    )
400{
401    BERR_Code retCode = BERR_SUCCESS;
402
403
404    BDBG_ENTER(BADS_OpenChannel);
405    BDBG_ASSERT( hDev );
406    BDBG_ASSERT( hDev->magicId == DEV_MAGIC_ID );
407
408    *phChn = NULL;
409    if( hDev->settings.funcPtr.OpenChannel != NULL )
410    {
411        retCode = hDev->settings.funcPtr.OpenChannel( hDev, phChn, channelNo, pChnDefSettings );
412    }
413    else
414    {
415        BDBG_WRN(("BADS_OpenChannel: Funtion Ptr is NULL"));
416    }
417
418    BDBG_LEAVE(BADS_OpenChannel);
419    return( retCode );
420}
421
422BERR_Code BADS_CloseChannel(
423    BADS_ChannelHandle hChn             /* [in] Device channel handle */
424    )
425{
426    BERR_Code retCode = BERR_SUCCESS;
427   
428
429    BDBG_ENTER(BADS_CloseChannel);
430    BDBG_ASSERT( hChn );
431    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
432
433    if( hChn->hAds->settings.funcPtr.CloseChannel != NULL )
434    {
435        retCode = hChn->hAds->settings.funcPtr.CloseChannel( hChn );
436    }
437    else
438    {
439        BDBG_WRN(("BADS_CloseChannel: Funtion Ptr is NULL"));
440    }
441
442    BDBG_LEAVE(BADS_CloseChannel);
443    return( retCode );
444}
445
446BERR_Code BADS_GetDevice(
447    BADS_ChannelHandle hChn,            /* [in] Device channel handle */
448    BADS_Handle *phDev                  /* [out] Returns Device handle */
449    )
450{
451    BERR_Code retCode = BERR_SUCCESS;
452
453
454    BDBG_ENTER(BADS_GetDevice);
455    BDBG_ASSERT( hChn );
456    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
457
458    *phDev = NULL;
459    if( hChn->hAds->settings.funcPtr.GetDevice != NULL )
460    {
461        retCode = hChn->hAds->settings.funcPtr.GetDevice( hChn, phDev );
462    }
463    else
464    {
465        BDBG_WRN(("BADS_GetDevice: Funtion Ptr is NULL"));
466    }
467
468    BDBG_LEAVE(BADS_GetDevice);
469    return( retCode );
470}
471
472BERR_Code BADS_GetDefaultAcquireParams(
473    BADS_ChannelHandle hChn ,           /* [in] Device channel handle */
474    BADS_InbandParam *ibParams          /* [out] default Inband Parameters */
475    )
476{
477    BERR_Code retCode = BERR_SUCCESS;
478
479
480    BDBG_ENTER(BADS_GetDefaultAcquireParams);
481    BDBG_ASSERT( hChn );
482    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
483
484    if( hChn->hAds->settings.funcPtr.GetDefaultAcquireParams != NULL )
485    {
486        retCode = hChn->hAds->settings.funcPtr.GetDefaultAcquireParams( ibParams );
487    }
488    else
489    {
490        BDBG_WRN(("BADS_GetDefaultAcquireParams: Funtion Ptr is NULL"));
491    }
492
493    BDBG_LEAVE(BADS_GetDefaultAcquireParams);
494    return( retCode );
495}
496
497BERR_Code BADS_SetAcquireParams(
498    BADS_ChannelHandle hChn ,           /* [in] Device channel handle */
499    const BADS_InbandParam *ibParams          /* [in] Inband Parameters to use */
500    )
501{
502    BERR_Code retCode = BERR_SUCCESS;
503
504
505    BDBG_ENTER(BADS_SetAcquireParams);
506    BDBG_ASSERT( hChn );
507    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
508
509    if( hChn->hAds->settings.funcPtr.SetAcquireParams != NULL )
510    {
511        retCode = hChn->hAds->settings.funcPtr.SetAcquireParams( hChn, ibParams );
512    }
513    else
514    {
515        BDBG_WRN(("BADS_SetAcquireParams: Funtion Ptr is NULL"));
516    }
517
518    BDBG_LEAVE(BADS_SetAcquireParams);
519    return( retCode );
520}
521
522BERR_Code BADS_GetAcquireParams(
523    BADS_ChannelHandle hChn ,           /* [in] Device channel handle */
524    BADS_InbandParam *ibParams          /* [out] Inband Parameters to use */
525    )
526{
527    BERR_Code retCode = BERR_SUCCESS;
528
529
530    BDBG_ENTER(BADS_GetAcquireParams);
531    BDBG_ASSERT( hChn );
532    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
533
534    if( hChn->hAds->settings.funcPtr.GetAcquireParams != NULL )
535    {
536        retCode = hChn->hAds->settings.funcPtr.GetAcquireParams( hChn, ibParams );
537    }
538    else
539    {
540        BDBG_WRN(("BADS_GetAcquireParams: Funtion Ptr is NULL"));
541    }
542
543    BDBG_LEAVE(BADS_GetAcquireParams);
544    return( retCode );
545}
546
547BERR_Code BADS_Acquire(
548    BADS_ChannelHandle hChn,            /* [in] Device channel handle */
549    BADS_InbandParam *ibParam           /* [in] Inband Parameters to use */
550    )
551{
552    BERR_Code retCode = BERR_SUCCESS;
553
554
555    BDBG_ENTER(BADS_Acquire);
556    BDBG_ASSERT( hChn );
557    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
558
559    if( hChn->hAds->settings.funcPtr.Acquire != NULL )
560    {
561        retCode = hChn->hAds->settings.funcPtr.Acquire( hChn, ibParam );
562    }
563    else
564    {
565        BDBG_WRN(("BADS_Acquire: Funtion Ptr is NULL"));
566    }
567
568    BDBG_LEAVE(BADS_Acquire);
569    return( retCode );
570}
571
572BERR_Code BADS_GetStatus(
573    BADS_ChannelHandle hChn,            /* [in] Device channel handle */
574    BADS_Status *pStatus                /* [out] Returns status */
575    )
576{
577    BERR_Code retCode = BERR_SUCCESS;
578
579
580    BDBG_ENTER(BADS_GetStatus);
581    BDBG_ASSERT( hChn );
582    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
583   
584    if( hChn->hAds->settings.funcPtr.GetStatus != NULL )
585    {
586        retCode = hChn->hAds->settings.funcPtr.GetStatus( hChn, pStatus);
587    }
588    else
589    {
590        BDBG_WRN(("BADS_Status: Funtion Ptr is NULL"));
591    }
592
593    BDBG_LEAVE(BADS_GetStatus);
594    return( retCode );
595}
596
597BERR_Code BADS_RequestAsyncStatus(
598    BADS_ChannelHandle hChn            /* [in] Device channel handle */
599    )
600{
601    BERR_Code retCode = BERR_SUCCESS;
602
603
604    BDBG_ENTER(BADS_RequestAsyncStatus);
605    BDBG_ASSERT( hChn );
606    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
607   
608    if( hChn->hAds->settings.funcPtr.RequestAsyncStatus != NULL )
609    {
610        retCode = hChn->hAds->settings.funcPtr.RequestAsyncStatus( hChn);
611    }
612    else
613    {
614        BDBG_WRN(("BADS_RequestAsyncStatus: Funtion Ptr is NULL"));
615    }
616
617    BDBG_LEAVE(BADS_RequestAsyncStatus);
618    return( retCode );
619}
620
621BERR_Code BADS_GetAsyncStatus(
622    BADS_ChannelHandle hChn,            /* [in] Device channel handle */
623    BADS_Status *pStatus                /* [out] Returns status */
624    )
625{
626    BERR_Code retCode = BERR_SUCCESS;
627
628
629    BDBG_ENTER(BADS_GetAsyncStatus);
630    BDBG_ASSERT( hChn );
631    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
632   
633    if( hChn->hAds->settings.funcPtr.GetAsyncStatus != NULL )
634    {
635        retCode = hChn->hAds->settings.funcPtr.GetAsyncStatus( hChn, pStatus);
636    }
637    else
638    {
639        BDBG_WRN(("BADS_AsyncStatus: Funtion Ptr is NULL"));
640    }
641
642    BDBG_LEAVE(BADS_GetAsyncStatus);
643    return( retCode );
644}
645
646BERR_Code BADS_GetScanStatus(
647    BADS_ChannelHandle hChn,            /* [in] Device channel handle */
648    BADS_ScanStatus *pScanStatus        /* [out] Returns status */
649    )
650{
651    BERR_Code retCode = BERR_SUCCESS;
652
653
654    BDBG_ENTER(BADS_GetScanStatus);
655    BDBG_ASSERT( hChn );
656    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
657   
658    if( hChn->hAds->settings.funcPtr.GetScanStatus != NULL )
659    {
660        retCode = hChn->hAds->settings.funcPtr.GetScanStatus( hChn, pScanStatus);
661    }
662    else
663    {
664        BDBG_WRN(("BADS_GetScanStatus: Funtion Ptr is NULL"));
665    }
666
667    BDBG_LEAVE(BADS_GetScanStatus);
668    return( retCode );
669}
670
671BERR_Code BADS_GetLockStatus(
672    BADS_ChannelHandle hChn,            /* [in] Device channel handle */
673    BADS_LockStatus *pLockStatus         /* [out] Returns lock status */
674    )
675{
676    BERR_Code retCode = BERR_SUCCESS;
677
678    BDBG_ENTER(BADS_GetLockStatus);
679    BDBG_ASSERT( hChn );
680    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
681
682    if( hChn->hAds->settings.funcPtr.GetLockStatus != NULL )
683    {
684        retCode = hChn->hAds->settings.funcPtr.GetLockStatus( hChn, pLockStatus );
685    }
686    else
687    {
688        BDBG_WRN(("BADS_GetLockStatus: Funtion Ptr is NULL"));
689    }
690
691    BDBG_LEAVE(BADS_GetLockStatus);
692    return( retCode );
693}
694
695BERR_Code BADS_GetSoftDecision(
696    BADS_ChannelHandle hChn,            /* [in] Device channel handle */
697    int16_t nbrToGet,                   /* [in] Number values to get */
698    int16_t *iVal,                      /* [out] Ptr to array to store output I soft decision */
699    int16_t *qVal,                      /* [out] Ptr to array to store output Q soft decision */
700    int16_t *nbrGotten                  /* [out] Number of values gotten/read */
701    )
702{
703    BERR_Code retCode = BERR_SUCCESS;
704
705
706    BDBG_ENTER(BADS_GetSoftDecision);
707    BDBG_ASSERT( hChn );
708    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
709
710    if( hChn->hAds->settings.funcPtr.GetSoftDecision != NULL )
711    {
712        retCode = hChn->hAds->settings.funcPtr.GetSoftDecision( hChn, nbrToGet, iVal, qVal, nbrGotten );
713    }
714    else
715    {
716        BDBG_WRN(("BADS_GetSoftDecision: Funtion Ptr is NULL"));
717    }
718
719    BDBG_LEAVE(BADS_GetSoftDecision);
720    return( retCode );
721}
722
723BERR_Code BADS_EnablePowerSaver(
724    BADS_ChannelHandle hChn         /* [in] Device channel handle */
725    )
726{
727    BERR_Code retCode = BERR_SUCCESS;
728
729
730    BDBG_ENTER(BADS_EnablePowerSaver);
731    BDBG_ASSERT( hChn );
732    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
733
734    if( hChn->hAds->settings.funcPtr.EnablePowerSaver != NULL )
735    {
736        retCode = hChn->hAds->settings.funcPtr.EnablePowerSaver( hChn );
737    }
738    else
739    {
740        BDBG_WRN(("BADS_EnablePowerSaver: Funtion Ptr is NULL"));
741    }
742
743    BDBG_LEAVE(BADS_EnablePowerSaver);
744    return( retCode );
745}
746
747
748BERR_Code BADS_DisablePowerSaver(
749    BADS_ChannelHandle hChn         /* [in] Device channel handle */
750    )
751{
752    BERR_Code retCode = BERR_SUCCESS;
753
754
755    BDBG_ENTER(BADS_DisablePowerSaver);
756    BDBG_ASSERT( hChn );
757    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
758
759    if( hChn->hAds->settings.funcPtr.DisablePowerSaver != NULL )
760    {
761        retCode = hChn->hAds->settings.funcPtr.DisablePowerSaver( hChn );
762    }
763    else
764    {
765        BDBG_WRN(("BADS_DisablePowerSaver: Funtion Ptr is NULL"));
766    }
767
768    BDBG_LEAVE(BADS_DisablePowerSaver);
769    return( retCode );
770}
771
772
773BERR_Code BADS_ProcessNotification(
774    BADS_ChannelHandle hChn,                /* [in] Device channel handle */
775    unsigned int event                      /* [in] Event code and event data*/
776    )
777{
778    BERR_Code retCode = BERR_SUCCESS;
779
780
781    BDBG_ENTER(BADS_ProcessNotification);
782    BDBG_ASSERT( hChn );
783    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
784
785    if( hChn->hAds->settings.funcPtr.ProcessNotification != NULL )
786    {
787        retCode = hChn->hAds->settings.funcPtr.ProcessNotification( hChn, event);
788    }
789    else
790    {
791        BDBG_WRN(("BADS_ProcessNotification: Funtion Ptr is NULL"));
792    }
793
794    BDBG_LEAVE(BADS_ProcessNotification);
795    return( retCode );
796}
797
798BERR_Code BADS_InstallCallback(
799    BADS_ChannelHandle hChn,            /* [in] Device channel handle */
800    BADS_Callback callbackType,         /* [in] Type of callback */
801    BADS_CallbackFunc pCallback,        /* [in] Function Ptr to callback */
802    void *pParam                        /* [in] Generic parameter send on callback */
803    )
804{
805    BERR_Code retCode = BERR_SUCCESS;
806
807
808    BDBG_ENTER(BADS_InstallCallback);
809    BDBG_ASSERT( hChn );
810    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
811   
812    if( hChn->hAds->settings.funcPtr.InstallCallback != NULL )
813    {
814        retCode = hChn->hAds->settings.funcPtr.InstallCallback( hChn, callbackType, pCallback, pParam );
815    }
816    else
817    {
818        BDBG_WRN(("BADS_InstallCallback: Funtion Ptr is NULL"));
819    }
820
821    BDBG_LEAVE(BADS_InstallCallback);
822    return( retCode );
823}
824
825BERR_Code BADS_SetDaisyChain(
826    BADS_Handle hDev,       /* [in] Returns handle */
827    bool enableDaisyChain   /* [in] Eanble/disable daisy chain. */
828    )
829{
830    BERR_Code retCode = BERR_SUCCESS;
831   
832   
833    BDBG_ENTER(BADS_SetDaisyChain);
834    BDBG_ASSERT( hDev );
835    BDBG_ASSERT( hDev->magicId == DEV_MAGIC_ID );
836
837    if( hDev->settings.funcPtr.SetDaisyChain != NULL )
838    {
839            retCode = hDev->settings.funcPtr.SetDaisyChain( hDev, enableDaisyChain);
840    }
841    else
842    {
843        BDBG_WRN(("BADS_SetDaisyChain: Funtion Ptr is NULL"));
844    }
845
846
847    BDBG_LEAVE(BADS_SetDaisyChain);
848    return( retCode );
849
850}
851
852BERR_Code BADS_GetDaisyChain(
853    BADS_Handle hDev,           /* [in] Returns handle */
854    bool *isEnableDaisyChain    /* [out] Eanble/disable daisy chain. */
855    )
856{
857    BERR_Code retCode = BERR_SUCCESS;
858   
859   
860    BDBG_ENTER(BADS_GetDaisyChain);
861    BDBG_ASSERT( hDev );
862    BDBG_ASSERT( hDev->magicId == DEV_MAGIC_ID );
863
864    if( hDev->settings.funcPtr.GetDaisyChain != NULL )
865    {
866            retCode = hDev->settings.funcPtr.GetDaisyChain( hDev, isEnableDaisyChain);
867    }
868    else
869    {
870        BDBG_WRN(("BADS_GetDaisyChain: Funtion Ptr is NULL"));
871    }
872
873
874    BDBG_LEAVE(BADS_GetDaisyChain);
875    return( retCode );
876
877}
878
879
880BERR_Code BADS_ResetStatus(
881    BADS_ChannelHandle hChn     /* [in] Device channel handle */
882    )
883{
884    BERR_Code retCode = BERR_SUCCESS;
885   
886    BDBG_ENTER(BADS_ResetStatus);
887    BDBG_ASSERT( hChn );
888    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
889   
890    if( hChn->hAds->settings.funcPtr.ResetStatus != NULL )
891    {
892        retCode = hChn->hAds->settings.funcPtr.ResetStatus( hChn);
893    }
894    else
895    {
896        BDBG_WRN(("BADS_ResetStatus: Funtion Ptr is NULL"));
897    }
898
899    BDBG_LEAVE(BADS_GetStatus);
900    return( retCode );
901}
902
903BERR_Code BADS_GetInterruptEventHandle(
904   BADS_Handle hDev,            /* [in] BADS handle */
905   BKNI_EventHandle *phEvent /* [out] event handle */
906)
907{
908    BERR_Code retCode = BERR_SUCCESS;
909   
910   
911    BDBG_ENTER(BADS_GetInterruptEventHandle);
912    BDBG_ASSERT( hDev );
913    BDBG_ASSERT( hDev->magicId == DEV_MAGIC_ID );
914
915    if( hDev->settings.funcPtr.GetInterruptEventHandle != NULL )
916    {
917        retCode = hDev->settings.funcPtr.GetInterruptEventHandle(hDev, phEvent);
918    }
919    else
920    {
921        BDBG_WRN(("BADS_GetInterruptEventHandle: Funtion Ptr is NULL"));
922    }
923
924    BDBG_LEAVE(BADS_GetInterruptEventHandle);
925    return( retCode );
926}
927
928
929BERR_Code BADS_ProcessInterruptEvent(
930   BADS_Handle hDev            /* [in] BADS handle */
931)
932{
933    BERR_Code retCode = BERR_SUCCESS;
934   
935   
936    BDBG_ENTER(BADS_ProcessInterruptEvent);
937    BDBG_ASSERT( hDev );
938    BDBG_ASSERT( hDev->magicId == DEV_MAGIC_ID );
939
940    if( hDev->settings.funcPtr.ProcessInterruptEvent != NULL )
941    {
942        retCode = hDev->settings.funcPtr.ProcessInterruptEvent( hDev);
943    }
944    else
945    {
946        BDBG_WRN(("BADS_ProcessInterruptEvent: Funtion Ptr is NULL"));
947    }
948
949    BDBG_LEAVE(BADS_ProcessInterruptEvent);
950    return( retCode );
951}
952
953BERR_Code BADS_Untune(
954        BADS_Handle hDev                        /* [in] BADS handle */
955        )
956{
957        BERR_Code retCode = BERR_SUCCESS;
958
959
960        BDBG_ENTER(BADS_Untune);
961        BDBG_ASSERT( hDev );
962        BDBG_ASSERT( hDev->magicId == DEV_MAGIC_ID );
963
964        if( hDev->settings.funcPtr.Untune != NULL )
965        {
966                retCode = hDev->settings.funcPtr.Untune( hDev );
967        }
968        else
969        {
970                BDBG_WRN(("BADS_Untune: Funtion Ptr is NULL"));
971        }
972
973        BDBG_LEAVE(BADS_Untune);
974        return( retCode );
975}
976
977BERR_Code BADS_ReadSlave(
978    BADS_ChannelHandle hChn,     /* [in] Device channel handle */
979        uint8_t chipAddr,                        /* [in] chip addr of the i2c slave device */
980        uint32_t subAddr,                        /* [in] sub addr of the register to read from the slave device */
981        uint8_t subAddrLen,                      /* [in] how many bytes is the sub addr? one to four*/
982        uint32_t *data,                          /* [out] ptr to the data that we will read from the slave device */
983        uint8_t dataLen                          /* [in] how many bytes are we going to read? one to four*/
984    )
985{
986    BERR_Code retCode = BERR_SUCCESS;
987   
988    BDBG_ENTER(BADS_ReadSlave);
989    BDBG_ASSERT( hChn );
990    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
991   
992    if( hChn->hAds->settings.funcPtr.ReadSlave != NULL )
993    {
994        retCode = hChn->hAds->settings.funcPtr.ReadSlave( hChn, chipAddr, subAddr, subAddrLen, data, dataLen );
995    }
996    else
997    {
998        BDBG_WRN(("BADS_ReadSlave: Funtion Ptr is NULL"));
999    }
1000
1001    BDBG_LEAVE(BADS_ReadSlave);
1002    return( retCode );
1003}
1004
1005BERR_Code BADS_WriteSlave(
1006    BADS_ChannelHandle hChn,     /* [in] Device channel handle */
1007        uint8_t chipAddr,                        /* [in] chip addr of the i2c slave device */
1008        uint32_t subAddr,                        /* [in] sub addr of the register to read from the slave device */
1009        uint8_t subAddrLen,                      /* [in] how many bytes is the sub addr? one to four*/
1010        uint32_t *data,                          /* [in] ptr to the data that we will write to the slave device */
1011        uint8_t dataLen                          /* [in] how many bytes are we going to write? one to four*/
1012    )
1013{
1014    BERR_Code retCode = BERR_SUCCESS;
1015   
1016    BDBG_ENTER(BADS_WriteSlave);
1017    BDBG_ASSERT( hChn );
1018    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
1019   
1020    if( hChn->hAds->settings.funcPtr.WriteSlave != NULL )
1021    {
1022        retCode = hChn->hAds->settings.funcPtr.WriteSlave(  hChn, chipAddr, subAddr, subAddrLen, data, dataLen );
1023    }
1024    else
1025    {
1026        BDBG_WRN(("BADS_WriteSlave: Funtion Ptr is NULL"));
1027    }
1028
1029    BDBG_LEAVE(BADS_WriteSlave);
1030    return( retCode );
1031}
1032
1033
1034/******************************************************************************
1035Summary:
1036   This function will pass the scan parameter to ADS.
1037Description:
1038 
1039Returns:
1040   BERR_Code
1041******************************************************************************/
1042BERR_Code BADS_SetScanParam(
1043                BADS_ChannelHandle hChn,     /* [in] Device channel handle */ 
1044            BADS_ChannelScanSettings *pChnScanSettings /* [in] Set Channel setting */
1045)
1046{
1047        BERR_Code retCode = BERR_SUCCESS;
1048   
1049    BDBG_ENTER(BADS_SetScanParam);
1050    BDBG_ASSERT( hChn );
1051    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
1052   
1053    if( hChn->hAds->settings.funcPtr.SetScanParam != NULL )
1054    {
1055        retCode = hChn->hAds->settings.funcPtr.SetScanParam(  hChn, pChnScanSettings);
1056    }
1057    else
1058    {
1059        BDBG_WRN(("BADS_SetScanParam: Funtion Ptr is NULL"));
1060    }
1061
1062    BDBG_LEAVE(BADS_SetScanParam);
1063    return( retCode );
1064}
1065/******************************************************************************
1066Summary:
1067   This function will get the scan parameter from ADS.
1068Description:
1069 
1070Returns:
1071   BERR_Code
1072******************************************************************************/
1073BERR_Code BADS_GetScanParam (
1074                BADS_ChannelHandle hChn,     /* [in] Device channel handle */ 
1075                BADS_ChannelScanSettings *pChnScanSettings /* [out] Returns channel default setting */
1076)
1077{
1078        BERR_Code retCode = BERR_SUCCESS;
1079   
1080    BDBG_ENTER(BADS_GetScanParam);
1081    BDBG_ASSERT( hChn );
1082    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
1083   
1084    if( hChn->hAds->settings.funcPtr.GetScanParam != NULL )
1085    {
1086        retCode = hChn->hAds->settings.funcPtr.GetScanParam(  hChn, pChnScanSettings);
1087    }
1088    else
1089    {
1090        BDBG_WRN(("BADS_GetScanParam: Funtion Ptr is NULL"));
1091    }
1092
1093    BDBG_LEAVE(BADS_GetScanParam);
1094    return( retCode );
1095}
1096
1097/******************************************************************************
1098Summary:
1099   This function sends request for spectrum analyzer data to the LEAP.
1100Description:
1101 
1102Returns:
1103   BERR_Code
1104******************************************************************************/
1105BERR_Code BADS_RequestSpectrumAnalyzerData(
1106    BADS_ChannelHandle hChn,     /* [in] Device channel handle */ 
1107    BADS_SpectrumSettings *pSettings /* [in] spectrum settings */
1108    )
1109{
1110        BERR_Code retCode = BERR_SUCCESS;
1111   
1112    BDBG_ENTER(BADS_RequestSpectrumAnalyzerData);
1113    BDBG_ASSERT( hChn );
1114    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
1115   
1116    if( hChn->hAds->settings.funcPtr.RequestSpectrumAnalyzerData != NULL )
1117    {
1118        retCode = hChn->hAds->settings.funcPtr.RequestSpectrumAnalyzerData(  hChn, pSettings);
1119    }
1120    else
1121    {
1122        BDBG_WRN(("BADS_RequestSpectrumAnalyzerData: Funtion Ptr is NULL"));
1123    }
1124
1125    BDBG_LEAVE(BADS_RequestSpectrumAnalyzerData);
1126    return( retCode );
1127}   
1128
1129/******************************************************************************
1130Summary:
1131   This function gets spectrum analyzer data from the LEAP.
1132Description:
1133 
1134Returns:
1135   BERR_Code
1136******************************************************************************/   
1137BERR_Code BADS_GetSpectrumAnalyzerData(
1138    BADS_ChannelHandle hChn,     /* [in] Device channel handle */ 
1139    BADS_SpectrumData  *pSpectrumData /* [out] spectrum Data*/
1140    )
1141{
1142        BERR_Code retCode = BERR_SUCCESS;
1143   
1144    BDBG_ENTER(BADS_GetSpectrumAnalyzerData);
1145    BDBG_ASSERT( hChn );
1146    BDBG_ASSERT( hChn->magicId == DEV_MAGIC_ID );
1147   
1148    if( hChn->hAds->settings.funcPtr.GetSpectrumAnalyzerData != NULL )
1149    {
1150        retCode = hChn->hAds->settings.funcPtr.GetSpectrumAnalyzerData(  hChn, pSpectrumData);
1151    }
1152    else
1153    {
1154        BDBG_WRN(("BADS_GetSpectrumAnalyzerData: Funtion Ptr is NULL"));
1155    }
1156
1157    BDBG_LEAVE(BADS_GetSpectrumAnalyzerData);
1158    return( retCode );
1159}
1160   
Note: See TracBrowser for help on using the repository browser.