cbrdcast.c

来自「这是一个SIGMA方案的PMP播放器的UCLINUX程序,可播放DVD,VCD,」· C语言 代码 · 共 388 行

C
388
字号
/******************************************************************************//*  cbrdcast.c : specific code for BROADCASTER board*  REALmagic Quasar Hardware Library*  Created by Aurelia Popa-Radu*  Copyright Sigma Designs Inc*  Sigma Designs Proprietary and confidential*  Created on 04/15/02*  Description:/******************************************************************************//****h* HwLib/CBrdcast_Implementation * DESCRIPTION *  CBrdcast implementation of the IDecoderBoard interface. * BROADCAST uses EM847X to implement digital overlay output, * TV and Scart output, HDTV output. * Identified by HwLib reading MD5,MD4,MD3,MD2 pins = 0000 (MDCFG_REFERENCE) and * by PciSubsystemID = 0x01. * PIO0	- IIC Clock for Eeprom * PIO1	- IIC Data for Eeprom * Implementation based on CVE2000. * Specific implementation: * QRESULT CBrdcast__VidSetVGATV(IDecoderBoard* pIDecoderBoard, DWORD VideoRunning, DWORD TvOut )/******************************************************************************/#include "pch.h"#if defined BROADCAST_BRD#include "cqsrbrd.h"BYTE SAA7115_test[]={	0x80,      0x90,	0x81,      0x00,//	0x82,      0x00,	0x83,      0x00,	// Xport 0x31,	0x84,      0x80,	0x85,      0x00,	0x86,      0xc5,	0x87,      0x00,	// Iport 0x31,	0x88,      0xf0,//	0x89,      0x00,//	0x8a,      0x00,//	0x8b,      0x00,//	0x8c,      0x00,//	0x8d,      0x00,//	0x8e,      0x00,//	0x8f,      0x00,	0x90,      0x00,	0x91,      0x08,	0x92,      0x00,	0x93,      0xc0,	0x94,      0x04,	0x95,      0x00,	0x96,      0xd0,	0x97,      0x02,	0x98,      0x07,	0x99,      0x01,	0x9a,      0x06,	0x9b,      0x01,	0x9c,      0xd0,	0x9d,      0x02,	0x9e,      0x07,	0x9f,      0x01,	0xa0,      0x01,	0xa1,      0x00,	0xa2,      0x00,//	0xa3,      0x80,	0xa4,      0x80,	0xa5,      0x40,	0xa6,      0x40,//	0xa7,      0x00,	0xa8,      0x00,	0xa9,      0x04,	0xaa,      0x00,//	0xab,      0x00,	0xac,      0x00,	0xad,      0x02,	0xae,      0x00,//	0xaf,      0x00,	0xb0,      0x00,	0xb1,      0x04,	0xb2,      0x00,	0xb3,      0x04,	0xb4,      0x00/*	0xb5,      0x00,	0xb6,      0x00,	0xb7,      0x00,	0xb8,      0x00,	0xb9,      0x00,	0xba,      0x00,	0xbb,      0x00,	0xbc,      0x00,	0xbd,      0x00,	0xbe,      0x00,	0xbf,      0x00,*/};// use predefined PIO0 and PIO1 for I2C_CLK_PIO, I2C_DATA_PIOvoid CBrdcast__VidSetTV(IDecoderBoard* pIDecoderBoard, DWORD VideoRunning){	CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard;	BYTE temp;	DWORD ccir = this->pRegistry->Ccir_656 |//	DWORD ccir = CCIR_601 |		(this->pRegistry->InvertField << 12) |		(this->pRegistry->SyncEnable << 4);	if(VideoRunning & RST_DC)		IDecoder_StopDisplayController(this->m_pIDecoder);	IDecoderBoard_SelectVClk(pIDecoderBoard, VideoInClk, NULL, 0);	// Use external VS,HS from SAA7115 connected at video in pins,	// Quasar slave, SigmaTv slave, SAA7128 slave	ITvEncoder_ProgramTV(this->m_pISigmaTv, TVSLAVE, 8,		ccir, this->Standard_TvOut, VideoRunning & ~RST_DC);	IDecoder_QuasarSlave( this->m_pIDecoder, 8, ccir,		(this->Standard_TvOut == SET_PAL) ? &this->MasterParamsPal:&this->MasterParamsNtsc,		VSHS_ACTIVE_LOW, Q3CTRL2_NOINTERLACED | USE_VIDEOIN_SYNCS | USE_VIDEOIN_CK | DIGITAL_DATA_ENABLE);	ITvEncoder_ProgramTV(this->m_pIExtTv, TVSLAVE, 8,		ccir, this->Standard_TvOut, VideoRunning & ~RST_DC);	// disable Xport	temp = 0x00;	IVideoDecoder_Write(this->m_pIVideoDecoder, 0x83, &temp );	// disable Iport	IVideoDecoder_Write(this->m_pIVideoDecoder, 0x87, &temp );	// use genlock -> enable RTCO	temp = 0xc0;	IVideoDecoder_Write(this->m_pIVideoDecoder, 0x13, &temp );	// enable RTCI	temp = 0xbf;	ITvEncoder_Write(this->m_pIExtTv, 0x62, temp );	IDecoderBoard_SetProperty(pIDecoderBoard,		VIDEO_DECODER_SET, evdTvStandard, 0,		&this->Standard_TvOut, sizeof(this->Standard_TvOut), NULL);	CQuasarBoard__TVVMIUpdateVideoWindow(pIDecoderBoard);}void CBrdcast__VidSetPassThrough(IDecoderBoard* pIDecoderBoard, DWORD VideoRunning){	CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard;	BYTE temp;	DWORD ccir = this->pRegistry->Ccir_656 |		(this->pRegistry->InvertField << 12) |		(this->pRegistry->SyncEnable << 4);	if(VideoRunning & RST_DC)		IDecoder_StopDisplayController(this->m_pIDecoder);	IDecoderBoard_SelectVClk(pIDecoderBoard, VideoInClk, NULL, 0);	// Use external VS,HS from SAA7115 connected at video in pins,	// Quasar slave, SigmaTv slave, SAA7128 slave	ITvEncoder_ProgramTV(this->m_pISigmaTv, TVSLAVE, 8,		ccir, this->Standard_TvOut, VideoRunning & ~RST_DC);	IDecoder_QuasarSlave( this->m_pIDecoder, 8, ccir,		(this->Standard_TvOut == SET_PAL) ? &this->MasterParamsPal:&this->MasterParamsNtsc,		VSHS_ACTIVE_LOW, Q3CTRL2_NOINTERLACED | USE_VIDEOIN_SYNCS | USE_VIDEOIN_CK );	ITvEncoder_ProgramTV(this->m_pIExtTv, TVSLAVE, 8,		ccir, this->Standard_TvOut, VideoRunning & ~RST_DC);	// enable Xport	temp = 0x01;	IVideoDecoder_Write(this->m_pIVideoDecoder, 0x83, &temp );	// disable Iport	temp = 0x00;	IVideoDecoder_Write(this->m_pIVideoDecoder, 0x87, &temp );	// use genlock -> enable RTCO	temp = 0xc0;	IVideoDecoder_Write(this->m_pIVideoDecoder, 0x13, &temp );	// enable RTCI	temp = 0xbf;	ITvEncoder_Write(this->m_pIExtTv, 0x62, temp );	IDecoderBoard_SetProperty(pIDecoderBoard,		VIDEO_DECODER_SET, evdTvStandard, 0,		&this->Standard_TvOut, sizeof(this->Standard_TvOut), NULL);	//	for( i=0; i< sizeof(SAA7115_test); i+=2)//		IVideoDecoder_Write(this->m_pIVideoDecoder, SAA7115_test[i], &SAA7115_test[i+1] );}QRESULT CBrdcast__VidSetVGATV(IDecoderBoard* pIDecoderBoard, DWORD VideoRunning, DWORD TvOut ){	CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard;	switch(TvOut)	{	case SET_TV:		this->TvOut = TvOut;		ITvEncoder_SetCurrentYcYuvRgb(this->m_pITvEncoder, this->ReqYcYuvRgb);		CBrdcast__VidSetTV(pIDecoderBoard, VideoRunning);	// genlock playback		break;	default:		this->TvOut = TvOut;		CBrdcast__VidSetPassThrough(pIDecoderBoard, VideoRunning);		return E_NOT_SUPPORTED;	}	return Q_OK;}QRESULT CBrdcast__UpdateOverlay(IDecoderBoard* pIDecoderBoard){	CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard;	if ( this->TvOut == evOutputDevice_DigOvOnly )		CQuasarBoard__HdtvUpdateVideoWindow(pIDecoderBoard);	else		CQuasarBoard__TVVMIUpdateVideoWindow(pIDecoderBoard);	return Q_OK;}QRESULT CBrdcast__SetVideoProperty(IDecoderBoard* pIDecoderBoard,	DWORD PropSet, DWORD PropId, DWORD Flags, void* pData, DWORD dwSizeIn, DWORD* pdwSizeOut){	//	CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard;	// VIDEO use DWORD for changing information and size condition is already checked	DWORD Value = *(DWORD*)pData;	//	QRESULT qr = Q_OK;	QDbgLog((QLOG_TRACE, QDebugLevelTrace,		TEXT("   --> CBrdcast__SetVideoProperty: set=%x id=%x flags=%x sz=%x value=%x"),		PropSet, PropId, Flags, dwSizeIn, Value));	switch(PropId)	{	default:		return CQuasarBoard__SetVideoProperty(pIDecoderBoard, PropSet, PropId, Flags, pData, dwSizeIn, pdwSizeOut);	}	return Q_OK;}QRESULT CBrdcast__GetVideoProperty( IDecoderBoard* pIDecoderBoard,	DWORD PropSet, DWORD PropId, DWORD Flags, void* pData, DWORD dwSizeIn, DWORD* pdwSizeOut){	//	CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard;	// VIDEO use DWORD for changing information and size condition is already checked	DWORD Value;	//	QRESULT qr = Q_OK;	switch(PropId)	{	default:		return CQuasarBoard__GetVideoProperty(pIDecoderBoard, PropSet, PropId, Flags, pData, dwSizeIn, pdwSizeOut);	}	*(DWORD*)pData = Value;	QDbgLog((QLOG_TRACE, QDebugLevelTrace,		TEXT("   <-- CBrdcast__GetVideoProperty: set=%x id=%x flags=%x sz=%x value=%x"),		PropSet, PropId, Flags, dwSizeIn, Value));	return Q_OK;}QRESULT CBrdcast__HwReset(IDecoderBoard* pIDecoderBoard){	CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard;	QRESULT qr = Q_OK;		qr = CVE2000__HwReset(pIDecoderBoard);	IDecoder_WritePIO(this->m_pIDecoder, PIO12, 0);	return qr;}void CBrdcast__InitVtable(IDecoderBoard* pIDecoderBoard){	CQuasarBoard* this = (CQuasarBoard*) pIDecoderBoard;	this->lpVtbl->HwReset							= CBrdcast__HwReset;	this->lpVtbl->SetCustomTvHdtv					= CVE2000__SetCustomTvHdtv;	this->lpVtbl->SelectVClk						= C847xBrd__SelectVClk;	this->lpVtbl->AudioSetSampleRate				= C847xBrd__AudioSetSampleRate;	if( this->BoardVersion == BROADCAST)	{		this->lpVtbl->VidSetVGATV					= CBrdcast__VidSetVGATV;		this->lpVtbl->UpdateOverlay					= CBrdcast__UpdateOverlay;	}	else	{		this->lpVtbl->VidSetVGATV					= C847xDigBrd__VidSetVGATV;		this->lpVtbl->UpdateOverlay					= CVE2000__UpdateOverlay;	}}QRESULT CBroadcaster__SpecificCreateInstance(IDecoderBoard* pIDecoderBoard, DWORD dwInstance){	CQuasarBoard* this = (CQuasarBoard*) pIDecoderBoard;	if( (IDecoder_ReadReg(this->m_pIDecoder, DRAM_startup) & 0x3C) == 0x00 )	{		DWORD TvEncoderId = 0x7F;		// Create CTvEncoder instance - use genlock to play		if( ModCreateInstance (dwInstance, &CLSID_CTVENCODER, &IID_ITVENCODER,			(void**)&this->m_pIExtTv) != NOERROR)		{			return Q_FAIL;		}		ISetI2CpIO_SetI2C_params( this->m_pISetI2CpIO, I2C_PIO_DATA, I2C_PIO_CLOCK);		ITvEncoder_Init(this->m_pIExtTv, &TvEncoderId);		ITvEncoder_SetRegistry(this->m_pIExtTv, this->pRegistry);		this->m_pITvEncoder = this->m_pIExtTv;		// Create also Csaa7175 instance		if( ModCreateInstance (dwInstance, &CLSID_CSAA7114, &IID_IVIDEODECODER,			(void**)&this->m_pIVideoDecoder) != NOERROR )		{			return Q_FAIL;		}		IVideoDecoder_Init(this->m_pIVideoDecoder);		IVideoDecoder_InitPropertySet(this->m_pIVideoDecoder, this->pPropSetList, sizeof(PROPERTY_SET_ITEM));		this->BoardVersion = BROADCAST;	}	else		this->BoardVersion = BROADCAST_LITE;		this->BoardCapabilities |= (		MPEG_CAPABILITY_TV_YUV_COMPONENT |		MPEG_CAPABILITY_TV_RGB_COMPONENT |		MPEG_CAPABILITY_HDTV_OUTPUT		);	this->pRegistry->Ccir_656 = CCIR_656;	this->pRegistry->SyncEnable = 1;	// by default disable VS,HS,VVLD for 656	this->pRegistry->TvOut = SET_TV | SET_NTSC | SET_ONETOONE;	this->TvOut = SET_TV;	// overwrite necessary values	CBrdcast__InitVtable(pIDecoderBoard);	this->DeviceId = VENTURA2000_DEVICEID;	this->SubId = (this->BoardVersion>>8);	if( this->PciSubsystemID != 0x03 )		QDbgLog((QLOG_TRACE, QDebugLevelWarning, TEXT("\n\nERROR: Create BROADCAST is FORCED !") ));	{	DWORD Value = I2S_SCkinJDA1CK_Jda1CkinDAMCK_ScinOUT_DamckIN;	IDecoder_WritePIO(this->m_pIDecoder, PIO12, 0);	IDecoder_SetProperty(this->m_pIDecoder,		DECODER_SET, edecAudioInOutConfig, 0, &Value, sizeof(DWORD), NULL);	Value = 24;	IDecoder_SetProperty(this->m_pIDecoder,		DECODER_SET, edecAudioDacBitsPerSample, 0, &Value, sizeof(DWORD), NULL);	}	return Q_OK;}#endif	// BROADCAST_BRD#if defined BROADCAST_BRD && !defined ANY_BRDQRESULT CreateInstance(DWORD* pInstance, void* pHwLibConf){	QRESULT qr = CommonCreateInstance(pInstance, pHwLibConf);	if( QSUCCEEDED(qr) )		qr = CBrdcast__SpecificCreateInstance(g_pIDecoderBoard[*pInstance], *pInstance);	if( QFAILED(qr) )	{		CQuasarBoard__DeleteObjects(g_pIDecoderBoard[*pInstance]);		g_pIDecoderBoard[*pInstance] = 0;		return E_CREATE_INSTANCE_FAILED;	}	return Q_OK;}#endif	// BROADCAST_BRD && !ANY_BRD

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?