source: svn/trunk/newcon3bcm2_21bu/magnum/basemodules/hab/bhab.h @ 2

Last change on this file since 2 was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 31.6 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-2011, 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: bhab.h $
11 * $brcm_Revision: Hydra_Software_Devel/33 $
12 * $brcm_Date: 12/8/11 3:12p $
13 *
14 *
15 * Revision History:
16 *
17 * $brcm_Log: /magnum/basemodules/hab/bhab.h $
18 *
19 * Hydra_Software_Devel/33   12/8/11 3:12p atanugul
20 * SW3128-89: Add PI support for Spectrum Analyzer Data retrieval
21 *
22 * Hydra_Software_Devel/32   11/9/11 2:57p atanugul
23 * SW3128-68: Add BHAB_ReadSlave() and BHAB_ReadSlave() API to 3128
24 *
25 * Hydra_Software_Devel/31   11/2/11 4:42p atanugul
26 * SW3461-3: Update BHAB_GetApVersion to include familyId, AP major
27 * version, minor version and remove script version and configuration
28 * version
29 *
30 * Hydra_Software_Devel/30   10/18/11 3:20p atanugul
31 * SW3461-67: change write_len, read_len and command_len in
32 * BHAB_SendHabCommand() from type uint8_t to uint16_t
33 *
34 * Hydra_Software_Devel/29   8/11/11 4:18p enavarro
35 * SWSATFE-86: added more BHAB error codes
36 *
37 * Hydra_Software_Devel/28   8/11/11 10:22a enavarro
38 * SWSATFE-86: added AST device to BHAB_DevId list
39 *
40 * Hydra_Software_Devel/27   8/11/11 9:24a enavarro
41 * SW7425-883: added BHAB_DevId for diseqc
42 *
43 * Hydra_Software_Devel/26   7/28/11 10:03a enavarro
44 * SW7425-883: added BHAB_DevId for satellite front end cores
45 *
46 * Hydra_Software_Devel/25   7/28/11 9:58a enavarro
47 * SW7425-883: added interrupt types for satellite front end
48 *
49 * Hydra_Software_Devel/24   6/30/11 3:58p atanugul
50 * SW3128-25: Add BHAB_ReadRegister() and BHAB_WriteRegister() prototypes
51 *
52 * Hydra_Software_Devel/23   6/20/11 11:46a atanugul
53 * SW3461-5: Add LoopThrough Support for 3461
54 *
55 * Hydra_Software_Devel/22   6/1/11 3:43p atanugul
56 * SW3461-5: Add THD support to 3461
57 *
58 * Hydra_Software_Devel/21   5/27/11 4:28p atanugul
59 * SW3461-3: Added BHAB_GetConfigSettings() and BHAB_SetConfigSettings()
60 *
61 * Hydra_Software_Devel/20   5/6/11 3:48p atanugul
62 * SW3128-2: Added support to configure TM_MTSIF_CTRL - Transport Control
63 * Register for BCM3128
64 *
65 * Hydra_Software_Devel/19   4/29/11 10:16a atanugul
66 * SW3128-8: Add SPI support for 3128
67 *
68 * Hydra_Software_Devel/18   3/28/11 12:13p atanugul
69 * SW3128-2: Add Support for 8 cores and code cleanup
70 *
71 * Hydra_Software_Devel/17   3/16/11 4:52p atanugul
72 * SW3128-2: Add Support for BCM3128
73 *
74 * Hydra_Software_Devel/16   3/2/11 6:08p atanugul
75 * SW3128-2: Add Support for BCM3128
76 *
77 * Hydra_Software_Devel/15   2/1/11 5:41p VISHK
78 * SW7422-171: Nexus support for the 3128 (8 ADS core + tuner on daughter
79 * board) plug on 7422 board  Read and write memory modified to 32 bit
80 * addressing to support 3128 chipset as it has 32 bit memory addressing.
81 *
82 * Hydra_Software_Devel/14   12/2/10 7:17p VISHK
83 * SW7405-5037: To make the i2c address programmable for the slave
84 * device(LNA) of 31xx frontend chip.
85 *
86 * Hydra_Software_Devel/13   11/2/10 5:59p VISHK
87 * SW7420-1020: Request for non-blocking call support in Nexus frontend
88 *
89 * Hydra_Software_Devel/12   10/21/10 6:48p vishk
90 * SW7420-1020: Request for non-blocking call support in Nexus frontend
91 *
92 * Hydra_Software_Devel/11   7/2/10 4:23p vishk
93 * SW7420-873: Add support to inform application to update frontend tuner
94 * gain and to inform that there is no signal to tune upon multiple tries
95 * to acquire
96 *
97 * Hydra_Software_Devel/10   6/22/10 6:02p vishk
98 * SW7420-839: Add support to program AGC gain to 31xx TNR PI
99 *
100 * Hydra_Software_Devel/9   10/5/09 10:43a vishk
101 * SW7405-2851: 31xx: Add support to configure the Watchdog feature of
102 * 31xx.
103 *
104 * Hydra_Software_Devel/8   5/12/09 10:54a vishk
105 * PR 46431: ADS PI: Add support for BCM3117, BCM3114, and BCM3112.
106 * PR 46436: AOB PI: Add support for BCM3117 and BCM3114
107 *
108 * Hydra_Software_Devel/7   4/10/09 11:51a vishk
109 * PR 46431: ADS PI: Add support for BCM3117, BCM3114, and BCM3112.
110 * PR 46436: AOB PI: Add support for BCM3117 and BCM3114
111 *
112 * Hydra_Software_Devel/6   3/3/09 1:08p vishk
113 * PR 46431: ADS PI: Add support for BCM3117, BCM3114, and BCM3112.
114 * PR 46436: AOB PI: Add support for BCM3117 and BCM3114
115 *
116 * Hydra_Software_Devel/5   1/29/09 7:17p vishk
117 * PR 46431: ADS PI: Add support for BCM3117, BCM3114, and BCM3112.
118 * PR 46436: AOB PI: Add support for BCM3117 and BCM3114
119 *
120 * Removed GetLockStateChangeEventHandle.
121 *
122 * Hydra_Software_Devel/4   1/17/09 2:37p vishk
123 * PR 46431: ADS PI: Add support for BCM3117, BCM3114, and BCM3112.
124 * PR 46436: AOB PI: Add support for BCM3117 and BCM3114
125 *
126 * Added comment.
127 *
128 * Hydra_Software_Devel/3   1/16/09 7:12p vishk
129 * PR 46431: ADS PI: Add support for BCM3117, BCM3114, and BCM3112.
130 * PR 46436: AOB PI: Add support for BCM3117 and BCM3114
131 *
132 * Hydra_Software_Devel/2   10/27/08 11:11a gmohile
133 * PR 47386 : Add temination byte for send hab command
134 *
135 * Hydra_Software_Devel/1   10/20/08 2:52p gmohile
136 * PR 47386 : Checkin initial version
137 *
138 ***************************************************************************/
139
140#ifndef BHAB_H
141#define BHAB_H
142
143#ifdef __cplusplus
144extern "C" {
145#endif
146
147
148#include "berr_ids.h"
149#include "bstd.h"
150#include "bkni.h"
151#include "bkni_multi.h"
152
153
154#define BHAB_CHK_RETCODE(x) \
155   { if ((retCode = (x)) != BERR_SUCCESS) goto done; }
156 
157
158/* bit definitions for BHAB_ApStatus */
159#define BHAB_APSTATUS_RESET      0x00000001 /* AP is in reset state */
160#define BHAB_APSTATUS_IDLE       0x00000002 /* AP is in idle state */
161#define BHAB_APSTATUS_RUN        0x00000000 /* AP is running */
162#define BHAB_APSTATUS_RUN_MASK   0x00000003 /* AP execution state mask */
163#define BHAB_APSTATUS_HAB_DONE   0x00000400 /* HAB done */
164#define BHAB_APSTATUS_HAB_ERR    0x00001000 /* HAB access violation */
165#define BHAB_APSTATUS_MEM_ERR    0x00002000 /* memory access violation */
166#define BHAB_APSTATUS_IOMB_ERR   0x00004000 /* io_mbox isb transfer error */
167#define BHAB_APSTATUS_H_ERR      0x00008000 /* host transfer error */
168#define BHAB_APSTATUS_INIT_DONE  0x00800000 /* AP init done */
169#define BHAB_APSTATUS_LOCK       0x00400000 /* inband lock status */
170#define BHAB_APSTATUS_HAB_MASK   0x00800403 /* HAB available condition mask */
171#define BHAB_APSTATUS_HAB_READY  0x00800400 /* HAB available condition */
172#define BHAB_APSTATUS_HABCMD_ERR 0x00080000 /* HAB command syntax error */
173#define BHAB_APSTATUS_AP_ERR     0x00040000 /* internal AP error */
174
175
176/***************************************************************************
177Summary:
178        BHAB error codes
179
180Description:
181
182See Also:
183
184****************************************************************************/
185#define BERR_HAB_ID            61
186#define BHAB_ERR_AP_FAIL       BERR_MAKE_CODE(BERR_HAB_ID, 0)  /* This is a BERR_Code to indicate that host was unable to reset/idle/run the AP. */
187#define BHAB_ERR_HOST_XFER     BERR_MAKE_CODE(BERR_HAB_ID, 1)  /* This is a BERR_Code to indicate a host transfer error (underrun/overrun). */
188#define BHAB_ERR_IOMB_XFER     BERR_MAKE_CODE(BERR_HAB_ID, 2)  /* This is a BERR_Code to indicate an IO Mailbox ISB transfer error. */
189#define BHAB_ERR_MEMAV         BERR_MAKE_CODE(BERR_HAB_ID, 3)  /* This is a BERR_Code to indicate a memory access violation. */
190#define BHAB_ERR_AP_EEPROM     BERR_MAKE_CODE(BERR_HAB_ID, 4)  /* This is a BERR_Code to indicate no i2c ack from EEPROM. */
191#define BHAB_ERR_AP_NOT_INIT   BERR_MAKE_CODE(BERR_HAB_ID, 5)  /* This is a BERR_Code to indicate that the AP has failed to initialize. */
192#define BHAB_ERR_HABAV         BERR_MAKE_CODE(BERR_HAB_ID, 6)  /* This is a BERR_Code to indicate an HAB access violation. */
193#define BHAB_ERR_HAB_NOT_AVAIL BERR_MAKE_CODE(BERR_HAB_ID, 7)  /* This is a BERR_Code to indicate that the HAB is busy. */
194#define BHAB_ERR_HAB_ERR       BERR_MAKE_CODE(BERR_HAB_ID, 8)  /* This is a BERR_Code to indicate an HAB command format error. */
195#define BHAB_ERR_HAB_NO_ACK    BERR_MAKE_CODE(BERR_HAB_ID, 9)  /* This is a BERR_Code to indicate that the HAB command was not processed by AP. */
196#define BHAB_ERR_HAB_FAIL      BERR_MAKE_CODE(BERR_HAB_ID, 10) /* This is a BERR_Code to indicate bad/unexpected HAB data read. */
197#define BHAB_ERR_AP_HABAV      BERR_MAKE_CODE(BERR_HAB_ID, 11) /* This is a BERR_Code to indicate an AP-internal error. */
198#define BHAB_ERR_AP_COPY       BERR_MAKE_CODE(BERR_HAB_ID, 12) /* This is a BERR_Code to indicate an AP-internal error. */
199#define BHAB_ERR_AP_IRQ        BERR_MAKE_CODE(BERR_HAB_ID, 13) /* This is a BERR_Code to indicate an AP-internal error. */
200#define BHAB_ERR_AP_SCR        BERR_MAKE_CODE(BERR_HAB_ID, 14) /* This is a BERR_Code to indicate an AP-internal error. */
201#define BHAB_ERR_AP_ISB        BERR_MAKE_CODE(BERR_HAB_ID, 15) /* This is a BERR_Code to indicate an AP-internal error. */
202#define BHAB_ERR_AP_WD         BERR_MAKE_CODE(BERR_HAB_ID, 16) /* This is a BERR_Code to indicate an AP-internal error. */
203#define BHAB_ERR_AP_STACK      BERR_MAKE_CODE(BERR_HAB_ID, 17) /* This is a BERR_Code to indicate an AP-internal error. */
204#define BHAB_ERR_AP_BSC        BERR_MAKE_CODE(BERR_HAB_ID, 18) /* This is a BERR_Code to indicate an AP-internal error. */
205#define BHAB_ERR_IOMB_BUSY     BERR_MAKE_CODE(BERR_HAB_ID, 19) /* This is a BERR_Code to indicate the IO MBOX was busy. */
206#define BHAB_ERR_HAB_TIMEOUT   BERR_MAKE_CODE(BERR_HAB_ID, 20) /* This is a BERR_Code to indicate an HAB timeout. */
207#define BHAB_ERR_AP_UNKNOWN    BERR_MAKE_CODE(BERR_HAB_ID, 21) /* This is a BERR_Code to indicate an AP-internal error. */
208#define BHAB_ERR_MI2C_NO_ACK   BERR_MAKE_CODE(BERR_HAB_ID, 22) /* This is a BERR_Code to indicate no ack from i2c slave device (e.g. tuner). */
209#define BHAB_ERR_HAB_CHECKSUM  BERR_MAKE_CODE(BERR_HAB_ID, 23) /* This is a BERR_Code to indicate bad checksum in HAB */
210#define BHAB_ERR_HAB_BAD_PARAM BERR_MAKE_CODE(BERR_HAB_ID, 24) /* This is a BERR_Code to indicate invalid parameter specified in HAB command */
211#define BHAB_ERR_HAB_NOT_SUPP  BERR_MAKE_CODE(BERR_HAB_ID, 25) /* This is a BERR_Code to indicate AP does not support this HAB command */
212
213
214/***************************************************************************
215Summary:
216        Enum for HAB interrupt tyes
217
218Description:
219        This enum lists the different types of interrupts from the device
220
221See Also:
222        None.
223
224****************************************************************************/
225typedef enum BHAB_InterruptType{
226        BHAB_Interrupt_eHabDone,
227        BHAB_Interrupt_eInitDone,
228        BHAB_Interrupt_eLockChange,
229        BHAB_Interrupt_eUpdateGain,
230        BHAB_Interrupt_eNoSignal,
231        BHAB_Interrupt_eQamAsyncStatusReady,
232        BHAB_Interrupt_eOobAsyncStatusReady,
233        BHAB_Interrupt_eTc2AsyncStatusReady,
234        BHAB_Interrupt_eThdAsyncStatusReady,
235        BHAB_Interrupt_eFskReady,
236        BHAB_Interrupt_eDiseqcDone,
237        BHAB_Interrupt_eDiseqcOverVoltage,
238        BHAB_Interrupt_eDiseqcUnderVoltage,
239        BHAB_Interrupt_eStatus,
240        BHAB_Interrupt_ePeakScanDone,
241        BHAB_Interrupt_eSpectrumAnalyzerDataReady,
242        BHAB_Interrupt_eMax
243} BHAB_InterruptType;
244
245
246typedef enum BHAB_DevId{
247        BHAB_DevId_eADS0 = 0,
248        BHAB_DevId_eADS1,
249        BHAB_DevId_eADS2,
250        BHAB_DevId_eADS3,
251        BHAB_DevId_eADS4,
252        BHAB_DevId_eADS5,
253        BHAB_DevId_eADS6,
254        BHAB_DevId_eADS7,
255        BHAB_DevId_eAOB0 = 10,
256        BHAB_DevId_eAOB1,
257        BHAB_DevId_eAUS0 = 20,
258        BHAB_DevId_eAUS1,
259        BHAB_DevId_eVSB0 = 30, 
260        BHAB_DevId_eVSB1,
261        BHAB_DevId_eTC20 = 40, 
262        BHAB_DevId_eTC21,   
263        BHAB_DevId_eTHD0 = 50,   
264        BHAB_DevId_eTHD1,   
265        BHAB_DevId_eAST,
266        BHAB_DevId_eMax
267}BHAB_DevId;
268
269/***************************************************************************
270Summary:
271    Enumeration for Daisy Chain
272   
273Description:
274        This enum lists the different types of Daisy Chain outputs from the
275    device.
276
277See Also:
278        BHAB_GetConfigSettings(), BHAB_SetConfigSettings()
279
280****************************************************************************/
281typedef enum BHAB_RfDaisyChain
282{
283    BHAB_RfDaisyChain_eOff,         /* Daisychaining is tunrned off. */
284    BHAB_RfDaisyChain_eExternalLna, /* Daisychaining through UHF path. This Rf daisychaining path does not use internal LNA. */
285    BHAB_RfDaisyChain_eInternalLna, /* Daisychaining through VHF path. This Rf daisychaining path uses internal LNA. */   
286    BHAB_RfDaisyChain_eMax
287} BHAB_RfDaisyChain;
288
289/***************************************************************************
290Summary:
291        The handle for hab module.
292
293Description:
294        This is an opaque handle that is used to access HAB.
295
296See Also:
297        BHAB_Open()
298
299****************************************************************************/
300typedef struct BHAB_P_Handle *BHAB_Handle;
301
302
303/***************************************************************************
304Summary:
305        Typedef for status information
306
307Description:
308        This typedef contains AP status information
309
310See Also:
311        None.
312
313****************************************************************************/
314typedef uint32_t BHAB_ApStatus;
315
316/***************************************************************************
317Summary:       
318
319Description:
320
321See Also:
322       
323****************************************************************************/
324typedef struct BHAB_NmiGpioSettings
325{
326        bool            polarity;
327        bool            enable;
328        uint8_t         select;
329} BHAB_NmiGpioSettings;
330
331/***************************************************************************
332Summary:       
333
334Description:
335
336See Also:
337       
338****************************************************************************/
339typedef struct BHAB_WatchDogTimerSettings
340{
341        bool                                    start;
342        bool                                    oneShot;
343        bool                                    nmiMode;
344        uint32_t                                timeout;
345        BHAB_NmiGpioSettings    clearWatchDog;
346} BHAB_WatchDogTimerSettings;
347
348/***************************************************************************
349Summary:       
350
351Description:
352
353See Also:
354       
355****************************************************************************/
356typedef struct BHAB_NmiSettings
357{
358        BHAB_NmiGpioSettings    powerDownDetect;
359        BHAB_NmiGpioSettings    spare1;
360        BHAB_NmiGpioSettings    spare2;
361        BHAB_NmiGpioSettings    nmi;                    /*Here the polarity is always high. */ 
362} BHAB_NmiSettings;
363
364/***************************************************************************
365Summary:
366     Structure to set HAB config settings.
367
368Description:
369    Defines the structure to set HAB config settings.
370
371See Also:
372        BHAB_GetConfigSettings(), BHAB_SetConfigSettings()
373
374****************************************************************************/
375typedef struct BHAB_ConfigSettings
376{
377    BHAB_RfDaisyChain   daisyChain;  /* daisy chain output*/
378    bool                enableLoopThrough;
379} BHAB_ConfigSettings;
380
381/***************************************************************************
382Summary:
383        This defines the function prototype that is used for callbacks.
384
385Description:
386        None.
387
388See Also:
389        None.
390
391****************************************************************************/
392typedef BERR_Code (*BHAB_IntCallbackFunc)( void * pParm1, int parm2 );
393
394
395typedef struct BHAB_Settings BHAB_Settings;
396
397
398/***************************************************************************
399Summary:
400        Structure for API function table
401
402Description:
403   This structure contains pointers to all public BHAB functions.
404
405See Also:
406        None.
407
408****************************************************************************/
409typedef struct BHAB_ApiFuncTable
410{         
411    BERR_Code (*Open)(BHAB_Handle *, void*, const BHAB_Settings *);
412    BERR_Code (*Close)(BHAB_Handle);
413    BERR_Code (*InitAp)(BHAB_Handle, const uint8_t *);
414    BERR_Code (*GetApStatus)(BHAB_Handle, BHAB_ApStatus *);
415    BERR_Code (*GetApVersion)(BHAB_Handle, uint32_t*, uint32_t*, uint16_t*, uint8_t*, uint8_t*);
416    BERR_Code (*ReadRegister)(BHAB_Handle, uint32_t, uint32_t*);
417    BERR_Code (*WriteRegister)(BHAB_Handle, uint32_t, uint32_t*);         
418    BERR_Code (*ReadMemory)(BHAB_Handle, uint32_t, uint8_t*, uint32_t);
419    BERR_Code (*WriteMemory)(BHAB_Handle, uint32_t, const uint8_t*, uint32_t);
420    BERR_Code (*ReadMbox)(BHAB_Handle, uint32_t, uint32_t*);
421    BERR_Code (*WriteMbox)(BHAB_Handle, uint32_t, uint32_t*);
422    BERR_Code (*HandleInterrupt_isr)(BHAB_Handle);
423    BERR_Code (*ProcessInterruptEvent)(BHAB_Handle);
424    BERR_Code (*EnableLockInterrupt)(BHAB_Handle, BHAB_DevId, bool);
425    BERR_Code (*InstallInterruptCallback)(BHAB_Handle, BHAB_DevId, BHAB_IntCallbackFunc, void *, int);
426    BERR_Code (*UnInstallInterruptCallback)(BHAB_Handle, BHAB_DevId);
427    BERR_Code (*SendHabCommand)(BHAB_Handle, uint8_t *, uint16_t, uint8_t *, uint16_t, bool, bool, uint16_t);
428    BERR_Code (*GetInterruptEventHandle)(BHAB_Handle, BKNI_EventHandle*);
429    BERR_Code (*GetWatchDogTimer)(BHAB_Handle, BHAB_WatchDogTimerSettings *);
430    BERR_Code (*SetWatchDogTimer)(BHAB_Handle, const BHAB_WatchDogTimerSettings *);
431    BERR_Code (*GetNmiConfig)(BHAB_Handle, BHAB_NmiSettings *);
432    BERR_Code (*SetNmiConfig)(BHAB_Handle, const BHAB_NmiSettings *);
433    BERR_Code (*GetConfigSettings)(BHAB_Handle, BHAB_ConfigSettings *);
434    BERR_Code (*SetConfigSettings)(BHAB_Handle, const BHAB_ConfigSettings *);
435    BERR_Code (*ReadSlave)(BHAB_Handle, uint8_t, uint32_t, uint32_t *, uint8_t);
436    BERR_Code (*WriteSlave)(BHAB_Handle, uint8_t, uint32_t, uint32_t *, uint8_t);   
437} BHAB_ApiFuncTable;
438
439
440/***************************************************************************
441Summary:
442        Structure for HAB settings
443
444Description:
445        This structure contains the settings for HAB.
446
447See Also:
448        None.
449
450****************************************************************************/
451struct BHAB_Settings
452{
453    uint16_t chipAddr;  /* i2c chip address (i2c) */
454    void     (*interruptEnableFunc)(bool, void*); /* callback function for enabling/disabling L1 interrupt */
455    void     *interruptEnableFuncParam; /* parameter passed to interruptEnableFunc */
456    BHAB_ApiFuncTable api;
457    uint8_t slaveChipAddr;  /* i2c chip address for the 31xx's i2c  slave device */
458    bool    isSpi;
459    bool    isMtsif;   
460};
461
462
463/******************************************************************************
464Summary:
465   Initializes the BHAB API.
466Description:
467   This function must be called first to get a BHAB_Handle.  This handle is
468   used by all other function calls in the BHAB API.
469Returns:
470   BERR_Code
471******************************************************************************/
472BERR_Code BHAB_Open(
473        BHAB_Handle *handle,     /* [out] BHAB handle */
474        void        *pReg,       /* [in] pointer ot i2c or spi handle */
475        const BHAB_Settings *pDefSettings /* [in] Default Settings */
476);
477
478
479/******************************************************************************
480Summary:
481   Closes the BHAB API.
482Description:
483   This function releases all the resources allocated by BHAB API and disables
484   host interrupts.
485Returns:
486   BERR_Code
487******************************************************************************/
488BERR_Code BHAB_Close(
489        BHAB_Handle h   /* [in] BHAB handle */
490);
491
492
493/******************************************************************************
494Summary:
495   Downloads the microcode and runs the AP.
496Description:
497   This function downloads the microcode to the AP RAM and then starts running
498   the AP.
499Returns:
500   BERR_Code : BERR_SUCCESS = AP is running and successfully initialized
501******************************************************************************/
502BERR_Code BHAB_InitAp(
503        BHAB_Handle   h,       /* [in] BHAB handle */
504        const uint8_t *pImage  /* [in] pointer to AP microcode image */
505);
506
507
508/******************************************************************************
509Summary:
510   Returns AP version information.
511Description:
512   This function returns the Family ID, chip ID, chip revision, AP microcode
513   version.
514Returns:
515   BERR_Code
516******************************************************************************/
517BERR_Code BHAB_GetApVersion(
518        BHAB_Handle    handle,     /* [in]  BHAB handle */
519    uint32_t       *pFamilyId, /* [out] Chip Family id */
520    uint32_t       *pChipId,   /* [out] chip id */
521        uint16_t       *pChipVer,  /* [out] chip revision number */
522    uint8_t        *pMajApVer,    /* [out] AP microcode major version */
523    uint8_t        *pMinApVer     /* [out] AP microcode minor version */
524);
525
526
527/******************************************************************************
528Summary:
529   Reads from an RBUS register.
530Description:
531   This function is normally used to read a specific RBUS register.
532Returns:
533   BERR_Code
534******************************************************************************/
535BERR_Code BHAB_ReadRegister(
536        BHAB_Handle handle,     /* [in] BHAB handle */
537        uint32_t    reg,        /* [in] address of register to read */
538        uint32_t    *val        /* [in] contains data that was read */
539);
540
541
542/******************************************************************************
543Summary:
544   Writes to an RBUS register.
545Description:
546   This function is normally used to write to a specific RBUS register.
547Returns:
548   BERR_Code
549******************************************************************************/
550BERR_Code BHAB_WriteRegister(
551        BHAB_Handle handle,     /* [in] BHAB handle */
552        uint32_t    reg,        /* [in] address of register to read */
553        uint32_t    *val        /* [in] contains data that was read */
554);
555
556
557/******************************************************************************
558Summary:
559   Reads from the AP RAM/ROM space.
560Description:
561   This function is normally used for verifying the contents of the AP RAM
562   after microcode download.  This function assumes that the AP is already in
563   idle or reset state.
564Returns:
565   BERR_Code
566******************************************************************************/
567BERR_Code BHAB_ReadMemory(
568        BHAB_Handle h,  /* [in] BHAB PI Handle */
569        uint32_t addr,  /* [in] starting address */
570        uint8_t *buf,   /* [out] holds the data read */
571        uint32_t n      /* [in] number of bytes to read */
572);
573
574
575/******************************************************************************
576Summary:
577   Writes to the AP RAM space.
578Description:
579   This function is normally used for downloading the microcode.  This function
580   assumes that the AP is already in idle or reset state.
581Returns:
582   BERR_Code
583******************************************************************************/
584BERR_Code BHAB_WriteMemory(
585        BHAB_Handle handle, /* [in] BHAB PI Handle */ 
586        uint32_t addr, /* [in] starting address in AP RAM */
587        uint8_t *buf,  /* [in] specifies the data to write */
588        uint32_t n     /* [in] number of bytes to write */
589);
590
591/******************************************************************************
592Summary:
593   Writes to the mailbox space.
594Description:
595Returns:
596   BERR_Code
597******************************************************************************/
598BERR_Code BHAB_ReadMbox(
599        BHAB_Handle handle,    /* [in] BHAB PI Handle */
600        uint32_t    reg,  /* [in] RBUS register address */
601        uint32_t    *val  /* [out] value read from register */
602);
603
604/******************************************************************************
605Summary:
606   Writes to the mailbox space.
607Description:
608Returns:
609   BERR_Code
610******************************************************************************/
611BERR_Code BHAB_WriteMbox(
612        BHAB_Handle handle,    /* [in] BHAB PI Handle */
613        uint32_t    reg,  /* [in] RBUS register address */
614        uint32_t    *val  /* [in] value to write */
615);
616
617/******************************************************************************
618Summary:
619   Handle BHAB interrupts.
620Description:
621   This function must be called when the host receives an interrupt from the
622   BHAB device.
623Returns:
624   BERR_Code
625******************************************************************************/
626BERR_Code BHAB_HandleInterrupt_isr(
627        BHAB_Handle handle   /* [in] BHAB handle */
628);
629
630
631/******************************************************************************
632Summary:
633   This function processes BHAB interrupt events.
634Description:
635   This function is used for an i2c-controlled BHAB device only.  The
636   application calls this function when a BHAB interrupt event has been
637   signalled.  This function will decode the interrupt and set approriate
638   events.  For memory-mapped BHAB devices, this function will return
639   BERR_NOT_SUPPORTED.
640Returns:
641   BERR_Code
642******************************************************************************/
643BERR_Code BHAB_ProcessInterruptEvent(
644        BHAB_Handle handle  /* [in] HAB device handle */
645);
646
647
648/******************************************************************************
649Summary:
650   Enables/Disables the inband channel lock interrupt.
651Description:
652   This function enables or disables an interrupt to be generated upon change
653   in inband channel lock status.
654Returns:
655   BERR_Code
656******************************************************************************/
657BERR_Code BHAB_EnableLockInterrupt(
658        BHAB_Handle handle, /* [in] BHAB Handle */
659        BHAB_DevId eDevId,    /* [in] Device ID */
660        bool bEnable   /* [in] true = enable lock interrupts, false = disables lock interrupts */
661);
662
663
664/******************************************************************************
665Summary:
666   Used to install a callback for a given Interrupt.
667Description:
668   This function install a callback for an interrupt
669Returns:
670   BERR_Code
671******************************************************************************/
672BERR_Code BHAB_InstallInterruptCallback(
673        BHAB_Handle handle,                /* [in] BHAB handle */
674        BHAB_DevId eDevId,    /* [in] Device ID */
675        BHAB_IntCallbackFunc fCallBack,    /* [in] Callback function pointer */
676        void * pParm1,                     /* [in] Paramater1 for callback function*/
677        int parm2                          /* [in] Paramater2 for callback function*/
678); 
679
680
681/******************************************************************************
682Summary:
683   Used to uninstall a callback for a given Interrupt.
684Description:
685   This function uninstall a callback for an interrupt
686Returns:
687   BERR_Code
688******************************************************************************/
689BERR_Code BHAB_UnInstallInterruptCallback(
690        BHAB_Handle handle,  /* [in] BHAB handle */
691        BHAB_DevId eDevId    /* [in] Device ID */
692);
693
694
695/******************************************************************************
696Summary:
697   This function sends an HAB command.
698Description:
699   This function writes a command to the HAB, asserts HABR, waits for the AP to
700   release the HAB, then optionally checks for a service acknowlegement from
701   the AP.  If bCheckForAck is true, then read_len must be greater than 0.
702Returns:
703   BERR_Code
704******************************************************************************/
705BERR_Code BHAB_SendHabCommand(
706        BHAB_Handle h,      /* [in] BHAB PI Handle */
707        uint8_t *write_buf, /* [in] specifies the HAB command to send */
708        uint16_t write_len,  /* [in] number of bytes of the HAB command to be written using either I2c or SPI. */ 
709        uint8_t *read_buf,  /* [out] holds the data read from the HAB */ 
710        uint16_t read_len,   /* [in] number of bytes to read from the HAB */
711        bool bCheckForAck,  /* [in] true = determine if the AP has serviced the command */
712        bool bInsertTermination, /* [in] true = insert termination byte 0x00 in write buffer at read_len position */
713        uint16_t command_len /* [in] Total number of bytes in the HAB command so that the termination byte is inserted at the right HAB location. */
714);
715
716
717/******************************************************************************
718Summary:
719   Returns status of the AP.
720Description:
721   The state of the AP and the HAB are returned in this function.
722Returns:
723   BERR_Code
724******************************************************************************/
725BERR_Code BHAB_GetApStatus(
726        BHAB_Handle   handle,    /* [in] HAB device handle */
727        BHAB_ApStatus *pStatus   /* [out] AP status */
728);
729
730/******************************************************************************
731Summary:
732   Returns status of the AP.
733Description:
734   The state of the AP and the HAB are returned in this function.
735Returns:
736   BERR_Code
737******************************************************************************/
738BERR_Code BHAB_GetInterruptEventHandle(
739        BHAB_Handle handle,     
740        BKNI_EventHandle *event /* [out] Interrupt event handle */
741);
742
743/******************************************************************************
744Summary:
745   Gets the watch dog timer configuration.
746   
747Description:
748
749Returns:
750   BERR_Code
751******************************************************************************/
752BERR_Code BHAB_GetWatchDogTimer(BHAB_Handle h, 
753        BHAB_WatchDogTimerSettings *wdtSettings);
754
755/******************************************************************************
756Summary:
757   Sets the watch dog timer configuration.
758   
759Description:
760   
761Returns:
762   BERR_Code
763******************************************************************************/
764BERR_Code BHAB_SetWatchDogTimer(BHAB_Handle h,      /* [in] BHAB PI Handle */
765        const BHAB_WatchDogTimerSettings *wdtSettings);
766
767/******************************************************************************
768Summary:
769   Gets the 31xx non maskable interrupt configuration.
770
771Description:
772   
773Returns:
774   BERR_Code
775******************************************************************************/
776BERR_Code BHAB_GetNmiConfig(BHAB_Handle h,      /* [in] BHAB PI Handle */
777        BHAB_NmiSettings *nmiSettings);
778
779/******************************************************************************
780Summary:
781   Sets the 31xx non maskable interrupt configuration.
782
783Description:
784
785Returns:
786   BERR_Code
787******************************************************************************/
788BERR_Code BHAB_SetNmiConfig(BHAB_Handle h,      /* [in] BHAB PI Handle */
789        const BHAB_NmiSettings *nmiSettings);
790
791/***************************************************************************
792Summary:
793    This function gets HAB settings.
794
795Description:
796    This function returns the current HAB Settings.
797   
798Returns:
799    TODO:
800
801See Also:
802    BHAB_SetConfigSettings()
803
804****************************************************************************/
805BERR_Code BHAB_GetConfigSettings(
806    BHAB_Handle handle,           /* [in] Device handle */
807    BHAB_ConfigSettings *settings     /* [out] HAB config settings. */
808    );
809   
810/***************************************************************************
811Summary:
812    This function sets HAB settings.
813
814Description:
815    This function sets the current HAB Settings.
816   
817Returns:
818    TODO:
819
820See Also:
821    BHAB_GetConfigSettings()
822****************************************************************************/
823BERR_Code BHAB_SetConfigSettings(
824    BHAB_Handle handle,           /* [in] Device handle */
825    const BHAB_ConfigSettings *settings     /* [in] HAB config settings. */
826    );
827   
828/******************************************************************************
829Summary:
830   This function allows the reading from a slave device attached to the demod chip.
831Description:
832 
833Returns:
834   BERR_Code
835******************************************************************************/
836BERR_Code BHAB_ReadSlave(
837    BHAB_Handle handle,     /* [in] Device channel handle */
838        uint8_t chipAddr,       /* [in] chip addr of the i2c slave device */
839        uint32_t subAddr,       /* [in] sub addr of the register to read from the slave device */
840        uint32_t *data,         /* [out] ptr to the data that we will read from the slave device */
841        uint8_t dataLen         /* [in] how many bytes are we going to read?, for 3412 LNA, this should be in multiples of 4-bytes,
842                                for 3128, dataLen can only be 4 bytes */
843);
844
845/******************************************************************************
846Summary:
847   This function allows the writing to a slave device attached to the demod chip.
848Description:
849 
850Returns:
851   BERR_Code
852******************************************************************************/
853BERR_Code BHAB_WriteSlave(
854    BHAB_Handle handle,     /* [in] Device channel handle */
855        uint8_t chipAddr,       /* [in] chip addr of the i2c slave device */
856        uint32_t subAddr,       /* [in] sub addr of the register to read from the slave device */
857        uint32_t *data,         /* [out] ptr to the data that we will read from the slave device */
858        uint8_t dataLen        /* [in] how many bytes are we going to read?, for 3412 LNA, this should be in multiples of 4-bytes,
859                                for 3128, dataLen can only be 4 bytes */   
860);
861   
862#ifdef __cplusplus
863}
864#endif
865
866
867#endif
Note: See TracBrowser for help on using the repository browser.