source: svn/trunk/newcon3bcm2_21bu/magnum/portinginterface/vbi/7552/bvbi_field.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: 19.0 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_field.c $
11 * $brcm_Revision: Hydra_Software_Devel/2 $
12 * $brcm_Date: 1/20/09 12:12p $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/portinginterface/vbi/7335/bvbi_field.c $
19 *
20 * Hydra_Software_Devel/2   1/20/09 12:12p darnstein
21 * PR51074: For the problem with 15 lines or more teletext (output), apply
22 * the same software workaround that was used on 7401-C0. Note that this
23 * workaround itself causes problems for some chipsets, such as 3563-C0.
24 * So the workaround is controlled by an #ifdef.
25 *
26 * Hydra_Software_Devel/1   12/3/08 8:01p darnstein
27 * PR45819:
28 *
29 ***************************************************************************/
30
31#include "bstd.h"           /* standard types */
32#include "bdbg.h"           /* Dbglib */
33#include "bkni.h"                       /* For critical sections */
34#include "bvbi.h"           /* VBI processing, this module. */
35#include "bvbi_priv.h"      /* VBI internal data structures */
36
37BDBG_MODULE(BVBI);
38
39/***************************************************************************
40* Forward declarations of static (private) functions
41***************************************************************************/
42
43static BERR_Code
44BVBI_P_Field_ClearFlagData_isr (
45        BVBI_Field_Handle fieldHandle,
46        uint32_t flagBit);
47
48
49/***************************************************************************
50 *
51 */
52BERR_Code BVBI_Field_Create( BVBI_Field_Handle* pFieldHandle,
53                                                         BVBI_Handle vbiHandle )
54{
55        BVBI_P_Handle *pVbi;
56        BVBI_P_Field_Handle *pVbi_Fld = NULL;
57        BVBI_P_TTData* pttData;
58        BERR_Code eStatus = BERR_SUCCESS;
59
60        BDBG_ENTER(BVBI_Field_Create);
61
62        /* check parameters */
63        BVBI_P_GET_CONTEXT(vbiHandle, pVbi);
64        if ((!pFieldHandle) || (!pVbi))
65        {
66                BDBG_ERR(("Invalid parameter\n"));
67                eStatus = BERR_TRACE(BERR_INVALID_PARAMETER);
68                goto BVBI_Field_Create_Done;
69        }
70
71        /* Alloc the VBI field handle. */
72        pVbi_Fld =
73                (BVBI_P_Field_Handle*)(BKNI_Malloc(sizeof(BVBI_P_Field_Handle)));
74        if(!pVbi_Fld)
75        {
76                eStatus = BERR_TRACE(BERR_OUT_OF_SYSTEM_MEMORY);
77                goto BVBI_Field_Create_Done;
78        }
79
80        /* Clear out the context and set defaults. */
81        BKNI_Memset((void*)pVbi_Fld, 0x0, sizeof(BVBI_P_Field_Handle));
82        pVbi_Fld->usCCData = BVBI_P_SetCCParityBits_isr(0x0);
83        pVbi_Fld->ulErrInfo = 0x0;
84
85        /* Remember VBI main handle for subsequent allocations */
86        pVbi_Fld->pVbi = pVbi;
87
88        /* Indicate no room for teletext, VPS, Gemstar, AMOL, or MCC  data */
89        pttData = (BVBI_P_TTData*)(BKNI_Malloc(sizeof(BVBI_P_TTData)));
90        if(!pttData)
91        {
92                eStatus = BERR_TRACE(BERR_OUT_OF_SYSTEM_MEMORY);
93                goto BVBI_Field_Create_Done;
94        }
95        BKNI_Memset((void*)pttData, 0x0, sizeof(BVBI_P_TTData));
96        BVBI_P_TTData_Alloc (pVbi_Fld->pVbi->hMem, 0, 0, pttData);
97        BVBI_P_LCOP_CREATE (pVbi_Fld, TTDataO, pttData, clink);
98        pVbi_Fld->pVPSData = 0x0;
99        pVbi_Fld->pGSData = 0x0;
100        pVbi_Fld->amolType = BVBI_AMOL_Type_None;
101        pVbi_Fld->pAmolData = 0x0;
102        pVbi_Fld->amolSize = 0;
103        pVbi_Fld->pMCCData = 0x0;
104        pVbi_Fld->pPScteData = 0x0;
105        pVbi_Fld->pCgmsbDatum = 0x0;
106
107        /* Indicate no valid VBI data yet */
108        pVbi_Fld->ulWhichPresent = 0x0;
109
110        /* We don't know what the polarity is */
111        pVbi_Fld->polarityMask = 0x0;
112
113        /* Initialize protected attributes */
114        pVbi_Fld->inUseCount = 0;
115
116        /* Initialize magic number to the size of the struct */
117        pVbi_Fld->ulBlackMagic = sizeof(BVBI_P_Field_Handle);
118
119        /* All done. now return the new fresh context to user. */
120        *pFieldHandle = (BVBI_Field_Handle)pVbi_Fld;
121
122  BVBI_Field_Create_Done:
123
124        BDBG_LEAVE(BVBI_Field_Create);
125
126        if ((BERR_SUCCESS != eStatus) && (NULL != pVbi_Fld))
127                BKNI_Free((void*)pVbi_Fld);
128
129        /* coverity[leaked_storage: FALSE] */
130        return eStatus;
131}
132
133/***************************************************************************
134 *
135 */
136BERR_Code BVBI_Field_TT_Allocate(
137                                BVBI_Field_Handle fieldHandle,
138                                uint8_t ucMaxLines,
139                                uint8_t ucLineSize )
140{
141        BVBI_P_Field_Handle* pVbi_Fld;
142        BVBI_P_TTData* pttData;
143        BERR_Code eErr;
144
145        BDBG_ENTER(BVBI_Field_TT_Allocate);
146
147        /* check parameters */
148        BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld);
149        if(!pVbi_Fld)
150        {
151                BDBG_ERR(("Invalid parameter\n"));
152                return BERR_TRACE(BERR_INVALID_PARAMETER);
153        }
154        if ((ucMaxLines != 0) && (ucLineSize == 0))
155        {
156                BDBG_ERR(("Invalid parameter\n"));
157                return BERR_TRACE(BERR_INVALID_PARAMETER);
158        }
159
160#ifdef BVBI_P_TTE_WA15
161        if (ucMaxLines !=0)
162                ucMaxLines = BVBI_TT_MAX_LINES;
163#endif
164
165        /* (Re)allocate TT data as necessary */
166        BVBI_P_LCOP_WRITE (pVbi_Fld, TTDataO, &pVbi_Fld->pVbi->ttFreelist, clink);
167        pttData = BVBI_P_LCOP_GET (pVbi_Fld, TTDataO);
168        eErr = BERR_TRACE (BVBI_P_TTData_Alloc (
169                pVbi_Fld->pVbi->hMem, ucMaxLines, ucLineSize, pttData));
170        if (eErr != BERR_SUCCESS)
171        {
172                BDBG_LEAVE(BVBI_Field_TT_Allocate);
173                return eErr;
174        }
175
176        BDBG_LEAVE(BVBI_Field_TT_Allocate);
177        return BERR_SUCCESS;
178}
179
180/***************************************************************************
181 *
182 */
183BERR_Code BVBI_Field_VPS_Allocate(
184                                BVBI_Field_Handle fieldHandle,
185                                bool bEnable )
186{
187        BVBI_P_Field_Handle* pVbi_Fld;
188
189        BDBG_ENTER(BVBI_Field_VPS_Allocate);
190
191        /* check parameters */
192        BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld);
193        if(!pVbi_Fld)
194        {
195                BDBG_ERR(("Invalid parameter\n"));
196                return BERR_TRACE(BERR_INVALID_PARAMETER);
197        }
198
199        /* Lose any VPS data that may exist already */
200        if (pVbi_Fld->pVPSData)
201        {
202                BKNI_Free((void*)pVbi_Fld->pVPSData);
203                pVbi_Fld->pVPSData = 0x0;
204        }
205
206        /* If user wants to hold any VPS data */
207        if (bEnable)
208        {
209                pVbi_Fld->pVPSData =
210                        (BVBI_VPSData*)(BKNI_Malloc(sizeof(BVBI_VPSData)));
211                if(!pVbi_Fld->pVPSData)
212                {
213                        return BERR_TRACE(BERR_OUT_OF_SYSTEM_MEMORY);
214                }
215        }
216
217        BDBG_LEAVE(BVBI_Field_VPS_Allocate);
218        return BERR_SUCCESS;
219}
220
221/***************************************************************************
222 *
223 */
224BERR_Code BVBI_Field_GS_Allocate(
225                                BVBI_Field_Handle fieldHandle,
226                                bool bEnable )
227{
228        BVBI_P_Field_Handle* pVbi_Fld;
229
230        BDBG_ENTER(BVBI_Field_GS_Allocate);
231
232        /* check parameters */
233        BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld);
234        if(!pVbi_Fld)
235        {
236                BDBG_ERR(("Invalid parameter\n"));
237                return BERR_TRACE(BERR_INVALID_PARAMETER);
238        }
239
240        /* Lose any GS data that may exist already */
241        if (pVbi_Fld->pGSData)
242        {
243                BKNI_Free((void*)pVbi_Fld->pGSData);
244                pVbi_Fld->pGSData = 0x0;
245        }
246
247        /* If user wants to hold any GS data */
248        if (bEnable)
249        {
250                pVbi_Fld->pGSData =
251                        (BVBI_GSData*)(BKNI_Malloc(sizeof(BVBI_GSData)));
252                if(!pVbi_Fld->pGSData)
253                {
254                        return BERR_TRACE(BERR_OUT_OF_SYSTEM_MEMORY);
255                }
256        }
257
258        BDBG_LEAVE(BVBI_Field_GS_Allocate);
259        return BERR_SUCCESS;
260}
261
262/***************************************************************************
263 *
264 */
265BERR_Code BVBI_Field_AMOL_Allocate(
266                                BVBI_Field_Handle fieldHandle,
267                                BVBI_AMOL_Type amolType)
268{
269        BVBI_P_Field_Handle* pVbi_Fld;
270        int dataSize;
271
272        BDBG_ENTER(BVBI_Field_AMOL_Allocate);
273
274        /* check parameters */
275        BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld);
276        if(!pVbi_Fld)
277        {
278                BDBG_ERR(("Invalid parameter\n"));
279                return BERR_TRACE(BERR_INVALID_PARAMETER);
280        }
281
282        /* Lose any AMOL data that may exist already */
283        if (pVbi_Fld->pAmolData)
284        {
285                BKNI_Free((void*)pVbi_Fld->pAmolData);
286                pVbi_Fld->pAmolData = 0x0;
287                pVbi_Fld->amolSize = 0;
288        }
289
290        switch (amolType)
291        {
292        case BVBI_AMOL_Type_None:
293                dataSize = 0;
294                break;
295        case BVBI_AMOL_Type_I:
296                dataSize = 6;
297                break;
298        case BVBI_AMOL_Type_II_Lowrate:
299                dataSize = 12;
300                break;
301        case BVBI_AMOL_Type_II_Highrate:
302                dataSize = 24;
303                break;
304        default:
305                BDBG_ERR(("Invalid parameter\n"));
306                return BERR_TRACE(BERR_INVALID_PARAMETER);
307                break;
308        }
309
310        if (dataSize != 0)
311        {
312                pVbi_Fld->pAmolData =
313                        (uint8_t*)(BKNI_Malloc(dataSize));
314                if(!pVbi_Fld->pAmolData)
315                {
316                        return BERR_TRACE(BERR_OUT_OF_SYSTEM_MEMORY);
317                }
318                pVbi_Fld->amolSize = dataSize;
319        }
320
321        BDBG_LEAVE(BVBI_Field_AMOL_Allocate);
322        return BERR_SUCCESS;
323}
324
325/***************************************************************************
326 *
327 */
328BERR_Code BVBI_Field_MCC_Allocate(
329                                BVBI_Field_Handle fieldHandle,
330                                bool alloc)
331{
332        BVBI_P_Field_Handle* pVbi_Fld;
333
334        BDBG_ENTER(BVBI_Field_MCC_Allocate);
335
336        /* check parameters */
337        BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld);
338        if(!pVbi_Fld)
339        {
340                BDBG_ERR(("Invalid parameter\n"));
341                return BERR_TRACE(BERR_INVALID_PARAMETER);
342        }
343
344        /* Lose any MCC data that may exist already */
345        if (pVbi_Fld->pMCCData)
346        {
347                BKNI_Free((void*)pVbi_Fld->pMCCData);
348                pVbi_Fld->pMCCData = 0x0;
349        }
350
351        if (alloc)
352        {
353                pVbi_Fld->pMCCData = (BVBI_MCCData*)(BKNI_Malloc(sizeof(BVBI_MCCData)));
354                if(!pVbi_Fld->pMCCData)
355                {
356                        return BERR_TRACE(BERR_OUT_OF_SYSTEM_MEMORY);
357                }
358        }
359        else
360        {
361                if (pVbi_Fld->pMCCData)
362                {
363                        BKNI_Free ((void*)(pVbi_Fld->pMCCData));
364                        pVbi_Fld->pMCCData = 0x0;
365                }
366        }
367
368        BDBG_LEAVE(BVBI_Field_MCC_Allocate);
369        return BERR_SUCCESS;
370}
371
372/***************************************************************************
373 *
374 */
375BERR_Code BVBI_Field_SCTE_Allocate(
376        BVBI_Field_Handle fieldHandle,
377        size_t cc_size, bool scteEnableNrtv, size_t pam_size, bool scteEnableMono)
378{
379        BVBI_P_Field_Handle* pVbi_Fld;
380        BERR_Code eStatus = BERR_SUCCESS;
381
382        BDBG_ENTER(BVBI_Field_SCTE_Allocate);
383
384        /* check parameters */
385        BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld);
386        if(!pVbi_Fld)
387        {
388                BDBG_ERR(("Invalid parameter\n"));
389                return BERR_TRACE(BERR_INVALID_PARAMETER);
390        }
391
392        /* If any data is requested */
393        if (cc_size || scteEnableNrtv || pam_size || scteEnableMono)
394        {
395                /* Allocate the internal struct if necessary */
396                if (!(pVbi_Fld->pPScteData))
397                {
398                        pVbi_Fld->pPScteData = BKNI_Malloc (sizeof (BVBI_P_SCTE_Data));
399                        if (!(pVbi_Fld->pPScteData))
400                        {
401                                return BERR_TRACE(BERR_OUT_OF_SYSTEM_MEMORY);
402                        }
403                        pVbi_Fld->pPScteData->field_number     = 0;
404                        pVbi_Fld->pPScteData->line_size        = 0;
405                        pVbi_Fld->pPScteData->nrtv_data[0]     = 0;
406                        pVbi_Fld->pPScteData->nrtv_data[1]     = 0;
407                        pVbi_Fld->pPScteData->pam_data_size    = 0;
408                        pVbi_Fld->pPScteData->mono_data[0]     = 0;
409                        pVbi_Fld->pPScteData->mono_data[1]     = 0;
410                }
411                /* Internal standard for SCTE data allocation */
412                eStatus =
413                        BVBI_P_SCTEData_Alloc (
414                                pVbi_Fld->pVbi->hMem, cc_size, scteEnableNrtv, pam_size,
415                                scteEnableMono, pVbi_Fld->pPScteData);
416                }
417        else /* no data is requested */
418        {
419                /* If internal data has been allocated */
420                if (pVbi_Fld->pPScteData)
421                {
422                        /* Internal standard for SCTE data de-allocation */
423                        eStatus =
424                                BVBI_P_SCTEData_Alloc (
425                                        pVbi_Fld->pVbi->hMem, 0, false, 0, false,
426                                        pVbi_Fld->pPScteData);
427                        if (eStatus != BERR_SUCCESS)
428                        {
429                                return BERR_TRACE(eStatus);
430                        }
431                        /* Clear out the internal data structure itself */
432                        BKNI_Free ((void*)((pVbi_Fld->pPScteData)));
433                        pVbi_Fld->pPScteData = 0x0;
434                }
435        }
436
437        BDBG_LEAVE(BVBI_Field_SCTE_Allocate);
438        return eStatus;
439}
440
441/***************************************************************************
442 *
443 */
444BERR_Code BVBI_Field_CGMSB_Allocate(
445                                BVBI_Field_Handle fieldHandle,
446                                bool bEnable)
447{
448        BVBI_P_Field_Handle* pVbi_Fld;
449
450        BDBG_ENTER(BVBI_Field_CGMSB_Allocate);
451
452        /* check parameters */
453        BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld);
454        if(!pVbi_Fld)
455        {
456                BDBG_ERR(("Invalid parameter\n"));
457                return BERR_TRACE(BERR_INVALID_PARAMETER);
458        }
459
460        /* Lose any CGMSB data that may exist already */
461        if (pVbi_Fld->pCgmsbDatum)
462        {
463                BKNI_Free((void*)pVbi_Fld->pCgmsbDatum);
464                pVbi_Fld->pCgmsbDatum = 0x0;
465        }
466
467        if (bEnable)
468        {
469                pVbi_Fld->pCgmsbDatum = 
470                        (BVBI_CGMSB_Datum*)(BKNI_Malloc(sizeof(BVBI_CGMSB_Datum)));
471                if(!pVbi_Fld->pCgmsbDatum)
472                {
473                        return BERR_TRACE(BERR_OUT_OF_SYSTEM_MEMORY);
474                }
475        }
476        else
477        {
478                if (pVbi_Fld->pCgmsbDatum)
479                {
480                        BKNI_Free ((void*)(pVbi_Fld->pCgmsbDatum));
481                        pVbi_Fld->pCgmsbDatum = 0x0;
482                }
483        }
484
485        BDBG_LEAVE(BVBI_Field_CGMSB_Allocate);
486        return BERR_SUCCESS;
487}
488
489/***************************************************************************
490 *
491 */
492BERR_Code BVBI_Field_Destroy(BVBI_Field_Handle fieldHandle)
493{
494        BVBI_P_Field_Handle* pVbi_Fld;
495        BVBI_P_TTData* pttData;
496
497        BDBG_ENTER(BVBI_Field_Destroy);
498
499        /* check parameters */
500        BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld);
501        if(!pVbi_Fld)
502        {
503                BDBG_ERR(("Invalid parameter\n"));
504                return BERR_TRACE(BERR_INVALID_PARAMETER);
505        }
506
507        /* Deallocate bulky data if necessary */
508        BVBI_P_LCOP_DESTROY (pVbi_Fld, TTDataO, &pVbi_Fld->pVbi->ttFreelist, clink);
509        pttData = BVBI_P_LCOP_GET (pVbi_Fld, TTDataO);
510        BVBI_P_TTData_Alloc (pVbi_Fld->pVbi->hMem, 0, 0, pttData);
511        BKNI_Free ((void*)pttData);
512        BVBI_Field_MCC_Allocate (fieldHandle, false);
513        BVBI_Field_AMOL_Allocate(fieldHandle, BVBI_AMOL_Type_None);
514        BVBI_Field_GS_Allocate (fieldHandle, false);
515        BVBI_Field_VPS_Allocate (fieldHandle, false);
516        BVBI_Field_CGMSB_Allocate (fieldHandle, false);
517        BVBI_Field_SCTE_Allocate (fieldHandle, 0, false, 0, false);
518
519        /* The handle is invalid */
520        pVbi_Fld->ulBlackMagic = 0;
521
522        /* Release context in system memory */
523        BKNI_Free((void*)pVbi_Fld);
524
525        BDBG_LEAVE(BVBI_Field_Destroy);
526        return BERR_SUCCESS;
527}
528
529/***************************************************************************
530 *
531 */
532BERR_Code BVBI_Field_SetPolarity_isr(
533    BVBI_Field_Handle fieldHandle,
534    uint32_t         polarityMask
535)
536{
537        BVBI_P_Field_Handle *pVbi_Fld;
538
539        BDBG_ENTER(BVBI_Field_SetPolarity_isr);
540
541        /* check parameters */
542        BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld);
543        if(!pVbi_Fld)
544        {
545                BDBG_ERR(("Invalid parameter\n"));
546                return BERR_TRACE(BERR_INVALID_PARAMETER);
547        }
548
549        if ((polarityMask != 0x0                         ) &&
550                (polarityMask != (1<<BAVC_Polarity_eTopField)) &&
551            (polarityMask != (1<<BAVC_Polarity_eBotField)) &&
552            (polarityMask !=
553                        ((1<<BAVC_Polarity_eTopField) | (1<<BAVC_Polarity_eBotField)))
554           )
555        {
556                BDBG_ERR(("Invalid parameter\n"));
557                return BERR_TRACE(BERR_INVALID_PARAMETER);
558        }
559
560        /* Set attribute as requested */
561        pVbi_Fld->polarityMask = polarityMask;
562
563        BDBG_LEAVE(BVBI_Field_SetPolarity_isr);
564        return BERR_SUCCESS;
565}
566
567/***************************************************************************
568 *
569 */
570BERR_Code BVBI_Field_GetPolarity_isr(
571    BVBI_Field_Handle fieldHandle,
572    uint32_t *      pPolarityMask
573)
574{
575        BVBI_P_Field_Handle *pVbi_Fld;
576
577        BDBG_ENTER(BVBI_Field_GetPolarity_isr);
578
579        /* check parameters */
580        BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld);
581        if((!pVbi_Fld) || (!pPolarityMask))
582        {
583                BDBG_ERR(("Invalid parameter\n"));
584                return BERR_TRACE(BERR_INVALID_PARAMETER);
585        }
586
587        /* Get attribute as requested */
588        *pPolarityMask = pVbi_Fld->polarityMask;
589
590        BDBG_LEAVE(BVBI_Field_GetPolarity_isr);
591        return BERR_SUCCESS;
592}
593
594/***************************************************************************
595 *
596 */
597BERR_Code BVBI_Field_GetErrorInfo_isr(
598        BVBI_Field_Handle fieldHandle, uint32_t *pErrInfo )
599{
600        BVBI_P_Field_Handle *pVbi_Fld;
601
602        BDBG_ENTER(BVBI_Field_GetErrorInfo_isr);
603
604        /* check parameters */
605        BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld);
606        if((!pVbi_Fld) || (!pErrInfo))
607        {
608                BDBG_ERR(("Invalid parameter\n"));
609                return BERR_TRACE(BERR_INVALID_PARAMETER);
610        }
611
612        /* Return info as requested */
613        *pErrInfo = pVbi_Fld->ulErrInfo;
614
615        BDBG_LEAVE(BVBI_Field_GetErrorInfo_isr);
616        return BERR_SUCCESS;
617}
618
619/***************************************************************************
620 *
621 */
622BERR_Code BVBI_Field_ClearCCData_isr (BVBI_Field_Handle fieldHandle)
623{
624        return BERR_TRACE (BVBI_P_Field_ClearFlagData_isr (
625                fieldHandle, BVBI_P_SELECT_CC));
626}
627BERR_Code BVBI_Field_ClearTTData_isr (BVBI_Field_Handle fieldHandle)
628{
629        return BERR_TRACE (BVBI_P_Field_ClearFlagData_isr (
630                fieldHandle, BVBI_P_SELECT_TT));
631}
632BERR_Code BVBI_Field_ClearCGMSAData_isr (BVBI_Field_Handle fieldHandle)
633{
634        return BERR_TRACE (BVBI_P_Field_ClearFlagData_isr (
635                fieldHandle, BVBI_P_SELECT_CGMSA));
636}
637BERR_Code BVBI_Field_ClearCGMSBData_isr (BVBI_Field_Handle fieldHandle)
638{
639        return BERR_TRACE (BVBI_P_Field_ClearFlagData_isr (
640                fieldHandle, BVBI_P_SELECT_CGMSB));
641}
642BERR_Code BVBI_Field_ClearWSSData_isr (BVBI_Field_Handle fieldHandle)
643{
644        return BERR_TRACE (BVBI_P_Field_ClearFlagData_isr (
645                fieldHandle, BVBI_P_SELECT_WSS));
646}
647BERR_Code BVBI_Field_ClearVPSData_isr (BVBI_Field_Handle fieldHandle)
648{
649        return BERR_TRACE (BVBI_P_Field_ClearFlagData_isr (
650                fieldHandle, BVBI_P_SELECT_VPS));
651}
652BERR_Code BVBI_Field_ClearGSData_isr (BVBI_Field_Handle fieldHandle)
653{
654        return BERR_TRACE (BVBI_P_Field_ClearFlagData_isr (
655                fieldHandle, BVBI_P_SELECT_GS));
656}
657BERR_Code BVBI_Field_ClearAMOLData_isr (BVBI_Field_Handle fieldHandle)
658{
659        return BERR_TRACE (BVBI_P_Field_ClearFlagData_isr (
660                fieldHandle, BVBI_P_SELECT_AMOL));
661}
662BERR_Code BVBI_Field_ClearMCCData_isr (BVBI_Field_Handle fieldHandle)
663{
664        return BERR_TRACE (BVBI_P_Field_ClearFlagData_isr (
665                fieldHandle, BVBI_P_SELECT_MCC));
666}
667BERR_Code BVBI_Field_ClearSCTEData_isr (BVBI_Field_Handle fieldHandle)
668{
669        return BERR_TRACE (BVBI_P_Field_ClearFlagData_isr (
670                fieldHandle, BVBI_P_SELECT_SCTE));
671}
672
673/***************************************************************************
674* Static (private) functions
675***************************************************************************/
676
677/***************************************************************************
678 *
679 */
680static BERR_Code
681BVBI_P_Field_ClearFlagData_isr (
682        BVBI_Field_Handle fieldHandle,
683        uint32_t flagBit)
684{
685        BVBI_P_Field_Handle *pVbi_Fld;
686
687        BDBG_ENTER(BVBI_P_Field_ClearFlagData_isr);
688
689        /* check parameter */
690        BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld);
691        if(!pVbi_Fld)
692        {
693                BDBG_ERR(("Invalid parameter\n"));
694                return BERR_TRACE(BERR_INVALID_PARAMETER);
695        }
696
697        /* Clear the data as requested */
698        pVbi_Fld->ulWhichPresent &= ~flagBit;
699
700        BDBG_LEAVE(BVBI_P_Field_ClearFlagData_isr);
701        return BERR_SUCCESS;
702}
703
704
705#if 0
706/***************************************************************************
707 *
708 */
709BERR_Code BVBI_P_Field_Dump( BVBI_Field_Handle fieldHandle,
710                                                         BAVC_Polarity polarity,
711                                                         char* printme, int printmetoo )
712{
713        BVBI_P_Field_Handle* pVbi_Fld;
714        char* polarityString;
715        uint8_t* pucData;
716        uint32_t mask;
717        char* p1;
718        char* p2;
719
720        BDBG_ENTER(BVBI_P_Field_Dump);
721
722        /* check parameters */
723        BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld);
724        if(!pVbi_Fld)
725        {
726                BDBG_ERR(("Invalid parameter\n"));
727                return BERR_TRACE(BERR_INVALID_PARAMETER);
728        }
729
730        switch (polarity)
731        {
732        case BAVC_Polarity_eTopField:
733                polarityString = "Top";
734                break;
735        case BAVC_Polarity_eBotField:
736                polarityString = "Bottom";
737                break;
738        case BAVC_Polarity_eFrame:
739                polarityString = "Frame";
740                break;
741        default:
742                return BERR_TRACE(BERR_INVALID_PARAMETER);
743                break;
744        }
745
746        pucData = pVbi_Fld->TTDataO.pucData;
747        mask = *(uint32_t*)pucData;
748        p1 = pucData + 4;
749        p2 = pucData + (4 + 34);
750        if (mask)
751        {
752                printf ("%s %d\n", printme, printmetoo);
753                printf ("Polarity %s, fpm %x\n",
754                        polarityString, pVbi_Fld->polarityMask);
755                printf ("Data %08x  \"%s\"  \"%s\"\n", mask, p1, p2);
756        }
757
758        BDBG_LEAVE(BVBI_P_Field_Dump);
759        return BERR_SUCCESS;
760}
761
762/***************************************************************************
763 *
764 */
765void BVBI_Field_Check(BVBI_Field_Handle fieldHandle)
766{
767        BVBI_P_Field_Handle* pVbi_Fld;
768
769        BDBG_ENTER(BVBI_P_Field_Check);
770
771        /* check parameters */
772        BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld);
773        BDBG_ASSERT (pVbi_Fld);
774        BDBG_ASSERT (pVbi_Fld->TTDataO.ucDataSize);
775        BDBG_ASSERT (pVbi_Fld->TTDataO.pucData);
776
777        BDBG_LEAVE(BVBI_P_Field_Check);
778}
779#endif /* 0 */
Note: See TracBrowser for help on using the repository browser.