source: svn/trunk/newcon3bcm2_21bu/magnum/portinginterface/vbi/7552/bvbi_priv.h

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: 44.2 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: bvbi_priv.h $
11 * $brcm_Revision: Hydra_Software_Devel/15 $
12 * $brcm_Date: 4/21/11 7:21p $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/portinginterface/vbi/7400/bvbi_priv.h $
19 *
20 * Hydra_Software_Devel/15   4/21/11 7:21p darnstein
21 * SW7125-916: Wrong interrupt control register was being programmed.
22 *
23 * Hydra_Software_Devel/14   3/22/11 12:57p darnstein
24 * SW7420-1693: CGMS for 480P video needs to take "VEC double rate
25 * sampling" into account.
26 *
27 * Hydra_Software_Devel/13   3/2/11 3:38p darnstein
28 * SW7422-261: More problems with line numbering for PAL-M and multi-line
29 * closed captioning. This time, chipsets whose CCE cores lack "SCTE"
30 * extensions were affected.
31 *
32 * Hydra_Software_Devel/12   10/1/10 2:49p darnstein
33 * SW7422-46: Adapt to 7422 and 7425 chipsets.
34 *
35 * Hydra_Software_Devel/11   3/3/10 8:08p darnstein
36 * SW7420-598: Adjust #ifdefs that select capabilities CGMS-B, CGMS-Bd.
37 *
38 * Hydra_Software_Devel/10   11/18/09 3:54p darnstein
39 * SW7468-24: Gemstar options now placed in dedicated data structure.
40 *
41 * Hydra_Software_Devel/9   6/24/09 4:38p darnstein
42 * PR56289: BVBI compiles for 7340 chipset now.
43 *
44 * Hydra_Software_Devel/8   3/27/09 5:56p darnstein
45 * PR53635: Remove internal ConfigForOthers code. It is obsolete, and it
46 * was causing a problem (this PR).
47 *
48 * Hydra_Software_Devel/7   2/20/09 12:37p darnstein
49 * PR49987: Add a missing piece of logic for the bBrokenDataCount option.
50 *
51 * Hydra_Software_Devel/6   2/9/09 7:57p darnstein
52 * PR45819: minor update for 7420 and CGMSAE core: version numbers.
53 *
54 * Hydra_Software_Devel/5   12/11/08 4:23p darnstein
55 * PR45819: program VBI_ENC and VEC_CFG cores.
56 *
57 * Hydra_Software_Devel/4   12/9/08 12:04p darnstein
58 * PR49987: remove some stray lines of code (copy and paste error).
59 *
60 * Hydra_Software_Devel/3   12/8/08 7:36p darnstein
61 * PR49987: fix bug in BVBI_Encode_Create(). Affects 656 output.
62 *
63 * Hydra_Software_Devel/2   12/3/08 7:57p darnstein
64 * PR45819: New, more modular form of most BVBI source files.
65 *
66 * Hydra_Software_Devel/92   9/16/08 6:44p darnstein
67 * PR46112: The new standard for CGMS-B CEA-805-D is now available for
68 * chip 7400-E0.
69 *
70 * Hydra_Software_Devel/91   9/15/08 8:58p darnstein
71 * PR46356: VPS decoder software in BVBI is ready for test.
72 *
73 * Hydra_Software_Devel/90   9/15/08 2:45p darnstein
74 * PR44539: add support for the latest version of the WSE core hardware.
75 * That is, the version present in 7601-A0.
76 *
77 * Hydra_Software_Devel/89   9/12/08 1:24p darnstein
78 * PR46112: Implement variant of CGMS-B (output) defined in CEA-805-D.
79 *
80 * Hydra_Software_Devel/88   7/30/08 8:39p darnstein
81 * PR43926,PR43413: Workaround for TTD addressing error in hardware.
82 * Decodes at most one line of teletext per video field. Will not
83 * corrrupt memory if input signal actually contains more teletext.
84 *
85 * Hydra_Software_Devel/87   7/30/08 5:41p darnstein
86 * PR43926: A basic solution to the memory addressing problem is in place.
87 * It can decode one line of teletext. If more teletext is present, then
88 * memory corruption will occur. This danger will be eliminated next.
89 *
90 * Hydra_Software_Devel/86   7/17/08 8:44p darnstein
91 * PR44539: compilation now possible for 7601.
92 *
93 * Hydra_Software_Devel/85   6/6/08 5:36p darnstein
94 * PR38956: compile in support for SCTE and AMOL in 93548.
95 *
96 * Hydra_Software_Devel/84   5/28/08 5:35p darnstein
97 * PR23220: Some implementation of Gemstar decoding was missing.
98 *
99 * Hydra_Software_Devel/83   5/20/08 6:26p darnstein
100 * PR42898: 7325-B0 and 7335-C0 have the "version 2" CGMSAE core.
101 *
102 * Hydra_Software_Devel/82   5/13/08 2:15p darnstein
103 * PR34584: Port over changes from 7401 dedicated branch. Allow user to
104 * choose bit shift direction for teletext encoding.
105 *
106 * Hydra_Software_Devel/81   5/12/08 2:56p darnstein
107 * PR42416: Implement Grossman's work-around for the conflict between VDEC
108 * frame comb filter and teletext decoder (TTD).
109 *
110 * Hydra_Software_Devel/80   4/28/08 7:49p darnstein
111 * PR38956: CGMS-B encoding ready for bring-up. Need accurate register
112 * settings for tuning.
113 *
114 * Hydra_Software_Devel/79   4/8/08 6:14p darnstein
115 * PR37064: This is the same 15-lines-of-teletext problem that was solved
116 * (worked-around, actually) on the dedicated 7401 ClearCase branch.
117 *
118 * Hydra_Software_Devel/78   4/8/08 5:53p darnstein
119 * PR41429: 97400-E0 chipset has CGMSAE core hardware version 2.
120 *
121 * Hydra_Software_Devel/77   4/2/08 7:55p darnstein
122 * PR38956: VBI software compiles now.
123 *
124 * Hydra_Software_Devel/76   3/14/08 3:19p darnstein
125 * PR23220: Gemstar decoding almost works. Cannot process video line 11
126 * for some reason.
127 *
128 * Hydra_Software_Devel/75   3/11/08 6:50p darnstein
129 * PR23220: fill in some missing Gemstar decoder logic.
130 *
131 * Hydra_Software_Devel/74   1/7/08 12:10p darnstein
132 * PR22719: Apply TTX ADDR software workaround to the chip revisions that
133 * actually need it. Using email 2008-01-06 from Ali Syed Mohammed as a
134 * reference.
135 *
136 * Hydra_Software_Devel/73   12/4/07 1:19p darnstein
137 * PR36897: VBI software is ready for testing with 97335 chipset.
138 *
139 * Hydra_Software_Devel/72   10/31/07 3:50p darnstein
140 * PR34528: BVBI is ready for testing on 7325.
141 *
142 * Hydra_Software_Devel/71   10/10/07 4:00p darnstein
143 * PR35440: handle ancillary VEC and passthrough VEC in the same fashion.
144 * Since there is already a #define macro for modular VEC, this seems
145 * more graceful than before.
146 *
147 * Hydra_Software_Devel/70   9/12/07 4:56p darnstein
148 * PR29723: For 7405 SCTE encoder core, account for register differences
149 * with same core in 7403 chipset.
150 *
151 * Hydra_Software_Devel/69   9/11/07 6:39p darnstein
152 * PR25708: fix ClearCase merge error.
153 *
154 * Hydra_Software_Devel/68   9/11/07 5:14p darnstein
155 * PR25708: First release of SCTE encoder software.
156 *
157 * Hydra_Software_Devel/67   6/6/07 12:49p darnstein
158 * PR30411: multi-line closed caption encoding is ready for test.
159 *
160 * Hydra_Software_Devel/66   6/5/07 3:27p darnstein
161 * PR21831: Let hardware compute WSS parity bit on 97403 chipset.
162 *
163 * Hydra_Software_Devel/65   4/20/07 3:35p darnstein
164 * PR29723: Compilation for 7405 chipset.
165 *
166 * Hydra_Software_Devel/64   2/26/07 2:25p darnstein
167 * PR25990: Some minor changes were required for compiling on 7400-B0.
168 *
169 * Hydra_Software_Devel/63   2/20/07 10:43a darnstein
170 * PR27521: Apply software workaround. The TTE core is reset, at every
171 * video field. Also, the encoder output for the field NOT in use is
172 * disabled, at every video field.
173 *
174 * Hydra_Software_Devel/62   1/17/07 5:32p darnstein
175 * PR26464: correctly handle teletext output to multiple VECs
176 *
177 * Hydra_Software_Devel/61   12/15/06 2:33p darnstein
178 * PR25990: Add a comment describing symbol BVBI_P_NEWER_SOFT_RESET.
179 *
180 * Hydra_Software_Devel/60   12/14/06 7:16p darnstein
181 * PR25990: Can compile for BCM97400-B0 now.
182 *
183 * Hydra_Software_Devel/59   11/16/06 4:43p darnstein
184 * PR25668: Mechanical changes to support the 97403 chipset.
185 *
186 * Hydra_Software_Devel/58   11/13/06 3:07p darnstein
187 * PR23247: Serial output of teletext is ready for testing.
188 *
189 * Hydra_Software_Devel/57   11/9/06 4:53p darnstein
190 * PR23247: The 3563 chipset is not ready for serial output of teletext
191 * yet.
192 *
193 * Hydra_Software_Devel/56   11/8/06 5:35p darnstein
194 * PR23247: Merge back to main branch.
195 *
196 * Hydra_Software_Devel/Refsw_Devel_3563/1   11/8/06 5:13p darnstein
197 * PR23247: Serial output of teletext is partially supported now.
198 *
199 * Hydra_Software_Devel/55   9/26/06 7:37p darnstein
200 * PR24573: The BVBI porting interface module now compiles for the 7440
201 * chipset. Correct operation has not been verified.
202 *
203 * Hydra_Software_Devel/54   9/13/06 6:34p darnstein
204 * PR21688: Can now compile for 97118-A0 chipset. Correct operation is not
205 * guaranteed.
206 *
207 * Hydra_Software_Devel/53   9/1/06 4:48p darnstein
208 * PR23242: Use encoder auto-parity when available. Some code commented
209 * out because RDB header files are not ready yet.
210 *
211 * Hydra_Software_Devel/52   8/31/06 2:09p darnstein
212 * PR23869: clean up the handling of multiple VECs and VDECs.
213 *
214 * Hydra_Software_Devel/51   8/18/06 6:51p darnstein
215 * PR23178: basic compile on 93563 is possible.
216 *
217 * Hydra_Software_Devel/50   7/24/06 4:45p darnstein
218 * PR22720: Implement the software workaround: duplicate the first framing
219 * code byte.
220 *
221 * Hydra_Software_Devel/49   7/20/06 2:23p darnstein
222 * PR21688: Use the new hardware soft reset scheme for later model chips.
223 *
224 * Hydra_Software_Devel/58   11/13/06 3:07p darnstein
225 * PR23247: Serial output of teletext is ready for testing.
226 *
227 * Hydra_Software_Devel/57   11/9/06 4:53p darnstein
228 * PR23247: The 3563 chipset is not ready for serial output of teletext
229 * yet.
230 *
231 * Hydra_Software_Devel/56   11/8/06 5:35p darnstein
232 * PR23247: Merge back to main branch.
233 *
234 * Hydra_Software_Devel/Refsw_Devel_3563/1   11/8/06 5:13p darnstein
235 * PR23247: Serial output of teletext is partially supported now.
236 *
237 * Hydra_Software_Devel/55   9/26/06 7:37p darnstein
238 * PR24573: The BVBI porting interface module now compiles for the 7440
239 * chipset. Correct operation has not been verified.
240 *
241 * Hydra_Software_Devel/54   9/13/06 6:34p darnstein
242 * PR21688: Can now compile for 97118-A0 chipset. Correct operation is not
243 * guaranteed.
244 *
245 * Hydra_Software_Devel/53   9/1/06 4:48p darnstein
246 * PR23242: Use encoder auto-parity when available. Some code commented
247 * out because RDB header files are not ready yet.
248 *
249 * Hydra_Software_Devel/52   8/31/06 2:09p darnstein
250 * PR23869: clean up the handling of multiple VECs and VDECs.
251 *
252 * Hydra_Software_Devel/51   8/18/06 6:51p darnstein
253 * PR23178: basic compile on 93563 is possible.
254 *
255 * Hydra_Software_Devel/50   7/24/06 4:45p darnstein
256 * PR22720: Implement the software workaround: duplicate the first framing
257 * code byte.
258 *
259 * Hydra_Software_Devel/49   7/20/06 2:23p darnstein
260 * PR21688: Use the new hardware soft reset scheme for later model chips.
261 *
262 * Hydra_Software_Devel/48   4/12/06 1:57p darnstein
263 * PR18010: Add ANCI656_PRIM_ANCI656_CNTRL setting to the PR18010
264 * backwards compatibility option.
265 *
266 * Hydra_Software_Devel/47   4/11/06 7:26p darnstein
267 * PR20429: first cut at AMOL encoder software.
268 *
269 * Hydra_Software_Devel/46   3/21/06 4:59p darnstein
270 * PR20088: Improve handling of 7438 chip. It was broken before.
271 *
272 * Hydra_Software_Devel/45   3/20/06 1:08p darnstein
273 * PR19719: After changing BCHP_VBI_ENC_PRIM_Control (indirectly), poll
274 * register until it has really changed. This enforces the one transition
275 * that is critical to this PR: when disabling a VBI encoder core, the
276 * appropriate bit in BCHP_VBI_ENC_PRIM_Control must be zeroed before the
277 * individual VBI core is disabled.
278 *
279 * Hydra_Software_Devel/44   3/9/06 2:02p darnstein
280 * PR 20088: streamline the way that existence of EXT_656_TOP chip core is
281 * handled.
282 *
283 * Hydra_Software_Devel/43   3/8/06 4:55p darnstein
284 * PR20088: add a clause for 7438 chip.
285 *
286 * Hydra_Software_Devel/42   3/3/06 12:50p darnstein
287 * PR18331: When BVBI_Decode_ApplyChanges() fails, roll back hardware
288 * state completely. The state was random before this fix.
289 *
290 * Hydra_Software_Devel/41   3/2/06 4:58p darnstein
291 * PR18331: When BVBI_Encode_ApplyChanges() fails, roll back hardware
292 * state completely. The state was random before this fix.
293 *
294 * Hydra_Software_Devel/40   2/3/06 1:28p darnstein
295 * PR19428: Add #ifdef's to support the 7400 chip.
296 *
297 * Hydra_Software_Devel/39   12/21/05 5:15p darnstein
298 * PR18341: Swap bytes of the teletext "line mask" DRAM entry on little-
299 * endian systems.
300 *
301 * Hydra_Software_Devel/38   12/5/05 7:29p darnstein
302 * PR18010: Implement work-around for the bad line number, together with
303 * an exception for customers that now depend on the bad line number.
304 *
305 * Hydra_Software_Devel/37   11/14/05 7:05p darnstein
306 * PR17732: Add macros for whether or not chip has Gemstar encoder,
307 * component video input.
308 *
309 * Hydra_Software_Devel/36   10/20/05 1:57p darnstein
310 * PR17732: Gemstar features not ready yet. However, the build for 97038
311 * is not broken.
312 *
313 * Hydra_Software_Devel/35   9/19/05 2:57p darnstein
314 * PR17151: Check for chip name where needed. Also, convert to new scheme
315 * for testing chip revisions (BCHP_VER).
316 *
317 * Hydra_Software_Devel/34   8/22/05 8:11p darnstein
318 * PR16057: To support many different chips, use private #defines that
319 * specify number of VECs, VDECs, and (separately) pass-through VECs.
320 *
321 * Hydra_Software_Devel/33   7/7/05 3:34p darnstein
322 * PR 16008: The default settings struct for BVBI_Open() now allows the
323 * user to choose a buffer size for capturing ancillary data packets in
324 * incoming ITU-R 656 digital video.
325 *
326 * Hydra_Software_Devel/32   7/6/05 5:55p darnstein
327 * PR 16008: Input of closed caption data in SAA7113 ancillary data
328 * packets of ITU-R 656 digital video has been confirmed. SAA7114 input
329 * almost certainly needs some debugging though.
330 *
331 * Hydra_Software_Devel/31   6/20/05 12:03p darnstein
332 * PR 15923: Adjust some #define's to support 93560 chip.
333 *
334 * Hydra_Software_Devel/30   6/15/05 5:05p darnstein
335 * PR 14487: Put in runtime checking for workaround for hardware PR 13583.
336 *
337 * Hydra_Software_Devel/29   5/18/05 5:47p darnstein
338 * PR 11440: Progress towards ITU-R 656 input of VBI data.
339 *
340 * Hydra_Software_Devel/28   7/16/04 7:06p darnstein
341 * PR 9080: merge in 656 input and output work. Some testing and debugging
342 * remains to be done.
343 *
344 * Hydra_Software_Devel/I656/3   7/15/04 5:52p darnstein
345 * Allow choice of sdid field in ancillary data packets written out.
346 *
347 * Hydra_Software_Devel/I656/2   7/8/04 7:44p darnstein
348 * ITU-R 656 decoding of VBI seems to be ready for bring up.  Expect bugs.
349 *
350 * Hydra_Software_Devel/I656/1   6/28/04 1:10p darnstein
351 * 656 output is ready for testing.
352 *
353 * Hydra_Software_Devel/27   6/17/04 6:19p darnstein
354 * PR 11443: Get rid of a kludge that was only needed in revision -A0 of
355 * the hardware.
356 *
357 * Hydra_Software_Devel/26   6/17/04 5:54p darnstein
358 * PR 9080: Do a better job of handling the fact that WSS and VPS only
359 * occur on top field.
360 *
361 * Hydra_Software_Devel/25   4/29/04 3:31p darnstein
362 * PR 9080: do video format check before programming VPS core.
363 *
364 * Hydra_Software_Devel/24   3/26/04 1:45p darnstein
365 * PR 8543: Workaround for "teletext lines in use" hardware bug.
366 *
367 * Hydra_Software_Devel/23   3/18/04 11:07a darnstein
368 * PR 9080: declare a private function that programs the
369 * VD_TOP_vd_interrupt register.
370 *
371 * Hydra_Software_Devel/22   3/12/04 5:51p darnstein
372 * PR 9080: Teletext for NTSC is working, with a kludge for an A0 hardware
373 * flaw.  There is a lot of debug code that will be removed later.
374 *
375 * Hydra_Software_Devel/21   3/4/04 4:24p darnstein
376 * PR 9080: add some functionality required by progressive video formats.
377 * Improve handling of teletext private data.
378 *
379 * Hydra_Software_Devel/20   2/27/04 6:13p darnstein
380 * PR 9080: Add checks for valid video format.
381 *
382 * Hydra_Software_Devel/19   2/26/04 3:13p darnstein
383 * PR 9906: When doing CRC computation in software, cache last computation
384 * for reuse, to save CPU cycles.
385 *
386 * Hydra_Software_Devel/18   2/26/04 2:05p darnstein
387 * PR 9906: Compute CRC in software for CGMS encoder.
388 *
389 * Hydra_Software_Devel/17   2/6/04 11:49a darnstein
390 * PR 9080: better handle VBI decoding errors.
391 *
392 * Hydra_Software_Devel/16   2/3/04 4:42p darnstein
393 * PR 9080: fix logic errors in handling decoding errors. A few other
394 * minor fixes.
395 *
396 * Hydra_Software_Devel/15   1/23/04 4:08p darnstein
397 * PR 9080: Routines used in (pseudo) ISRs have no critical sections.
398 *
399 * Hydra_Software_Devel/14   1/20/04 1:20p darnstein
400 * PR 9338: Don't fiddle with VBI_ENC_xxx_Control registers.  The VDC
401 * module owns them now.
402 *
403 * Hydra_Software_Devel/13   1/15/04 4:29p darnstein
404 * PR 9080: Some renaming and refactoring.
405 *
406 * Hydra_Software_Devel/12   12/19/03 5:05p darnstein
407 * PR 9080: several changes. Including: adapt to new BAVC enum for field
408 * polarity.
409 *
410 * Hydra_Software_Devel/11   10/17/03 3:38p darnstein
411 * VBI encoding can be disabled for one field time.
412 *
413 * Hydra_Software_Devel/10   10/14/03 11:26a darnstein
414 * Change polarity to polarityMask in BVBI_P_Field_Handle.
415 *
416 * Hydra_Software_Devel/9   10/9/03 4:00p darnstein
417 * Add polarity attribute to BVBI_Field_Handle and use it in the API.
418 *
419 * Hydra_Software_Devel/8   10/9/03 1:17p darnstein
420 * Add "use count" attribute to BVBI_Field_Handle.  Not for general use!
421 *
422 * Hydra_Software_Devel/7   9/25/03 4:48p darnstein
423 * BVBI module is mostly complete. The only things that I know are missing
424 * are the critical sections, 656 support, macrovision support, and LOTS
425 * OF TESTING.
426 *
427 * Hydra_Software_Devel/6   9/12/03 6:49p darnstein
428 * Done except for VPS, teletext, critical sections, and (lots of)
429 * testing.
430 *
431 * Hydra_Software_Devel/5   9/10/03 5:19p darnstein
432 * Change API according to agreement with Jason (yesterday).  Add
433 * documentation of function return values.  More documentation is needed
434 * though.
435 *
436 * Hydra_Software_Devel/4   9/9/03 7:53p darnstein
437 * I think all API functions have been implemented, though some with
438 * stubs.
439 *
440 * Hydra_Software_Devel/3   9/2/03 8:08p darnstein
441 * Still not ready for use.
442 *
443 * Hydra_Software_Devel/2   8/29/03 6:47p darnstein
444 * Private data structures to support the VBI API.
445 *
446 * Hydra_Software_Devel/1   8/28/03 11:37a darnstein
447 * Private data structures to support the VBI API.
448 *
449 ***************************************************************************/
450#ifndef BVBI_PRIV_H__
451#define BVBI_PRIV_H__
452
453#include "bvbi.h"
454#include "bvbi_lcop.h"
455#include "bvbi_util_priv.h"
456#include "bvbi_chip_priv.h"
457#include "blst_list.h"
458#include "bavc_hdmi.h"
459
460#ifdef __cplusplus
461extern "C" {
462#endif
463
464/*
465 * This macro take the check for a validity of a handle, and
466 * cast to context pointer.
467 */
468#define BVBI_P_GENERIC_GET_CONTEXT(handle, context, structname) \
469do { \
470        if(!(handle) || \
471           (((structname*)(handle))->ulBlackMagic != \
472           sizeof(structname))) \
473        { \
474                BDBG_ERR(("Corrupted context handle\n")); \
475                (context) = NULL; \
476        } \
477        else \
478        { \
479                (context) = (structname*)(handle); \
480        } \
481} while (0)
482
483/* Applications of the above macro */
484#define BVBI_P_GET_CONTEXT(handle, context) \
485        BVBI_P_GENERIC_GET_CONTEXT(handle, context, BVBI_P_Handle)
486#define BVBI_P_GET_DECODE_CONTEXT(handle, context) \
487        BVBI_P_GENERIC_GET_CONTEXT(handle, context, BVBI_P_Decode_Handle)
488#define BVBI_P_GET_ENCODE_CONTEXT(handle, context) \
489        BVBI_P_GENERIC_GET_CONTEXT(handle, context, BVBI_P_Encode_Handle)
490#define BVBI_P_GET_FIELD_CONTEXT(handle, context) \
491        BVBI_P_GENERIC_GET_CONTEXT(handle, context, BVBI_P_Field_Handle)
492
493/* Convenience macro for swapping two values */
494#define P_SWAP(A,B,TEMP)        \
495do {                                            \
496        (TEMP) = (A);                   \
497        (A)    = (B);                   \
498        (B)    = (TEMP);                \
499} while (0)
500
501/* Convenience function for doing little-endian <--> big-endian swap */
502uint32_t BVBI_P_LEBE_SWAP (uint32_t ulDatum);
503
504/***************************************************************************
505 * VBI internal enumerations and constants
506 ***************************************************************************/
507
508/* bitmasks for individual VBI standards */
509#define BVBI_P_SELECT_CC          0x0001
510#define BVBI_P_SELECT_CGMSA       0x0002
511#define BVBI_P_SELECT_WSS         0x0004
512#define BVBI_P_SELECT_TT          0x0008
513#define BVBI_P_SELECT_VPS         0x0010
514#define BVBI_P_SELECT_GS          0x0020
515#define BVBI_P_SELECT_AMOL        0x0040
516#define BVBI_P_SELECT_SCTE        0x0080
517#define BVBI_P_SELECT_MCC         0x0100
518#define BVBI_P_SELECT_CGMSB       0x0200
519#define BVBI_P_SELECT_VBIENC      0x0400        /* Pseudo standard */
520#define BVBI_P_SELECT_ANCI        0x0800        /* Pseudo standard */
521#define BVBI_P_SELECT_LAST        0x1000
522
523/* Enumeration of VEC VBI cores. Not exactly the same as the above. */
524typedef enum BVBI_P_EncCoreType
525{
526        BVBI_P_EncCoreType_eCCE = 0,
527        BVBI_P_EncCoreType_eCGMSAE,
528        BVBI_P_EncCoreType_eWSE,
529        BVBI_P_EncCoreType_eTTE,
530        BVBI_P_EncCoreType_eGSE,
531        BVBI_P_EncCoreType_eAMOLE,
532        BVBI_P_EncCoreType_eSCTE,
533        BVBI_P_EncCoreType_eVBIENC,
534        BVBI_P_EncCoreType_eANCI,
535        BVBI_P_EncCoreType_eLAST        /* Must be last! */
536} 
537BVBI_P_EncCoreType;
538
539
540/***************************************************************************
541 * VBI Internal data structures
542 ***************************************************************************/
543
544/* Linked list support: define decode_head and encode_head. */
545typedef struct decode_head decode_head;
546BLST_D_HEAD(decode_head, BVBI_P_Decode_Handle);
547typedef struct encode_head encode_head;
548BLST_D_HEAD(encode_head, BVBI_P_Encode_Handle);
549
550/* The chip-compatible storage of teletext data */
551typedef BVBI_P_LCOP_COUNTEDPROP(BVBI_P_TTData) BVBI_P_TTData_Counted;
552typedef struct BVBI_P_TTData
553{
554        BVBI_P_TTData_Counted clink;
555        uint16_t  ucDataSize; 
556        uint8_t   ucLines;
557        uint8_t   ucLineSize;
558        uint8_t   firstLine;
559        uint32_t  lineMask;
560        uint8_t  *pucData;
561
562} BVBI_P_TTData;
563typedef BVBI_P_LCOP_OWNERPROP(BVBI_P_TTData) BVBI_P_TTData_Owner;
564
565typedef struct BVBI_P_Handle
566{
567        /* Black magic */
568        uint32_t                       ulBlackMagic;
569
570        /* handed down from app. */
571        BCHP_Handle hChip;
572        BREG_Handle hReg;
573        BMEM_Handle hMem;
574        size_t      in656bufferSize;
575        bool        tteShiftDirMsb2Lsb;
576
577        /* List of decode contexts */
578        decode_head decode_contexts;
579
580        /* List of encode contexts */
581        encode_head encode_contexts;
582
583        /* Free lists for bulky data */
584        BVBI_P_TTData_Counted ttFreelist;
585
586        /* Usage of VEC hardware cores.
587         * Each entry refers to a type of hardware core.
588         * Each entry is a bitmask.
589         * In each entry, the bits positioned 0, 1, 2 indicate "in use." */
590        uint8_t vecHwCoreMask[BVBI_P_EncCoreType_eLAST];
591        uint8_t vecHwCoreMask_656[BVBI_P_EncCoreType_eLAST];
592
593} BVBI_P_Handle;
594
595/* Options for parsing SMPTE 291M ancillary data packets from ITU-R 656
596   bitstream input */
597typedef struct
598{
599        BVBI_Decode_656_SMPTE291M_Cb fParseCb;
600        void* fParseCbArg0;
601        bool bLongHeader;
602        bool bBrokenDataCount;
603
604} BVBI_P_SMPTE291Moptions;
605
606/*
607 * SCTE data internal format. This supports interleaved CC, PAM, and NRTV data,
608 * ordered by line number.
609 */
610typedef struct
611{
612        uint8_t cc_data_1;
613        uint8_t cc_data_2;
614
615} BVBI_P_SCTE_CC_Line_Data;
616
617typedef struct
618{
619        uint8_t sequence_number;
620        uint8_t segment_number;
621
622} BVBI_P_SCTE_NTRV_Line_Data;
623
624typedef struct
625{
626        bool first_segment_flag;
627        bool last_segment_flag;
628        uint16_t first_pixel_position;
629        uint8_t n_pixels;
630        int iArray;
631
632} BVBI_P_SCTE_Mono_Line_Data;
633
634typedef struct
635{
636        uint8_t valid;
637        uint8_t priority;
638        uint8_t line_number;
639        BVBI_SCTE_Type eType;
640        union 
641        {
642                BVBI_P_SCTE_CC_Line_Data     CC;
643                BVBI_P_SCTE_NTRV_Line_Data NRTV;
644                BVBI_P_SCTE_Mono_Line_Data Mono;
645        } d;
646} BVBI_P_SCTE_Line_Data;
647
648typedef struct
649{
650        uint8_t  field_number;
651        size_t line_count;
652        size_t line_size;
653        BVBI_P_SCTE_Line_Data* pLine;
654        uint8_t* nrtv_data[2];
655        size_t pam_data_count;
656        size_t pam_data_size;
657        uint8_t* pam_data;
658        uint8_t* mono_data[2];
659
660} BVBI_P_SCTE_Data;
661
662/* The current/next state for decoder */
663typedef struct BVBI_P_Decode_CNState
664{
665        /* What video display format to assume */
666        BFMT_VideoFmt eVideoFormat;
667
668        /* What format to expect for incoming VBI data in
669           ITU-R 656 ancillary data packets */
670        BVBI_656Fmt e656Format;
671
672        /* ITU-R 656 / SMPTE 291M options */
673        BVBI_P_SMPTE291Moptions SMPTE291Moptions;
674
675        /* WSS options */
676        uint16_t wssVline576i;
677
678        /* Gemstar options */
679        BVBI_GSOptions gsOptions;
680
681        /* Which VBI standards are active (bitmask of BVBI_P_SELECT_xyz) */
682        uint32_t ulActive_Standards;
683
684} BVBI_P_Decode_CNState;
685
686/* The full state for decoder */
687typedef struct BVBI_P_Decode_Handle
688{
689        /* Black magic */
690        uint32_t ulBlackMagic;
691
692        /* Current/next information */
693        BVBI_P_Decode_CNState curr;
694        BVBI_P_Decode_CNState next;
695        bool gsOptionsChanged;
696
697        /* Back pointer to the VBI context */
698        BVBI_P_Handle *pVbi;
699
700        /* Where to decode from */
701        BAVC_SourceId eSource;
702
703        /* LCO storage for bulky VBI data */
704        BVBI_P_TTData_Owner topTTDataO;
705        BVBI_P_TTData_Owner botTTDataO;
706
707        #ifdef BVBI_P_TTD_SCB2_ERROR
708        uint8_t* topTTscratch;
709        uint8_t* botTTscratch;
710        #endif
711
712        /* Double buffer storage for ITU-R 656 ancillary data */
713        uint8_t* top656Data;
714        uint8_t* bot656Data;
715
716        /* Linked list membership */
717        BLST_D_ENTRY(BVBI_P_Decode_Handle) link;
718
719} BVBI_P_Decode_Handle;
720
721/* Options for writing ITU-R 656 ancillary data packets */
722typedef struct
723{
724        BVBI_656Fmt e656Format;
725        uint8_t sdid;
726
727} BVBI_P_Encode_656_Options;
728
729/* The current/next state for encoder */
730typedef struct BVBI_P_Encode_CNState
731{
732        /* What video display format to assume */
733        BFMT_VideoFmt eVideoFormat;
734
735        /* HDMI pixel repetition to assume */
736        BAVC_HDMI_PixelRepetition ePixRep;
737
738        /* Options for encapsulating VBI data into
739           ITU-R 656 ancillary data packets */
740        BVBI_P_Encode_656_Options h656options;
741
742        /* Which VBI standards are active for analog output
743           (bitmask of BVBI_P_SELECT_xyz) */
744        uint32_t ulActive_Standards;
745
746        /* Same as above, but for ITU-R 656 output instead of analog output. */
747        uint32_t ulActive_656_Standards;
748
749        /* Same as above, but for serial output. */
750        uint32_t ulActive_XSER_Standards;
751
752        /* Serial output options */
753        BVBI_XSER_Settings xserSettings;
754
755        /* Gemstar options */
756        BVBI_GSOptions gsOptions;
757
758        /* AMOL options */
759        BVBI_AMOL_Type amolType;
760
761        /* SCTE options */
762        BVBI_SCTE_Type scteType;
763        BVBI_CSC eCsc;
764        BVBI_CSC eCoCsc;
765
766        /* CGMS-B options */
767        bool bCea805dStyle;
768
769        /* As of 2005-12-05, all chip products 97038 and later are affected by
770         * PR18010. The BVBI porting interface "works around" this bug in software,
771         * by default. However, when this flag is "true," then the buggy behavior
772         * will occur. This flag is provided for customers who have accomodated the
773         * buggy behavior and do not wish to switch over to correct behavior.
774         */
775        bool bPR18010_bad_line_number;
776
777        /* This identifies each VEC VBI core to use.
778         * Each entry refers to a type of hardware core.
779         * Each entry is either 0, 1, 2, or 0xFF.
780         * 0xFF means "unassigned."
781         * Entry BVBI_P_EncCoreType_eVBIENC is a special case. There is only a
782         * single core of type VBI_ENC. In this case, the value stored in the
783         * array indicates which VBI path is in use.                           */
784        uint8_t hwCoreIndex[BVBI_P_EncCoreType_eLAST];
785
786} BVBI_P_Encode_CNState;
787
788/* The full state for encoder */
789typedef struct BVBI_P_Encode_Handle
790{
791        /* Black magic */
792        uint32_t                       ulBlackMagic;
793
794        /* Current/next information */
795        BVBI_P_Encode_CNState curr;
796        BVBI_P_Encode_CNState next;
797
798        /* Back pointer to the VBI context */
799        BVBI_P_Handle *pVbi;
800
801        /* Where to decode to */
802        BAVC_VbiPath eDest;
803
804        /* Used to temporarily disable VBI encoding */
805        bool bDisabled;
806
807        /* Double buffer storage for bulky VBI data */
808        BVBI_P_TTData_Owner topTTDataO;
809        BVBI_P_TTData_Owner botTTDataO;
810        BVBI_LineBuilder_Handle hTopScteNrtv[2];
811        BVBI_LineBuilder_Handle hBotScteNrtv[2];
812        BVBI_LineBuilder_Handle hTopScteMono[2];
813        BVBI_LineBuilder_Handle hBotScteMono[2];
814        uint8_t* sctePamData;
815
816        /* Cache CGMS data from user */
817#ifdef P_CGMS_SOFTWARE_CRC
818        uint32_t last_cgms_user;
819        uint32_t last_cgms_formatted;
820#endif /* P_CGMS_SOFTWARE_CRC */
821
822        /* Linked list membership */
823        BLST_D_ENTRY(BVBI_P_Encode_Handle) link;
824
825} BVBI_P_Encode_Handle;
826
827typedef struct BVBI_P_Field_Handle
828{
829        /* Black magic */
830        uint32_t                       ulBlackMagic;
831
832        /* Pointer back to BVBI main context */
833        BVBI_P_Handle* pVbi;
834
835        /* Raw data storage */
836        uint16_t             usCCData;
837        uint16_t             usWSSData;
838        uint32_t             ulCGMSData;
839        BVBI_MCCData         *pMCCData;
840        BVBI_P_TTData_Owner TTDataO;
841        BVBI_VPSData         *pVPSData;
842        BVBI_GSData          *pGSData;
843        BVBI_AMOL_Type       amolType;
844        uint8_t              *pAmolData;
845        int                  amolSize;
846        BVBI_P_SCTE_Data*    pPScteData;
847        BVBI_CGMSB_Datum*    pCgmsbDatum;
848
849        /* Which of the above pieces of data is VALID
850           (bitmask of BVBI_P_SELECT_xyz) */
851        uint32_t ulWhichPresent;
852
853        /* Bitmask of error conditions from most
854        recent encode or decode operation */
855        uint32_t ulErrInfo;
856
857        /* Even/odd field parity bitmask.  May be "unspecified" or "any." */
858    uint32_t polarityMask;
859
860        /* In-use counter.  Used by BVBIlib syslib module. */
861        int inUseCount;
862
863} BVBI_P_Field_Handle;
864
865
866/***************************************************************************
867 * VBI private closed caption (CC) functions
868 ***************************************************************************/
869BERR_Code BVBI_P_CC_Init ( BVBI_P_Handle *pVbi );
870void BVBI_P_CC_Enc_Init (BREG_Handle hReg, bool is656, uint8_t hwCoreIndex);
871BERR_Code BVBI_P_CC_Enc_Program (
872        BREG_Handle hReg,
873        bool is656, 
874        uint8_t hwCoreIndex,
875        bool bActive,
876        bool bPR18010_bad_line_number,
877        BFMT_VideoFmt eVideoFormat);
878BERR_Code BVBI_P_CC_Encode_Data_isr ( 
879        BREG_Handle hReg, 
880    bool is656,
881        uint8_t hwCoreIndex,
882        BAVC_Polarity polarity,
883        uint16_t usData );
884BERR_Code BVBI_P_CC_Encode_Enable_isr (
885        BREG_Handle hReg,
886        bool is656,
887        uint8_t hwCoreIndex,
888        BFMT_VideoFmt eVideoFormat,
889        bool bEnable);
890uint16_t BVBI_P_SetCCParityBits_isr (
891        uint16_t uchData);
892void BVBI_P_CC_Dec_Init (BREG_Handle hReg, uint32_t ulCoreOffset);
893uint32_t BVBI_P_CC_Decode_Data_isr ( 
894        BREG_Handle hReg, 
895    BAVC_SourceId eSource,
896        BAVC_Polarity polarity,
897        uint16_t *pusData );
898BERR_Code BVBI_P_CC_Dec_Program (
899        BREG_Handle hReg,
900        BAVC_SourceId eSource,
901        bool bActive,
902        BFMT_VideoFmt eVideoFormat);
903
904
905/***************************************************************************
906 * VBI private CGMS functions
907 ***************************************************************************/
908BERR_Code BVBI_P_CGMS_Init ( BVBI_P_Handle *pVbi );
909
910void BVBI_P_CGMS_Enc_Init (BREG_Handle hReg, bool is656, uint8_t hwCoreIndex);
911BERR_Code BVBI_P_CGMSA_Enc_Program (
912        BREG_Handle hReg,
913        bool is656, 
914        uint8_t hwCoreIndex,
915        bool bActive,
916        BFMT_VideoFmt eVideoFormat,
917        BAVC_HDMI_PixelRepetition ePixRep);
918BERR_Code BVBI_P_CGMSA_Encode_Data_isr ( 
919        BREG_Handle hReg, 
920        bool is656, 
921        uint8_t hwCoreIndex,
922        BAVC_Polarity polarity,
923        uint32_t ulData );
924BERR_Code BVBI_P_CGMSA_Encode_Enable_isr (
925        BREG_Handle hReg,
926        bool is656, 
927        uint8_t hwCoreIndex,
928        BFMT_VideoFmt eVideoFormat,
929        bool bEnable);
930#if defined(BVBI_P_CGMSAE_VER2) || defined(BVBI_P_CGMSAE_VER3) || \
931    defined(BVBI_P_CGMSAE_VER5) /** { **/
932BERR_Code BVBI_P_CGMSB_Enc_Program (
933        BREG_Handle hReg,
934        bool is656, 
935        uint8_t hwCoreIndex,
936        bool bActive,
937        BFMT_VideoFmt eVideoFormat,
938        BAVC_HDMI_PixelRepetition ePixRep,
939        bool bCea805dStyle);
940
941BERR_Code BVBI_P_CGMSB_Encode_Data_isr ( 
942        BREG_Handle hReg, 
943        bool is656, 
944        uint8_t hwCoreIndex,
945        BAVC_Polarity polarity,
946        BVBI_CGMSB_Datum cgmsbDatum );
947
948BERR_Code BVBI_P_CGMSB_Encode_Enable_isr (
949        BREG_Handle hReg,
950        bool is656, 
951        uint8_t hwCoreIndex,
952        BFMT_VideoFmt eVideoFormat,
953        bool bEnable);
954#endif /** } **/
955
956void BVBI_P_CGMS_Dec_Init (BREG_Handle hReg, uint32_t ulCoreOffset);
957
958BERR_Code BVBI_P_CGMS_Dec_Program (
959        BREG_Handle hReg,
960        BAVC_SourceId eSource,
961        bool bActive,
962        BFMT_VideoFmt eVideoFormat);
963uint32_t BVBI_P_CGMS_Decode_Data_isr ( 
964        BREG_Handle hReg, 
965    BAVC_SourceId eSource,
966        BAVC_Polarity polarity,
967        uint32_t *pulData );
968
969uint32_t BVPI_P_CGMS_format_data (uint32_t userdata);
970
971
972/***************************************************************************
973 * VBI private WSS functions
974 ***************************************************************************/
975BERR_Code BVBI_P_WSS_Init ( BVBI_P_Handle *pVbi );
976
977void BVBI_P_WSS_Enc_Init     (BREG_Handle hReg, uint8_t hwCoreIndex);
978void BVBI_P_WSS_656_Enc_Init (BREG_Handle hReg, uint8_t hwCoreIndex);
979BERR_Code BVBI_P_WSS_Enc_Program (
980        BREG_Handle hReg,
981        bool is656, 
982        uint8_t hwCoreIndex,
983        bool bActive,
984        bool bPR18010_bad_line_number,
985        BFMT_VideoFmt eVideoFormat);
986BERR_Code BVBI_P_WSS_Encode_Data_isr ( 
987        BREG_Handle hReg, 
988        bool is656, 
989        uint8_t hwCoreIndex,
990        BAVC_Polarity polarity,
991        uint16_t usData );
992BERR_Code BVBI_P_WSS_Encode_Enable_isr (
993        BREG_Handle hReg,
994        bool is656, 
995        uint8_t hwCoreIndex,
996        BFMT_VideoFmt eVideoFormat,
997        bool bEnable);
998
999void BVBI_P_WSS_Dec_Init (BREG_Handle hReg, uint32_t ulCoreOffset);
1000uint16_t BVBI_P_AddWSSparity (uint16_t usData);
1001
1002BERR_Code BVBI_P_WSS_Dec_Program (
1003        BREG_Handle hReg,
1004        BAVC_SourceId eSource,
1005        bool bActive,
1006        BFMT_VideoFmt eVideoFormat,
1007        uint16_t wssVline576i);
1008uint32_t BVBI_P_WSS_Decode_Data_isr ( 
1009        BREG_Handle hReg, 
1010    BAVC_SourceId eSource,
1011        BAVC_Polarity polarity,
1012        uint16_t *pusData );
1013
1014
1015/***************************************************************************
1016 * VBI private VPS functions
1017 ***************************************************************************/
1018BERR_Code BVBI_P_VPS_Init ( BVBI_P_Handle *pVbi );
1019
1020void BVBI_P_VPS_Enc_Init (BREG_Handle hReg, uint8_t hwCoreIndex);
1021BERR_Code BVBI_P_VPS_Encode_Enable_isr (
1022        BREG_Handle hReg,
1023        bool is656, 
1024        uint8_t hwCoreIndex,
1025        BFMT_VideoFmt eVideoFormat,
1026        bool bEnable);
1027BERR_Code BVBI_P_VPS_Enc_Program (
1028        BREG_Handle hReg,
1029        bool is656, 
1030        uint8_t hwCoreIndex,
1031        bool bActive,
1032        BFMT_VideoFmt eVideoFormat);
1033BERR_Code BVBI_P_VPS_Encode_Data_isr ( 
1034        BREG_Handle hReg, 
1035        bool is656, 
1036        uint8_t hwCoreIndex,
1037        BAVC_Polarity polarity,
1038        BVBI_VPSData *pVPSData );
1039
1040#ifdef BVBI_P_HAS_VPSD
1041void BVBI_P_VPS_Dec_Init (BREG_Handle hReg, uint32_t ulCoreOffset);
1042BERR_Code BVBI_P_VPS_Dec_Program (
1043        BREG_Handle hReg,
1044        BAVC_SourceId eSource,
1045        bool bActive,
1046        BFMT_VideoFmt eVideoFormat);
1047uint32_t BVBI_P_VPS_Decode_Data_isr ( 
1048        BREG_Handle hReg, 
1049    BAVC_SourceId eSource,
1050        BAVC_Polarity polarity,
1051        BVBI_VPSData *pVPSData );
1052#endif
1053
1054/***************************************************************************
1055 * VBI private Teletext functions
1056 ***************************************************************************/
1057
1058BERR_Code BVBI_P_TT_Init ( BVBI_P_Handle *pVbi );
1059
1060void BVBI_P_TT_Enc_Init (BREG_Handle hReg, bool is656, uint8_t hwCoreIndex);
1061BERR_Code BVBI_P_TT_Enc_Program (
1062        BREG_Handle hReg,
1063        BMEM_Handle hMem,
1064        bool is656, 
1065        uint8_t hwCoreIndex,
1066        bool bActive,
1067        bool bXserActive,
1068        BFMT_VideoFmt eVideoFormat,
1069        bool tteShiftDirMsb2Lsb,
1070        BVBI_XSER_Settings* xserSettings,
1071        BVBI_P_TTData* topData,
1072        BVBI_P_TTData* botData
1073);
1074uint32_t BVBI_P_TT_Encode_Data_isr ( 
1075        BREG_Handle hReg, 
1076        BMEM_Handle hMem,
1077        bool is656, 
1078        uint8_t hwCoreIndex,
1079        BFMT_VideoFmt eVideoFormat,
1080        BAVC_Polarity polarity,
1081        bool bPR18010_bad_line_number,
1082        BVBI_P_TTData* pTTDataNext );
1083BERR_Code BVBI_P_TT_Encode_Enable_isr (
1084        BREG_Handle hReg,
1085        bool is656, 
1086        uint8_t hwCoreIndex,
1087        BFMT_VideoFmt eVideoFormat,
1088        bool bEnable);
1089
1090void BVBI_P_TT_Dec_Init (BREG_Handle hReg, uint32_t ulCoreOffset);
1091BERR_Code BVBI_P_TT_Dec_Program (
1092        BREG_Handle hReg,
1093        BMEM_Handle hMem,
1094        BAVC_SourceId eSource,
1095        bool bActive,
1096        BFMT_VideoFmt eVideoFormat,
1097        #ifdef BVBI_P_TTD_SCB2_ERROR
1098        uint8_t* topTTscratch,
1099        uint8_t* botTTscratch,
1100        #endif
1101        BVBI_P_TTData* topData,
1102        BVBI_P_TTData* botData
1103);
1104uint32_t BVBI_P_TT_Decode_Data_isr ( 
1105        BREG_Handle hReg, 
1106        BMEM_Handle hMem,
1107    BAVC_SourceId eSource,
1108        BFMT_VideoFmt eVideoFormat,
1109        BAVC_Polarity polarity,
1110        BVBI_P_TTData* pTTDataNext );
1111
1112uint32_t BVBI_P_TT_Size_Storage(uint32_t ulMaxLines, uint32_t ulMaxLineSize);
1113BERR_Code BVBI_P_TTData_Alloc (
1114        BMEM_Handle hMem, uint8_t ucMaxLines, uint8_t ucLineSize, 
1115        BVBI_P_TTData* pTTData);
1116
1117/***************************************************************************
1118 * VBI private Gemstar functions
1119 ***************************************************************************/
1120
1121BERR_Code BVBI_P_GS_Init ( BVBI_P_Handle *pVbi );
1122void BVBI_P_GS_Dec_Init (BREG_Handle hReg, uint32_t ulCoreOffset);
1123void BVBI_P_GS_Enc_Init (BREG_Handle hReg, bool is656, uint8_t hwCoreIndex);
1124
1125BERR_Code BVBI_P_GS_Enc_Program (
1126        BREG_Handle hReg,
1127        bool is656, 
1128        uint8_t hwCoreIndex,
1129        bool bActive,
1130        BFMT_VideoFmt eVideoFormat,
1131        BVBI_GSOptions* gsOptions
1132);
1133uint32_t BVBI_P_GS_Encode_Data_isr ( 
1134        BREG_Handle hReg, 
1135        bool is656, 
1136        uint8_t hwCoreIndex,
1137        BFMT_VideoFmt eVideoFormat,
1138        BAVC_Polarity polarity,
1139        BVBI_GSData* pGSDataNext );
1140BERR_Code BVBI_P_GS_Encode_Enable_isr (
1141        BREG_Handle hReg,
1142        bool is656, 
1143        uint8_t hwCoreIndex,
1144        BFMT_VideoFmt eVideoFormat,
1145        bool bEnable);
1146#ifdef BVBI_P_HAS_GSD
1147BERR_Code BVBI_P_GS_Dec_Program (
1148        BREG_Handle hReg,
1149        BAVC_SourceId eSource,
1150        bool bActive,
1151        BFMT_VideoFmt eVideoFormat,
1152        BVBI_GSOptions* gsOptions);
1153uint32_t BVBI_P_GS_Decode_Data_isr (
1154        BREG_Handle hReg, 
1155        BAVC_SourceId eSource,
1156        BFMT_VideoFmt eVideoFormat,
1157        BAVC_Polarity polarity,
1158        BVBI_GSData* pGSData);
1159#endif
1160
1161/***************************************************************************
1162 * VBI private AMOL functions
1163 ***************************************************************************/
1164
1165BERR_Code BVBI_P_AMOL_Init ( BVBI_P_Handle *pVbi );
1166void BVBI_P_AMOL_Enc_Init (BREG_Handle hReg, bool is656, uint8_t hwCoreIndex);
1167
1168BERR_Code BVBI_P_AMOL_Enc_Program (
1169        BREG_Handle hReg,
1170        bool is656,
1171        uint8_t hwCoreIndex,
1172        bool bActive,
1173        BFMT_VideoFmt eVideoFormat,
1174        BVBI_AMOL_Type amolType
1175);
1176uint32_t BVBI_P_AMOL_Encode_Data_isr ( 
1177        BREG_Handle hReg, 
1178        bool is656,
1179        uint8_t hwCoreIndex,
1180        BFMT_VideoFmt eVideoFormat,
1181        BAVC_Polarity polarity,
1182        BVBI_AMOL_Type amolType,
1183        uint8_t* pAMOLData );
1184BERR_Code BVBI_P_AMOL_Encode_Enable_isr (
1185        BREG_Handle hReg,
1186        bool is656,
1187        uint8_t hwCoreIndex,
1188        BFMT_VideoFmt eVideoFormat,
1189        bool bEnable);
1190
1191/***************************************************************************
1192 * VBI private multi-line closed caption functions
1193 ***************************************************************************/
1194
1195BERR_Code BVBI_P_MCC_Enc_Program (
1196        BREG_Handle hReg,
1197        bool is656,
1198        uint8_t hwCoreIndex,
1199        bool bActive,
1200        BFMT_VideoFmt eVideoFormat
1201);
1202uint32_t BVBI_P_MCC_Encode_Data_isr ( 
1203        BREG_Handle hReg, 
1204        bool is656,
1205        uint8_t hwCoreIndex,
1206        BFMT_VideoFmt eVideoFormat,
1207        BAVC_Polarity polarity,
1208        bool bPR18010_bad_line_number,
1209        BVBI_MCCData* pMCCData );
1210BERR_Code BVBI_P_MCC_Encode_Enable_isr (
1211        BREG_Handle hReg,
1212        bool is656,
1213        uint8_t hwCoreIndex,
1214        BFMT_VideoFmt eVideoFormat,
1215        bool bEnable);
1216
1217/***************************************************************************
1218 * VBI private SCTE functions
1219 ***************************************************************************/
1220
1221BERR_Code BVBI_P_SCTE_Init ( BVBI_P_Handle *pVbi );
1222
1223void BVBI_P_SCTE_Enc_Init (BREG_Handle hReg, uint8_t hwCoreIndex);
1224
1225BERR_Code BVBI_P_SCTE_Enc_Program (
1226        BREG_Handle hReg,
1227        bool is656,
1228        uint8_t hwCoreIndex,
1229        bool bActive,
1230        BFMT_VideoFmt eVideoFormat,
1231        BVBI_SCTE_Type scteType,
1232        BVBI_CSC csc,
1233        BVBI_CSC coCsc
1234);
1235uint32_t BVBI_P_SCTE_Encode_Data_isr ( 
1236        BREG_Handle hReg, 
1237        BMEM_Handle hMem,
1238        bool is656,
1239        uint8_t hwCoreIndex,
1240        BFMT_VideoFmt eVideoFormat,
1241        BAVC_Polarity polarity,
1242        BVBI_SCTE_Type scteType,
1243        BVBI_P_SCTE_Data* pData,
1244        BVBI_LineBuilder_Handle hTopScteNrtv[2],
1245        BVBI_LineBuilder_Handle hBotScteNrtv[2],
1246        BVBI_LineBuilder_Handle hTopScteMono[2],
1247        BVBI_LineBuilder_Handle hBotScteMono[2],
1248        uint8_t** pSctePamData
1249);
1250BERR_Code BVBI_P_SCTE_Encode_Enable_isr (
1251        BREG_Handle hReg,
1252        bool is656,
1253        uint8_t hwCoreIndex,
1254        BFMT_VideoFmt eVideoFormat,
1255        BVBI_SCTE_Type scteType,
1256        bool bEnable);
1257BERR_Code BVBI_P_SCTEData_Alloc (
1258        BMEM_Handle hMem, size_t cc_size, bool scteEnableNrtv, size_t pam_size, 
1259        bool scteEnableMono, BVBI_P_SCTE_Data* pPScteData);
1260BERR_Code BVBI_P_Encode_AllocScte (
1261        BMEM_Handle hMem,
1262        BVBI_LineBuilder_Handle topScteNrtv[2],
1263        BVBI_LineBuilder_Handle botScteNrtv[2],
1264        BVBI_LineBuilder_Handle topScteMono[2],
1265        BVBI_LineBuilder_Handle botScteMono[2],
1266        uint8_t** pSctePam);
1267void BVBI_P_Encode_FreeScte (
1268        BMEM_Handle hMem,
1269        BVBI_LineBuilder_Handle topScteNrtv[2],
1270        BVBI_LineBuilder_Handle botScteNrtv[2],
1271        BVBI_LineBuilder_Handle topScteMono[2],
1272        BVBI_LineBuilder_Handle botScteMono[2],
1273        uint8_t** pSctePam);
1274
1275/***************************************************************************
1276 * VBI private VDTOP functions
1277 ***************************************************************************/
1278BERR_Code BVBI_P_VDTOP_Dec_Program (
1279        BREG_Handle hReg,
1280        BAVC_SourceId eSource,
1281        BFMT_VideoFmt eVideoFormat);
1282
1283BERR_Code BVBI_P_VDTOP_Dec_Reset (
1284        BREG_Handle hReg,
1285        BAVC_SourceId eSource,
1286        uint32_t whichStandard);
1287
1288BERR_Code BVBI_P_VDTOP_656_Dec_Program (
1289        BREG_Handle hReg,
1290        BAVC_SourceId eSource,
1291        BFMT_VideoFmt eVideoFormat);
1292
1293/***************************************************************************
1294 * VBI private VBI_ENC functions
1295 ***************************************************************************/
1296BERR_Code BVBI_P_VE_Init  ( BVBI_P_Handle *pVbi );
1297BERR_Code BVBI_P_VE_Enc_Program (
1298        BREG_Handle hReg,
1299        bool is656, 
1300        uint8_t hwCoreIndex,
1301        uint32_t ulActive_Standards,
1302        uint32_t ulActive_656_Standards,
1303        BFMT_VideoFmt eVideoFormat);
1304#ifdef BVBI_P_HAS_CROSSBAR_VEC
1305void BVBI_P_VE_Crossbar_Program (
1306        BREG_Handle hReg,
1307        BAVC_VbiPath eDest,
1308        uint8_t hwCoreIndex[BVBI_P_EncCoreType_eLAST]);
1309#endif
1310
1311#ifdef BVBI_P_HAS_XSER_TT
1312/***************************************************************************
1313 * VBI private ITU656 functions
1314 ***************************************************************************/
1315BERR_Code BVBI_P_ITU656_Init( 
1316        BREG_Handle hReg, const BVBI_XSER_Settings* pXSERdefaultSettings );
1317BERR_Code BVBI_P_ITU656_Enc_Program (
1318        BREG_Handle hReg,
1319        BVBI_XSER_Settings* pSettings,
1320        uint32_t ulActive_XSER_Standards);
1321#endif
1322
1323/***************************************************************************
1324 * VBI private ANCI656 functions
1325 ***************************************************************************/
1326#if (BVBI_P_NUM_ANCI656_656 > 0)
1327BERR_Code BVBI_P_A656_Init  ( BVBI_P_Handle *pVbi );
1328BERR_Code BVBI_P_A656_Enc_Program (
1329        BREG_Handle hReg,
1330        uint8_t hwCoreIndex,
1331        BVBI_P_Encode_656_Options* h656options,
1332        bool bPR18010_bad_line_number,
1333        BFMT_VideoFmt eVideoFormat);
1334#endif
1335
1336/***************************************************************************
1337 * VBI private IN656 functions
1338 ***************************************************************************/
1339BERR_Code BVBI_P_IN656_Init  ( BVBI_P_Handle *pVbi );
1340BERR_Code BVBI_P_IN656_Dec_Program (
1341        BREG_Handle hReg,
1342        BMEM_Handle hMem,
1343        BAVC_SourceId eSource,
1344        bool bActive,
1345        BVBI_656Fmt anci656Fmt,
1346        BVBI_P_SMPTE291Moptions* pMoptions,
1347        BFMT_VideoFmt eVideoFormat,
1348        uint8_t* topData,
1349        uint8_t* botData);
1350BERR_Code BVBI_P_IN656_Decode_Data_isr ( 
1351        BREG_Handle hReg, 
1352    BAVC_SourceId eSource,
1353        BAVC_Polarity polarity,
1354        bool* bDataFound);
1355
1356/***************************************************************************
1357 * VBI private 656 (software parser) functions
1358 ***************************************************************************/
1359BERR_Code BVBI_P_P656_Init  ( BVBI_P_Decode_Handle* pVbi_Dec );
1360void      BVBI_P_P656_DeInit  ( BVBI_P_Decode_Handle* pVbi_Dec );
1361BERR_Code BVBI_P_P656_Process_Data_isr (
1362        BAVC_Polarity polarity,
1363        BVBI_P_Decode_Handle* pVbi_Dec,
1364        BVBI_P_Field_Handle* pVbi_Fld);
1365uint8_t BVBI_P_p656_SetEEbits (uint8_t arg);
1366
1367/***************************************************************************
1368 * VBI private Video Encoder (top level) functions
1369 ***************************************************************************/
1370BERR_Code BVBI_P_VIE_SoftReset (
1371        BREG_Handle hReg,
1372        bool is656, 
1373        uint8_t hwCoreIndex,
1374        uint32_t whichStandard);
1375#if (BVBI_P_NUM_ANCI656_656 > 0)
1376BERR_Code BVBI_P_VIE_AncilSoftReset (
1377        BREG_Handle hReg,
1378        uint8_t hwCoreIndex);
1379#endif
1380
1381/***************************************************************************
1382 * Other private, hardware dependent functions
1383 ***************************************************************************/
1384
1385BERR_Code BVBI_P_Encode_ReserveCore (
1386        BAVC_VbiPath eDest, uint32_t ulSelect_Standard,
1387        uint8_t vecHwCoreMask[BVBI_P_EncCoreType_eLAST],
1388        uint8_t vecHwCoreMask_656[BVBI_P_EncCoreType_eLAST],
1389        uint8_t hwCoreIndex[BVBI_P_EncCoreType_eLAST]);
1390void BVBI_P_Encode_ReleaseCore (
1391        BAVC_VbiPath eDest, uint32_t ulSelect_Standard,
1392        uint32_t ulActive_Standards, 
1393        uint8_t vecHwCoreMask[BVBI_P_EncCoreType_eLAST],
1394        uint8_t vecHwCoreMask_656[BVBI_P_EncCoreType_eLAST],
1395        uint8_t hwCoreIndex[BVBI_P_EncCoreType_eLAST]);
1396void BVBI_P_Encode_ConnectCores (
1397        BREG_Handle hReg, BAVC_VbiPath eDest, 
1398        uint8_t hwCoreIndex[BVBI_P_EncCoreType_eLAST]);
1399
1400/***************************************************************************
1401 * Other private functions
1402 ***************************************************************************/
1403bool BVBI_P_is656 (BAVC_VbiPath eDest);
1404const BVBI_XSER_Settings * BVBI_P_GetDefaultXserSettings (void);
1405
1406/*
1407 * Tuning parameters for retry access to VBI_ENC_PRIM_Control register, via a
1408 * RDMA scratch variable. These numbers express ten tries per field for 3
1409 * fields, if a field is 1/60 second.
1410 */
1411#define BVBI_P_MAX_HW_TRIES   30
1412#define BVBI_P_SLEEP_HW        2
1413
1414#ifdef __cplusplus
1415}
1416#endif
1417
1418#endif /* BVBI_PRIV_H__ */
1419
1420/* End of file. */
Note: See TracBrowser for help on using the repository browser.