| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2008, 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_vps.c $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/2 $ |
|---|
| 12 | * $brcm_Date: 12/3/08 7:58p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/portinginterface/vbi/7400/bvbi_vps.c $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/2 12/3/08 7:58p darnstein |
|---|
| 21 | * PR45819: New, more modular form of most BVBI source files. |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/29 10/1/08 2:53p darnstein |
|---|
| 24 | * PR46356: Check error condition: pointer argument is NULL. |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/28 9/15/08 8:58p darnstein |
|---|
| 27 | * PR46356: VPS decoder software in BVBI is ready for test. |
|---|
| 28 | * |
|---|
| 29 | * Hydra_Software_Devel/27 5/13/08 12:02p darnstein |
|---|
| 30 | * PR42416: adjust decoder video line number when the frame comb work- |
|---|
| 31 | * around is in place. |
|---|
| 32 | * |
|---|
| 33 | * Hydra_Software_Devel/26 2/20/07 10:44a darnstein |
|---|
| 34 | * PR27521: Apply software workaround. The TTE core is reset, at every |
|---|
| 35 | * video field. Also, the encoder output for the field NOT in use is |
|---|
| 36 | * disabled, at every video field. |
|---|
| 37 | * |
|---|
| 38 | * Hydra_Software_Devel/25 1/2/07 4:19p darnstein |
|---|
| 39 | * PR26872: Mechanically add SECAM to all cases where PAL formats are |
|---|
| 40 | * accepted. |
|---|
| 41 | * |
|---|
| 42 | * Hydra_Software_Devel/24 12/14/06 7:19p darnstein |
|---|
| 43 | * PR25990: Can compile for BCM97400-B0 now. |
|---|
| 44 | * |
|---|
| 45 | * Hydra_Software_Devel/23 8/31/06 2:09p darnstein |
|---|
| 46 | * PR23869: clean up the handling of multiple VECs and VDECs. |
|---|
| 47 | * |
|---|
| 48 | * Hydra_Software_Devel/22 5/3/06 2:31p darnstein |
|---|
| 49 | * PR18010: Remove extraneous call to BVBI_P_CC_ConfigForOthers() that |
|---|
| 50 | * might change the video format of closed caption encoder core. |
|---|
| 51 | * |
|---|
| 52 | * Hydra_Software_Devel/21 4/12/06 7:25p darnstein |
|---|
| 53 | * PR18010: Don't try to program encoders for don't exist for 656 output. |
|---|
| 54 | * |
|---|
| 55 | * Hydra_Software_Devel/20 4/10/06 6:06p darnstein |
|---|
| 56 | * PR20611: Fix Clearcase header (in comments). |
|---|
| 57 | * |
|---|
| 58 | ***************************************************************************/ |
|---|
| 59 | |
|---|
| 60 | #include "bstd.h" /* standard types */ |
|---|
| 61 | #include "bdbg.h" /* Dbglib */ |
|---|
| 62 | #include "bkni.h" /* For critical sections */ |
|---|
| 63 | #include "bvbi.h" /* VBI processing, this module. */ |
|---|
| 64 | #include "bvbi_priv.h" /* VBI internal data structures */ |
|---|
| 65 | |
|---|
| 66 | BDBG_MODULE(BVBI); |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | /*************************************************************************** |
|---|
| 70 | * Forward declarations of static (private) functions |
|---|
| 71 | ***************************************************************************/ |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | /*************************************************************************** |
|---|
| 75 | * Implementation of "BVBI_" API functions |
|---|
| 76 | ***************************************************************************/ |
|---|
| 77 | |
|---|
| 78 | |
|---|
| 79 | /*************************************************************************** |
|---|
| 80 | * |
|---|
| 81 | */ |
|---|
| 82 | BERR_Code BVBI_Field_GetVPSData_isr( BVBI_Field_Handle fieldHandle, |
|---|
| 83 | BVBI_VPSData *pVPSData ) |
|---|
| 84 | { |
|---|
| 85 | BVBI_P_Field_Handle* pVbi_Fld; |
|---|
| 86 | BERR_Code eErr = BERR_SUCCESS; |
|---|
| 87 | |
|---|
| 88 | BDBG_ENTER(BVBI_Field_GetVPSData_isr); |
|---|
| 89 | |
|---|
| 90 | /* check parameters */ |
|---|
| 91 | BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld); |
|---|
| 92 | if((!pVbi_Fld) || (!pVPSData)) |
|---|
| 93 | { |
|---|
| 94 | return BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 95 | } |
|---|
| 96 | |
|---|
| 97 | /* Verify that data is present on this field handle */ |
|---|
| 98 | if (!(pVbi_Fld->ulWhichPresent & BVBI_P_SELECT_VPS)) |
|---|
| 99 | return (BVBI_ERR_FIELD_NODATA); |
|---|
| 100 | if (pVbi_Fld->ulErrInfo & BVBI_LINE_ERROR_VPS_NOENCODE) |
|---|
| 101 | eErr = (BVBI_ERR_FIELD_BADDATA); |
|---|
| 102 | |
|---|
| 103 | /* Check that field handle was properly sized */ |
|---|
| 104 | if (!pVbi_Fld->pVPSData) |
|---|
| 105 | { |
|---|
| 106 | return BERR_TRACE (BVBI_ERR_FLDH_CONFLICT); |
|---|
| 107 | } |
|---|
| 108 | |
|---|
| 109 | /* Return data as requested */ |
|---|
| 110 | *pVPSData = *pVbi_Fld->pVPSData; |
|---|
| 111 | |
|---|
| 112 | BDBG_LEAVE(BVBI_Field_GetVPSData_isr); |
|---|
| 113 | return eErr; |
|---|
| 114 | } |
|---|
| 115 | |
|---|
| 116 | /*************************************************************************** |
|---|
| 117 | * |
|---|
| 118 | */ |
|---|
| 119 | BERR_Code BVBI_Field_SetVPSData_isr( BVBI_Field_Handle fieldHandle, |
|---|
| 120 | BVBI_VPSData *pVPSData ) |
|---|
| 121 | { |
|---|
| 122 | BVBI_P_Field_Handle* pVbi_Fld; |
|---|
| 123 | |
|---|
| 124 | BDBG_ENTER(BVBI_Field_SetVPSData_isr); |
|---|
| 125 | |
|---|
| 126 | /* check parameters */ |
|---|
| 127 | BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld); |
|---|
| 128 | if((!pVbi_Fld) || (!pVPSData)) |
|---|
| 129 | { |
|---|
| 130 | BDBG_ERR(("Invalid parameter\n")); |
|---|
| 131 | return BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 132 | } |
|---|
| 133 | |
|---|
| 134 | /* Check that field handle was properly sized */ |
|---|
| 135 | if (!pVbi_Fld->pVPSData) |
|---|
| 136 | { |
|---|
| 137 | return BERR_TRACE (BVBI_ERR_FLDH_CONFLICT); |
|---|
| 138 | } |
|---|
| 139 | |
|---|
| 140 | /* Store data as requested */ |
|---|
| 141 | *pVbi_Fld->pVPSData = *pVPSData; |
|---|
| 142 | |
|---|
| 143 | /* Indicate valid data is present */ |
|---|
| 144 | pVbi_Fld->ulWhichPresent |= BVBI_P_SELECT_VPS; |
|---|
| 145 | |
|---|
| 146 | BDBG_LEAVE(BVBI_Field_SetVPSData_isr); |
|---|
| 147 | return BERR_SUCCESS; |
|---|
| 148 | } |
|---|
| 149 | |
|---|
| 150 | |
|---|
| 151 | /*************************************************************************** |
|---|
| 152 | * Implementation of supporting VPS functions that are not in API |
|---|
| 153 | ***************************************************************************/ |
|---|
| 154 | |
|---|
| 155 | |
|---|
| 156 | BERR_Code BVBI_P_VPS_Init( BVBI_P_Handle *pVbi ) |
|---|
| 157 | { |
|---|
| 158 | uint8_t hwIndex; |
|---|
| 159 | #if defined(BVBI_P_HAS_VPSD) |
|---|
| 160 | uint32_t ulCoreOffset; |
|---|
| 161 | #endif |
|---|
| 162 | BERR_Code eErr = BERR_SUCCESS; |
|---|
| 163 | |
|---|
| 164 | BDBG_ENTER(BVBI_P_VPS_Init); |
|---|
| 165 | |
|---|
| 166 | /* Initialize VPS encoders */ |
|---|
| 167 | for (hwIndex = 0 ; hwIndex < BVBI_P_NUM_WSE ; ++hwIndex) |
|---|
| 168 | BVBI_P_VPS_Enc_Init (pVbi->hReg, hwIndex); |
|---|
| 169 | |
|---|
| 170 | #if defined(BVBI_P_HAS_VPSD) |
|---|
| 171 | if ((eErr = BVBI_P_VDTOP_Dec_Reset ( |
|---|
| 172 | pVbi->hReg, BAVC_SourceId_eVdec0, BVBI_P_SELECT_VPS)) != BERR_SUCCESS) |
|---|
| 173 | { |
|---|
| 174 | BDBG_LEAVE(BVBI_P_VPS_Init); |
|---|
| 175 | return eErr; |
|---|
| 176 | } |
|---|
| 177 | ulCoreOffset = 0x0; |
|---|
| 178 | BVBI_P_VPS_Dec_Init (pVbi->hReg, ulCoreOffset); |
|---|
| 179 | #endif |
|---|
| 180 | |
|---|
| 181 | BDBG_LEAVE(BVBI_P_VPS_Init); |
|---|
| 182 | return eErr; |
|---|
| 183 | } |
|---|
| 184 | |
|---|
| 185 | |
|---|
| 186 | /*************************************************************************** |
|---|
| 187 | * Static (private) functions |
|---|
| 188 | ***************************************************************************/ |
|---|
| 189 | |
|---|
| 190 | /* End of file */ |
|---|