/***************************************
 * FUNCTION: VPP profile configuration
 * INPUT: NONE
 * RETURN: NONE
 **************************************/
int MV_THINVPP_Config(void)
{
    int i;

    if (!thinvpp_obj)
        return (MV_THINVPP_ENODEV);

    /* VPP module has been configured */
    if (thinvpp_obj->status == STATUS_ACTIVE)
        return (MV_THINVPP_OK);

    thinvpp_obj->pSemHandle = dhub_semaphore(&VPP_dhubHandle.dhub);

    /* config planes */
    for (i=FIRST_PLANE; i<MAX_NUM_PLANES; i++){

        /* set plane's DMA channel ID */
        if (i == PLANE_MAIN){
            thinvpp_obj->plane[i].dmaRID = avioDhubChMap_vpp_MV_R; // inline read DMA
            thinvpp_obj->plane[i].dmaRdhubID = (int)(&VPP_dhubHandle);
            thinvpp_obj->plane[i].offline_dmaWID = avioDhubChMap_vpp_MV_FRC_W; // offline write-back DMA
            thinvpp_obj->plane[i].offline_dmaWdhubID = (int)(&VPP_dhubHandle);
            thinvpp_obj->plane[i].offline_dmaRID = avioDhubChMap_vpp_MV_FRC_R; // offline readd-back DMA
            thinvpp_obj->plane[i].offline_dmaRdhubID = (int)(&VPP_dhubHandle);
        }

    } // <- config FE planes

    /* config channels */
    thinvpp_obj->chan[CHAN_MAIN].dvID = CPCB_1;
    thinvpp_obj->chan[CHAN_MAIN].zorder = CPCB_ZORDER_2;
    thinvpp_obj->chan[CHAN_MAIN].dvlayerID = CPCB1_PLANE_1;

    thinvpp_obj->chan[CHAN_AUX].dvID = CPCB_3;
    thinvpp_obj->chan[CHAN_AUX].zorder = CPCB_ZORDER_1;
    thinvpp_obj->chan[CHAN_AUX].dvlayerID = CPCB1_PLANE_1; // PLANE-1 of CPCB-2

    thinvpp_obj->dv[CPCB_1].num_of_chans = 1;
    thinvpp_obj->dv[CPCB_1].chanID[0] = CHAN_MAIN;

    thinvpp_obj->dv[CPCB_1].num_of_vouts = 1;
    thinvpp_obj->dv[CPCB_1].voutID[0] = VOUT_HDMI;

    thinvpp_obj->dv[CPCB_3].num_of_chans = 0;

    /* config VOUTs */
    thinvpp_obj->vout[VOUT_HDMI].dvID = CPCB_1;

    /* select BCM sub-buffer to dump register settings */
    THINVPP_BCMBUF_Select(thinvpp_obj->pVbiBcmBuf, -1);

    BCM_SCHED_SetMux(BCM_SCHED_Q0, 0); /* CPCB0 VBI -> Q0 */

    /* set VPP module to be configured */
    thinvpp_obj->status = STATUS_ACTIVE;
    return (MV_THINVPP_OK);
}
/*******************************************************************
 * FUNCTION: set CPCB or DV output resolution
 * INPUT: cpcbID - CPCB(for Berlin) or DV(for Galois) id
 *        resID - id of output resolution
 *        bit_depth - HDMI deep color bit depth
 * RETURN: MV_THINVPP_OK - SUCCEED
 *         MV_EBADPARAM - invalid parameters
 *         MV_EUNCONFIG - VPP not configured or plane not active
 *         MV_EFRAMEQFULL - frame queue is full
 * Note: this function has to be called before enabling a plane
 *       which belongs to that CPCB or DV.
 *******************************************************************/
int MV_THINVPP_SetCPCBOutputResolution(int cpcbID, int resID, int bit_depth)
{
    int params[3];

    if (!thinvpp_obj) {
        return (MV_THINVPP_ENODEV);
    }

    if (resID<FIRST_RES || resID>=MAX_NUM_RESS) {
        return (MV_THINVPP_EBADPARAM);
    }

    if (thinvpp_obj->status == STATUS_INACTIVE){
        /* VPP module is not configured */
        return (MV_THINVPP_EUNCONFIG);
    }

    if (cpcbID<FIRST_CPCB || cpcbID>=MAX_NUM_CPCBS) {
        return (MV_THINVPP_EBADPARAM);
    }


    if (resID != RES_RESET) {

        /* select BCM sub-buffer to dump register settings */
        THINVPP_BCMBUF_Select(thinvpp_obj->pVbiBcmBuf, cpcbID);

        /* set CPCB resolution */
        params[0] = cpcbID;
        params[1] = resID;
        VPP_SetCPCBOutputResolution(thinvpp_obj, params);

        /* set DV status to active */
        thinvpp_obj->dv[cpcbID].status = STATUS_ACTIVE;
    }
   return (MV_THINVPP_OK);
}
/***************************************
 * FUNCTION: VPP reset
 * INPUT: NONE
 * RETURN: NONE
 **************************************/
int MV_THINVPP_Reset(void)
{
    int i;

    if (!thinvpp_obj)
        return (MV_THINVPP_ENODEV);

    // reset VPP object variable
    thinvpp_obj->status = STATUS_INACTIVE;

    /* reset planes */
    for (i=FIRST_PLANE; i<MAX_NUM_PLANES; i++){
        thinvpp_obj->plane[i].status = STATUS_INACTIVE;
        thinvpp_obj->plane[i].mode = -1; // invalid
        thinvpp_obj->plane[i].srcfmt = -1; // invalid
        thinvpp_obj->plane[i].order = -1; // invalid

        thinvpp_obj->plane[i].actv_win.x = 0;
        thinvpp_obj->plane[i].actv_win.y = 0;
        thinvpp_obj->plane[i].actv_win.width = 0;
        thinvpp_obj->plane[i].actv_win.height = 0;
    }

    /* reset channels */
    for (i=FIRST_CHAN; i<MAX_NUM_CHANS; i++) {
        thinvpp_obj->chan[i].status = STATUS_INACTIVE;
        thinvpp_obj->chan[i].dvID = -1; // invalid
        thinvpp_obj->chan[i].dvlayerID = -1; // invalid
        thinvpp_obj->chan[i].zorder = -1; // invalid

        thinvpp_obj->chan[i].disp_win.x = 0;
        thinvpp_obj->chan[i].disp_win.y = 0;
        thinvpp_obj->chan[i].disp_win.width = 0;
        thinvpp_obj->chan[i].disp_win.height = 0;
    }

    /* reset DVs */
    for (i=FIRST_CPCB; i<MAX_NUM_CPCBS; i++) {
        thinvpp_obj->dv[i].status = STATUS_INACTIVE;
        thinvpp_obj->dv[i].output_res = RES_INVALID; // invalid
        thinvpp_obj->dv[i].num_of_vouts = 0;
        thinvpp_obj->dv[i].vbi_num = 0;
    }

    /* reset VOUTs */
    for (i=FIRST_VOUT; i<MAX_NUM_VOUTS; i++) {
        thinvpp_obj->vout[i].status = STATUS_INACTIVE;
        thinvpp_obj->vout[i].dvID = -1; // invalid
    }

    /* reset VBI BCM buffer */
    THINVPP_BCMBUF_Reset(&thinvpp_obj->vbi_bcm_buf[0]);
    thinvpp_obj->pVbiBcmBuf = &(thinvpp_obj->vbi_bcm_buf[0]);
    thinvpp_obj->hdmi_mute = 0;

#if !LOGO_USE_SHM
    // do no need double buffers for dhub queues
    THINVPP_BCMBUF_Reset(&thinvpp_obj->vbi_bcm_buf[1]);
#endif
    thinvpp_obj->pVbiBcmBufCpcb[CPCB_1] = &(thinvpp_obj->vbi_bcm_buf[0]);

    thinvpp_obj->dv[CPCB_1].curr_cpcb_vbi_dma_cfgQ = &(thinvpp_obj->dv[CPCB_1].vbi_dma_cfgQ[0]);
    thinvpp_obj->dv[CPCB_1].curr_cpcb_vbi_bcm_cfgQ = &(thinvpp_obj->dv[CPCB_1].vbi_bcm_cfgQ[0]);

    /* reset dHub cmdQ */
#if (BERLIN_CHIP_VERSION != BERLIN_BG2CD_A0)
    for (i = 0; i < avioDhubChMap_vpp_TT_R; i++)
#else /* (BERLIN_CHIP_VERSION != BERLIN_BG2CD_A0) */
    for (i = 0; i < avioDhubChMap_vpp_SPDIF_W; i++)
#endif /* (BERLIN_CHIP_VERSION != BERLIN_BG2CD_A0) */
        thinvpp_obj->dhub_cmdQ[i] = 0;

    /* select BCM sub-buffer to dump register settings */
    THINVPP_BCMBUF_Select(thinvpp_obj->pVbiBcmBuf, -1);

    return (MV_THINVPP_OK);
}
Example #4
0
/***************************************
 * FUNCTION: VPP reset
 * INPUT: NONE
 * RETURN: NONE
 **************************************/
int MV_THINVPP_Reset(void)
{
    int i;

    if (!thinvpp_obj)
        return (MV_THINVPP_ENODEV);

    // reset VPP object variable
    thinvpp_obj->status = STATUS_INACTIVE;

    /* reset planes */
    for (i=FIRST_PLANE; i<MAX_NUM_PLANES; i++){
        thinvpp_obj->plane[i].status = STATUS_INACTIVE;
        thinvpp_obj->plane[i].mode = -1; // invalid
        thinvpp_obj->plane[i].srcfmt = -1; // invalid
        thinvpp_obj->plane[i].order = -1; // invalid

        thinvpp_obj->plane[i].actv_win.x = 0;
        thinvpp_obj->plane[i].actv_win.y = 0;
        thinvpp_obj->plane[i].actv_win.width = 0;
        thinvpp_obj->plane[i].actv_win.height = 0;

        thinvpp_obj->plane[i].ref_win = thinvpp_obj->plane[i].actv_win;
    }

    /* reset channels */
    for (i=FIRST_CHAN; i<MAX_NUM_CHANS; i++) {
        thinvpp_obj->chan[i].status = STATUS_INACTIVE;
        thinvpp_obj->chan[i].dvID = -1; // invalid
        thinvpp_obj->chan[i].dvlayerID = -1; // invalid
        thinvpp_obj->chan[i].zorder = -1; // invalid

        thinvpp_obj->chan[i].disp_win.x = 0;
        thinvpp_obj->chan[i].disp_win.y = 0;
        thinvpp_obj->chan[i].disp_win.width = 0;
        thinvpp_obj->chan[i].disp_win.height = 0;
    }

    /* reset DVs */
    for (i=FIRST_CPCB; i<MAX_NUM_CPCBS; i++) {
        thinvpp_obj->dv[i].status = STATUS_INACTIVE;
        thinvpp_obj->dv[i].output_res = RES_INVALID; // invalid
        thinvpp_obj->dv[i].num_of_vouts = 0;
        thinvpp_obj->dv[i].vbi_num = 0;
    }

    /* reset VOUTs */
    for (i=FIRST_VOUT; i<MAX_NUM_VOUTS; i++) {
        thinvpp_obj->vout[i].status = STATUS_INACTIVE;
        thinvpp_obj->vout[i].dvID = -1; // invalid
    }

    /* reset VBI BCM buffer */
    THINVPP_BCMBUF_Reset(&thinvpp_obj->vbi_bcm_buf);

    thinvpp_obj->pVbiBcmBuf = &(thinvpp_obj->vbi_bcm_buf);
    thinvpp_obj->pVbiBcmBufCpcb[CPCB_1] = &(thinvpp_obj->vbi_bcm_buf);


    /* reset dHub cmdQ */
#if (BERLIN_CHIP_VERSION != BERLIN_BG2CD_A0)
    for (i = 0; i < avioDhubChMap_vpp_TT_R; i++)
#else /* (BERLIN_CHIP_VERSION != BERLIN_BG2CD_A0) */
    for (i = 0; i < avioDhubChMap_vpp_SPDIF_W; i++)
#endif /* (BERLIN_CHIP_VERSION != BERLIN_BG2CD_A0) */
        thinvpp_obj->dhub_cmdQ[i] = 0;

    /* select BCM sub-buffer to dump register settings */
    THINVPP_BCMBUF_Select(thinvpp_obj->pVbiBcmBuf, -1);

    THINVPP_SCL_Reset(thinvpp_obj);
    THINVPP_CPCB_Reset(thinvpp_obj);
    THINVPP_BE_Reset(thinvpp_obj);

    /* start BCM engine to program VPP registers */
    THINVPP_BCMBUF_HardwareTrans(thinvpp_obj->pVbiBcmBuf, 1/*block*/);

    return (MV_THINVPP_OK);
}