source: svn/trunk/newcon3bcm2_21bu/magnum/portinginterface/vbi/7552/bvbi_gs.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: 7.5 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-2009, 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: bvbi_gs.c $
11 * $brcm_Revision: Hydra_Software_Devel/3 $
12 * $brcm_Date: 11/24/09 4:35p $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/portinginterface/vbi/7400/bvbi_gs.c $
19 *
20 * Hydra_Software_Devel/3   11/24/09 4:35p darnstein
21 * SW35230-16: first cut at 35230 support.
22 *
23 * Hydra_Software_Devel/2   12/3/08 7:56p darnstein
24 * PR45819: New, more modular form of most BVBI source files.
25 *
26 * Hydra_Software_Devel/28   10/1/08 2:50p darnstein
27 * PR47070: The data structure for Gemstar data changes to include line
28 * number information and line-by-line parity error information. This is
29 * an API change, so applications software will need to adapt.
30 *
31 * Hydra_Software_Devel/27   9/29/08 3:06p darnstein
32 * PR40702: When reading Gemstar data bitmask, AND in the control bitmask.
33 * This knocks out the extraneous bits that the hardware seems to report.
34 *
35 * Hydra_Software_Devel/26   6/18/08 12:07p darnstein
36 * PR38956: reverse BYTE_ORDER. Decoding now works.
37 *
38 * Hydra_Software_Devel/25   5/28/08 5:35p darnstein
39 * PR23220: Some implementation of Gemstar decoding was missing.
40 *
41 * Hydra_Software_Devel/24   3/21/08 7:02p darnstein
42 * PR40830: change VEC GAIN register value to 0x48, per Lin Ma.
43 *
44 * Hydra_Software_Devel/23   3/14/08 3:18p darnstein
45 * PR23220: Gemstar decoding almost works. Cannot process video line 11
46 * for some reason.
47 *
48 * Hydra_Software_Devel/22   10/10/07 6:08p darnstein
49 * PR35440: Some RDB adaptations were not correct.
50 *
51 * Hydra_Software_Devel/21   3/6/07 5:44p darnstein
52 * PR28456: Support third VEC.
53 *
54 * Hydra_Software_Devel/20   12/15/06 3:06p darnstein
55 * PR25990: Fix another minor error.
56 *
57 * Hydra_Software_Devel/19   12/15/06 2:54p darnstein
58 * PR25990: Fix a stupid typo in previous checkin.
59 *
60 * Hydra_Software_Devel/18   12/15/06 2:39p darnstein
61 * PR25990: Improve method for switching among VEC paths.
62 *
63 * Hydra_Software_Devel/17   10/19/06 5:49p darnstein
64 * PR24979: change horizontal offset of waveform when sending NTSC.
65 * Theory: VEC microcode changed in such a way that the register values
66 * are interpreted differently.
67 *
68 * Hydra_Software_Devel/16   10/2/06 5:05p darnstein
69 * PR21688: Silence two compiler warnings.
70 *
71 * Hydra_Software_Devel/15   8/31/06 2:31p darnstein
72 * PR23220: manually merge in some preliminary code from the 3560 branch.
73 *
74 * Hydra_Software_Devel/14   7/20/06 2:33p darnstein
75 * PR21688: Use the new hardware soft reset scheme for later model chips.
76 *
77 * Hydra_Software_Devel/13   4/25/06 1:22p darnstein
78 * PR18010: silence compiler warnings for some chipsets. Reported by
79 * DLwin.
80 *
81 * Hydra_Software_Devel/12   4/12/06 6:16p darnstein
82 * PR18010: Don't try to program encoders for don't exist for 656 output.
83 *
84 * Hydra_Software_Devel/11   4/3/06 5:45p darnstein
85 * PR20611: Useless code removed.
86 *
87 * Hydra_Software_Devel/10   2/16/06 3:29p darnstein
88 * PR19716: Adapt to new names for "null" control registers.
89 *
90 * Hydra_Software_Devel/9   2/7/06 3:35p darnstein
91 * PR17616: use register settings tuned by Kin Fan Ho. Switch to automatic
92 * parity bit generation.
93 *
94 * Hydra_Software_Devel/8   1/5/06 6:04p darnstein
95 * PR18688: Fixed bad logic errors in BVBI_P_GS_Encode_Data_isr().
96 *
97 * Hydra_Software_Devel/7   11/15/05 1:54p darnstein
98 * PR17732: Comment out or remove debugging code. Fix compile error on
99 * chips that do not have a Gemstar encoder.
100 *
101 * Hydra_Software_Devel/6   11/14/05 7:20p darnstein
102 * PR17732: Bug fixes mean this version basically works. Still left to do:
103 * Get rid of debugging code. Get rid of incorrect calls to BERR_TRACE().
104 * Tune analog waveform parameters.
105 *
106 * Hydra_Software_Devel/5   10/28/05 3:02p darnstein
107 * PR17732: Switch to manual parity in hardware. Still doesn't work.
108 *
109 * Hydra_Software_Devel/4   10/21/05 8:17p darnstein
110 * PR17732: Fix a counting bug. Affected programming user's data values
111 * into hardware.
112 *
113 ***************************************************************************/
114
115#include "bstd.h"           /* standard types */
116#include "bdbg.h"           /* Dbglib */
117#include "bkni.h"                       /* For critical sections */
118#include "bvbi.h"           /* VBI processing, this module. */
119#include "bvbi_priv.h"      /* VBI internal data structures */
120
121BDBG_MODULE(BVBI);
122
123
124/***************************************************************************
125* Implementation of "BVBI_" API functions
126***************************************************************************/
127
128
129/***************************************************************************
130 *
131 */
132BERR_Code BVBI_Field_GetGSData_isr( BVBI_Field_Handle fieldHandle, 
133        BVBI_GSData* pGSData)
134{
135        BVBI_P_Field_Handle* pVbi_Fld;
136        BERR_Code eErr = BERR_SUCCESS;
137
138        BDBG_ENTER(BVBI_Field_GetGSData_isr);
139
140        /* check parameters */
141        BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld);
142        if((!pVbi_Fld) || (!pGSData))
143        {
144                return BERR_TRACE(BERR_INVALID_PARAMETER);
145        }
146
147        /* Verify that data is present on this field handle */
148        if (!(pVbi_Fld->ulWhichPresent & BVBI_P_SELECT_GS))
149                return (BVBI_ERR_FIELD_NODATA);
150        else if (pVbi_Fld->ulErrInfo & BVBI_LINE_ERROR_GEMSTAR_NOENCODE)
151                eErr = (BVBI_ERR_FIELD_BADDATA);
152
153        /* Check that field handle was properly sized */
154        if (!pVbi_Fld->pGSData)
155        {
156                return BERR_TRACE (BVBI_ERR_FLDH_CONFLICT);
157        }
158
159        /* Return data as requested */
160        *pGSData = *(pVbi_Fld->pGSData);
161
162        BDBG_LEAVE(BVBI_Field_GetGSData_isr);
163        return eErr;
164}
165
166/***************************************************************************
167 *
168 */
169BERR_Code BVBI_Field_SetGSData_isr( BVBI_Field_Handle fieldHandle, 
170        BVBI_GSData* pGSData)
171{
172        BVBI_P_Field_Handle* pVbi_Fld;
173
174        BDBG_ENTER(BVBI_Field_SetGSData_isr);
175
176        /* check parameters */
177        BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld);
178        if((!pVbi_Fld) || (!pGSData))
179        {
180                BDBG_ERR(("Invalid parameter\n"));
181                return BERR_TRACE(BERR_INVALID_PARAMETER);
182        }
183
184        /* Check that field handle was properly sized */
185        if (!pVbi_Fld->pGSData)
186        {
187                return BERR_TRACE (BVBI_ERR_FLDH_CONFLICT);
188        }
189
190        /* Store data as requested */
191        *(pVbi_Fld->pGSData) = *pGSData;
192
193        /* Indicate valid data is present */
194        pVbi_Fld->ulWhichPresent |= BVBI_P_SELECT_GS;
195
196        BDBG_LEAVE(BVBI_Field_SetGSData_isr);
197        return BERR_SUCCESS;
198}
199
200
201/***************************************************************************
202* Implementation of supporting GS functions that are not in API
203***************************************************************************/
204
205BERR_Code BVBI_P_GS_Init( BVBI_P_Handle *pVbi )
206{
207#if (BVBI_P_NUM_GSE > 0) || (BVBI_P_NUM_GSE_656 > 0)
208        uint8_t hwIndex;
209#endif
210
211        BDBG_ENTER(BVBI_P_GS_Init);
212
213#if (BVBI_P_NUM_GSE == 0) && (BVBI_P_NUM_GSE_656 == 0)
214        BSTD_UNUSED (pVbi);
215#endif
216
217        /* Initialize CC encoders */
218#if (BVBI_P_NUM_GSE > 0)
219        for (hwIndex = 0 ; hwIndex < BVBI_P_NUM_GSE ; ++hwIndex)
220                BVBI_P_GS_Enc_Init (pVbi->hReg, false, hwIndex);
221#endif
222#if (BVBI_P_NUM_GSE_656 > 0)
223        for (hwIndex = 0 ; hwIndex < BVBI_P_NUM_GSE_656 ; ++hwIndex)
224                BVBI_P_GS_Enc_Init (pVbi->hReg, true, hwIndex);
225#endif
226
227        /* Initialize GS decoders */
228#ifdef BVBI_P_HAS_GSD /** { **/
229        BVBI_P_GS_Dec_Init(pVbi->hReg, 0x0);
230#endif /** } **/
231
232        BDBG_LEAVE(BVBI_P_GS_Init);
233        return BERR_SUCCESS;
234}
235
236/* End of file */
Note: See TracBrowser for help on using the repository browser.