| 1 | /*************************************************************************** |
|---|
| 2 | * (c)2007-2011 Broadcom Corporation |
|---|
| 3 | * |
|---|
| 4 | * This program is the proprietary software of Broadcom Corporation and/or its licensors, |
|---|
| 5 | * and may only be used, duplicated, modified or distributed pursuant to the terms and |
|---|
| 6 | * conditions of a separate, written license agreement executed between you and Broadcom |
|---|
| 7 | * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants |
|---|
| 8 | * no license (express or implied), right to use, or waiver of any kind with respect to the |
|---|
| 9 | * Software, and Broadcom expressly reserves all rights in and to the Software and all |
|---|
| 10 | * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU |
|---|
| 11 | * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY |
|---|
| 12 | * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. |
|---|
| 13 | * |
|---|
| 14 | * Except as expressly set forth in the Authorized License, |
|---|
| 15 | * |
|---|
| 16 | * 1. This program, including its structure, sequence and organization, constitutes the valuable trade |
|---|
| 17 | * secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, |
|---|
| 18 | * and to use this information only in connection with your use of Broadcom integrated circuit products. |
|---|
| 19 | * |
|---|
| 20 | * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" |
|---|
| 21 | * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR |
|---|
| 22 | * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO |
|---|
| 23 | * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES |
|---|
| 24 | * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, |
|---|
| 25 | * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION |
|---|
| 26 | * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF |
|---|
| 27 | * USE OR PERFORMANCE OF THE SOFTWARE. |
|---|
| 28 | * |
|---|
| 29 | * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS |
|---|
| 30 | * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR |
|---|
| 31 | * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR |
|---|
| 32 | * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF |
|---|
| 33 | * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT |
|---|
| 34 | * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE |
|---|
| 35 | * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF |
|---|
| 36 | * ANY LIMITED REMEDY. |
|---|
| 37 | * |
|---|
| 38 | * $brcm_Workfile: nexus_ccir656_input.h $ |
|---|
| 39 | * $brcm_Revision: 5 $ |
|---|
| 40 | * $brcm_Date: 5/13/11 12:17p $ |
|---|
| 41 | * |
|---|
| 42 | * Module Description: |
|---|
| 43 | * |
|---|
| 44 | * Revision History: |
|---|
| 45 | * |
|---|
| 46 | * $brcm_Log: /nexus/modules/display/7400/include/nexus_ccir656_input.h $ |
|---|
| 47 | * |
|---|
| 48 | * 5 5/13/11 12:17p erickson |
|---|
| 49 | * SW7420-1873: remove shutdown attribute |
|---|
| 50 | * |
|---|
| 51 | * 4 2/28/11 4:54p erickson |
|---|
| 52 | * SW7405-5146: move attr{null_allowed=y} |
|---|
| 53 | * |
|---|
| 54 | * 3 2/28/11 11:45a vsilyaev |
|---|
| 55 | * SW7405-5146: Allow NULL arguments in NEXUS_Ccir656Input_Open |
|---|
| 56 | * |
|---|
| 57 | * 2 3/27/09 2:36p erickson |
|---|
| 58 | * PR53453: add 656 vbi support |
|---|
| 59 | * |
|---|
| 60 | * 1 6/11/08 12:44p vsilyaev |
|---|
| 61 | * PR 43491: Added support for CCIR-656 input |
|---|
| 62 | * |
|---|
| 63 | * |
|---|
| 64 | **************************************************************************/ |
|---|
| 65 | #ifndef NEXUS_CCIR656_INPUT_H__ |
|---|
| 66 | #define NEXUS_CCIR656_INPUT_H__ |
|---|
| 67 | |
|---|
| 68 | #include "nexus_types.h" |
|---|
| 69 | #include "nexus_display_types.h" |
|---|
| 70 | |
|---|
| 71 | #ifdef __cplusplus |
|---|
| 72 | extern "C" { |
|---|
| 73 | #endif |
|---|
| 74 | |
|---|
| 75 | /** |
|---|
| 76 | Summary: |
|---|
| 77 | The supported methods for encapsulating VBI data into ITU-R 656 bitstreams |
|---|
| 78 | **/ |
|---|
| 79 | typedef enum NEXUS_Ccir656VbiFormat |
|---|
| 80 | { |
|---|
| 81 | NEXUS_Ccir656VbiFormat_eSaa7113 = 0, |
|---|
| 82 | NEXUS_Ccir656VbiFormat_eModifiedSaa7113, |
|---|
| 83 | NEXUS_Ccir656VbiFormat_eSaa7114, |
|---|
| 84 | NEXUS_Ccir656VbiFormat_eSaa7114A, |
|---|
| 85 | NEXUS_Ccir656VbiFormat_eSaa7114B, |
|---|
| 86 | NEXUS_Ccir656VbiFormat_eSaa7114C, |
|---|
| 87 | NEXUS_Ccir656VbiFormat_eSaa7115, |
|---|
| 88 | NEXUS_Ccir656VbiFormat_eSmpte291, |
|---|
| 89 | NEXUS_Ccir656VbiFormat_eMax |
|---|
| 90 | } NEXUS_Ccir656VbiFormat; |
|---|
| 91 | |
|---|
| 92 | |
|---|
| 93 | /** |
|---|
| 94 | Summary: |
|---|
| 95 | Settings for Ccir656Input input |
|---|
| 96 | **/ |
|---|
| 97 | typedef struct NEXUS_Ccir656InputSettings { |
|---|
| 98 | NEXUS_VideoFormat format; /* If autoFormatMode is false, format will be set as the video format. */ |
|---|
| 99 | struct { |
|---|
| 100 | NEXUS_Ccir656VbiFormat format; |
|---|
| 101 | unsigned bufferSize; /* Size of 656 ancillary ring buffer in bytes. Default is zero. |
|---|
| 102 | You will also need to set NEXUS_DisplayModuleSettings.vbi.ccir656InputBufferSize. */ |
|---|
| 103 | bool longHeader; /* If true, then incomping SMPTE 291M packets are expected to have the three |
|---|
| 104 | byte "component stream" header 00 FF FF. Otherwise, packets are expected to have |
|---|
| 105 | the one byte "composite stream" header FF. Default is false. */ |
|---|
| 106 | bool brokenDataCount; /* If true, then the incoming SMPTE 291M packets are expected to be in the |
|---|
| 107 | historical, incorrect format produced by Broadcom ITU-R 656 encoders. In particular, |
|---|
| 108 | the packet DATA COUNT field counts bytes instead of DWORDs, and the accompanying |
|---|
| 109 | parity bits are not present. Default is true. */ |
|---|
| 110 | NEXUS_CallbackDesc dataReady; |
|---|
| 111 | } vbi; |
|---|
| 112 | } NEXUS_Ccir656InputSettings; |
|---|
| 113 | |
|---|
| 114 | /** |
|---|
| 115 | Summary: |
|---|
| 116 | Handle for the Ccir656 input interface |
|---|
| 117 | **/ |
|---|
| 118 | typedef struct NEXUS_Ccir656Input *NEXUS_Ccir656InputHandle; |
|---|
| 119 | |
|---|
| 120 | /** |
|---|
| 121 | Summary: |
|---|
| 122 | Get default settings for the structure. |
|---|
| 123 | |
|---|
| 124 | Description: |
|---|
| 125 | This is required in order to make application code resilient to the addition of new strucutre members in the future. |
|---|
| 126 | **/ |
|---|
| 127 | void NEXUS_Ccir656Input_GetDefaultSettings( |
|---|
| 128 | NEXUS_Ccir656InputSettings *pSettings /* [out] */ |
|---|
| 129 | ); |
|---|
| 130 | |
|---|
| 131 | /** |
|---|
| 132 | Summary: |
|---|
| 133 | Open a new Ccir656 Input. |
|---|
| 134 | |
|---|
| 135 | **/ |
|---|
| 136 | NEXUS_Ccir656InputHandle NEXUS_Ccir656Input_Open( /* attr{destructor=NEXUS_Ccir656Input_Close} */ |
|---|
| 137 | unsigned index, |
|---|
| 138 | const NEXUS_Ccir656InputSettings *pSettings /* attr{null_allowed=y} */ |
|---|
| 139 | ); |
|---|
| 140 | |
|---|
| 141 | /** |
|---|
| 142 | Summary: |
|---|
| 143 | Close a Ccir656 Input. |
|---|
| 144 | **/ |
|---|
| 145 | void NEXUS_Ccir656Input_Close( |
|---|
| 146 | NEXUS_Ccir656InputHandle ccir656Input |
|---|
| 147 | ); |
|---|
| 148 | |
|---|
| 149 | /** |
|---|
| 150 | Summary: |
|---|
| 151 | This function is used to get current configuration |
|---|
| 152 | **/ |
|---|
| 153 | void NEXUS_Ccir656Input_GetSettings( |
|---|
| 154 | NEXUS_Ccir656InputHandle ccir656Input, |
|---|
| 155 | NEXUS_Ccir656InputSettings *pSettings /* [out] */ |
|---|
| 156 | ); |
|---|
| 157 | |
|---|
| 158 | /** |
|---|
| 159 | Summary: |
|---|
| 160 | This function is used to set new configuration |
|---|
| 161 | **/ |
|---|
| 162 | NEXUS_Error NEXUS_Ccir656Input_SetSettings( |
|---|
| 163 | NEXUS_Ccir656InputHandle ccir656Input, |
|---|
| 164 | const NEXUS_Ccir656InputSettings *pSettings |
|---|
| 165 | ); |
|---|
| 166 | |
|---|
| 167 | /** |
|---|
| 168 | Summary: |
|---|
| 169 | Returns the abstract NEXUS_VideoInput connector for the video input. |
|---|
| 170 | This connector is passed to an NEXUS_AnalogVideoDecoder to digitize the analog video. |
|---|
| 171 | |
|---|
| 172 | Description: |
|---|
| 173 | Assign to NEXUS_AnalogVideoDecoderSettings.videoInput |
|---|
| 174 | **/ |
|---|
| 175 | NEXUS_VideoInput NEXUS_Ccir656Input_GetConnector( |
|---|
| 176 | NEXUS_Ccir656InputHandle ccir656Input |
|---|
| 177 | ); |
|---|
| 178 | |
|---|
| 179 | /** |
|---|
| 180 | Summary: |
|---|
| 181 | Header for 656 ancillary data packets in the ring buffer |
|---|
| 182 | **/ |
|---|
| 183 | typedef struct NEXUS_Ccir656InputVbiHeader |
|---|
| 184 | { |
|---|
| 185 | bool topField; |
|---|
| 186 | uint8_t dataId; |
|---|
| 187 | uint8_t secondId; |
|---|
| 188 | unsigned payload; /* size of payload following this header in bytes */ |
|---|
| 189 | } NEXUS_Ccir656InputVbiHeader; |
|---|
| 190 | |
|---|
| 191 | /** |
|---|
| 192 | Summary: |
|---|
| 193 | Get pointer to data in the 656 ancillary data ring buffer |
|---|
| 194 | |
|---|
| 195 | Description: |
|---|
| 196 | The application is responsible for parsing the header and the payload correctly. |
|---|
| 197 | Nexus will always atomically add a header plus all of its payload. |
|---|
| 198 | Application must handle wrap around. Wraparound could occur in the header or in the payload. |
|---|
| 199 | **/ |
|---|
| 200 | NEXUS_Error NEXUS_Ccir656Input_GetBuffer( |
|---|
| 201 | NEXUS_Ccir656InputHandle ccir656Input, |
|---|
| 202 | void **pBuffer, /* [out] attr{memory=cached} pointer to data. size of data determined by size. */ |
|---|
| 203 | unsigned *pSize /* [out] */ |
|---|
| 204 | ); |
|---|
| 205 | |
|---|
| 206 | /** |
|---|
| 207 | Summary: |
|---|
| 208 | Update amount consumed from last NEXUS_Ccir656Input_GetBuffer call. |
|---|
| 209 | **/ |
|---|
| 210 | NEXUS_Error NEXUS_Ccir656Input_ReadComplete( |
|---|
| 211 | NEXUS_Ccir656InputHandle ccir656Input, |
|---|
| 212 | unsigned sizeConsumed |
|---|
| 213 | ); |
|---|
| 214 | |
|---|
| 215 | /** |
|---|
| 216 | Summary: |
|---|
| 217 | Flush 656 ancillary data ring buffer |
|---|
| 218 | **/ |
|---|
| 219 | void NEXUS_Ccir656Input_Flush( |
|---|
| 220 | NEXUS_Ccir656InputHandle ccir656Input |
|---|
| 221 | ); |
|---|
| 222 | |
|---|
| 223 | #ifdef __cplusplus |
|---|
| 224 | } |
|---|
| 225 | #endif |
|---|
| 226 | |
|---|
| 227 | #endif /* NEXUS_CCIR656_INPUT_H__ */ |
|---|
| 228 | |
|---|