| 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: bxpt_pcr.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/7 $ |
|---|
| 12 | * $brcm_Date: 9/12/11 4:36p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/portinginterface/xpt/base2/bxpt_pcr.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/7 9/12/11 4:36p gmullen |
|---|
| 21 | * SW7344-193: Merged changes to Hydra |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/SW7344-193/1 9/7/11 4:34p gmullen |
|---|
| 24 | * SW7344-193: Added tri-state logic to jitter API |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/6 8/22/11 5:45p gmullen |
|---|
| 27 | * SW7231-319: Merged to Hydra branch |
|---|
| 28 | * |
|---|
| 29 | * Hydra_Software_Devel/SW7231-319/1 8/16/11 2:15p gmullen |
|---|
| 30 | * SW7231-319: Initial support for B0 |
|---|
| 31 | * |
|---|
| 32 | * Hydra_Software_Devel/5 5/16/11 4:58p gmullen |
|---|
| 33 | * SW7408-284: Added support for jitter adjust in PCR hw to PI |
|---|
| 34 | * |
|---|
| 35 | * Hydra_Software_Devel/4 11/8/10 4:02p gmullen |
|---|
| 36 | * SW7422-20: PI can now generate the required INT IDs |
|---|
| 37 | * |
|---|
| 38 | * Hydra_Software_Devel/3 10/27/10 2:08p gmullen |
|---|
| 39 | * SW7422-20: Added BXPT_PCR_TimeRef_eHD_DVI_H1 and |
|---|
| 40 | * BXPT_PCR_TimeRef_eHD_DVI_V1 as placeholders |
|---|
| 41 | * |
|---|
| 42 | * Hydra_Software_Devel/2 10/27/10 12:03p gmullen |
|---|
| 43 | * SW7422-20: Ported to 7422 |
|---|
| 44 | * |
|---|
| 45 | * Hydra_Software_Devel/1 10/25/10 2:09p gmullen |
|---|
| 46 | * SW7425-15: Moved srcs to base2 folder |
|---|
| 47 | * |
|---|
| 48 | * Hydra_Software_Devel/1 10/8/10 2:57p gmullen |
|---|
| 49 | * SW7425-15: Added header files |
|---|
| 50 | * |
|---|
| 51 | * Hydra_Software_Devel/20 9/2/10 10:26a gmullen |
|---|
| 52 | * SW35230-2: Fixed incorrect timebase mapping in enum |
|---|
| 53 | * |
|---|
| 54 | * Hydra_Software_Devel/19 11/18/09 2:38p gmullen |
|---|
| 55 | * SW35230-2: eHD_DVI_V0/V1 is supported on the 35230 |
|---|
| 56 | * |
|---|
| 57 | * Hydra_Software_Devel/18 6/17/09 6:46p gmullen |
|---|
| 58 | * PR56110: Added support.xpt/7550/uif_image/a0 |
|---|
| 59 | * |
|---|
| 60 | * Hydra_Software_Devel/17 5/11/09 5:11p piyushg |
|---|
| 61 | * PR53746: Added xpt interface for retrieving phase error at isr time |
|---|
| 62 | * BXPT_PCR_GetPhaseError_isr(). |
|---|
| 63 | * |
|---|
| 64 | * Hydra_Software_Devel/16 4/7/09 5:25p piyushg |
|---|
| 65 | * PR52986: Add support for 7635 |
|---|
| 66 | * Added directory element "7635". |
|---|
| 67 | * |
|---|
| 68 | * Hydra_Software_Devel/15 11/26/08 4:14p gmullen |
|---|
| 69 | * PR47755: Added support for 7420. |
|---|
| 70 | * |
|---|
| 71 | * Hydra_Software_Devel/14 11/10/08 9:07a gmullen |
|---|
| 72 | * PR48128: Added playback support for 7325/7335. Removed redundant code. |
|---|
| 73 | * |
|---|
| 74 | * Hydra_Software_Devel/13 9/12/08 2:21p gmullen |
|---|
| 75 | * PR46659: Added 3556/3548 B0 support |
|---|
| 76 | * |
|---|
| 77 | * Hydra_Software_Devel/12 9/12/08 11:27a gmullen |
|---|
| 78 | * PR46659: Added B0 support |
|---|
| 79 | * |
|---|
| 80 | * Hydra_Software_Devel/11 8/8/08 5:47p gmullen |
|---|
| 81 | * PR45362: Merged SanJose_CDI_Devel changes to Hydra_Software_Devel |
|---|
| 82 | * |
|---|
| 83 | * Hydra_Software_Devel/10 4/10/08 3:36p gmullen |
|---|
| 84 | * PR38954: Updated number of playbacks, added HDDVI support to PCR API, |
|---|
| 85 | * and added packetizer support. |
|---|
| 86 | * |
|---|
| 87 | * Hydra_Software_Devel/9 2/5/08 8:19a gmullen |
|---|
| 88 | * PR39329: Added ISR version of GetLastPcr. |
|---|
| 89 | * |
|---|
| 90 | * Hydra_Software_Devel/8 8/15/07 4:56p gmullen |
|---|
| 91 | * PR34082: Removed incorrect comment from description of |
|---|
| 92 | * BXPT_PCR_XptStreamPcrCfg |
|---|
| 93 | * |
|---|
| 94 | * Hydra_Software_Devel/7 8/15/07 4:52p gmullen |
|---|
| 95 | * PR34082: Added filter coefficients to BXPT_PCR_XptStreamPcrCfg struct. |
|---|
| 96 | * |
|---|
| 97 | * Hydra_Software_Devel/6 7/18/07 1:38p gmullen |
|---|
| 98 | * PR33106: Added BXPT_PCR_SetCenterFrequency() |
|---|
| 99 | * |
|---|
| 100 | * Hydra_Software_Devel/5 11/10/06 5:47p katrep |
|---|
| 101 | * PR25737: Added BXPT_PCR_SetTimeRefTrackRange API. |
|---|
| 102 | * |
|---|
| 103 | * Hydra_Software_Devel/4 8/18/06 10:13a gmullen |
|---|
| 104 | * PR23345: Added MaxPcrError to Get/SetSettings calls. |
|---|
| 105 | * |
|---|
| 106 | * Hydra_Software_Devel/3 8/8/06 6:36p gmullen |
|---|
| 107 | * PR15309: Added proto for BXPT_PCR_GetTimeBaseFreqRefDefaults |
|---|
| 108 | * |
|---|
| 109 | * Hydra_Software_Devel/2 8/2/06 3:56p gmullen |
|---|
| 110 | * PR23137: Added support for playback data to PCR block. |
|---|
| 111 | * |
|---|
| 112 | * Hydra_Software_Devel/3 9/26/05 4:40p gmullen |
|---|
| 113 | * PR15309: Removed support for loading user STCs. That support is now in |
|---|
| 114 | * bxpt_pcr_offset.c |
|---|
| 115 | * |
|---|
| 116 | * Hydra_Software_Devel/2 8/4/05 8:14a gmullen |
|---|
| 117 | * PR15309: Added PCR support. |
|---|
| 118 | * |
|---|
| 119 | * Hydra_Software_Devel/1 5/13/05 1:27p gmullen |
|---|
| 120 | * PR15309: First draft of XPT PI. |
|---|
| 121 | * |
|---|
| 122 | ***************************************************************************/ |
|---|
| 123 | |
|---|
| 124 | #ifndef BXPT_PCR_H__ |
|---|
| 125 | #define BXPT_PCR_H__ |
|---|
| 126 | |
|---|
| 127 | #include "bxpt.h" |
|---|
| 128 | #include "bchp_xpt_dpcr0.h" |
|---|
| 129 | |
|---|
| 130 | #ifdef __cplusplus |
|---|
| 131 | extern "C"{ |
|---|
| 132 | #endif |
|---|
| 133 | |
|---|
| 134 | /*=************************ Module Overview ******************************** |
|---|
| 135 | <verbatim> |
|---|
| 136 | Overview: |
|---|
| 137 | </verbatim> |
|---|
| 138 | ***************************************************************************/ |
|---|
| 139 | |
|---|
| 140 | /*************************************************************************** |
|---|
| 141 | Summary: |
|---|
| 142 | The opaque handle for a PCR module. |
|---|
| 143 | Description: |
|---|
| 144 | This structure represents the PCR handle. It is created at BXPT_PCR_Open |
|---|
| 145 | ***************************************************************************/ |
|---|
| 146 | typedef struct BXPT_P_PcrHandle_Impl *BXPT_PCR_Handle; |
|---|
| 147 | |
|---|
| 148 | /*************************************************************************** |
|---|
| 149 | Summary: |
|---|
| 150 | Time base frequency reference control configuration. It is for non-transport |
|---|
| 151 | timebase reference. |
|---|
| 152 | Description: |
|---|
| 153 | The members in the structure controls the frequency of a timebase reference. |
|---|
| 154 | It appies to analog references and the internal reference. This is not for |
|---|
| 155 | timebase pulse frequency which is controlled in rate managers of different |
|---|
| 156 | hardware blocks. |
|---|
| 157 | ***************************************************************************/ |
|---|
| 158 | typedef struct BXPT_PCR_TimebaseFreqRefConfig |
|---|
| 159 | { |
|---|
| 160 | uint32_t Prescale; /* frequency control parm*/ |
|---|
| 161 | uint32_t Inc; /* frequency control parm*/ |
|---|
| 162 | uint8_t FiltA; /* integrator leak. */ |
|---|
| 163 | uint8_t FiltB; /* loop gain. */ |
|---|
| 164 | uint8_t FiltC; /* direct path gain. */ |
|---|
| 165 | } |
|---|
| 166 | BXPT_PCR_TimebaseFreqRefConfig; |
|---|
| 167 | |
|---|
| 168 | /*************************************************************************** |
|---|
| 169 | Summary: |
|---|
| 170 | Different format for the packet timestamps supported by the PCR block. |
|---|
| 171 | ***************************************************************************/ |
|---|
| 172 | typedef enum |
|---|
| 173 | { |
|---|
| 174 | BXPT_PCR_JitterTimestampMode_e32 = 0, /* 32 bit timestamp */ |
|---|
| 175 | BXPT_PCR_JitterTimestampMode_e28_4P = 1, /* 28 bit timestamp with 4 bit parity.*/ |
|---|
| 176 | BXPT_PCR_JitterTimestampMode_e30_2U = 2, /* 30 bit timstamp with 2 user bits. */ |
|---|
| 177 | BXPT_PCR_JitterTimestampMode_eAuto, /* Do not change the current (global) setting. */ |
|---|
| 178 | BXPT_PCR_JitterTimestampMode_eMax |
|---|
| 179 | } |
|---|
| 180 | BXPT_PCR_JitterTimestampMode; |
|---|
| 181 | |
|---|
| 182 | /*************************************************************************** |
|---|
| 183 | Summary: |
|---|
| 184 | ***************************************************************************/ |
|---|
| 185 | typedef enum |
|---|
| 186 | { |
|---|
| 187 | BXPT_PCR_JitterCorrection_eEnable = 0, |
|---|
| 188 | BXPT_PCR_JitterCorrection_eDisable = 1, |
|---|
| 189 | BXPT_PCR_JitterCorrection_eAuto, /* Do not change the current (global) setting. */ |
|---|
| 190 | BXPT_PCR_JitterCorrection_eMax |
|---|
| 191 | } |
|---|
| 192 | BXPT_PCR_JitterCorrection; |
|---|
| 193 | |
|---|
| 194 | /*************************************************************************** |
|---|
| 195 | Summary: |
|---|
| 196 | Configuration for PCR module when transport stream is timebase reference. |
|---|
| 197 | |
|---|
| 198 | Description: |
|---|
| 199 | This structure covers pcr pid, stream source, PcrSendEn, and sendmode |
|---|
| 200 | configurations when locking to a transport stream. |
|---|
| 201 | |
|---|
| 202 | If jitter adjust is enabled, the jitter adjustment block is supposed to be |
|---|
| 203 | programmed to match with the Playback timestamp format (i.e. 32-bit, 28-bit |
|---|
| 204 | or 30-bit formats). This tells the jitter calculation hardware whether to use |
|---|
| 205 | all 32-bits of the timestamp, or to ignore the upper 4 bits of the timestamp |
|---|
| 206 | (4-bit parity + 28-bit, or 2-bit User + 30-bit). The 32-bit support in the |
|---|
| 207 | DPCR is for both binary and Mod-300. The hardware uses the Packet type (MPEG |
|---|
| 208 | or 130 byte) to decide whether timestamp mode is Mod-300 or binary. |
|---|
| 209 | |
|---|
| 210 | NOTE!! that timestamp mode and PCR type must match for jitter calculation to |
|---|
| 211 | work correctly, i.e. if it is MPEG stream with PCRs then the timestamps must |
|---|
| 212 | also be Mod-300. This means we can't use jitter adjustment for MPEG stream |
|---|
| 213 | with PCRs but with binary/DLNA timestamps. |
|---|
| 214 | ***************************************************************************/ |
|---|
| 215 | typedef struct BXPT_PCR_XptStreamPcrCfg |
|---|
| 216 | { |
|---|
| 217 | uint32_t PidChannel; /* PCR PID channel */ |
|---|
| 218 | uint32_t MaxPcrError; /* Maximum PCR error thredhold*/ |
|---|
| 219 | |
|---|
| 220 | /* |
|---|
| 221 | ** Note: these params are unique in that the hw setting is *global* to all bxpt_pcr instances. |
|---|
| 222 | ** Thus, changing one param here will affect other blocks. This isn't a problem in the usage |
|---|
| 223 | ** cases the hw engineers know about, but it requires some care by sw. These params are |
|---|
| 224 | ** tri-state, as follows. _eAuto should be selected, unless the user knows this block must |
|---|
| 225 | ** have a unique setting. At some point in the future, these params may no longer be global. |
|---|
| 226 | ** |
|---|
| 227 | ** The tri-state values are: |
|---|
| 228 | ** _eAuto - Do not change the existing global setting. |
|---|
| 229 | ** _eEnable or _eDisable for PbJitterDisable and LiveJitterDisable. |
|---|
| 230 | ** _e32, etc for JitterTimestamp. |
|---|
| 231 | */ |
|---|
| 232 | BXPT_PCR_JitterTimestampMode JitterTimestamp; |
|---|
| 233 | BXPT_PCR_JitterCorrection PbJitterDisable; |
|---|
| 234 | BXPT_PCR_JitterCorrection LiveJitterDisable; |
|---|
| 235 | |
|---|
| 236 | BXPT_PCR_TimebaseFreqRefConfig TimebaseCfg; /* Customized filter coefficients. */ |
|---|
| 237 | } |
|---|
| 238 | BXPT_PCR_XptStreamPcrCfg; |
|---|
| 239 | |
|---|
| 240 | /*************************************************************************** |
|---|
| 241 | Summary: |
|---|
| 242 | Configurations for modifying the rate of the STC extension counter. |
|---|
| 243 | Description: |
|---|
| 244 | The members in the structure sets the rate control of STC extension. |
|---|
| 245 | ***************************************************************************/ |
|---|
| 246 | typedef struct BXPT_PCR_STCExtRateConfig |
|---|
| 247 | { |
|---|
| 248 | uint32_t Prescale; /* frequency control parm*/ |
|---|
| 249 | uint32_t Inc; /* frequency control parm*/ |
|---|
| 250 | } |
|---|
| 251 | BXPT_PCR_STCExtRateConfig; |
|---|
| 252 | |
|---|
| 253 | /*************************************************************************** |
|---|
| 254 | Summary: |
|---|
| 255 | Timebase references for all the sources that a timebase can lock to. |
|---|
| 256 | Description: |
|---|
| 257 | This enum represents all the time references that timebase |
|---|
| 258 | may lock to. |
|---|
| 259 | ***************************************************************************/ |
|---|
| 260 | typedef enum BXPT_PCR_TimeRef |
|---|
| 261 | { |
|---|
| 262 | BXPT_PCR_TimeRef_eI656_Hl = 3, /* Lock to Hsync from ITU656 input 0 */ |
|---|
| 263 | BXPT_PCR_TimeRef_eI656_Vl = 4, /* Lock to Vsync from ITU656 input 0 */ |
|---|
| 264 | BXPT_PCR_TimeRef_eI656_Fl = 5, /* Lock to Fsync from ITU656 input 0 */ |
|---|
| 265 | BXPT_PCR_TimeRef_eI2S0 = 6, /* Lock to I2S input #0 */ |
|---|
| 266 | BXPT_PCR_TimeRef_eHD_DVI_H0 = 11, /* Hsync from HD DVI input 0 */ |
|---|
| 267 | BXPT_PCR_TimeRef_eHD_DVI_V0 = 12, /* Vsync from HD DVI input 0 */ |
|---|
| 268 | BXPT_PCR_TimeRef_eInternal = 14, /* Lock to Internal Reference which has a period of 16384 cycles at 27MHz */ |
|---|
| 269 | BXPT_PCR_TimeRef_eXpt = 15, /* Lock to transport PCR values */ |
|---|
| 270 | |
|---|
| 271 | /* Not available on all chips. Check your hw docs. */ |
|---|
| 272 | BXPT_PCR_TimeRef_eSPDIF = 18, /* SPDIF input 1 */ |
|---|
| 273 | BXPT_PCR_TimeRef_eMaiIn = 19, /* Frame Sync from DVP_HR */ |
|---|
| 274 | |
|---|
| 275 | BXPT_PCR_TimeRef_eMax = 100, /* Max value, marks the end of the supported inputs. */ |
|---|
| 276 | |
|---|
| 277 | /* These are placeholders, in case hw for HD DVI input 1 is added in the future. */ |
|---|
| 278 | BXPT_PCR_TimeRef_eHD_DVI_H1 = 101, /* Hsync from HD DVI input 1 */ |
|---|
| 279 | BXPT_PCR_TimeRef_eHD_DVI_V1 = 102 /* Vsync from HD DVI input 1 */ |
|---|
| 280 | } |
|---|
| 281 | BXPT_PCR_TimeRef; |
|---|
| 282 | |
|---|
| 283 | /*************************************************************************** |
|---|
| 284 | Summary: |
|---|
| 285 | Timebase references possible track Range values |
|---|
| 286 | Description: |
|---|
| 287 | ***************************************************************************/ |
|---|
| 288 | typedef enum BXPT_PCR_RefTrackRange |
|---|
| 289 | { |
|---|
| 290 | BXPT_PCR_TrackRange_PPM_8 = 0, |
|---|
| 291 | BXPT_PCR_TrackRange_PPM_15, |
|---|
| 292 | BXPT_PCR_TrackRange_PPM_30, |
|---|
| 293 | BXPT_PCR_TrackRange_PPM_61, |
|---|
| 294 | BXPT_PCR_TrackRange_PPM_122, |
|---|
| 295 | BXPT_PCR_TrackRange_PPM_244 |
|---|
| 296 | |
|---|
| 297 | }BXPT_PCR_RefTrackRange; |
|---|
| 298 | |
|---|
| 299 | /*************************************************************************** |
|---|
| 300 | Summary: |
|---|
| 301 | Valid error clamping ranges for the phase error input. |
|---|
| 302 | ***************************************************************************/ |
|---|
| 303 | typedef enum BXPT_PCR_PhaseErrorClampRange |
|---|
| 304 | { |
|---|
| 305 | BXPT_PCR_PhaseErrorClampRange_e22_8mS = 5, /* +/- 22.8 mS */ |
|---|
| 306 | BXPT_PCR_PhaseErrorClampRange_e11_4mS = 4, /* +/- 11.4 mS */ |
|---|
| 307 | BXPT_PCR_PhaseErrorClampRange_e5_7mS = 3, /* +/- 5.7 mS */ |
|---|
| 308 | BXPT_PCR_PhaseErrorClampRange_e2_8mS = 2, /* +/- 2.8 mS */ |
|---|
| 309 | BXPT_PCR_PhaseErrorClampRange_e1_4mS = 1, /* +/- 1.4 mS */ |
|---|
| 310 | BXPT_PCR_PhaseErrorClampRange_e0_7mS = 0 /* +/- -0.7 mS */ |
|---|
| 311 | } |
|---|
| 312 | BXPT_PCR_PhaseErrorClampRange; |
|---|
| 313 | |
|---|
| 314 | |
|---|
| 315 | /*************************************************************************** |
|---|
| 316 | Summary: |
|---|
| 317 | Defaultsettings PCR modules |
|---|
| 318 | Description: |
|---|
| 319 | This structure represents the default settings for a pcr module. |
|---|
| 320 | ***************************************************************************/ |
|---|
| 321 | typedef struct BXPT_PCR_DefSettings |
|---|
| 322 | { |
|---|
| 323 | uint32_t MaxPcrError; /* Maximum PCR error thredhold*/ |
|---|
| 324 | bool PcrTwoErrReaquireEn; /* control of re-acquisition of PCR when TWO_PCR_ERROR occurs */ |
|---|
| 325 | } |
|---|
| 326 | BXPT_PCR_DefSettings; |
|---|
| 327 | |
|---|
| 328 | /*************************************************************************** |
|---|
| 329 | Summary: |
|---|
| 330 | Return the number of Pcr channels. |
|---|
| 331 | Description: |
|---|
| 332 | This function returns the number of pcr channels supported. |
|---|
| 333 | Returns: |
|---|
| 334 | BERR_SUCCESS - returns the number of Pcr channel. |
|---|
| 335 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 336 | ****************************************************************************/ |
|---|
| 337 | BERR_Code BXPT_PCR_GetTotalChannels( |
|---|
| 338 | BXPT_Handle hXpt, /* [in] The transport handle */ |
|---|
| 339 | unsigned int *TotalChannels /* [out] The number of Pcr channels. */ |
|---|
| 340 | ); |
|---|
| 341 | |
|---|
| 342 | /*************************************************************************** |
|---|
| 343 | Summary: |
|---|
| 344 | Returns the Pcr channel default settings. |
|---|
| 345 | |
|---|
| 346 | Description: |
|---|
| 347 | This function gets the default settings for a given channel and places |
|---|
| 348 | them in a structure. The default settings shall be retrieved and changed |
|---|
| 349 | before channel openings. The values are set at channel openings. |
|---|
| 350 | Returns: |
|---|
| 351 | BERR_SUCCESS - Retrieved Pcr defaults. |
|---|
| 352 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 353 | ****************************************************************************/ |
|---|
| 354 | BERR_Code BXPT_PCR_GetChannelDefSettings( |
|---|
| 355 | BXPT_Handle hXpt, /* [in] The transport handle - need chip info */ |
|---|
| 356 | unsigned int WhichPcr, /* [in] Which pcr module */ |
|---|
| 357 | BXPT_PCR_DefSettings *pcrSettings /* [out] The default settings of a pcr module */ |
|---|
| 358 | ); |
|---|
| 359 | |
|---|
| 360 | /*************************************************************************** |
|---|
| 361 | Summary: |
|---|
| 362 | Open a Pcr channel for a given PCR module |
|---|
| 363 | Description: |
|---|
| 364 | This functions obtains a PCR handle. Sets default settings, |
|---|
| 365 | enable the PCR_TWO_ERROR interrupt. |
|---|
| 366 | Returns: |
|---|
| 367 | BERR_SUCCESS - if successful |
|---|
| 368 | BERR_OUT_OF_DEVICE_MEMORY - Memory failure (should not happen) |
|---|
| 369 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 370 | ***************************************************************************/ |
|---|
| 371 | BERR_Code BXPT_PCR_Open( |
|---|
| 372 | BXPT_Handle hXpt, /* [in] The transport handle*/ |
|---|
| 373 | unsigned int WhichPcr, /* [in] Which pcr module */ |
|---|
| 374 | BXPT_PCR_DefSettings *pcrSettings, /* [in] The default setting */ |
|---|
| 375 | BXPT_PCR_Handle *hPcr /* [out] The pcr handle */ |
|---|
| 376 | ); |
|---|
| 377 | |
|---|
| 378 | /*************************************************************************** |
|---|
| 379 | Summary: |
|---|
| 380 | Close a Pcr channel. |
|---|
| 381 | Description: |
|---|
| 382 | This function closes the pcr channel by disabling PCR and sets back to |
|---|
| 383 | default settings. |
|---|
| 384 | Returns: |
|---|
| 385 | BERR_SUCCESS - if successful |
|---|
| 386 | BERR_OUT_OF_DEVICE_MEMORY - Memory failure (should not happen) |
|---|
| 387 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 388 | ***************************************************************************/ |
|---|
| 389 | BERR_Code BXPT_PCR_Close( |
|---|
| 390 | BXPT_PCR_Handle hPcr /* [in] The pcr handle */ |
|---|
| 391 | ); |
|---|
| 392 | |
|---|
| 393 | /*************************************************************************** |
|---|
| 394 | Summary: |
|---|
| 395 | Gets PCR configuration when PCR is locking to a transport stream |
|---|
| 396 | Description: |
|---|
| 397 | This functions gets the current setting of the PCR configuration. It includes |
|---|
| 398 | PCR Pid, stream source, SEND_EN, and send mode for Video. |
|---|
| 399 | Returns: |
|---|
| 400 | BERR_SUCCESS - if successful |
|---|
| 401 | BERR_OUT_OF_DEVICE_MEMORY - Memory failure (should not happen) |
|---|
| 402 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 403 | ***************************************************************************/ |
|---|
| 404 | BERR_Code BXPT_PCR_GetStreamPcrConfig( |
|---|
| 405 | BXPT_PCR_Handle hPcr, /* [in] The pcr handle */ |
|---|
| 406 | BXPT_PCR_XptStreamPcrCfg *PcrCfg /* [out] Transport source configuration */ |
|---|
| 407 | ); |
|---|
| 408 | |
|---|
| 409 | /*************************************************************************** |
|---|
| 410 | Summary: |
|---|
| 411 | Sets PCR configuration when PCR is locking to a transport stream |
|---|
| 412 | |
|---|
| 413 | Description: |
|---|
| 414 | This functions sets Pids, stream source, SEND_EN and timebase reference to |
|---|
| 415 | transport stream and puts the PCR module into acqusition mode. |
|---|
| 416 | |
|---|
| 417 | For 7401B0 and later devices, the PCR block can accept data from |
|---|
| 418 | playback channels by setting PcrCfg->eStreamSelect = BXPT_DataSource_ePlayback |
|---|
| 419 | |
|---|
| 420 | Returns: |
|---|
| 421 | BERR_SUCCESS - if successful |
|---|
| 422 | BERR_OUT_OF_DEVICE_MEMORY - Memory failure (should not happen) |
|---|
| 423 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 424 | ***************************************************************************/ |
|---|
| 425 | BERR_Code BXPT_PCR_SetStreamPcrConfig( |
|---|
| 426 | BXPT_PCR_Handle hPcr, /* [in] The pcr handle */ |
|---|
| 427 | const BXPT_PCR_XptStreamPcrCfg *PcrCfg /* [in] Transport source configuration */ |
|---|
| 428 | ); |
|---|
| 429 | |
|---|
| 430 | /*************************************************************************** |
|---|
| 431 | Summary: |
|---|
| 432 | Sets PCR configuration when PCR is locking to a transport stream. This |
|---|
| 433 | function is only be to used from within an ISR. |
|---|
| 434 | |
|---|
| 435 | Description: |
|---|
| 436 | This functions sets Pids, stream source, SEND_EN and timebase reference to |
|---|
| 437 | transport stream and puts the PCR module into acqusition mode. |
|---|
| 438 | |
|---|
| 439 | For 7401B0 and later devices, the PCR block can accept data from |
|---|
| 440 | playback channels by setting PcrCfg->eStreamSelect = BXPT_DataSource_ePlayback |
|---|
| 441 | |
|---|
| 442 | Returns: |
|---|
| 443 | BERR_SUCCESS - if successful |
|---|
| 444 | BERR_OUT_OF_DEVICE_MEMORY - Memory failure (should not happen) |
|---|
| 445 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 446 | ***************************************************************************/ |
|---|
| 447 | BERR_Code BXPT_PCR_SetStreamPcrConfig_isr( |
|---|
| 448 | BXPT_PCR_Handle hPcr, /* [in] The pcr handle */ |
|---|
| 449 | const BXPT_PCR_XptStreamPcrCfg *PcrCfg /* [in] Transport source configuration */ |
|---|
| 450 | ); |
|---|
| 451 | |
|---|
| 452 | |
|---|
| 453 | /*************************************************************************** |
|---|
| 454 | Summary: |
|---|
| 455 | XPT interface for retrieving phase error at isr time |
|---|
| 456 | |
|---|
| 457 | Returns: |
|---|
| 458 | BERR_SUCCESS - if successful |
|---|
| 459 | ***************************************************************************/ |
|---|
| 460 | BERR_Code BXPT_PCR_GetPhaseError_isr( |
|---|
| 461 | BXPT_PCR_Handle hPcr, |
|---|
| 462 | int32_t *p_error |
|---|
| 463 | ); |
|---|
| 464 | |
|---|
| 465 | /*************************************************************************** |
|---|
| 466 | Summary: |
|---|
| 467 | controls modifying the rate of the STC extension counter. |
|---|
| 468 | Description: |
|---|
| 469 | This function configures the pre-scale and increment parameters of the |
|---|
| 470 | PCR STC EXT control register. The PCR_INC_VAL (M) and PCR_PRESCALE (N) |
|---|
| 471 | can be used to alter the rate of the STC counter to 27 MHz * M/(N+1). |
|---|
| 472 | For example, to run the STC counter at 18 MHz, (i.e. 2/3 of the normal rate), |
|---|
| 473 | program M=2 and N=2. |
|---|
| 474 | Returns: |
|---|
| 475 | BERR_SUCCESS - if successful |
|---|
| 476 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 477 | ***************************************************************************/ |
|---|
| 478 | BERR_Code BXPT_PCR_SetStcExtRateControl( |
|---|
| 479 | BXPT_PCR_Handle hPcr, /* [in] The pcr handle */ |
|---|
| 480 | const BXPT_PCR_STCExtRateConfig *StcExtRateCfg /* [in] Stc extension rate control configuration */ |
|---|
| 481 | ); |
|---|
| 482 | |
|---|
| 483 | /*************************************************************************** |
|---|
| 484 | Summary: |
|---|
| 485 | enables PCR processing on PCR_PID and puts PCR into an acquisition mode. |
|---|
| 486 | Description: |
|---|
| 487 | This function enables PCR processing on PCR_PID. Writing a "1" to Valid bit |
|---|
| 488 | also puts the PCR module into an acquisition mode. |
|---|
| 489 | Returns: |
|---|
| 490 | BERR_SUCCESS - if successful |
|---|
| 491 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 492 | ***************************************************************************/ |
|---|
| 493 | void BXPT_PCR_RefreshPcrPid( |
|---|
| 494 | BXPT_PCR_Handle hPcr /*[in] The pcr handle */ |
|---|
| 495 | ); |
|---|
| 496 | |
|---|
| 497 | /*************************************************************************** |
|---|
| 498 | Summary: |
|---|
| 499 | Gets the last PCR captured in last PCR Hi/Lo registers. |
|---|
| 500 | Description: |
|---|
| 501 | This function reads the values from PCR_LAST_PCR_HI/LO registers. |
|---|
| 502 | Returns: |
|---|
| 503 | BERR_SUCCESS - if successful |
|---|
| 504 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 505 | ***************************************************************************/ |
|---|
| 506 | BERR_Code BXPT_PCR_GetLastPcr( |
|---|
| 507 | BXPT_PCR_Handle hPcr, /* [in] The pcr handle */ |
|---|
| 508 | uint32_t *p_pcrHi, /* [out] Upper bits of PCR*/ |
|---|
| 509 | uint32_t *p_pcrLo /* [out] Bit9-LSB of base bit[0-8]-extension*/ |
|---|
| 510 | ); |
|---|
| 511 | |
|---|
| 512 | /*************************************************************************** |
|---|
| 513 | Summary: |
|---|
| 514 | ISR version of BXPT_PCR_GetLastPcr. |
|---|
| 515 | Description: |
|---|
| 516 | This function reads the values from PCR_LAST_PCR_HI/LO registers. It is |
|---|
| 517 | callable from within an ISR context. |
|---|
| 518 | Returns: |
|---|
| 519 | BERR_SUCCESS - if successful |
|---|
| 520 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 521 | ***************************************************************************/ |
|---|
| 522 | BERR_Code BXPT_PCR_GetLastPcr_isr( |
|---|
| 523 | BXPT_PCR_Handle hPcr, |
|---|
| 524 | uint32_t *p_pcrHi, |
|---|
| 525 | uint32_t *p_pcrLo |
|---|
| 526 | ); |
|---|
| 527 | |
|---|
| 528 | /*************************************************************************** |
|---|
| 529 | Summary: |
|---|
| 530 | Gets the STC counter values |
|---|
| 531 | Description: |
|---|
| 532 | This function read the PCR STC counters from STC_HI/LO registers |
|---|
| 533 | Returns: |
|---|
| 534 | BERR_SUCCESS - if successful |
|---|
| 535 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 536 | ***************************************************************************/ |
|---|
| 537 | BERR_Code BXPT_PCR_GetStc( |
|---|
| 538 | BXPT_PCR_Handle hPcr, /* [in] The pcr handle */ |
|---|
| 539 | uint32_t *p_stcHi, /* [out] Upper bits of STC*/ |
|---|
| 540 | uint32_t *p_stcLo /* [out] bit9-LSB of base bit[0-8]-extension*/ |
|---|
| 541 | ); |
|---|
| 542 | |
|---|
| 543 | /*************************************************************************** |
|---|
| 544 | Summary: |
|---|
| 545 | Sets non-transport source for a timebase reference and configures frequency |
|---|
| 546 | control for the reference. |
|---|
| 547 | Description: |
|---|
| 548 | This function sets a timebase locking to a non transport source and sets |
|---|
| 549 | the frequency control for the reference. It is recommanded to use |
|---|
| 550 | BXPT_PCR_GetfreqRefConfig before calling this function to preserve |
|---|
| 551 | the default values of frequency control if no intention to change the |
|---|
| 552 | frequency. |
|---|
| 553 | Returns: |
|---|
| 554 | BERR_SUCCESS - if successful |
|---|
| 555 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 556 | ***************************************************************************/ |
|---|
| 557 | BERR_Code BXPT_PCR_ConfigNonStreamTimeBase( |
|---|
| 558 | BXPT_PCR_Handle hPcr, /* [in] The pcr handle */ |
|---|
| 559 | BXPT_PCR_TimeRef eNonStreamTimeBaseCfg, /* [in] Non transport source configuration */ |
|---|
| 560 | BXPT_PCR_TimebaseFreqRefConfig *Timebasefreq /* [in] Non transport source frequency config */ |
|---|
| 561 | ); |
|---|
| 562 | |
|---|
| 563 | /*************************************************************************** |
|---|
| 564 | Summary: |
|---|
| 565 | Gets timebase reference frequency control. It is for non transport time |
|---|
| 566 | references. |
|---|
| 567 | Description: |
|---|
| 568 | This function gets the pre-scale and increment parameters of the |
|---|
| 569 | DPCR_REF_PCR control register. |
|---|
| 570 | Returns: |
|---|
| 571 | BERR_SUCCESS - if successful |
|---|
| 572 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 573 | ***************************************************************************/ |
|---|
| 574 | BERR_Code BXPT_PCR_GetfreqRefConfig( |
|---|
| 575 | BXPT_PCR_Handle hPcr, /* [in] The pcr handle */ |
|---|
| 576 | BXPT_PCR_TimebaseFreqRefConfig *TimebaseFreqConfig /* [out] Non transport source configuration */ |
|---|
| 577 | ); |
|---|
| 578 | |
|---|
| 579 | /*************************************************************************** |
|---|
| 580 | Summary: |
|---|
| 581 | Isr version of enabling PCR processing on PCR_PID and putting PCR into |
|---|
| 582 | an acquisition mode. |
|---|
| 583 | Description: |
|---|
| 584 | This function enables PCR processing on PCR_PID. Writing a "1" to Valid bit |
|---|
| 585 | also puts the PCR module into an acquisition mode. |
|---|
| 586 | Returns: |
|---|
| 587 | BERR_SUCCESS - if successful |
|---|
| 588 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 589 | ***************************************************************************/ |
|---|
| 590 | void BXPT_PCR_RefreshPcrPid_isr( |
|---|
| 591 | BXPT_PCR_Handle hPcr /*[in] The pcr handle */ |
|---|
| 592 | ); |
|---|
| 593 | |
|---|
| 594 | /*************************************************************************** |
|---|
| 595 | Summary: |
|---|
| 596 | Freeze integration loop. |
|---|
| 597 | |
|---|
| 598 | Description: |
|---|
| 599 | Stop loop tracking by freezing the integrator. Useful for cases like analog |
|---|
| 600 | decode. The integrator can be un-frozen by setting the Freeze argument to |
|---|
| 601 | false. |
|---|
| 602 | |
|---|
| 603 | Returns: |
|---|
| 604 | void |
|---|
| 605 | ***************************************************************************/ |
|---|
| 606 | void BXPT_PCR_FreezeIntegrator( |
|---|
| 607 | BXPT_PCR_Handle hPcr, /* [in] The pcr handle */ |
|---|
| 608 | bool Freeze /* [in] Freeze integrator if true, run if false. */ |
|---|
| 609 | ); |
|---|
| 610 | |
|---|
| 611 | /*************************************************************************** |
|---|
| 612 | Summary: |
|---|
| 613 | Set the center frequency. |
|---|
| 614 | |
|---|
| 615 | Description: |
|---|
| 616 | Set the absolute center frequency of the timebase relative to the crytal. A |
|---|
| 617 | value of 0x400000 will generate a timebase of 27MHz. Changing the center |
|---|
| 618 | frequency by one bit will change the timebase by about 3.8 ppm. |
|---|
| 619 | |
|---|
| 620 | Returns: |
|---|
| 621 | void |
|---|
| 622 | ***************************************************************************/ |
|---|
| 623 | void BXPT_PCR_SetCenterFrequency( |
|---|
| 624 | BXPT_PCR_Handle hPcr, /* [in] The pcr handle */ |
|---|
| 625 | uint32_t CenterFreq /* [in] Center frequency */ |
|---|
| 626 | ); |
|---|
| 627 | |
|---|
| 628 | /*************************************************************************** |
|---|
| 629 | Summary: |
|---|
| 630 | Get default values for locking to the given timebase reference. |
|---|
| 631 | |
|---|
| 632 | Description: |
|---|
| 633 | Return default values for the loop gain constants, pcr increment, and |
|---|
| 634 | prescale. These defaults are tailored to the given timebase reference. These |
|---|
| 635 | defaults may be used in a subsequent call to BXPT_PCR_ConfigNonStreamTimeBase. |
|---|
| 636 | |
|---|
| 637 | Returns: |
|---|
| 638 | BERR_SUCCESS - if successful |
|---|
| 639 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 640 | ***************************************************************************/ |
|---|
| 641 | BERR_Code BXPT_PCR_GetTimeBaseFreqRefDefaults( |
|---|
| 642 | BXPT_PCR_Handle hPcr, |
|---|
| 643 | BXPT_PCR_TimeRef TimeBase, |
|---|
| 644 | BXPT_PCR_TimebaseFreqRefConfig *Def |
|---|
| 645 | ); |
|---|
| 646 | |
|---|
| 647 | /*************************************************************************** |
|---|
| 648 | Summary: |
|---|
| 649 | Set the time base tracking range in the PCR block. |
|---|
| 650 | |
|---|
| 651 | Description: |
|---|
| 652 | The timebase has a limited tracking range. The tracking range is centered on |
|---|
| 653 | the crystal reference + pcr center. Note that changes to the tracking range |
|---|
| 654 | may cause sudden changes to the timebase, and may affect the video output quality. |
|---|
| 655 | |
|---|
| 656 | Returns: |
|---|
| 657 | BERR_SUCCESS - if successful |
|---|
| 658 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 659 | ***************************************************************************/ |
|---|
| 660 | void BXPT_PCR_SetTimeRefTrackRange( |
|---|
| 661 | BXPT_PCR_Handle hPcr, |
|---|
| 662 | BXPT_PCR_RefTrackRange TrackRange |
|---|
| 663 | ); |
|---|
| 664 | |
|---|
| 665 | /*************************************************************************** |
|---|
| 666 | Summary: |
|---|
| 667 | Set the phase error clamp range for the phase error input to the loop filter |
|---|
| 668 | |
|---|
| 669 | Description: |
|---|
| 670 | |
|---|
| 671 | Returns: |
|---|
| 672 | BERR_SUCCESS - if successful |
|---|
| 673 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 674 | ***************************************************************************/ |
|---|
| 675 | void BXPT_PCR_SetPhaseErrorClampRange( |
|---|
| 676 | BXPT_PCR_Handle hPcr, |
|---|
| 677 | BXPT_PCR_PhaseErrorClampRange ClampRange |
|---|
| 678 | ); |
|---|
| 679 | |
|---|
| 680 | /*************************************************************************** |
|---|
| 681 | Summary: |
|---|
| 682 | Enumeration of all supported interrupts in a Rave context. |
|---|
| 683 | ****************************************************************************/ |
|---|
| 684 | typedef enum BXPT_PCR_IntName |
|---|
| 685 | { |
|---|
| 686 | /* Set whenever a PCR is detected */ |
|---|
| 687 | BXPT_PCR_IntName_ePhaseCompare = BCHP_XPT_DPCR0_INTR_STATUS_REG_PHASE_CMP_INT_SHIFT, |
|---|
| 688 | |
|---|
| 689 | /* Set whenever 2 consecutive PCR errors are seen in the stream. */ |
|---|
| 690 | BXPT_PCR_IntName_eTwoPcrErrors = BCHP_XPT_DPCR0_INTR_STATUS_REG_TWO_PCR_ERROR_SHIFT, |
|---|
| 691 | |
|---|
| 692 | BXPT_PCR_IntName_eMax /* Marks the end of the supported interrutps */ |
|---|
| 693 | } |
|---|
| 694 | BXPT_PCR_IntName; |
|---|
| 695 | |
|---|
| 696 | /*************************************************************************** |
|---|
| 697 | Summary: |
|---|
| 698 | Generate the interrupt ID for the requested interrupt name. |
|---|
| 699 | |
|---|
| 700 | Description: |
|---|
| 701 | Prevents the app from having to do it directly. |
|---|
| 702 | |
|---|
| 703 | Returns: |
|---|
| 704 | BERR_SUCCESS - if successful |
|---|
| 705 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 706 | ***************************************************************************/ |
|---|
| 707 | BERR_Code BXPT_PCR_GetIntId( |
|---|
| 708 | unsigned WhichPcr, /* Which PCR block. Same value as used in BXPT_PCR_Open() */ |
|---|
| 709 | BXPT_PCR_IntName Name, /* The interrupt in question. */ |
|---|
| 710 | BINT_Id *IntId /* IntId suitable for the BINT module. */ |
|---|
| 711 | ); |
|---|
| 712 | |
|---|
| 713 | #ifdef __cplusplus |
|---|
| 714 | } |
|---|
| 715 | #endif |
|---|
| 716 | |
|---|
| 717 | #endif |
|---|