⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cqsrbrd.c

📁 这是一个SIGMA方案的PMP播放器的UCLINUX程序,可播放DVD,VCD,CD MP3...有很好的参考价值.
💻 C
📖 第 1 页 / 共 5 页
字号:
	{ E_EEPROM_NOT_PRESENT,		TEXT("EEPROM not present")},	{ E_PROGRAM_EEPROM_FAILED,	TEXT("EEPROM test failed")},	{ E_NOVA_AUTOCALIB_FAILED,	TEXT("Nova autocalibration failed")},	{ E_TEST_SCANCONVERTER_FAILED,	TEXT("Scancoverter failed")},	{ 0,						TEXT("LastError")},};typedef struct tagBoardEntry{	DWORD BoardVersion;	TCHAR* String;} BoardEntry;/****v* HwLib/g_BoardVersionNames * NAME *	g_BoardVersionNames * DESCRIPTION *	Global table of strings for the names of the supported boards. */BoardEntry g_BoardVersionNames[] ={	{ NE2000,			TEXT("NE2000")},	{ NE2000TV,			TEXT("NE2000TV")},	{ NE2000STPC,		TEXT("NE2000STPC")},	{ ANALOG_PVR,		TEXT("ANALOG_PVR")},	{ NE4000,			TEXT("NE4000")},	{ NE4000_SIGMATV,	TEXT("NE4000_SIGMATV")},	{ VE2000,			TEXT("VE2000")},	{ GALAXY2000,		TEXT("GALAXY2000")},	{ CLARION,			TEXT("CLARION")},	{ QUADMASTER,		TEXT("QUADMASTER")},	{ QUADSLAVE,		TEXT("QUADSLAVE")},	{ SYMPHONY,			TEXT("SYMPHONY")},	{ PVR_DIGITAL,		TEXT("PVR_DIGITAL")},	{ XCARD,			TEXT("XCARD")},	{ NEC,				TEXT("NEC")},	{ BROADCAST_LITE,	TEXT("BROADCAST_LITE")},	{ BROADCAST,		TEXT("BROADCAST")},	{ MELODY,			TEXT("MELODY")},	{ SONY_HAC,			TEXT("SONY_HAC")},	{ SONY_HVC,			TEXT("SONY_HVC")},	{ JASMINE2,			TEXT("JASMINE2")},	{ SYMPHONY2,		TEXT("SYMPHONY2")}};/****f* HwLib/GetBoardDescription * USAGE *	TCHAR* GetBoardDescription(DWORD BoardVersion) * DESCRIPTION *	GetLastQError - It finds the global string in g_BoardVersionNames *  associated with BoardVersion. * SEE ALSO *   g_BoardVersionNames/******************************************************************************/TCHAR* GetBoardDescription(DWORD BoardVersion){	int i;	BoardEntry* pBoardEntry = g_BoardVersionNames;	for(i = 0; i<(sizeof(g_BoardVersionNames)/sizeof(BoardEntry)); i++)	{		if( BoardVersion == pBoardEntry->BoardVersion )			return pBoardEntry->String;		pBoardEntry++;	}	return TEXT("Unknown Board");}/****f* HwLib/GetLastQError * USAGE *	TCHAR* GetLastQError(QRESULT qr) * DESCRIPTION *	GetLastQError - It finds the global string in g_ErrorTable associated with qr. * PARAMETERS *	IN QRESULT qr = QRESULT returned by a HwLib function * RETURN VALUE *	pointer to the global string associated with qr * SEE ALSO *   g_ErrorTable/******************************************************************************/TCHAR* GetLastQError(QRESULT qr){	int i;	ErrorEntry* pErrorEntry = g_ErrorTable;	for(i = 0; i<(sizeof(g_ErrorTable)/sizeof(ErrorEntry)); i++)	{		if( qr == pErrorEntry->Code )			return pErrorEntry->String;		pErrorEntry++;	}	return TEXT("Unknown Error");}/****v* HwLib/g_InfoError * NAME *	g_InfoError * DESCRIPTION *	Global String receiving specific description of errors./******************************************************************************/TCHAR g_InfoError[128];QRESULT CommonCreateInstance(DWORD* pInstance, void* pHwLibConf){	IDecoderBoard* pIDecoderBoard;	CQuasarBoard* this;	DWORD dwInstance , i, TvEncoderId;	HWLIB_CONFIG* pPCI = (HWLIB_CONFIG*)pHwLibConf;	DWORD SymbolTableSize;	QRESULT qr;	dwInstance = MAX_INSTANCES;	for (i = 0; i < MAX_INSTANCES; i++)	{		if( g_pIDecoderBoard[i] == NULL )		{			dwInstance = i;			break;		}	}	if(dwInstance >= MAX_INSTANCES )	{		pIDecoderBoard = 0;		return E_TOO_MANY_INSTANCES;	}	// Create CQuasarBoard instance	if( ModCreateInstance (dwInstance, &CLSID_CQUASARBOARD, &IID_IDECODERBOARD,		(void**)&pIDecoderBoard) != NOERROR )	{		pIDecoderBoard = 0;		return E_CREATE_INSTANCE_FAILED;	}	g_pIDecoderBoard[dwInstance] = pIDecoderBoard;	*pInstance = dwInstance;	this = (CQuasarBoard*) pIDecoderBoard;	OSmemcpy( &this->HwLibConf, pPCI, sizeof(HWLIB_CONFIG));	this->PciDeviceID = pPCI->DeviceID;	this->PciSubsystemID = pPCI->SubsystemID;	this->PciSubsystemVendorID = pPCI->SubsystemVendorID;// used only by NEC board		// Create CQuasar instance	if( ModCreateInstance (dwInstance, &CLSID_CQUASAR, &IID_IDECODER,		(void**)&this->m_pIDecoder) != NOERROR )	{		CQuasarBoard__DeleteObjects(pIDecoderBoard);		pIDecoderBoard = 0;		return E_CREATE_INSTANCE_FAILED;	}	IDecoder_QueryInterface( this->m_pIDecoder, IID_ISETI2CPIO, (void**)&(this->m_pISetI2CpIO));	IDecoder_Init( this->m_pIDecoder, pHwLibConf, &this->QuasarVersion );// find QuasarVersion	// choose microcode & get symbols	this->MicrocodeType = ebiUcode_MpegDecode;	if(QFAILED( qr = IDecoder_SetMicrocode(this->m_pIDecoder, this->MicrocodeType)) )	{		CQuasarBoard__DeleteObjects(pIDecoderBoard);		pIDecoderBoard = 0;		return qr;	}	IDecoder_GetSymbolTable(this->m_pIDecoder, &this->pQ, &SymbolTableSize);	// Create CSigmaTv instance	if( ModCreateInstance (dwInstance, &CLSID_CTVENCODER, &IID_ISIGMATV,		(void**)&this->m_pISigmaTv) != NOERROR )	{		CQuasarBoard__DeleteObjects(pIDecoderBoard);		pIDecoderBoard = 0;		return E_CREATE_INSTANCE_FAILED;	}	TvEncoderId = 0;	ITvEncoder_Init(this->m_pISigmaTv, &TvEncoderId);	this->m_pITvEncoder = this->m_pISigmaTv;	// Create CEeprom instance	ISetI2CpIO_SetI2C_params( this->m_pISetI2CpIO, I2C_PIO_DATA, I2C_PIO_CLOCK);	if( ModCreateInstance (dwInstance, &CLSID_CEEPROM, &IID_IEEPROM,		(void**)&this->m_pIEeprom) != NOERROR )	{		CQuasarBoard__DeleteObjects(pIDecoderBoard);		pIDecoderBoard = 0;		return E_CREATE_INSTANCE_FAILED;	}	IEeprom_Init( this->m_pIEeprom );	if (this->QuasarVersion != EM85XX_JASPER)	{		if( !IEeprom_CheckPresence( this->m_pIEeprom ) )		{			QDbgLog((QLOG_TRACE, QDebugLevelWarning, TEXT("   NO EEPROM on Board")));		}		else		{			QDbgLog((QLOG_TRACE, QDebugLevelWarning, TEXT("   EEPROM on PIO_DATA=%x & PIO_CLOCK=%x"),				I2C_PIO_DATA, I2C_PIO_CLOCK ));		}	}	else	{		QDbgLog((QLOG_TRACE, QDebugLevelWarning, TEXT("   NO EEPROM for Jasper")));	}	// Create CI2C instance	if( ModCreateInstance (dwInstance, &CLSID_CI2C, &IID_II2C,		(void**)&this->m_pII2C) != NOERROR )	{		CQuasarBoard__DeleteObjects(pIDecoderBoard);		pIDecoderBoard = 0;		return E_CREATE_INSTANCE_FAILED;	}	II2C_Init( this->m_pII2C );	this->VideoMode = MPEG_ATTRIBUTE_VIDEO_NTSC;	this->XOffset = 200;	this->YOffset = 30;	this->DefCorrection = 1000;	this->Correction = this->DefCorrection;	// default acquisition window size fixing opera imaginaire application zooming after playing VCD2.0	this->SrcWnd.x = 0;	this->SrcWnd.y = 0;	this->SrcWnd.w = NTSC_ACTIVE_VIDEO_WIDTH;	this->SrcWnd.h = NTSC_ACTIVE_VIDEO_HEIGHT;	this->AcqWnd = this->SrcWnd;	// Problem = the microcode doesn't strt properly if the dest window is NULL.	// Fix = initialize MaxDisplayWnd and DstWnd with not null values to be sure	// that there are no problems.	this->MaxDisplayWnd = this->SrcWnd;	this->DstWnd.w = 4;	this->DstWnd.h = 4;	this->m_bEnableSync = TRUE;	this->FirstSystemSCR = TRUE;#ifdef AUDIO_PATCH	this->AudioByteCounter == 0xffffffff;#endif	this->iPpmRange = 150;	this->HwVcxo = eHwVcxoMax;	// inoperant by default	// RefFreqForPLL23 used only in HdtvCalc to program PLL2=pixel clock in SET_HDTV mode	this->RefFreqForPLL23 = 16000000;	// Hz	// Video port update 	this->m_bUpdateVideoPort = FALSE;	// default values for VideoIn	this->Vc_config = VC_cfg_656 | VC_cfg_422 |		VC_cfg_UnPackLuma | VC_cfg_UnPackChroma |		VC_cfg_Interlaced | VC_cfg_8bits |		VC_cfg_Zoom | VC_cfg_Mpeg2 |		VC_cfg_HSyncLo | VC_cfg_VSyncLo |		VC_cfg_VSyncActiveLeadingEdge;	this->VideoInParams.x = 0;	this->VideoInParams.y = 0;	this->VideoInParams.w = 720;	this->VideoInParams.h = 480;	this->VideoInParams.OutputLineLength = 720;	this->VideoInParams.Ccir = CCIR_656;	this->VideoInParams.ChromaDownScale = YUV422;	this->VideoInParams.YuvPacked = 0;			// not packed	this->VideoInParams.InterlacedSource =	1;	// interlaced	this->VideoInParams.InvertField = 0;		// no invert	this->VideoInParams.BitsPerClock = 8;	this->VideoInParams.HSyncPolarity = 0;	this->VideoInParams.VSyncPolarity = 0;	this->VideoInParams.VSyncActiveEdge = 1;	// leading	this->Vc_Vip20Input = 1; // VIP2.0 by default	this->BoardCapabilities = (		MPEG_CAPABILITY_TV_OUTPUT |		MPEG_CAPABILITY_TV_TOLERANCE |		MPEG_CAPABILITY_PAL60 |		MPEG_CAPABILITY_DAC_SPDIF |		MPEG_CAPABILITY_BSC_ADJUST |		MPEG_CAPABILITY_ASPECT_RATIO |		MPEG_CAPABILITY_DVD_CAN_PLAY |		MPEG_CAPABILITY_FRAME_FF |		MPEG_CAPABILITY_DVD_DECRYPTION 		);	if( (this->PciDeviceID == 0x8475) || (this->PciDeviceID == 0x8476) ||		(this->PciDeviceID == 0x8485) || (this->PciDeviceID == 0x8486) )	{		this->HwVcxo = eHwVcxoPio14;		this->BoardCapabilities |= MPEG_CAPABILITY_AUDIO_VCXO;	}	if( (this->PciDeviceID & 0xFFF0) >= 0x8470 )		this->BoardCapabilities |= MPEG_CAPABILITY_MPEG4_DECODE;	// Initialize auxiliary interface	this->m_this = this;	if ( IEeprom_GetPresence(this->m_pIEeprom) )		this->BoardCapabilities |= MPEG_CAPABILITY_EEPROM_PRESENT;	if( !CQuasarBoard__CreateRegistry(pIDecoderBoard) )		return Q_FAIL;	if( !CQuasarBoard__CreatePropertySetList(pIDecoderBoard) )		return Q_FAIL;	CQuasarBoard__InitPendingStack(pIDecoderBoard);	// to have the iVast defaults for now	this->VideoCTSTimeScale = 1000;	this->AudioCTSTimeScale = 1000;	this->VOPTimeIncrRes = 30;	// init same way like the registry	this->DigOvOnlyParams.BitsPerClock = 8;	this->DigOvOnlyParams.Ccir = CCIR_601;	this->DigOvOnlyParams.InvertField = 0;	this->DigOvOnlyParams.SyncEnable = 1;	// by default enable VS,HS, VVLD	this->DigOvOnlyParams.Vip20 = 1;		// by default VIP2.0	this->DigOvOnlyParams.TvHdtvStandard = evTvHdtvStandard_NTSC;	this->DigOvOnlyParams.SyncGen = evSyncGen_em8xxx_Master;	this->AudioInOutConfig = eAudioInOut_BitClockInternDivMClk;	this->AudioInParams.HwConfig = eAudioInConfig_Master_MSBFirst;	this->AudioInParams.SampleRate = 48000;	this->AudioInParams.BitsPerSample = 24;	return Q_OK;}QRESULT CQuasarBoard__DeleteObjects(IDecoderBoard* pIDecoderBoard){	CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard;	if (this->m_pINova1)			// Call CAnalogOverlay Destructor		IAnalogOverlay_Delete ( this->m_pINova1, TRUE );	if (this->m_pINovaLite)			// Call CAnalogOverlay Destructor		IAnalogOverlay_Delete ( this->m_pINovaLite, TRUE );	if (this->m_pII2C)				// Call CII2C Destructor		II2C_Delete ( this->m_pII2C, TRUE );	if (this->m_pIEeprom)			// Call CEeprom Destructor		IEeprom_Delete ( this->m_pIEeprom, TRUE );	if (this->m_pIExtTv)			// Call CTvEncoder Destructor		ITvEncoder_Delete ( this->m_pIExtTv, TRUE );	if (this->m_pIScanConverter)	// Call Cfs400 Destructor		IScanConverter_Delete ( this->m_pIScanConverter, TRUE );	if (this->m_pIVideoDecoder)		// Call Csaa7114 Destructor		IVideoDecoder_Delete ( this->m_pIVideoDecoder, TRUE );	if (this->m_pITvTuner)		// Call CTvTuner Destructor		ITvTuner_Delete ( this->m_pITvTuner, TRUE );	if (this->m_pIMpegEncoder)		// Call Csm2288 Destructor		IMpegEncoder_Delete ( this->m_pIMpegEncoder, TRUE );	if (this->m_pIDviTransmitter)	// Call Csii168 Destructor		IDviTransmitter_Delete ( this->m_pIDviTransmitter, TRUE );	if (this->m_pISigmaTv)			// Call CTvEncoder Destructor		ITvEncoder_Delete ( this->m_pISigmaTv, TRUE );	if (this->m_pIDecoder)			// Call CQuasar Destructor		IDecoder_Delete (  this->m_pIDecoder, TRUE );	if( this->pRegistry )		CQuasarBoard__DeleteRegistry(pIDecoderBoard);	if( this->pPropSetList )		CQuasarBoard__DeletePropertySetList(pIDecoderBoard);	// Call CQuasarBoard Destructor	IDecoderBoard_Delete ( pIDecoderBoard, TRUE );	return Q_OK;}/****f* HwLib/DeleteHardware

⌨️ 快捷键说明

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