| 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_offset.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/7 $ |
|---|
| 12 | * $brcm_Date: 8/3/11 5:54p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/portinginterface/xpt/base2/bxpt_pcr_offset.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/7 8/3/11 5:54p gmullen |
|---|
| 21 | * SW7231-325: Merged new API to Hydra |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/SW7231-325/1 8/3/11 4:16p gmullen |
|---|
| 24 | * SW7231-325: Added BXPT_PcrOffset_Acquire() |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/6 6/8/11 2:16p gmullen |
|---|
| 27 | * SW7425-653: Fixed prototype |
|---|
| 28 | * |
|---|
| 29 | * Hydra_Software_Devel/5 6/7/11 2:27p gmullen |
|---|
| 30 | * SW7425-653: Return STC INC HI and LO registers |
|---|
| 31 | * |
|---|
| 32 | * Hydra_Software_Devel/4 6/3/11 4:34p gmullen |
|---|
| 33 | * SW7425-653: Merged changes to Hydra branch |
|---|
| 34 | * |
|---|
| 35 | * Hydra_Software_Devel/SW7425-653/4 6/3/11 4:05p gmullen |
|---|
| 36 | * SW7425-653: Fixed typos in NRT example code |
|---|
| 37 | * |
|---|
| 38 | * Hydra_Software_Devel/SW7425-653/3 6/3/11 3:16p gmullen |
|---|
| 39 | * SW7425-653: Updated sample code with change to |
|---|
| 40 | * BXPT_PcrOffset_GetSoftIncrementRegOffset() |
|---|
| 41 | * |
|---|
| 42 | * Hydra_Software_Devel/SW7425-653/2 6/2/11 10:35a gmullen |
|---|
| 43 | * SW7425-653: Added non-realtime transcoding support |
|---|
| 44 | * |
|---|
| 45 | * Hydra_Software_Devel/SW7425-653/1 5/28/11 12:53p gmullen |
|---|
| 46 | * SW7425-653: Revised API proposal. |
|---|
| 47 | * |
|---|
| 48 | * Hydra_Software_Devel/3 3/22/11 1:42p gmullen |
|---|
| 49 | * SW7425-223: Added code to correctly map STC broadcasts |
|---|
| 50 | * |
|---|
| 51 | * Hydra_Software_Devel/2 12/21/10 9:24a gmullen |
|---|
| 52 | * SW7425-15: Added STC broadcast mode |
|---|
| 53 | * |
|---|
| 54 | * Hydra_Software_Devel/1 10/25/10 2:09p gmullen |
|---|
| 55 | * SW7425-15: Moved srcs to base2 folder |
|---|
| 56 | * |
|---|
| 57 | * Hydra_Software_Devel/1 10/8/10 2:57p gmullen |
|---|
| 58 | * SW7425-15: Added header files |
|---|
| 59 | * |
|---|
| 60 | * Hydra_Software_Devel/31 9/28/10 11:20a gmullen |
|---|
| 61 | * SW35230-1354: Default error acquire threshold to 2 |
|---|
| 62 | * |
|---|
| 63 | * Hydra_Software_Devel/30 9/14/10 10:07a gmullen |
|---|
| 64 | * SW35230-1354: Added ONE_ERR_ACQ or TWO_ERR_ACQ support to the PI |
|---|
| 65 | * |
|---|
| 66 | * Hydra_Software_Devel/29 6/17/09 6:46p gmullen |
|---|
| 67 | * PR56110: Added support.xpt/7550/uif_image/a0 |
|---|
| 68 | * |
|---|
| 69 | * Hydra_Software_Devel/28 6/8/09 4:40p gmullen |
|---|
| 70 | * PR55611: Added support for selecting which DPCR block drives the STC to |
|---|
| 71 | * _GetSettings() and _SetSettings() |
|---|
| 72 | * |
|---|
| 73 | * Hydra_Software_Devel/27 4/7/09 5:25p piyushg |
|---|
| 74 | * PR52986: Add support for 7635 |
|---|
| 75 | * Added directory element "7635". |
|---|
| 76 | * |
|---|
| 77 | * Hydra_Software_Devel/26 1/28/09 9:53a gmullen |
|---|
| 78 | * PR51198: Fixed bug in IntId mapping |
|---|
| 79 | * |
|---|
| 80 | * Hydra_Software_Devel/25 1/27/09 1:09p gmullen |
|---|
| 81 | * PR51625: Added 7336 support |
|---|
| 82 | * |
|---|
| 83 | * Hydra_Software_Devel/24 1/20/09 6:01p gmullen |
|---|
| 84 | * PR50689: Added GetIntId API. |
|---|
| 85 | * |
|---|
| 86 | * Hydra_Software_Devel/23 11/26/08 4:15p gmullen |
|---|
| 87 | * PR47755: Added support for 7420. |
|---|
| 88 | * |
|---|
| 89 | * Hydra_Software_Devel/22 9/22/08 2:53p gmullen |
|---|
| 90 | * PR47074: Do not disable PID channel if its used by the PCR Offset |
|---|
| 91 | * block. |
|---|
| 92 | * |
|---|
| 93 | * Hydra_Software_Devel/21 7/9/08 9:18a gmullen |
|---|
| 94 | * PR44665: Added BXPT_PcrOffset_CaptureStcOnce() and |
|---|
| 95 | * BXPT_PcrOffset_CaptureStcOnce_isr() |
|---|
| 96 | * |
|---|
| 97 | * Hydra_Software_Devel/20 5/15/08 9:25a gmullen |
|---|
| 98 | * PR42537: Added BXPT_PcrOffset_ReloadPcrPidChannel_isr() |
|---|
| 99 | * |
|---|
| 100 | * Hydra_Software_Devel/19 3/26/08 11:24a gmullen |
|---|
| 101 | * PR38954: Added 3548 support to XPT PI. |
|---|
| 102 | * |
|---|
| 103 | * Hydra_Software_Devel/18 2/27/08 3:29p piyushg |
|---|
| 104 | * PR39387: Added a new API BXPT_PcrOffset_ForceInvalid to |
|---|
| 105 | * clear the PCR_OFFSET_VALID bit. |
|---|
| 106 | * |
|---|
| 107 | * Hydra_Software_Devel/17 2/19/08 2:31p gmullen |
|---|
| 108 | * PR38918: Added BXPT_PcrOffset_IsOffsetValid() and |
|---|
| 109 | * BXPT_PcrOffset_IsOffsetValid_isr() |
|---|
| 110 | * |
|---|
| 111 | * Hydra_Software_Devel/16 12/3/07 10:54a katrep |
|---|
| 112 | * PR36900: Added support for 7335. |
|---|
| 113 | * |
|---|
| 114 | * Hydra_Software_Devel/15 11/28/07 11:26a gmullen |
|---|
| 115 | * PR36900: Added 7335 support |
|---|
| 116 | * |
|---|
| 117 | * Hydra_Software_Devel/14 10/30/07 3:11p gmullen |
|---|
| 118 | * PR35018: Added support for 7325 |
|---|
| 119 | * |
|---|
| 120 | * Hydra_Software_Devel/13 6/5/07 8:53p gmullen |
|---|
| 121 | * PR31834: PCR jitter correction can now be disabled. |
|---|
| 122 | * |
|---|
| 123 | * Hydra_Software_Devel/12 4/17/07 5:53p gmullen |
|---|
| 124 | * PR26217: Added StcSelect to BXPT_PcrOffset_Settings struct. |
|---|
| 125 | * |
|---|
| 126 | * Hydra_Software_Devel/11 3/1/07 11:31a gmullen |
|---|
| 127 | * PR26217: Changed new API names to conform to sw arch spec. |
|---|
| 128 | * |
|---|
| 129 | * Hydra_Software_Devel/10 2/28/07 1:33p gmullen |
|---|
| 130 | * PR26217: Enable offset generation for PCR PID. |
|---|
| 131 | * |
|---|
| 132 | * Hydra_Software_Devel/9 2/14/07 1:10p gmullen |
|---|
| 133 | * PR27642: Added support for 7405. |
|---|
| 134 | * |
|---|
| 135 | * Hydra_Software_Devel/8 2/8/07 4:33p gmullen |
|---|
| 136 | * PR26217: Changed API names for consistency |
|---|
| 137 | * |
|---|
| 138 | * Hydra_Software_Devel/7 2/6/07 7:05p gmullen |
|---|
| 139 | * PR26217: Added B0 support. |
|---|
| 140 | * |
|---|
| 141 | * Hydra_Software_Devel/6 11/21/06 3:02p gmullen |
|---|
| 142 | * PR26073: Added BXPT_PcrOffset_RegenOffset_isr() |
|---|
| 143 | * |
|---|
| 144 | * Hydra_Software_Devel/5 8/18/06 10:13a gmullen |
|---|
| 145 | * PR23345: Added MaxPcrError to Get/SetSettings calls. |
|---|
| 146 | * |
|---|
| 147 | * Hydra_Software_Devel/4 8/8/06 10:58a gmullen |
|---|
| 148 | * PR23345: Added MaxPcrError to BXPT_PcrOffset_Defaults. |
|---|
| 149 | * |
|---|
| 150 | * Hydra_Software_Devel/3 3/31/06 11:30a gmullen |
|---|
| 151 | * PR20565: Added UseHostPcrs to settings struct. |
|---|
| 152 | * |
|---|
| 153 | * Hydra_Software_Devel/2 2/10/06 12:06p katrep |
|---|
| 154 | * PR19583: added isr flavours of various pcr offset routines, similar to |
|---|
| 155 | * 7401, pcrlib should now compile okay |
|---|
| 156 | * |
|---|
| 157 | * Hydra_Software_Devel/9 11/14/05 9:11a gmullen |
|---|
| 158 | * PR15309: OffsetThreshold may now be set through Defaults or Get/Set |
|---|
| 159 | * methods. |
|---|
| 160 | * |
|---|
| 161 | * Hydra_Software_Devel/8 10/28/05 4:39p gmullen |
|---|
| 162 | * PR17859: Added BXPT_PcrOffset_GetOffset(). |
|---|
| 163 | * |
|---|
| 164 | * Hydra_Software_Devel/7 10/28/05 11:59a gmullen |
|---|
| 165 | * PR15309: Added BXPT_PCROFFSET_USE_HOST_PCRS define. |
|---|
| 166 | * |
|---|
| 167 | * Hydra_Software_Devel/6 9/26/05 3:51p gmullen |
|---|
| 168 | * PR15309: Added BXPT_PcrOffset_SetStc() . |
|---|
| 169 | * |
|---|
| 170 | * Hydra_Software_Devel/5 9/26/05 1:37p gmullen |
|---|
| 171 | * PR15309: Moved CountMode from Defaults struct to Settings struct, to |
|---|
| 172 | * reduce overhead during channel change, |
|---|
| 173 | * |
|---|
| 174 | * Hydra_Software_Devel/4 9/21/05 2:17p gmullen |
|---|
| 175 | * PR15309: Added support for AAC HE and AC3+ audio, fixed bug in playback |
|---|
| 176 | * PI, modified RAVE PI to support channel change and reset. |
|---|
| 177 | * |
|---|
| 178 | * Hydra_Software_Devel/3 8/31/05 10:58a gmullen |
|---|
| 179 | * PR15309: Fixed bugs in PSI extraction and MPEG audio support. |
|---|
| 180 | * |
|---|
| 181 | * Hydra_Software_Devel/2 8/4/05 8:14a gmullen |
|---|
| 182 | * PR15309: Added PCR support. |
|---|
| 183 | * |
|---|
| 184 | * Hydra_Software_Devel/1 5/13/05 1:27p gmullen |
|---|
| 185 | * PR15309: First draft of XPT PI. |
|---|
| 186 | * |
|---|
| 187 | ***************************************************************************/ |
|---|
| 188 | |
|---|
| 189 | #ifndef BXPT_PCR_OFFSET_H__ |
|---|
| 190 | #define BXPT_PCR_OFFSET_H__ |
|---|
| 191 | |
|---|
| 192 | #include "bxpt.h" |
|---|
| 193 | |
|---|
| 194 | #ifdef __cplusplus |
|---|
| 195 | extern "C"{ |
|---|
| 196 | #endif |
|---|
| 197 | |
|---|
| 198 | /*=************************ Module Overview ******************************** |
|---|
| 199 | <verbatim> |
|---|
| 200 | Overview: |
|---|
| 201 | </verbatim> |
|---|
| 202 | ***************************************************************************/ |
|---|
| 203 | |
|---|
| 204 | /*************************************************************************** |
|---|
| 205 | Summary: |
|---|
| 206 | This define is being deprecated. Use BXPT_PcrOffset_Settings.UseHostPcrs |
|---|
| 207 | instead. |
|---|
| 208 | ****************************************************************************/ |
|---|
| 209 | #define BXPT_PCROFFSET_USE_HOST_PCRS ( 0xFF ) |
|---|
| 210 | |
|---|
| 211 | /*************************************************************************** |
|---|
| 212 | Summary: |
|---|
| 213 | Module private defines. User code should not use these defines directly. |
|---|
| 214 | ****************************************************************************/ |
|---|
| 215 | #define BXPT_P_SPLICING_QUEUE_SIZE 8 |
|---|
| 216 | |
|---|
| 217 | /*************************************************************************** |
|---|
| 218 | Summary: |
|---|
| 219 | Defines the number of usable slots in the PCR splicing stack. |
|---|
| 220 | ****************************************************************************/ |
|---|
| 221 | #define MAX_PCR_SPLICING_ENTRIES ( BXPT_P_SPLICING_QUEUE_SIZE - 1 ) |
|---|
| 222 | |
|---|
| 223 | /*************************************************************************** |
|---|
| 224 | Summary: |
|---|
| 225 | The opaque handle for a PCR offset module. |
|---|
| 226 | |
|---|
| 227 | Description: |
|---|
| 228 | This structure represents the PCR handle. It is created at |
|---|
| 229 | BXPT_PcrOffset_Open |
|---|
| 230 | ***************************************************************************/ |
|---|
| 231 | typedef struct BXPT_P_PcrOffset_Impl *BXPT_PcrOffset_Handle; |
|---|
| 232 | |
|---|
| 233 | /*************************************************************************** |
|---|
| 234 | Summary: |
|---|
| 235 | Enumeration of all the data sources a parser band can use. |
|---|
| 236 | ****************************************************************************/ |
|---|
| 237 | typedef enum BXPT_PcrOffset_StcCountMode |
|---|
| 238 | { |
|---|
| 239 | BXPT_PcrOffset_StcCountMode_eMod300 = 0, |
|---|
| 240 | BXPT_PcrOffset_StcCountMode_eBinary = 1 |
|---|
| 241 | } |
|---|
| 242 | BXPT_PcrOffset_StcCountMode; |
|---|
| 243 | |
|---|
| 244 | #if BXPT_HAS_TSMUX |
|---|
| 245 | /*************************************************************************** |
|---|
| 246 | Summary: |
|---|
| 247 | Enumeration of all the data sources a parser band can use. |
|---|
| 248 | ****************************************************************************/ |
|---|
| 249 | typedef enum BXPT_PcrOffset_BroadcastMode |
|---|
| 250 | { |
|---|
| 251 | BXPT_PcrOffset_BroadcastMode_eLegacy = 0, |
|---|
| 252 | BXPT_PcrOffset_BroadcastMode_eLsb32 = 1, |
|---|
| 253 | BXPT_PcrOffset_BroadcastMode_eMsb32 = 2, |
|---|
| 254 | BXPT_PcrOffset_BroadcastMode_eFull42 = 3 |
|---|
| 255 | } |
|---|
| 256 | BXPT_PcrOffset_BroadcastMode; |
|---|
| 257 | #endif |
|---|
| 258 | |
|---|
| 259 | /*************************************************************************** |
|---|
| 260 | Summary: |
|---|
| 261 | Default settings for a PCR Offset channel. |
|---|
| 262 | |
|---|
| 263 | Description: |
|---|
| 264 | The settings read from, or will be written to, a PCR offset channel. |
|---|
| 265 | ***************************************************************************/ |
|---|
| 266 | typedef struct BXPT_PcrOffset_Defaults |
|---|
| 267 | { |
|---|
| 268 | /* |
|---|
| 269 | ** If UsePcrTimebase is false, the STC count is driven from a free-running |
|---|
| 270 | ** 27 MHz source. Otherwise, WhichPcr selects the timebase that clocks the |
|---|
| 271 | ** STC. |
|---|
| 272 | */ |
|---|
| 273 | bool UsePcrTimeBase; |
|---|
| 274 | unsigned WhichPcr; |
|---|
| 275 | |
|---|
| 276 | /* |
|---|
| 277 | ** If the new PCR Offset differs from the current PCR Offset by less |
|---|
| 278 | ** than OffsetThreshold, no Offset will be broadcast (non will show up |
|---|
| 279 | ** in the ITB data). Setting OffsetThreshold to 0 will force a broadcast |
|---|
| 280 | ** of each new PCR Offset as it is computed. |
|---|
| 281 | */ |
|---|
| 282 | unsigned OffsetThreshold; |
|---|
| 283 | |
|---|
| 284 | /* |
|---|
| 285 | ** The maximum absolute PCR error. If the base portion of the PCR just |
|---|
| 286 | ** received is greater than the current STC minus the PCR Offset, a |
|---|
| 287 | ** PCR out-of-range error is generated. |
|---|
| 288 | */ |
|---|
| 289 | unsigned MaxPcrError; |
|---|
| 290 | |
|---|
| 291 | /* |
|---|
| 292 | ** Which STC will drive the given PCR Offset channel. |
|---|
| 293 | ** The default mapping mimics the behavior of the previous PCR Offset hardware, |
|---|
| 294 | ** for the first BXPT_P_MAX_STCS offset channels. Beyond that, the caller is |
|---|
| 295 | ** expected to override this with whatever value is needed for mosaic support. |
|---|
| 296 | */ |
|---|
| 297 | unsigned WhichStc; |
|---|
| 298 | |
|---|
| 299 | /* |
|---|
| 300 | ** The hardware can update the PCR offset after a number of consecutive PCRs are greater than the |
|---|
| 301 | ** OffsetThreshold (above) are seen. That number is programmable, below. |
|---|
| 302 | */ |
|---|
| 303 | unsigned ConsecutiveErrorThreshold; |
|---|
| 304 | } |
|---|
| 305 | BXPT_PcrOffset_Defaults; |
|---|
| 306 | |
|---|
| 307 | /*************************************************************************** |
|---|
| 308 | Summary: |
|---|
| 309 | Settings for a PCR Offset channel. |
|---|
| 310 | |
|---|
| 311 | Description: |
|---|
| 312 | The settings read from, or will be written to, a PCR offset channel. |
|---|
| 313 | ***************************************************************************/ |
|---|
| 314 | typedef struct BXPT_PcrOffset_Settings |
|---|
| 315 | { |
|---|
| 316 | /* |
|---|
| 317 | ** If UsePcrTimebase is false, the STC count is driven from a free-running |
|---|
| 318 | ** 27 MHz source. Otherwise, WhichPcr selects the timebase that clocks the |
|---|
| 319 | ** STC. |
|---|
| 320 | */ |
|---|
| 321 | bool UsePcrTimeBase; |
|---|
| 322 | unsigned WhichPcr; |
|---|
| 323 | |
|---|
| 324 | /* |
|---|
| 325 | ** Counting mode used by the STC counter. |
|---|
| 326 | ** For MPEG streams, CountMode should be BXPT_PcrOffset_StcCountMode_eMod300. |
|---|
| 327 | ** For DirecTV streams, CountMode should be BXPT_PcrOffset_StcCountMode_eBinary |
|---|
| 328 | */ |
|---|
| 329 | BXPT_PcrOffset_StcCountMode CountMode; |
|---|
| 330 | |
|---|
| 331 | uint32_t PidChannelNum; /* PID channel carrying PCRs */ |
|---|
| 332 | |
|---|
| 333 | /* |
|---|
| 334 | ** If the new PCR Offset differs from the current PCR Offset by less |
|---|
| 335 | ** than OffsetThreshold, no Offset will be broadcast (non will show up |
|---|
| 336 | ** in the ITB data). Setting OffsetThreshold to 0 will force a broadcast |
|---|
| 337 | ** of each new PCR Offset as it is computed. |
|---|
| 338 | */ |
|---|
| 339 | unsigned OffsetThreshold; |
|---|
| 340 | |
|---|
| 341 | /* |
|---|
| 342 | ** When the host processer wants to load its own PCRs instead of using those |
|---|
| 343 | ** in the PID stream, UseHostPcrs should be set to true. This prevents PCRs |
|---|
| 344 | ** in the stream from being used. |
|---|
| 345 | */ |
|---|
| 346 | bool UseHostPcrs; |
|---|
| 347 | |
|---|
| 348 | /* |
|---|
| 349 | ** The maximum absolute PCR error. If the base portion of the PCR just |
|---|
| 350 | ** received is greater than the current STC minus the PCR Offset, a |
|---|
| 351 | ** PCR out-of-range error is generated. |
|---|
| 352 | */ |
|---|
| 353 | unsigned MaxPcrError; |
|---|
| 354 | |
|---|
| 355 | /* Selects which STC is used for PCR offset generation. */ |
|---|
| 356 | unsigned StcSelect; |
|---|
| 357 | |
|---|
| 358 | /* |
|---|
| 359 | ** The hardware can update the PCR offset after a number of consecutive PCRs are greater than the |
|---|
| 360 | ** OffsetThreshold (above) are seen. That number is programmable, below. |
|---|
| 361 | */ |
|---|
| 362 | unsigned ConsecutiveErrorThreshold; |
|---|
| 363 | |
|---|
| 364 | /* |
|---|
| 365 | ** Disable timestamp correction for PCR packet jitter. For normal usage modes |
|---|
| 366 | ** this setting should be false (ie, enable timestamp correction). IP SetTop |
|---|
| 367 | ** user might need to set this to true. |
|---|
| 368 | */ |
|---|
| 369 | bool TimestampDisable; |
|---|
| 370 | |
|---|
| 371 | #if BXPT_HAS_TSMUX |
|---|
| 372 | BXPT_PcrOffset_BroadcastMode BroadcastMode; |
|---|
| 373 | #endif |
|---|
| 374 | } |
|---|
| 375 | BXPT_PcrOffset_Settings; |
|---|
| 376 | |
|---|
| 377 | #if BXPT_HAS_TSMUX |
|---|
| 378 | |
|---|
| 379 | /*************************************************************************** |
|---|
| 380 | Summary: |
|---|
| 381 | Maximum number of external triggers supported. |
|---|
| 382 | ****************************************************************************/ |
|---|
| 383 | #define BXPT_MAX_EXTERNAL_TRIGS ( 2 ) |
|---|
| 384 | |
|---|
| 385 | /*************************************************************************** |
|---|
| 386 | Summary: |
|---|
| 387 | Status bits for the TsMux channel. |
|---|
| 388 | ****************************************************************************/ |
|---|
| 389 | typedef enum BXPT_PcrOffset_StcTriggerMode |
|---|
| 390 | { |
|---|
| 391 | BXPT_PcrOffset_StcTriggerMode_eTimebase, /* Increment STC by timebase */ |
|---|
| 392 | BXPT_PcrOffset_StcTriggerMode_eExternalTrig, /* Increment by external trigger source. */ |
|---|
| 393 | BXPT_PcrOffset_StcTriggerMode_eSoftIncrement, /* Increment when STC_INC_TRIG register is written */ |
|---|
| 394 | BXPT_PcrOffset_StcTriggerMode_eMax |
|---|
| 395 | } |
|---|
| 396 | BXPT_PcrOffset_StcTriggerMode; |
|---|
| 397 | |
|---|
| 398 | /*************************************************************************** |
|---|
| 399 | Summary: |
|---|
| 400 | PCR Offset configuration for Non-Realtime Transcoding. |
|---|
| 401 | ****************************************************************************/ |
|---|
| 402 | typedef struct BXPT_PcrOffset_NRTConfig |
|---|
| 403 | { |
|---|
| 404 | unsigned PairedStc; /* Which STC is paired with this PcrOffset's for AV Window comparisons */ |
|---|
| 405 | bool EnableAvWindowComparison; /* Enable AV Window comparisons with AvCompareStc */ |
|---|
| 406 | unsigned AvWindow; /* Window, expressed in mSec. The STC increment is stalled when the |
|---|
| 407 | comparison exceedes this window. */ |
|---|
| 408 | BXPT_PcrOffset_StcTriggerMode TriggerMode; /* Event that will increment the STC */ |
|---|
| 409 | unsigned ExternalTriggerNum; /* Identifies which external trigger is used when TriggerMode == _eExternalTrig */ |
|---|
| 410 | |
|---|
| 411 | /* |
|---|
| 412 | ** Amount to increment the STC by when external or soft trigger is used. |
|---|
| 413 | ** This should be set to one video or audio frame-time, depending on which |
|---|
| 414 | ** decoder is being driven. The value is expressed in 42-bit MPEG or |
|---|
| 415 | ** 32-bit binary STC format, as dictated by the transport format being used. |
|---|
| 416 | */ |
|---|
| 417 | uint64_t StcIncrement; |
|---|
| 418 | } |
|---|
| 419 | BXPT_PcrOffset_NRTConfig; |
|---|
| 420 | |
|---|
| 421 | /*************************************************************************** |
|---|
| 422 | Summary: Example code for configurating an audio and a video decoder PCR |
|---|
| 423 | Offset channels in Non-Realtime Transcoding. |
|---|
| 424 | |
|---|
| 425 | // Pcr Offset 0 will be used for video, 1 for audio. |
|---|
| 426 | |
|---|
| 427 | BXPT_PcrOffset_Defaults ChannelDefaults; |
|---|
| 428 | BXPT_PcrOffset_Handle hVideoPcrOffset, hAudioPcrOffset; |
|---|
| 429 | BXPT_PcrOffset_Settings VideoPcrOffsetSettings, AudioPcrOffsetSettings; |
|---|
| 430 | BXPT_PcrOffset_NRTConfig AudioNrtConfig, VideoNrtConfig; |
|---|
| 431 | unsigned SoftIncRegisterOffset; |
|---|
| 432 | |
|---|
| 433 | BXPT_PcrOffset_GetChannelDefSettings( hXpt, 0, &ChannelDefaults ); |
|---|
| 434 | BXPT_PcrOffset_Open( hXpt, 0, &ChannelDefaults, &hVideoPcrOffset ); |
|---|
| 435 | BXPT_PcrOffset_GetChannelDefSettings( hXpt, 1, &ChannelDefaults ); |
|---|
| 436 | BXPT_PcrOffset_Open( hXpt, 1, &ChannelDefaults, &hAudioPcrOffset ); |
|---|
| 437 | |
|---|
| 438 | BXPT_PcrOffset_GetNRTConfig( hVideoPcrOffset, &VideoNrtConfig ); |
|---|
| 439 | BXPT_PcrOffset_GetNRTConfig( hAudioPcrOffset, &AudioNrtConfig ); |
|---|
| 440 | BXPT_PcrOffset_GetSettings( hVideoPcrOffset, &VideoPcrOffsetSettings ); |
|---|
| 441 | BXPT_PcrOffset_GetSettings( hAudioPcrOffset, &AudioPcrOffsetSettings ); |
|---|
| 442 | |
|---|
| 443 | VideoNrtConfig.EnableAvWindowComparison = AudioNrtConfig.EnableAvWindowComparison = true; |
|---|
| 444 | VideoNrtConfig.AvWindow = AudioNrtConfig.AvWindow = 100; // 100mS |
|---|
| 445 | |
|---|
| 446 | VideoNrtConfig.TriggerMode = BXPT_PcrOffset_StcTriggerMode_eExternalTrig; |
|---|
| 447 | VideoNrtConfig.ExternalTriggerNum = 0; // This may change in actual usage. |
|---|
| 448 | VideoNrtConfig.StcIncrement = 0x00; // Placeholders. This should be set to one |
|---|
| 449 | // video frame-time, expressed in MPEG or binary |
|---|
| 450 | // STC format as appropriate. |
|---|
| 451 | |
|---|
| 452 | // For audio, the soft increment register is used, rather than the external |
|---|
| 453 | // trigger. So, ExternalTriggerNum is a "don't care". |
|---|
| 454 | AudioNrtConfig.TriggerMode = BXPT_PcrOffset_StcTriggerMode_eSoftIncrement; |
|---|
| 455 | AudioNrtConfig.StcIncrement = 0x00; // Placeholders. This should be set to one |
|---|
| 456 | // audio frame-time, expressed in MPEG or binary |
|---|
| 457 | // STC format as appropriate. |
|---|
| 458 | |
|---|
| 459 | // This sets up the linking of the audio and video decoder STCs |
|---|
| 460 | VideoNrtConfig.PairedStc = AudioPcrOffsetSettings.StcSelect; |
|---|
| 461 | AudioNrtConfig.PairedStc = VideoPcrOffsetSettings.StcSelect; |
|---|
| 462 | |
|---|
| 463 | BXPT_PcrOffset_SetNRTConfig( hVideoPcrOffset, &VideoNrtConfig ); |
|---|
| 464 | BXPT_PcrOffset_SetNRTConfig( hAudioPcrOffset, &AudioNrtConfig ); |
|---|
| 465 | |
|---|
| 466 | // The register offsets in RegMap should be passed over to the audio DSP. The |
|---|
| 467 | // struct is defined in magnum/commonutils/avc/$(CHIP)/bavc_xpt.h . |
|---|
| 468 | BXPT_PcrOffset_GetSoftIncrementRegisterOffsets( hPcrOffset, &RegMap ); |
|---|
| 469 | ****************************************************************************/ |
|---|
| 470 | |
|---|
| 471 | /*************************************************************************** |
|---|
| 472 | Summary: |
|---|
| 473 | Get the PCR Offset configuration for Non-Realtime Transcoding. |
|---|
| 474 | ****************************************************************************/ |
|---|
| 475 | void BXPT_PcrOffset_GetNRTConfig( |
|---|
| 476 | BXPT_PcrOffset_Handle hPcrOffset, /* [in] The channel handle */ |
|---|
| 477 | BXPT_PcrOffset_NRTConfig *Config |
|---|
| 478 | ); |
|---|
| 479 | |
|---|
| 480 | /*************************************************************************** |
|---|
| 481 | Summary: |
|---|
| 482 | Set the PCR Offset configuration for Non-Realtime Transcoding. |
|---|
| 483 | ****************************************************************************/ |
|---|
| 484 | BERR_Code BXPT_PcrOffset_SetNRTConfig( |
|---|
| 485 | BXPT_PcrOffset_Handle hPcrOffset, /* [in] The channel handle */ |
|---|
| 486 | const BXPT_PcrOffset_NRTConfig *Config |
|---|
| 487 | ); |
|---|
| 488 | |
|---|
| 489 | /*************************************************************************** |
|---|
| 490 | Summary: |
|---|
| 491 | Get address of the soft increment registers. |
|---|
| 492 | ****************************************************************************/ |
|---|
| 493 | void BXPT_PcrOffset_GetSoftIncrementRegisterOffsets( |
|---|
| 494 | BXPT_PcrOffset_Handle hPcrOffset, /* [in] The channel handle */ |
|---|
| 495 | BAVC_Xpt_StcSoftIncRegisters *RegMap |
|---|
| 496 | ); |
|---|
| 497 | |
|---|
| 498 | #endif |
|---|
| 499 | |
|---|
| 500 | /*************************************************************************** |
|---|
| 501 | Summary: |
|---|
| 502 | Return the total number of PCR Offset channels available. |
|---|
| 503 | |
|---|
| 504 | Description: |
|---|
| 505 | The number of PCR Offset instantiations can vary from one chip to another. |
|---|
| 506 | This call will return the number available on the current chip. |
|---|
| 507 | |
|---|
| 508 | Returns: |
|---|
| 509 | BERR_SUCCESS - Returned the total channel count. |
|---|
| 510 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 511 | ****************************************************************************/ |
|---|
| 512 | BERR_Code BXPT_PcrOffset_GetTotalChannels( |
|---|
| 513 | BXPT_Handle hXpt, /* [in] The transport handle */ |
|---|
| 514 | unsigned int *TotalChannels /* [out] The number of Pcr offset channels. */ |
|---|
| 515 | ); |
|---|
| 516 | |
|---|
| 517 | /*************************************************************************** |
|---|
| 518 | Summary: |
|---|
| 519 | Return defaults for a PCR Offset channel. |
|---|
| 520 | |
|---|
| 521 | Description: |
|---|
| 522 | This call returns the default settings for the given PCR Offset channel. The |
|---|
| 523 | settings returned can be changed and used during channel open. |
|---|
| 524 | |
|---|
| 525 | Returns: |
|---|
| 526 | BERR_SUCCESS - Returned the defaults for the channel. |
|---|
| 527 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 528 | |
|---|
| 529 | See also: |
|---|
| 530 | BXPT_PcrOffset_Open |
|---|
| 531 | ****************************************************************************/ |
|---|
| 532 | BERR_Code BXPT_PcrOffset_GetChannelDefSettings( |
|---|
| 533 | BXPT_Handle hXpt, /* [in] The transport handle - need chip info */ |
|---|
| 534 | unsigned int ChannelNo, /* [in] Which pcr offset module */ |
|---|
| 535 | BXPT_PcrOffset_Defaults *Defaults /* [out] The default settings of a pcr module */ |
|---|
| 536 | ); |
|---|
| 537 | |
|---|
| 538 | /*************************************************************************** |
|---|
| 539 | Summary: |
|---|
| 540 | Open a PCR Offset channel. |
|---|
| 541 | |
|---|
| 542 | Description: |
|---|
| 543 | The PCR Offset channel give by WhichOne is initialized, using the setting |
|---|
| 544 | provided in the Defaults structure. A handle for the opened channel is |
|---|
| 545 | returned. |
|---|
| 546 | |
|---|
| 547 | Returns: |
|---|
| 548 | BERR_SUCCESS - Channel opened successfully. |
|---|
| 549 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 550 | ***************************************************************************/ |
|---|
| 551 | BERR_Code BXPT_PcrOffset_Open( |
|---|
| 552 | BXPT_Handle hXpt, /* [in] The transport handle*/ |
|---|
| 553 | unsigned int ChannelNo, /* [in] Which pcr offset module */ |
|---|
| 554 | BXPT_PcrOffset_Defaults *Defaults, /* [in] The default setting */ |
|---|
| 555 | BXPT_PcrOffset_Handle *hChannel /* [out] The channel handle */ |
|---|
| 556 | ); |
|---|
| 557 | |
|---|
| 558 | /*************************************************************************** |
|---|
| 559 | Summary: |
|---|
| 560 | Close a PCR Offset channel. |
|---|
| 561 | |
|---|
| 562 | Description: |
|---|
| 563 | The given channel is disabled. The associated splicing stack is also cleared. |
|---|
| 564 | |
|---|
| 565 | Returns: |
|---|
| 566 | BERR_SUCCESS - Channel closed succesfully. |
|---|
| 567 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 568 | ***************************************************************************/ |
|---|
| 569 | BERR_Code BXPT_PcrOffset_Close( |
|---|
| 570 | BXPT_PcrOffset_Handle hChannel /* [in] The channel handle */ |
|---|
| 571 | ); |
|---|
| 572 | |
|---|
| 573 | /*************************************************************************** |
|---|
| 574 | Summary: |
|---|
| 575 | Get the current PID settings. |
|---|
| 576 | |
|---|
| 577 | Description: |
|---|
| 578 | The PID channel number and parser band being used for PCR offset calculation |
|---|
| 579 | are returned. |
|---|
| 580 | |
|---|
| 581 | Returns: |
|---|
| 582 | BERR_SUCCESS - Settings read succesfully. |
|---|
| 583 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 584 | ***************************************************************************/ |
|---|
| 585 | BERR_Code BXPT_PcrOffset_GetSettings( |
|---|
| 586 | BXPT_PcrOffset_Handle hPcrOff, |
|---|
| 587 | BXPT_PcrOffset_Settings *Settings |
|---|
| 588 | ); |
|---|
| 589 | |
|---|
| 590 | /*************************************************************************** |
|---|
| 591 | Summary: |
|---|
| 592 | Set the current PID settings. |
|---|
| 593 | |
|---|
| 594 | Description: |
|---|
| 595 | Load mew values for the PID channel number into hardware, for |
|---|
| 596 | use by the PCR offset calculation. Note that the PID channel must be |
|---|
| 597 | configured and enabled before calling this function. |
|---|
| 598 | |
|---|
| 599 | Returns: |
|---|
| 600 | BERR_SUCCESS - Settings written succesfully. |
|---|
| 601 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 602 | ***************************************************************************/ |
|---|
| 603 | BERR_Code BXPT_PcrOffset_SetSettings( |
|---|
| 604 | BXPT_PcrOffset_Handle hPcrOff, |
|---|
| 605 | const BXPT_PcrOffset_Settings *Settings |
|---|
| 606 | ); |
|---|
| 607 | |
|---|
| 608 | /*************************************************************************** |
|---|
| 609 | Summary: |
|---|
| 610 | Change the STC clock rate. |
|---|
| 611 | |
|---|
| 612 | Description: |
|---|
| 613 | The STC can be run at a faster or slower rate during playback, to support |
|---|
| 614 | STC-based trick modes. This call will change the STC rate according to the |
|---|
| 615 | following formula: |
|---|
| 616 | |
|---|
| 617 | new_rate = increment_rate * ( Increment / ( Prescale + 1 ) ) |
|---|
| 618 | where increment_rate is 45kHz for MPEG, or 27 MHz for other standards. |
|---|
| 619 | |
|---|
| 620 | Returns: |
|---|
| 621 | BERR_SUCCESS - STC rate changed. |
|---|
| 622 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 623 | ***************************************************************************/ |
|---|
| 624 | BERR_Code BXPT_PcrOffset_ChangeStcRate( |
|---|
| 625 | BXPT_PcrOffset_Handle hChannel, /* [in] The channel handle */ |
|---|
| 626 | unsigned Increment, /* [in] STC increment value */ |
|---|
| 627 | unsigned Prescale /* [in] STC prescale value */ |
|---|
| 628 | ); |
|---|
| 629 | |
|---|
| 630 | /*************************************************************************** |
|---|
| 631 | Summary: |
|---|
| 632 | Freeze the STC clock. |
|---|
| 633 | |
|---|
| 634 | Description: |
|---|
| 635 | The STC value is frozen at it's current value. That value will be continually |
|---|
| 636 | broadcast. |
|---|
| 637 | |
|---|
| 638 | Returns: |
|---|
| 639 | BERR_SUCCESS - STC frozen (or unfrozen as requested). |
|---|
| 640 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 641 | ***************************************************************************/ |
|---|
| 642 | BERR_Code BXPT_PcrOffset_FreezeStc( |
|---|
| 643 | BXPT_PcrOffset_Handle hChannel, /* [in] The channel handle */ |
|---|
| 644 | bool Freeze /* [in] STC is frozen if true, unfrozen if false */ |
|---|
| 645 | ); |
|---|
| 646 | |
|---|
| 647 | /*************************************************************************** |
|---|
| 648 | Summary: |
|---|
| 649 | Set the current STC. |
|---|
| 650 | |
|---|
| 651 | Description: |
|---|
| 652 | Load a user-defined STC. This value will be the new STC broadcast by the |
|---|
| 653 | PCR Offset block. Note that this value must be added to the PCR Offset |
|---|
| 654 | value (obtained by calling BXPT_PcrOffset_GetOffset()) to obtain the full |
|---|
| 655 | STC value used by the decoders for timestamp management. |
|---|
| 656 | |
|---|
| 657 | For MPEG streams, the PCR Offset is the most significant 32 bits of the 33 |
|---|
| 658 | bit base value. For DirecTV, it is the full 32 bit RTS. |
|---|
| 659 | |
|---|
| 660 | Returns: |
|---|
| 661 | BERR_SUCCESS - New STC loaded succesfully. |
|---|
| 662 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 663 | ***************************************************************************/ |
|---|
| 664 | BERR_Code BXPT_PcrOffset_SetStc( |
|---|
| 665 | BXPT_PcrOffset_Handle hChannel, /* [in] The channel handle */ |
|---|
| 666 | uint32_t NewStc |
|---|
| 667 | ); |
|---|
| 668 | BERR_Code BXPT_PcrOffset_SetStc_isr( |
|---|
| 669 | BXPT_PcrOffset_Handle hChannel, /* [in] The channel handle */ |
|---|
| 670 | uint32_t NewStc |
|---|
| 671 | ); |
|---|
| 672 | |
|---|
| 673 | /*************************************************************************** |
|---|
| 674 | Summary: |
|---|
| 675 | Retrieve the STC clock value. |
|---|
| 676 | |
|---|
| 677 | Description: |
|---|
| 678 | The upper 32 bits of the current STC are returned. The STC used here is NOT |
|---|
| 679 | the actual PCR value recovered from the stream. The STC is initialized to 0 in |
|---|
| 680 | hardware, and is incremented by the DPCR block. When PCRs are seen in the |
|---|
| 681 | transport stream, the value of that PCR is subtracted from the STC and |
|---|
| 682 | becomes the PCR Offset that is given to the decoders. As such, the STC is |
|---|
| 683 | usable for timestamp management, even though it's value (probably) doesn't |
|---|
| 684 | match the actuall PCRs in the stream. |
|---|
| 685 | |
|---|
| 686 | Note that this value is added to the PCR Offset (which can be obtained by calling |
|---|
| 687 | BXPT_PcrOffset_GetOffset()) to obtain the full STC value used by the decoders |
|---|
| 688 | for timestamp management. |
|---|
| 689 | |
|---|
| 690 | For MPEG streams, the PCR Offset is the most significant 32 bits of the 33 |
|---|
| 691 | bit base value. For DirecTV, it is the full 32 bit RTS. |
|---|
| 692 | |
|---|
| 693 | Returns: |
|---|
| 694 | uint32_t - The 32 most significant bits of the STC. |
|---|
| 695 | ***************************************************************************/ |
|---|
| 696 | uint32_t BXPT_PcrOffset_GetStc( |
|---|
| 697 | BXPT_PcrOffset_Handle hChannel /* [in] The channel handle */ |
|---|
| 698 | ); |
|---|
| 699 | |
|---|
| 700 | uint32_t BXPT_PcrOffset_GetStc_isr( |
|---|
| 701 | BXPT_PcrOffset_Handle hChannel /* [in] The channel handle */ |
|---|
| 702 | ); |
|---|
| 703 | |
|---|
| 704 | /*************************************************************************** |
|---|
| 705 | Summary: |
|---|
| 706 | Load a new PCR Offset. |
|---|
| 707 | |
|---|
| 708 | Description: |
|---|
| 709 | A user-supplied PCR Offset is loaded into hardware. Note that this is added |
|---|
| 710 | to the current STC (which can be obtained by calling BXPT_PcrOffset_GetStc()) |
|---|
| 711 | to yield the value used by the decoders for timestamp management. |
|---|
| 712 | |
|---|
| 713 | For MPEG streams, the PCR Offset is the most significant 32 bits of the 33 |
|---|
| 714 | bit base value. For DirecTV, it is the full 32 bit RTS. |
|---|
| 715 | |
|---|
| 716 | Returns: |
|---|
| 717 | BERR_SUCCESS - PVR offset loaded. |
|---|
| 718 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 719 | ***************************************************************************/ |
|---|
| 720 | BERR_Code BXPT_PcrOffset_SetOffset( |
|---|
| 721 | BXPT_PcrOffset_Handle hChannel, /* [in] The channel handle */ |
|---|
| 722 | uint32_t UserPcrOffset /* [in] User-supplied PCR Offset */ |
|---|
| 723 | ); |
|---|
| 724 | |
|---|
| 725 | BERR_Code BXPT_PcrOffset_SetOffset_isr( |
|---|
| 726 | BXPT_PcrOffset_Handle hChannel, /* [in] The channel handle */ |
|---|
| 727 | uint32_t UserPcrOffset /* [in] User-supplied PCR Offset */ |
|---|
| 728 | ); |
|---|
| 729 | |
|---|
| 730 | /*************************************************************************** |
|---|
| 731 | Summary: |
|---|
| 732 | Get the current PCR Offset. |
|---|
| 733 | |
|---|
| 734 | Description: |
|---|
| 735 | Return the current PCR Offset. This must be added to the value returned by |
|---|
| 736 | BXPT_PcrOffset_GetStc() to yield the complete STC that the audio and video |
|---|
| 737 | decoders will use for timestamp management. |
|---|
| 738 | |
|---|
| 739 | For MPEG streams, the PCR Offset is the most significant 32 bits of the 33 |
|---|
| 740 | bit base value. For DirecTV, it is the full 32 bit RTS. |
|---|
| 741 | |
|---|
| 742 | Returns: |
|---|
| 743 | uint32_t - The current PCR Offset |
|---|
| 744 | ***************************************************************************/ |
|---|
| 745 | uint32_t BXPT_PcrOffset_GetOffset( |
|---|
| 746 | BXPT_PcrOffset_Handle hChannel /* [in] The channel handle */ |
|---|
| 747 | ); |
|---|
| 748 | |
|---|
| 749 | uint32_t BXPT_PcrOffset_GetOffset_isr( |
|---|
| 750 | BXPT_PcrOffset_Handle hChannel /* [in] The channel handle */ |
|---|
| 751 | ); |
|---|
| 752 | |
|---|
| 753 | /*************************************************************************** |
|---|
| 754 | Summary: |
|---|
| 755 | Put the STC counter into free running mode. |
|---|
| 756 | |
|---|
| 757 | Description: |
|---|
| 758 | When free running is enabled, an internal 27 MHz clock will drive the STC |
|---|
| 759 | counter, rather than the timebase selected during the channel open. When |
|---|
| 760 | free running is disabled, the timebase given during the open will be |
|---|
| 761 | restored. |
|---|
| 762 | |
|---|
| 763 | Returns: |
|---|
| 764 | BERR_SUCCESS - Mode changed |
|---|
| 765 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 766 | ***************************************************************************/ |
|---|
| 767 | BERR_Code BXPT_PcrOffset_FreeRun( |
|---|
| 768 | BXPT_PcrOffset_Handle hChannel, /* [in] The channel handle */ |
|---|
| 769 | bool FreeRun /* [in] Free run if true. */ |
|---|
| 770 | ); |
|---|
| 771 | |
|---|
| 772 | /*************************************************************************** |
|---|
| 773 | Summary: |
|---|
| 774 | Push a PID channel onto the splicing stack. |
|---|
| 775 | |
|---|
| 776 | Description: |
|---|
| 777 | The given PID channel is pushed onto the PCR PID splicing stack. |
|---|
| 778 | |
|---|
| 779 | Returns: |
|---|
| 780 | BERR_SUCCESS - PID pushed onto the stack. |
|---|
| 781 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 782 | BXPT_ERR_QUEUE_FULL - No room left in the stack. |
|---|
| 783 | ***************************************************************************/ |
|---|
| 784 | BERR_Code BXPT_PcrOffset_PushPidChannel( |
|---|
| 785 | BXPT_PcrOffset_Handle hChannel, /* [in] The channel handle */ |
|---|
| 786 | unsigned int PidChannel /* [in] Channel carrying the PID to splice. */ |
|---|
| 787 | ); |
|---|
| 788 | |
|---|
| 789 | /*************************************************************************** |
|---|
| 790 | Summary: |
|---|
| 791 | Clear the splicing stack. |
|---|
| 792 | |
|---|
| 793 | Description: |
|---|
| 794 | The splicing stack is emptied. All PIDs in the stack are removed. |
|---|
| 795 | |
|---|
| 796 | Returns: |
|---|
| 797 | BERR_SUCCESS - Queue cleared. |
|---|
| 798 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 799 | ***************************************************************************/ |
|---|
| 800 | BERR_Code BXPT_PcrOffset_ClearQueue( |
|---|
| 801 | BXPT_PcrOffset_Handle hChannel /* [in] The channel handle */ |
|---|
| 802 | ); |
|---|
| 803 | |
|---|
| 804 | /*************************************************************************** |
|---|
| 805 | Summary: |
|---|
| 806 | Get splicing countdown. |
|---|
| 807 | |
|---|
| 808 | Description: |
|---|
| 809 | Return the value of the splicing countdown seen in the last PCR-bearing |
|---|
| 810 | packet. 0 will be returned if no PCR-bearing packet has been seen. |
|---|
| 811 | |
|---|
| 812 | Returns: |
|---|
| 813 | unsigned - The splicing countdown |
|---|
| 814 | ***************************************************************************/ |
|---|
| 815 | unsigned BXPT_PcrOffset_GetCountdown( |
|---|
| 816 | BXPT_PcrOffset_Handle hChannel /* [in] The channel handle */ |
|---|
| 817 | ); |
|---|
| 818 | |
|---|
| 819 | /*************************************************************************** |
|---|
| 820 | Summary: |
|---|
| 821 | Get splicing stack depth. |
|---|
| 822 | |
|---|
| 823 | Description: |
|---|
| 824 | Return depth of the splicing stack, i.e. the number of PIDs already pushed |
|---|
| 825 | but not yet spliced. |
|---|
| 826 | |
|---|
| 827 | Returns: |
|---|
| 828 | unsigned - The splicing countdown |
|---|
| 829 | ***************************************************************************/ |
|---|
| 830 | unsigned BXPT_PcrOffset_GetQueueDepth( |
|---|
| 831 | BXPT_PcrOffset_Handle hChannel /* [in] The channel handle */ |
|---|
| 832 | ); |
|---|
| 833 | |
|---|
| 834 | /*************************************************************************** |
|---|
| 835 | Summary: |
|---|
| 836 | Regenerate the PCR Offset. |
|---|
| 837 | |
|---|
| 838 | Description: |
|---|
| 839 | Regenerate a PCR Offset to the RAVE when the next PCR is seen in the current |
|---|
| 840 | stream. This function should be called only from within an ISR context. |
|---|
| 841 | |
|---|
| 842 | This API is being replaced by BXPT_PcrOffset_ReloadPcrPidChannel_isr(). |
|---|
| 843 | |
|---|
| 844 | Returns: |
|---|
| 845 | void |
|---|
| 846 | ***************************************************************************/ |
|---|
| 847 | void BXPT_PcrOffset_RegenOffset_isr( |
|---|
| 848 | BXPT_PcrOffset_Handle hPcrOff |
|---|
| 849 | ); |
|---|
| 850 | |
|---|
| 851 | /*************************************************************************** |
|---|
| 852 | Summary: |
|---|
| 853 | Reload the PCR PID channel. |
|---|
| 854 | |
|---|
| 855 | Description: |
|---|
| 856 | Another way to regenerate the PCR Offset is to reload/rewrite the PCR PID |
|---|
| 857 | channel. This function should be called only from within an ISR context. |
|---|
| 858 | |
|---|
| 859 | Returns: |
|---|
| 860 | void |
|---|
| 861 | ***************************************************************************/ |
|---|
| 862 | void BXPT_PcrOffset_ReloadPcrPidChannel_isr( |
|---|
| 863 | BXPT_PcrOffset_Handle hPcrOff |
|---|
| 864 | ); |
|---|
| 865 | |
|---|
| 866 | /*************************************************************************** |
|---|
| 867 | Summary: |
|---|
| 868 | Determine if the current offset is valid. |
|---|
| 869 | |
|---|
| 870 | Description: |
|---|
| 871 | In some cases, it's handy to know if the current Offset is valid. Return a |
|---|
| 872 | boolean indicating the valid status. |
|---|
| 873 | |
|---|
| 874 | Returns: |
|---|
| 875 | void |
|---|
| 876 | ***************************************************************************/ |
|---|
| 877 | bool BXPT_PcrOffset_IsOffsetValid( |
|---|
| 878 | BXPT_PcrOffset_Handle hPcrOff |
|---|
| 879 | ); |
|---|
| 880 | |
|---|
| 881 | /*************************************************************************** |
|---|
| 882 | Summary: |
|---|
| 883 | Determine if the current offset is valid, ISR version. |
|---|
| 884 | |
|---|
| 885 | Description: |
|---|
| 886 | In some cases, it's handy to know if the current Offset is valid. Return a |
|---|
| 887 | boolean indicating the valid status. This API can be called from within an |
|---|
| 888 | ISR context. |
|---|
| 889 | |
|---|
| 890 | Returns: |
|---|
| 891 | void |
|---|
| 892 | ***************************************************************************/ |
|---|
| 893 | bool BXPT_PcrOffset_IsOffsetValid_isr( |
|---|
| 894 | BXPT_PcrOffset_Handle hPcrOff |
|---|
| 895 | ); |
|---|
| 896 | |
|---|
| 897 | |
|---|
| 898 | /*************************************************************************** |
|---|
| 899 | Summary: |
|---|
| 900 | Force reset the PCR_OFFSET_VALID bit. |
|---|
| 901 | |
|---|
| 902 | Description: |
|---|
| 903 | Application should call this API before starting the Playback to clear |
|---|
| 904 | PCR_OFFSET_VALID. |
|---|
| 905 | |
|---|
| 906 | Returns: |
|---|
| 907 | void |
|---|
| 908 | ***************************************************************************/ |
|---|
| 909 | |
|---|
| 910 | void BXPT_PcrOffset_ForceInvalid( |
|---|
| 911 | BXPT_PcrOffset_Handle hPcrOff |
|---|
| 912 | ); |
|---|
| 913 | |
|---|
| 914 | /*************************************************************************** |
|---|
| 915 | Summary: |
|---|
| 916 | Force reset the PCR_OFFSET_VALID bit. ISR version. |
|---|
| 917 | |
|---|
| 918 | Description: |
|---|
| 919 | Application should call this API before starting the Playback to clear |
|---|
| 920 | PCR_OFFSET_VALID. |
|---|
| 921 | |
|---|
| 922 | Returns: |
|---|
| 923 | void |
|---|
| 924 | ***************************************************************************/ |
|---|
| 925 | |
|---|
| 926 | void BXPT_PcrOffset_ForceInvalid_isr( |
|---|
| 927 | BXPT_PcrOffset_Handle hPcrOff |
|---|
| 928 | ); |
|---|
| 929 | |
|---|
| 930 | /*************************************************************************** |
|---|
| 931 | Summary: |
|---|
| 932 | Generate PCR offsets for an additional PID channel. |
|---|
| 933 | |
|---|
| 934 | Description: |
|---|
| 935 | Mosaic mode requires that PCR offsets be generated for PID channels other |
|---|
| 936 | than the one specified in BXPT_PcrOffset_Settings.PidChannelNum . This call |
|---|
| 937 | is used to enable offset generation for those other channels. The offsets are |
|---|
| 938 | based on the PCR Offset / STC channel given by the BXPT_PcrOffset_Handle . |
|---|
| 939 | |
|---|
| 940 | Returns: |
|---|
| 941 | BERR_SUCCESS - Offset generation is enabled. |
|---|
| 942 | BERR_INVALID_PARAMETER - Bad input parameter |
|---|
| 943 | ***************************************************************************/ |
|---|
| 944 | BERR_Code BXPT_PcrOffset_EnableOffset( |
|---|
| 945 | BXPT_PcrOffset_Handle hPcrOff, /* [in] Handle for the PCR Offset channel to use */ |
|---|
| 946 | uint32_t PidChannelNum, /* [in] Which PID channel to generate offsets for */ |
|---|
| 947 | bool FixedOffsetEn, /* [in] Add a fixed offset during jitter adjustment */ |
|---|
| 948 | bool JitterAdjustEn /* [in] Enable jitter adjustment */ |
|---|
| 949 | ); |
|---|
| 950 | |
|---|
| 951 | /*************************************************************************** |
|---|
| 952 | Summary: |
|---|
| 953 | Disable PCR offset generation for an additional channel. |
|---|
| 954 | |
|---|
| 955 | Description: |
|---|
| 956 | Mosaic mode requires that PCR offsets be generated for PID channels other |
|---|
| 957 | than the one specified in BXPT_PcrOffset_Settings.PidChannelNum . This call |
|---|
| 958 | disables generation of PCR offsets for one of these other PID channels. |
|---|
| 959 | |
|---|
| 960 | Returns: |
|---|
| 961 | void |
|---|
| 962 | ***************************************************************************/ |
|---|
| 963 | void BXPT_PcrOffset_DisableOffset( |
|---|
| 964 | BXPT_PcrOffset_Handle hPcrOff, /* [in] Handle for the PCR Offset channel to use */ |
|---|
| 965 | uint32_t PidChannelNum /* [in] Which PID channel to disable offsets for */ |
|---|
| 966 | ); |
|---|
| 967 | |
|---|
| 968 | /*************************************************************************** |
|---|
| 969 | Summary: |
|---|
| 970 | Arm single capture of the STC from the stream. |
|---|
| 971 | |
|---|
| 972 | Description: |
|---|
| 973 | Enable capturing the STC from the next PCR in the stream. The capture is done |
|---|
| 974 | only once; to repeat the capture, call this API again after each capture. |
|---|
| 975 | |
|---|
| 976 | Returns: |
|---|
| 977 | void |
|---|
| 978 | ***************************************************************************/ |
|---|
| 979 | void BXPT_PcrOffset_CaptureStcOnce( |
|---|
| 980 | BXPT_PcrOffset_Handle hPcrOff, /* [in] Handle for the PCR Offset channel to use */ |
|---|
| 981 | bool Enable /* [in] true to capture once, false to disable a pending capture */ |
|---|
| 982 | ); |
|---|
| 983 | |
|---|
| 984 | /*************************************************************************** |
|---|
| 985 | Summary: |
|---|
| 986 | Arm single capture of the STC from the stream, ISR version. |
|---|
| 987 | |
|---|
| 988 | Description: |
|---|
| 989 | Use this call instead of BXPT_PcrOffset_CaptureStcOnce() when operating |
|---|
| 990 | from within an ISR context. |
|---|
| 991 | |
|---|
| 992 | Returns: |
|---|
| 993 | void |
|---|
| 994 | ***************************************************************************/ |
|---|
| 995 | void BXPT_PcrOffset_CaptureStcOnce_isr( |
|---|
| 996 | BXPT_PcrOffset_Handle hPcrOff, /* [in] Handle for the PCR Offset channel to use */ |
|---|
| 997 | bool Enable /* [in] true to capture once, false to disable a pending capture */ |
|---|
| 998 | ); |
|---|
| 999 | |
|---|
| 1000 | typedef enum BXPT_PcrOffsetIntName |
|---|
| 1001 | { |
|---|
| 1002 | BXPT_PcrOffsetIntName_ePcrNew = 0, |
|---|
| 1003 | BXPT_PcrOffsetIntName_ePcrDiscont = 1, |
|---|
| 1004 | BXPT_PcrOffsetIntName_ePcrOneErr = 2, |
|---|
| 1005 | BXPT_PcrOffsetIntName_ePcrTwoErr = 3, |
|---|
| 1006 | BXPT_PcrOffsetIntName_ePcrSpliceDone = 4, |
|---|
| 1007 | BXPT_PcrOffsetIntName_ePcrSpliceError = 5, |
|---|
| 1008 | BXPT_PcrOffsetIntName_eStcCaptured = 6 |
|---|
| 1009 | } |
|---|
| 1010 | BXPT_PcrOffsetIntName; |
|---|
| 1011 | |
|---|
| 1012 | /*************************************************************************** |
|---|
| 1013 | Summary: |
|---|
| 1014 | Return the INT ID for a given interrupt |
|---|
| 1015 | |
|---|
| 1016 | Description: |
|---|
| 1017 | Given the PCR Offset channel and a generic interrupt name, return the INT ID |
|---|
| 1018 | needed to create a callback for the channel's specific interrupt. |
|---|
| 1019 | |
|---|
| 1020 | Returns: |
|---|
| 1021 | BINT_id A BINT compatable interrupt ID |
|---|
| 1022 | ***************************************************************************/ |
|---|
| 1023 | BERR_Code BXPT_PcrOffset_GetIntId( |
|---|
| 1024 | BXPT_PcrOffset_Handle hChannel, |
|---|
| 1025 | BXPT_PcrOffsetIntName Name, |
|---|
| 1026 | BINT_Id *IntId |
|---|
| 1027 | ); |
|---|
| 1028 | |
|---|
| 1029 | /*************************************************************************** |
|---|
| 1030 | Summary: |
|---|
| 1031 | Put the PCR Offset channel back into acquire mode. |
|---|
| 1032 | |
|---|
| 1033 | Description: |
|---|
| 1034 | Should be called as part of channel change processing. |
|---|
| 1035 | |
|---|
| 1036 | Returns: |
|---|
| 1037 | void |
|---|
| 1038 | ***************************************************************************/ |
|---|
| 1039 | void BXPT_PcrOffset_Acquire( |
|---|
| 1040 | BXPT_PcrOffset_Handle hChannel |
|---|
| 1041 | ); |
|---|
| 1042 | |
|---|
| 1043 | /* |
|---|
| 1044 | ** These functions are called internally. |
|---|
| 1045 | ** Users should NOT uses these functions directly. |
|---|
| 1046 | */ |
|---|
| 1047 | |
|---|
| 1048 | bool BXPT_P_PcrOffset_IsPidChannelInUse( |
|---|
| 1049 | BXPT_Handle hXpt, /* [in] The transport handle */ |
|---|
| 1050 | uint32_t PidChannelNum /* [in] Which PID channel to disable offsets for */ |
|---|
| 1051 | ); |
|---|
| 1052 | |
|---|
| 1053 | void BXPT_P_PcrOffset_ModuleInit( |
|---|
| 1054 | BXPT_Handle hXpt |
|---|
| 1055 | ); |
|---|
| 1056 | |
|---|
| 1057 | #ifdef __cplusplus |
|---|
| 1058 | } |
|---|
| 1059 | #endif |
|---|
| 1060 | |
|---|
| 1061 | #endif /* BXPT_PCR_OFFSET_H__ */ |
|---|