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

📄 cnestpc.c

📁 这是一个SIGMA方案的PMP播放器的UCLINUX程序,可播放DVD,VCD,CD MP3...有很好的参考价值.
💻 C
字号:
/********************************************************************************************//*  cnestpc.c : specific code for DVD player board*  REALmagic Quasar Hardware Library*  Created by Aurelia Popa-Radu*  Copyright Sigma Designs Inc*  Sigma Designs Proprietary and confidential*  Created on 8/7/01*  Description:/********************************************************************************************//****h* HwLib/CNeStpc_Implementation * DESCRIPTION *  CNeStpc implementation of the IDecoderBoard interface. * STPC uses EM840X, EM9010 components to implement TV output, HDTV output. * Identified by HwLib reading MD5,MD4,MD3,MD2 pins  = 1000 (MDCFG_NE2000STPC). * PIO0	- IIC Clock for EM9010, Eeprom * PIO1	- IIC Data for EM9010, Eeprom * PIO2 - AUDIOSEL0 = audio frequency selection * PIO3 - AUDIOSEL1 = audio frequency selection * PIO4	- MD for Pcm1716 or Pcm1720 * PIO5 - MC for Pcm1716 or Pcm1720 * PIO6 - ML for Pcm1716 or Pcm1720 * PIO7 - MUTEX for Pcm1716 or Pcm1720 * Implementation based on CNE2000 without analog cable. * Specific implementation: * QRESULT CNeStpc__VidSetVGATV(IDecoderBoard* pIDecoderBoard, *		DWORD VideoRunning, DWORD TvOut) * QRESULT CNeStpc__AudioSetSampleRate(IDecoderBoard* pIDecoderBoard, DWORD Rate) * QRESULT CNeStpc__SelectVClk(IDecoderBoard* pIDecoderBoard, * 	VCLK_TYPE Type, void* pContext, DWORD ContextSize)/******************************************************************************/#include "pch.h"#if defined NE2000STPC_BRD#include "cqsrbrd.h"QRESULT CNeStpc__VidSetVGATV(IDecoderBoard* pIDecoderBoard, DWORD VideoRunning, DWORD TvOut){	CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard;	DWORD ccir = CCIR_601 | NO_INVERT_FIELD | SYNC_ENABLE_1;	if(TvOut == SET_VGA)		return E_NOT_SUPPORTED;	this->TvOut = TvOut;	if(VideoRunning & RST_DC)		IDecoder_StopDisplayController(this->m_pIDecoder);	QDbgLog((QLOG_TRACE, QDebugLevelError, TEXT("CNeStpc__VidSetVGATV VideoRunning=%x this->TvOut=%x"),		VideoRunning, this->TvOut));	switch(this->TvOut)	{	case SET_HDTV_SUBD:	case SET_HDTV:		// Mpeg FullScreen on VGA monitor, Quasar master, TVs slave and Nova slave		ITvEncoder_ProgramTV(this->m_pISigmaTv, TVSLAVE, 8,			ccir, this->Standard_TvOut, 0);		IAnalogOverlay_SetMode(this->m_pINova1, MpegModeRectangle);		IAnalogOverlay_SlaveShowAll(this->m_pINova1);		// all the results are in pixels, updates this->HFrequency		CQuasarBoard__HdtvCalc(pIDecoderBoard, 16, &this->HdtvMode, &this->MasterParams, &this->HFrequency);		IDecoderBoard_SelectVClk(pIDecoderBoard, HdtvVClk, &this->HdtvMode.PixelFreq, sizeof(this->HdtvMode.PixelFreq));		this->MasterParams.HSyncTotal = this->HdtvMode.PixelFreq / this->HdtvMode.HFreq;		// Quasar master interlaced or progressive, DVCLK from PLL2, polarity VGA		IDecoder_QuasarMaster( this->m_pIDecoder, 16, ccir, &this->MasterParams,			this->HdtvMode.Interlaced ? DISPLAY_INTERLACED:DISPLAY_NONINTERLACED,			VSHS_ACTIVE_HI, Q3CTRL2_NOINTERLACED | DIGITAL_DATA_ENABLE);		CQuasarBoard__HdtvUpdateVideoWindow(pIDecoderBoard);		break;	case SET_TV:		// Mpeg FullScreen on TV monitor: Quasar slave, TV master and Nova slave		// Nova - DVCLK disable, GND selected - hide the MPEG		IAnalogOverlay_SetTv(this->m_pINova1);		ITvEncoder_SetCurrentYcYuvRgb(this->m_pITvEncoder, this->ReqYcYuvRgb);		ITvEncoder_ProgramTV(this->m_pISigmaTv, TVMASTER, 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 | DIGITAL_DATA_ENABLE);		IDecoderBoard_SelectVClk(pIDecoderBoard, TvVClk, NULL, 0);		CQuasarBoard__TVVMIUpdateVideoWindow(pIDecoderBoard);		break;	}	return Q_OK;}QRESULT CNeStpc__AudioSetSampleRate(IDecoderBoard* pIDecoderBoard, DWORD Rate){	CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard;	BYTE j;	WORD Pcm17xx[4];	if( (!(this->BoardAudioRate & FORCED_HW_UPDATE)) && (this->BoardAudioRate == Rate) )		return Q_OK;	this->BoardAudioRate = Rate & ~FORCED_HW_UPDATE;	// use most significant bit to force programming	QDbgLog((QLOG_TRACE, QDebugLevelTrace, TEXT(" CQB__AudioSetSampleRate= %lu"), this->BoardAudioRate));	IDecoder_SetAudioSampleRate(this->m_pIDecoder, this->BoardAudioRate);	Pcm17xx[0] = 0x000 | 0x1ff;	// 0x1FF left attenuation	Pcm17xx[1] = 0x200 | 0x1ff;	// 0x3FF right attenuation	if(this->pRegistry->DacType == 1716)	// Pcm1716	{		Pcm17xx[2] = 0x400 | 0x008;		// 0x408 stereo, 24 bits		//Pcm17xx[2] = 0x400;			// 0x400 stereo, 16 bits		Pcm17xx[3] = (this->BoardAudioRate == 32000) ? 0xC0 : ((this->BoardAudioRate == 44100) ? 0x80 : 0x40);		Pcm17xx[3] |= (0x600 | 0x01);	// 0x641 for 48kHz, I2S		Pcm17xx[3] |= 0x100;			// IZD - zero detection	}	else	// Pcm1720	{		Pcm17xx[2] = 0x400 | 0x120 | 0x010;	// 0x530 stereo, 24 bits//			Pcm17xx[2] = 0x400 | 0x120;			// 0x520 stereo, 16 bits		Pcm17xx[3] = (this->BoardAudioRate == 32000) ? 0x80 : ((this->BoardAudioRate == 44100) ? 0x00 : 0x40);		Pcm17xx[3] |= (0x600 | 0x01);		// 0x641 for 48kHz, I2S		Pcm17xx[3] |= 0x100;				// IZD - zero detection	}	// PIO7 is MUTEX ??	IDecoder_WritePIO(this->m_pIDecoder, PIO7, 1);	// PIO6 - ML, PIO5 - MC, PIO4 - MD	for (j=0;j<sizeof(Pcm17xx)/sizeof(WORD);j++)		WritePcmDacReg(pIDecoderBoard, j, Pcm17xx[j], PIO6, PIO5, PIO4);	switch(this->BoardAudioRate)	{	case 32000:		IDecoder_WritePIO(this->m_pIDecoder, PIO2, 0);		IDecoder_WritePIO(this->m_pIDecoder, PIO3, 0);		break;	case 44100:		IDecoder_WritePIO(this->m_pIDecoder, PIO2, 1);		IDecoder_WritePIO(this->m_pIDecoder, PIO3, 0);		break;	default:	case 48000:		IDecoder_WritePIO(this->m_pIDecoder, PIO2, 0);		IDecoder_WritePIO(this->m_pIDecoder, PIO3, 1);		break;	}	return Q_OK;}QRESULT CNeStpc__SelectVClk(IDecoderBoard* pIDecoderBoard,	VCLK_TYPE Type, void* pContext, DWORD ContextSize){	CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard;	switch(Type)	{	case TvVClk:		// Let'use PLL2 like PixelClock: PLL2 = Fref * (N+2) / ((M+2)*2^K ),		// If Fref=14318000 -> N+2 = 132, M+2 = 35, K=1 => 26.99999657(142857) MHz		IAnalogOverlay_ProgramPLL(this->m_pINova1, PLL2, 130, 33, 1);		break;	case HdtvVClk:		CNE2000__ProgramVclkForHdtv(pIDecoderBoard);		break;			case VgaVClk:		// impossible case		break;	case VideoInClk:		// impossible case		break;	}	return Q_OK;}void CNeStpc__InitVtable(IDecoderBoard* pIDecoderBoard){	CQuasarBoard* this = (CQuasarBoard*) pIDecoderBoard;	CNE2000Common__InitVtable(pIDecoderBoard);	this->lpVtbl->VidSetVGATV				= CNeStpc__VidSetVGATV;	this->lpVtbl->AudioSetSampleRate		= CNeStpc__AudioSetSampleRate;	this->lpVtbl->SelectVClk				= CNeStpc__SelectVClk;}QRESULT CNeStpc__SpecificCreateInstance(IDecoderBoard* pIDecoderBoard, DWORD dwInstance){	CQuasarBoard* this = (CQuasarBoard*) pIDecoderBoard;	QRESULT qr;	if( QFAILED(qr = CNE2000Common__SpecificCreateInstance(pIDecoderBoard, dwInstance)) )		return qr;	// overwrite necessary values	CNeStpc__InitVtable(pIDecoderBoard);	this->BoardVersion = NE2000STPC;	this->SubId = (this->BoardVersion>>8);	this->RefFreqForPLL23 = 14318180;	// Hz	{	DWORD Value = 24;	IDecoder_SetProperty(this->m_pIDecoder,		DECODER_SET, edecAudioDacBitsPerSample, 0, &Value, sizeof(DWORD), NULL);	}	return Q_OK;}#endif	// NE2000STPC_BRD#if defined NE2000STPC_BRD && !defined ANY_BRDQRESULT CreateInstance(DWORD* pInstance, void* pHwLibConf){	QRESULT qr = CommonCreateInstance(pInstance, pHwLibConf);	if( QSUCCEEDED(qr) )		qr = CNeStpc__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	// NE2000STPC_BRD && !ANY_BRD

⌨️ 快捷键说明

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