コード例 #1
0
TVC_STATUS TVC_CommitChanges(BOOL blocking)
{
    if (_tvcContext.srcFormatSizeDirty)
    {
        _WaitForRegUpdated();

        // Config Source Format
        {
            TVC_REG_CON CON = TVC_REG->CONTROL;
            CON.DATA_FMT = _tvcContext.srcFormat;
            OUTREG32(&TVC_REG->CONTROL, AS_UINT32(&CON));
        }

        // Config Source Size
        OUTREG32(&TVC_REG->SRC_WIDTH, _tvcContext.srcSize.width);
        OUTREG32(&TVC_REG->SRC_HEIGHT, _tvcContext.srcSize.height);

        // Config Line Pitch
        {
            TVC_REG_LINE_OFFSET OFFSET = TVC_REG->LINE_OFFSET;
            OFFSET.LINE_OFFSET = (TVC_YUV420_BLK == _tvcContext.srcFormat) ?
                                 (_tvcContext.srcSize.width * 1) :
                                 (_tvcContext.srcSize.width * 2);
            OUTREG32(&TVC_REG->LINE_OFFSET, AS_UINT32(&OFFSET));
        }

        // Config Target Size
        _ConfigTarSize();

        // Config Full Display Region
        _ConfigFullDisplayRegion();


		// Config check line num, for MTKYUV the min is 4, for others the min is 1

		if (_tvcContext.srcFormat == TVC_YUV420_BLK) {
        	TVC_REG->CHECK_LINE = 4;
		} else {
        	TVC_REG->CHECK_LINE = 1;
		}

        _tvcContext.srcFormatSizeDirty = FALSE;
    }

    // Commit the Register Changes
    {
        TVC_REG_UPDATE update = TVC_REG->REG_UPDATE;
        update.REG_RDY = 1;
        OUTREG32(&TVC_REG->REG_UPDATE, AS_UINT32(&update));
    }

    if (blocking) {
        _WaitForRegUpdated();
    }

    return TVC_STATUS_OK;
}
コード例 #2
0
ファイル: tvc_drv.c プロジェクト: Lesozav25/ZOPO-TSN
TVC_STATUS TVC_CommitChanges(BOOL blocking)
{
    if (_tvcContext.srcFormatSizeDirty)
    {
        _WaitForRegUpdated();

        // Config Source Format
        {
            TVC_REG_CON CON = TVC_REG->CONTROL;
            CON.DATA_FMT = _tvcContext.srcFormat;
            OUTREG32(&TVC_REG->CONTROL, AS_UINT32(&CON));
        }

        // Config Source Size
        OUTREG32(&TVC_REG->SRC_WIDTH, _tvcContext.srcSize.width);
        OUTREG32(&TVC_REG->SRC_HEIGHT, _tvcContext.srcSize.height);

        // Config Line Pitch
        {
            TVC_REG_LINE_OFFSET OFFSET = TVC_REG->LINE_OFFSET;
            OFFSET.LINE_OFFSET = (TVC_YUV420_BLK == _tvcContext.srcFormat ||
                                  TVC_YUV420_PLANAR == _tvcContext.srcFormat) ?
                                 (_tvcContext.srcSize.width * 1) :
                                 (_tvcContext.srcSize.width * 2);
            OUTREG32(&TVC_REG->LINE_OFFSET, AS_UINT32(&OFFSET));
        }

        // Config Target Size
        _ConfigTarSize();

        // Config Full Display Region
        _ConfigFullDisplayRegion();


		// Config check line num, for MTKYUV the min is 4, for others the min is 1
#if 0
		if (_tvcContext.srcFormat == TVC_YUV420_BLK) {
        	TVC_REG->CHECK_LINE = 4;
		} else {
        	TVC_REG->CHECK_LINE = 1;
		}
#endif
#if defined ENABLE_TVC_INTERRUPT
        //_tvcContext.tvc_checkline_cnt = _tvcContext.srcSize.height - check_line_offset;
        _tvcContext.tvc_checkline_cnt = 1 + check_line_offset;
        if (_tvcContext.srcFormat == TVC_YUV420_BLK)
        {
            _tvcContext.tvc_checkline_cnt += 0x3;
            _tvcContext.tvc_checkline_cnt &= ~0x3;
        }
        ASSERT(_tvcContext.tvc_checkline_cnt != 0);
        TV_INFO("check line: %d\n", _tvcContext.tvc_checkline_cnt);
        TVC_REG->CHECK_LINE = _tvcContext.tvc_checkline_cnt;
#endif
        _tvcContext.srcFormatSizeDirty = FALSE;
    }

    OUTREG32(&TVC_REG->SRC_Y_ADDR, _tvcContext.srcAddrY);
    if (_tvcContext.srcFormat == TVC_YUV420_BLK || _tvcContext.srcFormat == TVC_YUV420_PLANAR)
    {
        OUTREG32(&TVC_REG->SRC_U_ADDR, _tvcContext.srcAddrU);
        OUTREG32(&TVC_REG->SRC_V_ADDR, _tvcContext.srcAddrV);
    }

    // Commit the Register Changes
    {
        TVC_REG_UPDATE update = TVC_REG->REG_UPDATE;
        update.REG_RDY = 1;
        OUTREG32(&TVC_REG->REG_UPDATE, AS_UINT32(&update));
    }

    if (blocking) {
        _WaitForRegUpdated();
    }

    return TVC_STATUS_OK;
}