source: svn/trunk/newcon3bcm2_21bu/magnum/syslib/pcrlib/7552/bpcrlib_ape.c

Last change on this file was 2, checked in by jglee, 11 years ago

first commit

  • Property svn:executable set to *
File size: 3.4 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2005-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: bpcrlib_ape.c $
11 * $brcm_Revision: Hydra_Software_Devel/1 $
12 * $brcm_Date: 5/17/11 1:20p $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/syslib/pcrlib/7038/bpcrlib_ape.c $
19 *
20 * Hydra_Software_Devel/1   5/17/11 1:20p jgarrett
21 * SW7425-604: Adding APE support to pcrlib
22 *
23 ***************************************************************************/
24
25#include "bstd.h"
26#include "bpcrlib.h"
27#include "bpcrlib_ape.h"
28#include "bxpt_pcr_offset.h"
29
30BDBG_MODULE(pcrlib);
31
32static BERR_Code
33BPCRlib_Audio_GetStc_Ape_isr(void *trp, void *dec, uint32_t *stc)
34{
35    BSTD_UNUSED(dec);
36    BDBG_MSG(("APE:GetStc %#x %#x", (unsigned)trp, (unsigned)dec));
37    *stc = BXPT_PcrOffset_GetStc_isr(trp) + BXPT_PcrOffset_GetOffset_isr(trp);
38    return BERR_SUCCESS;
39}
40
41static BERR_Code
42BPCRlib_Audio_GetPts_Ape_isr(void *dec, BAVC_PTSInfo *pts)
43{
44    BAPE_DecoderTsmStatus tsmStatus;
45    BERR_Code rc;
46    const BPCRlib_Ape_Decoder *ape=dec;
47
48    BDBG_MSG(("APE:GetPts %#x", (unsigned)dec));
49    rc = BAPE_Decoder_GetTsmStatus_isr(ape->dec, &tsmStatus);
50    *pts = tsmStatus.ptsInfo;
51   
52    return rc;
53}
54
55static BERR_Code
56BPCRlib_Audio_GetCdbLevel_Ape_isr(void *dec, unsigned *level)
57{
58    const BPCRlib_Ape_Decoder *ape=dec;
59    BXPT_Rave_BufferInfo buffer_info;
60    BERR_Code rc;
61
62    BDBG_ASSERT(ape->rave);
63    rc = BXPT_Rave_GetBufferInfo_isr(ape->rave, &buffer_info);
64    if (rc==BERR_SUCCESS) {
65        *level = buffer_info.CdbDepth;
66    }
67    return rc;
68}
69
70
71static BERR_Code
72BPCRlib_Audio_SetStc_Ape_isr(void *trp, void *dec, bool dss, uint32_t stc)
73{
74    BERR_Code  rc = BERR_SUCCESS;
75    const BPCRlib_Ape_Decoder *ape=dec;
76    uint32_t current_stc;
77    int32_t diff;
78    BSTD_UNUSED(dss);
79
80    BDBG_MSG(("APE:SetStc %#x %#x", (unsigned)trp, (unsigned)dec));
81
82    current_stc = BXPT_PcrOffset_GetStc_isr(trp);
83    diff = (int32_t)current_stc - (int32_t)stc;
84    /* If the STC is already very close, there's no point in resetting it. This
85    prevents PTS Errors from raptor which tries to follow a tight TSM threshold. */
86    if (diff > 100 || diff < -100) {
87        /* assume that PCR_OFFSET offset was set to 0 by host before starting PVR. */
88        rc = BXPT_PcrOffset_SetStc_isr(trp, stc);
89    }
90   
91    if (rc==BERR_SUCCESS) {
92        rc = BAPE_Decoder_SetStcValid_isr(ape->dec);
93    }
94    return rc;
95}
96
97static BERR_Code
98BPCRlib_Audio_UpdateStc_Ape_isr(void *trp, bool is_request_stc)
99{
100    BDBG_MSG(("APE::UpdateStc %#x", (unsigned)trp));
101    if (is_request_stc) {
102        /* If PCR_OFFSET block has non-zero OFFSET_THRESHOLD, then it needs
103        to be forced to regenerate an offset message to RAVE. Otherwise the decoder
104        may lose a pcr_offset_valid message. */
105        BXPT_PcrOffset_RegenOffset_isr(trp);
106    }
107    return 0;
108}
109
110const BPCRlib_StcDecIface BPCRlib_Audio_Ape = {
111    BPCRlib_Audio_GetPts_Ape_isr,
112    BPCRlib_Audio_GetStc_Ape_isr,
113    BPCRlib_Audio_GetCdbLevel_Ape_isr,
114    BPCRlib_Audio_SetStc_Ape_isr, 
115    BPCRlib_Audio_UpdateStc_Ape_isr,  /* no update STC */
116    true
117};
118
Note: See TracBrowser for help on using the repository browser.