source: svn/newcon3bcm2_21bu/magnum/portinginterface/xpt/7552/bxpt_pcr_offset.h

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 38.6 KB
Line 
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
195extern "C"{
196#endif
197
198/*=************************ Module Overview ********************************
199<verbatim>
200Overview:
201</verbatim>
202***************************************************************************/
203
204/***************************************************************************
205Summary:
206This define is being deprecated. Use BXPT_PcrOffset_Settings.UseHostPcrs
207instead.
208****************************************************************************/
209#define BXPT_PCROFFSET_USE_HOST_PCRS        ( 0xFF )
210
211/***************************************************************************
212Summary:
213Module private defines. User code should not use these defines directly.
214****************************************************************************/
215#define BXPT_P_SPLICING_QUEUE_SIZE              8
216
217/***************************************************************************
218Summary:
219Defines 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/***************************************************************************
224Summary:
225The opaque handle for a PCR offset module.
226
227Description:
228This structure represents the PCR handle. It is created at
229BXPT_PcrOffset_Open
230***************************************************************************/
231typedef struct BXPT_P_PcrOffset_Impl *BXPT_PcrOffset_Handle;
232
233/***************************************************************************
234Summary:
235Enumeration of all the data sources a parser band can use.
236****************************************************************************/
237typedef enum BXPT_PcrOffset_StcCountMode
238{
239    BXPT_PcrOffset_StcCountMode_eMod300 = 0, 
240    BXPT_PcrOffset_StcCountMode_eBinary = 1
241}
242BXPT_PcrOffset_StcCountMode;
243
244#if BXPT_HAS_TSMUX
245/***************************************************************************
246Summary:
247Enumeration of all the data sources a parser band can use.
248****************************************************************************/
249typedef 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}
256BXPT_PcrOffset_BroadcastMode;
257#endif
258
259/***************************************************************************
260Summary:
261Default settings for a PCR Offset channel.
262
263Description:
264The settings read from, or will be written to, a PCR offset channel.
265***************************************************************************/
266typedef 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} 
305BXPT_PcrOffset_Defaults;
306
307/***************************************************************************
308Summary:
309Settings for a PCR Offset channel.
310
311Description:
312The settings read from, or will be written to, a PCR offset channel.
313***************************************************************************/
314typedef 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}
375BXPT_PcrOffset_Settings;
376
377#if BXPT_HAS_TSMUX
378
379/***************************************************************************
380Summary:
381Maximum number of external triggers supported.
382****************************************************************************/
383#define BXPT_MAX_EXTERNAL_TRIGS     ( 2 )
384
385/***************************************************************************
386Summary:
387Status bits for the TsMux channel.
388****************************************************************************/
389typedef 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}
396BXPT_PcrOffset_StcTriggerMode;
397
398/***************************************************************************
399Summary:
400PCR Offset configuration for Non-Realtime Transcoding. 
401****************************************************************************/
402typedef 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}
419BXPT_PcrOffset_NRTConfig;
420
421/***************************************************************************
422Summary: Example code for configurating an audio and a video decoder PCR
423Offset 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/***************************************************************************
472Summary:
473Get the PCR Offset configuration for Non-Realtime Transcoding. 
474****************************************************************************/
475void BXPT_PcrOffset_GetNRTConfig(
476    BXPT_PcrOffset_Handle hPcrOffset,   /* [in] The channel handle */
477    BXPT_PcrOffset_NRTConfig *Config
478    );
479
480/***************************************************************************
481Summary:
482Set the PCR Offset configuration for Non-Realtime Transcoding. 
483****************************************************************************/
484BERR_Code BXPT_PcrOffset_SetNRTConfig(
485    BXPT_PcrOffset_Handle hPcrOffset,   /* [in] The channel handle */
486    const BXPT_PcrOffset_NRTConfig *Config
487    );
488
489/***************************************************************************
490Summary:
491Get address of the soft increment registers.
492****************************************************************************/
493void BXPT_PcrOffset_GetSoftIncrementRegisterOffsets(
494    BXPT_PcrOffset_Handle hPcrOffset,   /* [in] The channel handle */
495    BAVC_Xpt_StcSoftIncRegisters *RegMap
496    );
497
498#endif
499
500/***************************************************************************
501Summary:
502Return the total number of PCR Offset channels available.
503
504Description:
505The number of PCR Offset instantiations can vary from one chip to another.
506This call will return the number available on the current chip.
507
508Returns:
509    BERR_SUCCESS                - Returned the total channel count.
510    BERR_INVALID_PARAMETER      - Bad input parameter
511****************************************************************************/
512BERR_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/***************************************************************************
518Summary:
519Return defaults for a PCR Offset channel.
520
521Description:
522This call returns the default settings for the given PCR Offset channel. The
523settings returned can be changed and used during channel open.
524
525Returns:
526    BERR_SUCCESS                - Returned the defaults for the channel.
527    BERR_INVALID_PARAMETER      - Bad input parameter
528
529See also:
530BXPT_PcrOffset_Open
531****************************************************************************/
532BERR_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/***************************************************************************
539Summary:
540Open a PCR Offset channel.
541
542Description:
543The PCR Offset channel give by WhichOne is initialized, using the setting
544provided in the Defaults structure. A handle for the opened channel is
545returned.
546
547Returns:
548    BERR_SUCCESS                - Channel opened successfully.
549    BERR_INVALID_PARAMETER      - Bad input parameter
550***************************************************************************/
551BERR_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/***************************************************************************
559Summary:
560Close a PCR Offset channel.
561
562Description:
563The given channel is disabled. The associated splicing stack is also cleared.
564
565Returns:
566    BERR_SUCCESS                - Channel closed succesfully.
567    BERR_INVALID_PARAMETER      - Bad input parameter
568***************************************************************************/
569BERR_Code BXPT_PcrOffset_Close(
570    BXPT_PcrOffset_Handle hChannel   /* [in] The channel handle */
571    );
572
573/***************************************************************************
574Summary:
575Get the current PID settings.
576
577Description:
578The PID channel number and parser band being used for PCR offset calculation
579are returned.
580
581Returns:
582    BERR_SUCCESS                - Settings read succesfully.
583    BERR_INVALID_PARAMETER      - Bad input parameter
584***************************************************************************/
585BERR_Code BXPT_PcrOffset_GetSettings(
586    BXPT_PcrOffset_Handle hPcrOff,
587    BXPT_PcrOffset_Settings *Settings
588    );
589
590/***************************************************************************
591Summary:
592Set the current PID settings.
593
594Description:
595Load mew values for the PID channel number into hardware, for
596use by the PCR offset calculation. Note that the PID channel must be
597configured and enabled before calling this function.
598
599Returns:
600    BERR_SUCCESS                - Settings written succesfully.
601    BERR_INVALID_PARAMETER      - Bad input parameter
602***************************************************************************/
603BERR_Code BXPT_PcrOffset_SetSettings(
604    BXPT_PcrOffset_Handle hPcrOff,
605    const BXPT_PcrOffset_Settings *Settings
606    );
607
608/***************************************************************************
609Summary:
610Change the STC clock rate.
611
612Description:
613The STC can be run at a faster or slower rate during playback, to support
614STC-based trick modes. This call will change the STC rate according to the
615following formula:
616
617new_rate = increment_rate * ( Increment / ( Prescale + 1 ) )
618where increment_rate is 45kHz for MPEG, or 27 MHz for other standards.
619
620Returns:
621    BERR_SUCCESS                - STC rate changed.
622    BERR_INVALID_PARAMETER      - Bad input parameter
623***************************************************************************/
624BERR_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/***************************************************************************
631Summary:
632Freeze the STC clock.
633
634Description:
635The STC value is frozen at it's current value. That value will be continually
636broadcast.
637
638Returns:
639    BERR_SUCCESS                - STC frozen (or unfrozen as requested).
640    BERR_INVALID_PARAMETER      - Bad input parameter
641***************************************************************************/
642BERR_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/***************************************************************************
648Summary:
649Set the current STC.
650
651Description:
652Load a user-defined STC. This value will be the new STC broadcast by the
653PCR Offset block. Note that this value must be added to the PCR Offset
654value (obtained by calling BXPT_PcrOffset_GetOffset()) to obtain the full
655STC value used by the decoders for timestamp management.
656
657For MPEG streams, the PCR Offset is the most significant 32 bits of the 33
658bit base value. For DirecTV, it is the full 32 bit RTS.
659
660Returns:
661    BERR_SUCCESS                - New STC loaded succesfully.
662    BERR_INVALID_PARAMETER      - Bad input parameter
663***************************************************************************/
664BERR_Code BXPT_PcrOffset_SetStc(
665    BXPT_PcrOffset_Handle hChannel,     /* [in] The channel handle */
666    uint32_t NewStc
667    );
668BERR_Code BXPT_PcrOffset_SetStc_isr(
669    BXPT_PcrOffset_Handle hChannel,     /* [in] The channel handle */
670    uint32_t NewStc
671    );
672
673/***************************************************************************
674Summary:
675Retrieve the STC clock value.
676
677Description:
678The upper 32 bits of the current STC are returned. The STC used here is NOT
679the actual PCR value recovered from the stream. The STC is initialized to 0 in
680hardware, and is incremented by the DPCR block. When PCRs are seen in the
681transport stream, the value of that PCR is subtracted from the STC and
682becomes the PCR Offset that is given to the decoders. As such, the STC is
683usable for timestamp management, even though it's value (probably) doesn't
684match the actuall PCRs in the stream.
685
686Note that this value is added to the PCR Offset (which can be obtained by calling
687BXPT_PcrOffset_GetOffset()) to obtain the full STC value used by the decoders
688for timestamp management.
689
690For MPEG streams, the PCR Offset is the most significant 32 bits of the 33
691bit base value. For DirecTV, it is the full 32 bit RTS.
692
693Returns:
694    uint32_t - The 32 most significant bits of the STC.
695***************************************************************************/
696uint32_t BXPT_PcrOffset_GetStc(
697    BXPT_PcrOffset_Handle hChannel      /* [in] The channel handle */
698    );
699
700uint32_t BXPT_PcrOffset_GetStc_isr(
701    BXPT_PcrOffset_Handle hChannel      /* [in] The channel handle */
702    );
703
704/***************************************************************************
705Summary:
706Load a new PCR Offset.
707
708Description:
709A user-supplied PCR Offset is loaded into hardware. Note that this is added
710to the current STC (which can be obtained by calling BXPT_PcrOffset_GetStc())
711to yield the value used by the decoders for timestamp management.
712
713For MPEG streams, the PCR Offset is the most significant 32 bits of the 33
714bit base value. For DirecTV, it is the full 32 bit RTS.
715
716Returns:
717    BERR_SUCCESS                - PVR offset loaded.
718    BERR_INVALID_PARAMETER      - Bad input parameter
719***************************************************************************/
720BERR_Code BXPT_PcrOffset_SetOffset(
721    BXPT_PcrOffset_Handle hChannel,     /* [in] The channel handle */
722    uint32_t UserPcrOffset                  /* [in] User-supplied PCR Offset */
723    );
724
725BERR_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/***************************************************************************
731Summary:
732Get the current PCR Offset.
733
734Description:
735Return the current PCR Offset. This must be added to the value returned by
736BXPT_PcrOffset_GetStc() to yield the complete STC that the audio and video
737decoders will use for timestamp management.
738
739For MPEG streams, the PCR Offset is the most significant 32 bits of the 33
740bit base value. For DirecTV, it is the full 32 bit RTS.
741
742Returns:
743    uint32_t - The current PCR Offset
744***************************************************************************/
745uint32_t BXPT_PcrOffset_GetOffset(
746    BXPT_PcrOffset_Handle hChannel          /* [in] The channel handle */
747    );
748
749uint32_t BXPT_PcrOffset_GetOffset_isr(
750    BXPT_PcrOffset_Handle hChannel          /* [in] The channel handle */
751    );
752
753/***************************************************************************
754Summary:
755Put the STC counter into free running mode.
756
757Description:
758When free running is enabled, an internal 27 MHz clock will drive the STC
759counter, rather than the timebase selected during the channel open. When
760free running is disabled, the timebase given during the open will be
761restored.
762
763Returns:
764    BERR_SUCCESS                - Mode changed
765    BERR_INVALID_PARAMETER      - Bad input parameter
766***************************************************************************/
767BERR_Code BXPT_PcrOffset_FreeRun(
768    BXPT_PcrOffset_Handle hChannel,     /* [in] The channel handle */
769    bool FreeRun                        /* [in] Free run if true. */
770    );
771
772/***************************************************************************
773Summary:
774Push a PID channel onto the splicing stack.
775
776Description:
777The given PID channel is pushed onto the PCR PID splicing stack.
778
779Returns:
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***************************************************************************/
784BERR_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/***************************************************************************
790Summary:
791Clear the splicing stack.
792
793Description:
794The splicing stack is emptied. All PIDs in the stack are removed.
795
796Returns:
797    BERR_SUCCESS                - Queue cleared.
798    BERR_INVALID_PARAMETER      - Bad input parameter
799***************************************************************************/
800BERR_Code BXPT_PcrOffset_ClearQueue(
801    BXPT_PcrOffset_Handle hChannel      /* [in] The channel handle */
802    );
803
804/***************************************************************************
805Summary:
806Get splicing countdown.
807
808Description:
809Return the value of the splicing countdown seen in the last PCR-bearing
810packet. 0 will be returned if no PCR-bearing packet has been seen.
811
812Returns:
813    unsigned - The splicing countdown
814***************************************************************************/
815unsigned BXPT_PcrOffset_GetCountdown(
816    BXPT_PcrOffset_Handle hChannel      /* [in] The channel handle */
817    );
818
819/***************************************************************************
820Summary:
821Get splicing stack depth.
822
823Description:
824Return depth of the splicing stack, i.e. the number of PIDs already pushed
825but not yet spliced.
826
827Returns:
828    unsigned - The splicing countdown
829***************************************************************************/
830unsigned BXPT_PcrOffset_GetQueueDepth(
831    BXPT_PcrOffset_Handle hChannel      /* [in] The channel handle */
832    );
833
834/***************************************************************************
835Summary:
836Regenerate the PCR Offset.
837
838Description:
839Regenerate a PCR Offset to the RAVE when the next PCR is seen in the current
840stream. This function should be called only from within an ISR context.
841
842This API is being replaced by BXPT_PcrOffset_ReloadPcrPidChannel_isr().
843
844Returns:
845    void
846***************************************************************************/
847void BXPT_PcrOffset_RegenOffset_isr(
848    BXPT_PcrOffset_Handle hPcrOff
849    );
850
851/***************************************************************************
852Summary:
853Reload the PCR PID channel.
854
855Description:
856Another way to regenerate the PCR Offset is to reload/rewrite the PCR PID
857channel. This function should be called only from within an ISR context.
858
859Returns:
860    void
861***************************************************************************/
862void BXPT_PcrOffset_ReloadPcrPidChannel_isr(
863        BXPT_PcrOffset_Handle hPcrOff
864        );
865
866/***************************************************************************
867Summary:
868Determine if the current offset is valid.
869
870Description:
871In some cases, it's handy to know if the current Offset is valid. Return a
872boolean indicating the valid status.
873
874Returns:
875    void
876***************************************************************************/
877bool BXPT_PcrOffset_IsOffsetValid(
878    BXPT_PcrOffset_Handle hPcrOff
879    );
880
881/***************************************************************************
882Summary:
883Determine if the current offset is valid, ISR version.
884
885Description:
886In some cases, it's handy to know if the current Offset is valid. Return a
887boolean indicating the valid status. This API can be called from within an
888ISR context.
889
890Returns:
891    void
892***************************************************************************/
893bool BXPT_PcrOffset_IsOffsetValid_isr(
894    BXPT_PcrOffset_Handle hPcrOff
895    );
896
897
898/***************************************************************************
899Summary:
900Force reset the PCR_OFFSET_VALID bit.
901
902Description:
903 Application should call this API before starting the Playback to clear
904 PCR_OFFSET_VALID.
905
906Returns:
907    void
908***************************************************************************/
909
910void BXPT_PcrOffset_ForceInvalid( 
911        BXPT_PcrOffset_Handle hPcrOff
912        );
913
914/***************************************************************************
915Summary:
916Force reset the PCR_OFFSET_VALID bit. ISR version.
917
918Description:
919 Application should call this API before starting the Playback to clear
920 PCR_OFFSET_VALID.
921
922Returns:
923    void
924***************************************************************************/
925
926void BXPT_PcrOffset_ForceInvalid_isr( 
927        BXPT_PcrOffset_Handle hPcrOff
928        );
929
930/***************************************************************************
931Summary:
932Generate PCR offsets for an additional PID channel.
933
934Description:
935Mosaic mode requires that PCR offsets be generated for PID channels other
936than the one specified in BXPT_PcrOffset_Settings.PidChannelNum . This call
937is used to enable offset generation for those other channels. The offsets are
938based on the PCR Offset / STC channel given by the BXPT_PcrOffset_Handle .
939
940Returns:
941    BERR_SUCCESS                - Offset generation is enabled.
942    BERR_INVALID_PARAMETER      - Bad input parameter
943***************************************************************************/
944BERR_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/***************************************************************************
952Summary:
953Disable PCR offset generation for an additional channel.
954
955Description:
956Mosaic mode requires that PCR offsets be generated for PID channels other
957than the one specified in BXPT_PcrOffset_Settings.PidChannelNum . This call
958disables generation of PCR offsets for one of these other PID channels.
959
960Returns:
961    void
962***************************************************************************/
963void 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/***************************************************************************
969Summary:
970Arm single capture of the STC from the stream.
971
972Description:
973Enable capturing the STC from the next PCR in the stream. The capture is done
974only once; to repeat the capture, call this API again after each capture.
975
976Returns:
977    void
978***************************************************************************/
979void 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/***************************************************************************
985Summary:
986Arm single capture of the STC from the stream, ISR version.
987
988Description:
989Use this call instead of BXPT_PcrOffset_CaptureStcOnce() when operating
990from within an ISR context.
991
992Returns:
993    void
994***************************************************************************/
995void 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
1000typedef 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}
1010BXPT_PcrOffsetIntName;
1011
1012/***************************************************************************
1013Summary:
1014Return the INT ID for a given interrupt
1015
1016Description:
1017Given the PCR Offset channel and a generic interrupt name, return the INT ID
1018needed to create a callback for the channel's specific interrupt.
1019
1020Returns:
1021    BINT_id     A BINT compatable interrupt ID
1022***************************************************************************/
1023BERR_Code BXPT_PcrOffset_GetIntId(
1024    BXPT_PcrOffset_Handle hChannel,
1025    BXPT_PcrOffsetIntName Name,
1026    BINT_Id *IntId
1027    );
1028
1029/***************************************************************************
1030Summary:
1031Put the PCR Offset channel back into acquire mode.
1032 
1033Description:
1034Should be called as part of channel change processing.
1035 
1036Returns:
1037        void
1038***************************************************************************/
1039void 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
1048bool 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
1053void BXPT_P_PcrOffset_ModuleInit( 
1054    BXPT_Handle hXpt
1055    );
1056
1057#ifdef __cplusplus
1058}
1059#endif
1060
1061#endif      /* BXPT_PCR_OFFSET_H__ */
Note: See TracBrowser for help on using the repository browser.