source: svn/newcon3bcm2_21bu/magnum/basemodules/hab/3114/bhab_31xx_priv.h

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

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

  • Property svn:executable set to *
File size: 16.4 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_31xx_priv.h $
11 * $brcm_Revision: Hydra_Software_Devel/16 $
12 * $brcm_Date: 3/3/11 6:43p $
13 *
14 *
15 * Revision History:
16 *
17 * $brcm_Log: /magnum/basemodules/hab/3117/bhab_31xx_priv.h $
18 *
19 * Hydra_Software_Devel/16   3/3/11 6:43p mward
20 * SW3128-2: Add Support for BCM3128.  Change n argument of _ReadMemory
21 * and _WriteMemory to uint32_t.
22 *
23 * Hydra_Software_Devel/15   2/1/11 5:37p VISHK
24 * SW7422-171: Nexus support for the 3128 (8 ADS core + tuner on daughter
25 * board) plug on 7422 board  Read and write memory modified to 32 bit
26 * addressing to support 3128 chipset as it has 32 bit memory addressing.
27 *
28 * Hydra_Software_Devel/15   2/1/11 5:36p VISHK
29 * SW7422-171: Nexus support for the 3128 (8 ADS core + tuner on daughter
30 * board) plug on 7422 board  Read and write memory modified to 32 bit
31 * addressing to support 3128 chipset as it has 32 bit memory addressing.
32 *
33 * Hydra_Software_Devel/14   12/2/10 7:18p VISHK
34 * SW7405-5037: To make the i2c address programmable for the slave
35 * device(LNA) of 31xx frontend chip.
36 *
37 * Hydra_Software_Devel/13   8/31/10 3:36p mward
38 * SW7125-35:  When closing, don't reset AP if it wasn't loaded by the
39 * host at start time.
40 *
41 * Hydra_Software_Devel/12   6/22/10 5:53p vishk
42 * SW7420-839: Add support to program AGC gain to 31xx TNR PI
43 *
44 * Hydra_Software_Devel/12   6/22/10 5:51p vishk
45 * SW7420-839: Add support to program AGC gain to 31xx TNR PI
46 *
47 * Hydra_Software_Devel/12   6/22/10 5:50p vishk
48 * SW7420-839: Add support to program AGC gain to 31xx TNR PI
49 *
50 * Hydra_Software_Devel/11   10/14/09 1:48p mward
51 * SW7405-2851: Compiler warning:  Added "const" to BHAB_NmiSettings and
52 * BHAB_WatchDogTimerSettings.
53 *
54 * Hydra_Software_Devel/10   10/5/09 10:44a vishk
55 * SW7405-2851: 31xx: Add support to configure the Watchdog feature of
56 * 31xx.
57 *
58 * Hydra_Software_Devel/9   5/12/09 10:54a vishk
59 * PR 46431: Add support for BCM3117, BCM3114, and BCM3112
60 *
61 * Hydra_Software_Devel/8   4/10/09 11:48a vishk
62 * PR 46431: Add support for BCM3117, BCM3114, and BCM3112
63 *
64 * Hydra_Software_Devel/7   3/13/09 11:19a vishk
65 * PR 46431: Add support for BCM3117, BCM3114, and BCM3112
66 *
67 * Hydra_Software_Devel/6   3/10/09 1:51p vishk
68 * PR 46431: Add support for BCM3117, BCM3114, and BCM3112
69 *
70 ***************************************************************************/
71#ifndef BHAB_31XX_PRIV_H
72#define BHAB_31XX_PRIV_H
73
74#include "bstd.h"
75#include "bi2c.h"
76#include "bkni.h"
77#include "bkni_multi.h"
78#include "bhab_priv.h"
79
80#include "bchp_31xx.h"
81
82#define BHAB_WINDOW_IRAM      0x00000000
83#define BHAB_WINDOW_IROM      0x00008000
84#define BHAB_WINDOW_HAB       0x00010000
85#define BHAB_WINDOW_IDATA     0x00010400
86
87#define BHAB_IRAM_SIZE        0xffff
88#define BHAB_IROM_SIZE        0x8000
89#define BHAB_MEM_SIZE         0x00010000
90#define BHAB_HAB_SIZE         0x80
91#define BHAB_INIT_RETRIES     0x14
92
93#define BHAB_P_ACQUIRE_MUTEX(handle) BKNI_AcquireMutex(((BHAB_31xx_P_Handle *)(handle->pImpl))->hMutex)
94#define BHAB_P_RELEASE_MUTEX(handle) BKNI_ReleaseMutex(((BHAB_31xx_P_Handle *)(handle->pImpl))->hMutex)
95
96
97typedef struct BHAB_P_CallbackInfo
98{
99      BHAB_IntCallbackFunc func;
100      void * pParm1;
101      int parm2 ;
102} BHAB_P_CallbackInfo;
103
104
105typedef struct BHAB_31xx_P_Handle
106{
107      BREG_I2C_Handle  hRegister;         /* handle to the master I2C device used to access registers */     
108      BKNI_EventHandle hInterruptEvent;   /* interrupt event handle */   
109      BKNI_EventHandle hApiEvent;         /* API event handle */   
110      BKNI_EventHandle hInitDoneEvent;    /* AP initialization done event handle */
111      BKNI_EventHandle hHabDoneEvent;     /* HAB done event handle */
112      BKNI_MutexHandle hMutex;            /* Mutex handle for serialization */
113      uint8_t          last_page_16_15;   /* most recent position of the 128 byte window into the AP address space */
114      uint8_t          last_page_14_7;    /* most recent position of the 128 byte window into the AP address space */
115      BHAB_P_CallbackInfo InterruptCallbackInfo[BHAB_DevId_eMax];
116      BHAB_WatchDogTimerSettings wdtSettings;
117      BHAB_NmiSettings nmiSettings;
118      bool loadAP;                                                /* Load(ed) Acquisition Processor microcode when starting. */   
119      uint8_t slaveChipAddr;  /* i2c chip address for the 31xx's i2c  slave device */
120} BHAB_31xx_P_Handle;
121
122
123/******************************************************************************
124Summary:
125   Enables/Disables the L1 host interrupt.
126Description:
127   Enables/Disables the L1 host interrupt by calling the application-supplied
128   callback routine the the BHAB settings.
129Returns:
130   BERR_Code
131******************************************************************************/
132BERR_Code BHAB_31xx_P_EnableHostInterrupt(
133    BHAB_Handle handle, /* [in] BHAB PI handle */
134    bool bEnable   /* [in] true=enables the L1 interrupt on the host processor */
135);
136
137
138/******************************************************************************
139Summary:
140   Disables all host interrupts.
141Description:
142   This function clears the host interrupt enable bits on the BCM31xx.
143Returns:
144   BERR_Code
145******************************************************************************/
146BERR_Code BHAB_31xx_P_DisableInterrupts(
147   BHAB_Handle handle   /* [in] BHAB Handle */
148);
149
150
151/******************************************************************************
152Summary:
153   Enables the AP initialization done interrupt.
154Description:
155   This function is called by the BHAB_InitAp().
156Returns:
157   BERR_Code
158******************************************************************************/
159BERR_Code BHAB_31xx_P_EnableInitDoneInterrupt(
160   BHAB_Handle handle  /* [in] BHAB Handle */
161);
162
163
164/******************************************************************************
165Summary:
166   Waits for a BHAB event.
167Description:
168   This function waits for an interrupt within the given timeout period.  Any
169   interrupts are then decoded via I2C.  If the given event has been signaled,
170   then this function returns BERR_SUCCESS.
171Returns:
172   BERR_Code
173******************************************************************************/
174BERR_Code BHAB_31xx_P_WaitForEvent(
175    BHAB_Handle handle,             /* [in] BHAB Handle */
176    BKNI_EventHandle hEvent,   /* [in] event to wait on */
177    int timeoutMsec            /* [in] timeout in milliseconds */
178);
179
180
181/******************************************************************************
182Summary:
183   Runs the AP.
184Description:
185   This function takes the AP to out of reset/idle state and starts running.
186Returns:
187   BERR_Code
188******************************************************************************/
189BERR_Code BHAB_31xx_P_RunAp(
190    BHAB_Handle handle   /* [in] BHAB PI Handle */
191);
192
193
194/******************************************************************************
195Summary:
196   Resets the AP.
197Description:
198   This function puts the AP in reset state.
199Returns:
200   BERR_Code
201******************************************************************************/
202BERR_Code BHAB_31xx_P_ResetAp(
203    BHAB_Handle handle   /* [in] BHAB PI Handle */
204);
205
206
207/******************************************************************************
208Summary:
209   Positions the 128 byte window in the AP address space.
210Description:
211   The last 128-byte window position is stored in the BHAB_Handle struct,
212   so I2C accesses will occur only if the window has moved.
213Returns:
214   BERR_Code
215******************************************************************************/
216BERR_Code BHAB_31xx_P_SetApWindow(
217    BHAB_Handle handle,    /* [in] BHAB PI Handle */
218    uint32_t window   /* [in] base address of the 128-byte window */
219);
220
221
222/******************************************************************************
223Summary:
224   Reads from the host access buffer.
225Description:
226   This function positions the 128 byte window in the AP address space to the
227   host access buffer area.  (n) bytes are then read into (buf) starting from
228   the given HAB (offset) address.
229Returns:
230   BERR_Code
231******************************************************************************/
232BERR_Code BHAB_31xx_P_ReadHab(
233    BHAB_Handle handle,   /* [in] BHAB PI Handle */
234    uint8_t offset,  /* [in] starting offset within the HAB to read */
235    uint8_t *buf,    /* [out] holds the data read */
236    uint8_t n        /* [in] number of bytes to read */ 
237);
238
239
240/******************************************************************************
241Summary:
242   Writes to the host access buffer.
243Description:
244   This function positions the 128 byte window in the AP address space to the
245   host access buffer area.  (n) bytes in (buf) are then written starting from
246   the given HAB (offset) address.
247Returns:
248   BERR_Code
249******************************************************************************/
250BERR_Code BHAB_31xx_P_WriteHab(
251    BHAB_Handle handle,   /* [in] BHAB PI Handle */
252    uint8_t offset,  /* [in] starting offset in the HAB to write */
253    uint8_t *buf,    /* [in] specifies the data to write */
254    uint8_t n        /* [in] number of bytes to write */
255);
256
257
258/******************************************************************************
259Summary:
260   This function sends the command already written in the HAB.
261Description:
262   This function asserts HABR, waits for the AP to release the HAB, then
263   optionally checks for a service acknowlegement from the AP.  If bCheckForAck
264   is true, then read_len must be greater than 0.  This function is called by
265   BHAB_P_SendHabCommand().
266Returns:
267   BERR_Code
268******************************************************************************/
269BERR_Code BHAB_31xx_P_ServiceHab(
270    BHAB_Handle h,   /* [in] BHAB Handle */
271    uint8_t *read_buf,  /* [out] holds the data read from the HAB */ 
272    uint8_t read_len,   /* [in] number of bytes to read from the HAB */
273    bool bCheckForAck,  /* [in] true = determine if the AP has serviced the command */
274    uint8_t ack_byte    /* [in] value of the ack byte to expect */
275);
276
277
278/******************************************************************************
279Summary:
280   Sets certain BKNI_Events based on the source of the BCM31xx host interrupt.
281Description:
282   This function reads and clears the BCM31xx interrupt status registers,
283   clears the enable mask of the interrupts, and sets BKNI_Events based on the
284   interrupt sources.
285Returns:
286   BERR_Code
287******************************************************************************/
288BERR_Code BHAB_31xx_P_DecodeInterrupt(
289    BHAB_Handle handle /* [in] BHAB Handle */
290);
291
292
293
294/******************************************************************************
295Summary:
296   Returns the BERR_Code corresponding to the given BHAB_ApStatus.
297Description:
298   This function returns ths BERR_Code of any errors in the given BHAB_ApStatus.
299Returns:
300   BERR_Code
301******************************************************************************/
302BERR_Code BHAB_31xx_P_DecodeError(
303   BHAB_Handle h,           /* [in] BHAB PI Handle */
304   BHAB_ApStatus *pApStatus /* [in] AP status returned by BHAB_GetApStatus */
305);
306
307
308/******************************************************************************
309Summary:
310   This function checks if the host is currently permitted to send an HAB
311   command.
312Description:
313   The HAB is available to the host if all 3 conditions currently apply:
314   1) The AP is running.
315   2) The AP has initialized.
316   3) The AP is not currently servicing the HAB (i.e. HABR bit is 0)
317Returns:
318   BERR_Code - BERR_SUCCESS if HAB is available, otherwise BERR_Code is reason
319   why HAB is not available
320******************************************************************************/
321BERR_Code BHAB_31xx_P_CheckHab(
322   BHAB_Handle h  /* [in] BHAB PI Handle */
323);
324
325
326
327/****************** BCM31xx implementation of API functions *****************/
328
329
330
331BERR_Code BHAB_31xx_Open(
332    BHAB_Handle *handle,     /* [out] BHAB handle */
333    void        *pReg,       /* [in] pointer ot i2c or spi handle */
334    const BHAB_Settings *pDefSettings /* [in] Default Settings */
335);
336
337BERR_Code BHAB_31xx_Close(
338    BHAB_Handle h   /* [in] BHAB handle */
339);
340
341BERR_Code BHAB_31xx_InitAp(
342    BHAB_Handle   h,       /* [in] BHAB handle */
343    const uint8_t *pImage  /* [in] pointer to AP microcode image */
344);
345
346BERR_Code BHAB_31xx_GetApStatus(
347    BHAB_Handle   handle,    /* [in] HAB device handle */
348    BHAB_ApStatus *pStatus   /* [out] AP status */
349);
350
351BERR_Code BHAB_31xx_GetApVersion(
352    BHAB_Handle    handle,     /* [in]  BHAB handle */
353    uint16_t       *pChipId,   /* [out] chip id */
354    uint16_t       *pChipVer,  /* [out] chip revision number */
355    uint8_t        *pApVer,    /* [out] AP microcode version */
356    uint8_t        *pScrVer,   /* [out] acquisition script version */
357    uint8_t        *pCfgVer    /* [out] host configuration version */
358);
359
360BERR_Code BHAB_31xx_ReadRegister(
361    BHAB_Handle handle,  /* [in] BHAB handle */
362    uint32_t    reg,     /* [in] address of register to read */
363    uint32_t    *val     /* [in] contains data that was read */
364);
365
366BERR_Code BHAB_31xx_WriteRegister(
367    BHAB_Handle handle,  /* [in] BHAB handle */
368    uint32_t    reg,     /* [in] address of register to read */
369    uint32_t    *val     /* [in] contains data that was read */
370);
371
372BERR_Code BHAB_31xx_ReadMemory(
373    BHAB_Handle h,  /* [in] BHAB PI Handle */
374    uint32_t addr,  /* [in] starting address */
375    uint8_t *buf,   /* [out] holds the data read */
376    uint32_t n      /* [in] number of bytes to read */
377);
378
379BERR_Code BHAB_31xx_WriteMemory(
380    BHAB_Handle handle, /* [in] BHAB PI Handle */ 
381    uint32_t addr, /* [in] starting address in AP RAM */
382    const uint8_t *buf,  /* [in] specifies the data to write */
383    uint32_t n     /* [in] number of bytes to write */
384);
385
386BERR_Code BHAB_31xx_ReadMbox(
387    BHAB_Handle handle,    /* [in] BHAB PI Handle */
388    uint32_t    reg,  /* [in] RBUS register address */
389    uint32_t    *val  /* [out] value read from register */
390);
391
392BERR_Code BHAB_31xx_WriteMbox(
393    BHAB_Handle handle,    /* [in] BHAB PI Handle */
394    uint32_t    reg,  /* [in] RBUS register address */
395    uint32_t    *val  /* [in] value to write */
396);
397
398BERR_Code BHAB_31xx_HandleInterrupt_isr(
399    BHAB_Handle handle   /* [in] BHAB handle */
400);
401
402BERR_Code BHAB_31xx_ProcessInterruptEvent(
403    BHAB_Handle handle  /* [in] HAB device handle */
404);
405
406BERR_Code BHAB_31xx_EnableLockInterrupt(
407    BHAB_Handle handle, /* [in] BHAB Handle */
408    BHAB_DevId eDevId,    /* [in] Device ID */
409    bool bEnable   /* [in] true = enable lock interrupts, false = disables lock interrupts */
410);
411
412BERR_Code BHAB_31xx_InstallInterruptCallback(
413    BHAB_Handle handle,                /* [in] BHAB handle */
414    BHAB_DevId eDevId,    /* [in] Device ID */
415    BHAB_IntCallbackFunc fCallBack,    /* [in] Callback function pointer */
416    void * pParm1,                     /* [in] Paramater1 for callback function*/
417    int parm2                          /* [in] Paramater2 for callback function*/
418); 
419
420BERR_Code BHAB_31xx_UnInstallInterruptCallback(
421    BHAB_Handle handle,  /* [in] BHAB handle */
422    BHAB_DevId eDevId    /* [in] Device ID */
423);
424
425BERR_Code BHAB_31xx_SendHabCommand(
426    BHAB_Handle h,      /* [in] BHAB PI Handle */
427    uint8_t *write_buf, /* [in] specifies the HAB command to send */
428    uint8_t write_len,  /* [in] number of bytes in the HAB command */ 
429    uint8_t *read_buf,  /* [out] holds the data read from the HAB */ 
430    uint8_t read_len,   /* [in] number of bytes to read from the HAB */
431    bool bCheckForAck,  /* [in] true = determine if the AP has serviced the command */
432    bool bInsertTermination, /* [in] true = insert termination byte 0x00 in write buffer at read_len position */
433    uint8_t command_len
434);
435
436BERR_Code BHAB_31xx_GetInterruptEventHandle(
437    BHAB_Handle handle,            /* [in] BHAB handle */
438    BKNI_EventHandle *hEvent       /* [out] interrupt event handle */
439);
440
441BERR_Code BHAB_31xx_GetWatchDogTimer(
442    BHAB_Handle handle,    /* [in] BHAB Handle */
443    BHAB_WatchDogTimerSettings *wdtSettings
444);
445
446BERR_Code BHAB_31xx_SetWatchDogTimer(
447    BHAB_Handle handle,    /* [in] BHAB Handle */
448    const BHAB_WatchDogTimerSettings *wdtSettings
449);
450
451BERR_Code BHAB_31xx_GetNmiConfig(
452    BHAB_Handle handle,    /* [in] BHAB Handle */
453    BHAB_NmiSettings *nmiSettings
454);
455
456BERR_Code BHAB_31xx_SetNmiConfig(
457    BHAB_Handle handle,    /* [in] BHAB Handle */
458    const BHAB_NmiSettings *nmiSettings
459);
460
461#endif
Note: See TracBrowser for help on using the repository browser.