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

📄 cgalaxy2.c

📁 这是一个SIGMA方案的PMP播放器的UCLINUX程序,可播放DVD,VCD,CD MP3...有很好的参考价值.
💻 C
字号:
/******************************************************************************//*  cgalaxy2.c : specific code for GALAXY2 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/CGalaxy2_Implementation * DESCRIPTION *  CGalaxy2 implementation of the IDecoderBoard interface. * GALAXY2 uses EM840X component to implement digital overlay output and * TV output. * Identified by HwLib reading MD5,MD4,MD3,MD2 pins = 0000 (MDCFG_REFERENCE). * PIO0	- IIC Clock for Eeprom * PIO1	- IIC Data for Eeprom * PIO2 - AUDIOSEL0 = audio frequency selection * PIO3 - AUDIOSEL1 = audio frequency selection * PIO4	-  * PIO5	-  * PIO6 -  * PIO7 - 1/0 = analog mux to show (IGS + EM8400 window)/(EM8400 fullscreen) on TV * Implementation based on CVE2000. * Specific implementation: * QRESULT CGalaxy2__VidSetVGATV(IDecoderBoard* pIDecoderBoard, DWORD VideoRunning, DWORD TvOut) * QRESULT CGalaxy2__AudioSetSampleRate(IDecoderBoard* pIDecoderBoard, DWORD Rate)/******************************************************************************/#include "pch.h"#if defined GALAXY2_BRD#include "cqsrbrd.h"#ifndef AUDIOSEL0_32#define AUDIOSEL0_32     0     /* PIO2 value for 32K audio */#define AUDIOSEL1_32     0     /* PIO3 value for 32K audio */#define AUDIOSEL0_441    1     /* PIO2 value for 44.1K audio */#define AUDIOSEL1_441    0     /* PIO3 value for 44.1K audio */#define AUDIOSEL0_48     0     /* PIO2 value for 48K audio */#define AUDIOSEL1_48     1     /* PIO3 value for 48K audio */#endifQRESULT CGalaxy2__VidSetVGATV(IDecoderBoard* pIDecoderBoard, DWORD VideoRunning, DWORD TvOut){	CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard;	if( this->QuasarVersion >= EM847XA_Q4 )	{		switch(TvOut)		{		case SET_TV:		case SET_VGA:			this->TvOut = TvOut;			ITvEncoder_SetCurrentYcYuvRgb(this->m_pITvEncoder, this->ReqYcYuvRgb);			CVE2000__VidSetTV(pIDecoderBoard, VideoRunning);			break;		case SET_HDTV:			this->TvOut = TvOut;			C847xBrd__CheckHdtvMcrvsn(pIDecoderBoard);			C847xBrd__VidSetHdtv(pIDecoderBoard, VideoRunning);			break;		case evOutputDevice_DigOvOnly:			this->TvOut = TvOut;			ITvEncoder_SetCurrentYcYuvRgb(this->m_pITvEncoder, this->ReqYcYuvRgb);			return C847xBrd__DigOvOnly(pIDecoderBoard, VideoRunning);		default:			return E_NOT_SUPPORTED;		}		return Q_OK;	}	// EM840x	switch(TvOut)	{	case SET_TV:	case SET_VGA:	case SET_HDTV:		this->TvOut = TvOut;		ITvEncoder_SetCurrentYcYuvRgb(this->m_pITvEncoder, this->ReqYcYuvRgb);		CVE2000__VidSetTV(pIDecoderBoard, VideoRunning);		break;	case evOutputDevice_DigOvOnly:		this->TvOut = TvOut;		ITvEncoder_SetCurrentYcYuvRgb(this->m_pITvEncoder, this->ReqYcYuvRgb);		return C840xBrd__DigOvOnly(pIDecoderBoard, VideoRunning);	default:		return E_NOT_SUPPORTED;	}	return Q_OK;/*	// PIO7 = 1/0 -> analog mux to show (IGS + EM8400 window)/(EM8400 fullscreen) on TV	if(	TvOut == SET_TV )		IDecoder_WritePIO(this->m_pIDecoder, PIO7, 1);	else		IDecoder_WritePIO(this->m_pIDecoder, PIO7, 0);*/	return Q_OK;}QRESULT CGalaxy2__AudioSetSampleRate(IDecoderBoard* pIDecoderBoard, DWORD Rate){	CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard;	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);	switch(this->BoardAudioRate)	{	case 32000:		IDecoder_WritePIO(this->m_pIDecoder, PIO2, AUDIOSEL0_32);		IDecoder_WritePIO(this->m_pIDecoder, PIO3, AUDIOSEL1_32);		break;	case 44100:		IDecoder_WritePIO(this->m_pIDecoder, PIO2, AUDIOSEL0_441);		IDecoder_WritePIO(this->m_pIDecoder, PIO3, AUDIOSEL1_441);		break;	default:	case 48000:		IDecoder_WritePIO(this->m_pIDecoder, PIO2, AUDIOSEL0_48);		IDecoder_WritePIO(this->m_pIDecoder, PIO3, AUDIOSEL1_48);		break;	}	return Q_OK;}void CGalaxy2__InitVtable(IDecoderBoard* pIDecoderBoard){	CQuasarBoard* this = (CQuasarBoard*) pIDecoderBoard;	this->lpVtbl->UpdateOverlay				= CVE2000__UpdateOverlay;	this->lpVtbl->HwReset					= CVE2000__HwReset;	this->lpVtbl->SetCustomTvHdtv			= CVE2000__SetCustomTvHdtv;	this->lpVtbl->VidSetVGATV				= CGalaxy2__VidSetVGATV;	this->lpVtbl->AudioSetSampleRate		= CGalaxy2__AudioSetSampleRate;}QRESULT CGalaxy2__SpecificCreateInstance(IDecoderBoard* pIDecoderBoard, DWORD dwInstance){	CQuasarBoard* this = (CQuasarBoard*) pIDecoderBoard;	this->pRegistry->Ccir_656 = CCIR_656;	this->pRegistry->SyncEnable = 0;	// by default disable VS,HS,VVLD for 656	this->pRegistry->TvOut = SET_TV | SET_NTSC | SET_ONETOONE;	this->TvOut = SET_TV;	this->HwVcxo = eHwVcxoPio5;	// Fujitsu Siemens	this->BoardCapabilities |= MPEG_CAPABILITY_AUDIO_VCXO;	// Fujitsu Siemens	// overwrite necessary values	CGalaxy2__InitVtable(pIDecoderBoard);	this->DeviceId = VENTURA2000_DEVICEID;	this->BoardVersion = GALAXY2000;	this->SubId = (this->BoardVersion>>8);	{	DWORD Value = I2SInv_SCkinSCIN_Jda1CkinGCK_ScinIN_DamckIN;	IDecoder_SetProperty(this->m_pIDecoder,		DECODER_SET, edecAudioInOutConfig, 0, &Value, sizeof(DWORD), NULL);	Value = 16;	IDecoder_SetProperty(this->m_pIDecoder,		DECODER_SET, edecAudioDacBitsPerSample, 0, &Value, sizeof(DWORD), NULL);	}	return Q_OK;}#endif	// GALAXY2_BRD#if defined GALAXY2_BRD && !defined ANY_BRDQRESULT CreateInstance(DWORD* pInstance, void* pHwLibConf){	QRESULT qr = CommonCreateInstance(pInstance, pHwLibConf);	if( QSUCCEEDED(qr) )		qr = CGalaxy2__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	// GALAXY2_BRD && !ANY_BRD

⌨️ 快捷键说明

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