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

📄 canybrd.c

📁 这是一个SIGMA方案的PMP播放器的UCLINUX程序,可播放DVD,VCD,CD MP3...有很好的参考价值.
💻 C
字号:
/********************************************************************************************//*  canybrd.c : code to detect and support any Sigma 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:/********************************************************************************************/#include "pch.h"#include "cqsrbrd.h"#if defined ANY_BRDQRESULT dummy(IDecoderBoard* pIDecoderBoard, DWORD dwInstance){	QDbgLog((QLOG_TRACE, QDebugLevelWarning, TEXT("NO SUPPORT for this board") ));\	return Q_FAIL;}// analog overlay boards#ifdef NE2000_BRDQRESULT CNE2000__SpecificCreateInstance(IDecoderBoard* pIDecoderBoard, DWORD dwInstance);#else#define CNE2000__SpecificCreateInstance dummy#endif#ifdef NE2000TV_BRDQRESULT CNE2000TV__SpecificCreateInstance(IDecoderBoard* pIDecoderBoard, DWORD dwInstance);#else#define CNE2000TV__SpecificCreateInstance dummy#endif#ifdef NE2000STPC_BRDQRESULT CNeStpc__SpecificCreateInstance(IDecoderBoard* pIDecoderBoard, DWORD dwInstance);#else#define CNeStpc__SpecificCreateInstance dummy#endif#ifdef ANALOG_PVR_BRDQRESULT CAnlgPvr__SpecificCreateInstance(IDecoderBoard* pIDecoderBoard, DWORD dwInstance);#else#define CAnlgPvr__SpecificCreateInstance dummy#endif// digital overlay boards#ifdef VE2000_BRDQRESULT CVE2000__SpecificCreateInstance(IDecoderBoard* pIDecoderBoard, DWORD dwInstance);#else#define CVE2000__SpecificCreateInstance dummy#endif#ifdef GALAXY2_BRDQRESULT CGalaxy2__SpecificCreateInstance(IDecoderBoard* pIDecoderBoard, DWORD dwInstance);#else#define CGalaxy2__SpecificCreateInstance dummy#endif#ifdef CLARION_BRDQRESULT CClarion__SpecificCreateInstance(IDecoderBoard* pIDecoderBoard, DWORD dwInstance);#else#define CClarion__SpecificCreateInstance dummy#endif#ifdef QUAD_BRDQRESULT CQuad__SpecificCreateInstance(IDecoderBoard* pIDecoderBoard, DWORD dwInstance);#else#define CQuad__SpecificCreateInstance dummy#endif#ifdef DIGITAL_PVR_BRDQRESULT CDigPvr__SpecificCreateInstance(IDecoderBoard* pIDecoderBoard, DWORD dwInstance);#else#define CDigPvr__SpecificCreateInstance dummy#endif#if defined SYMPHONY_BRD || defined DVD8500_BRDQRESULT CSymphony__SpecificCreateInstance(IDecoderBoard* pIDecoderBoard, DWORD dwInstance);#else#define CSymphony__SpecificCreateInstance dummy#endif#ifdef XCARD_BRDQRESULT CXcard__SpecificCreateInstance(IDecoderBoard* pIDecoderBoard, DWORD dwInstance);#else#define CXcard__SpecificCreateInstance dummy#endif#ifdef BROADCAST_BRDQRESULT CBroadcaster__SpecificCreateInstance(IDecoderBoard* pIDecoderBoard, DWORD dwInstance);#else#define CBroadcaster__SpecificCreateInstance dummy#endif#ifdef QUAD7X_BRDQRESULT CQuad7x__SpecificCreateInstance(IDecoderBoard* pIDecoderBoard, DWORD dwInstance);#else#define CQuad7x__SpecificCreateInstance dummy#endif#ifdef NEC_BRDQRESULT CNec__SpecificCreateInstance(IDecoderBoard* pIDecoderBoard, DWORD dwInstance);#else#define CNec__SpecificCreateInstance dummy#endif/****f* HwLib/CQuasarBoard__FindDeviceIdSubId * USAGE *	NOT PRESENT in IDecoderBoard interface *	QRESULT CQuasarBoard__FindDeviceIdSubId(IDecoderBoard* pIDecoderBoard, DWORD dwInstance) * DESCRIPTION *	CQuasarBoard__FindDeviceIdSubId is called only by CreateInstance. *	Every board can be identified through: *		- 4 input pins MD5...MD2 (4bits = 12 available combinations) and/or *		- PCI Configuration SubSystemId (8bits = 256 combinations) *	DeviceId, SubId, BoardVersion, BoardCapabilities, creating of new objects are *	decided depending on these settings: *		- DeviceId, SubId will be used by IDecoderBoard_GetDeviceIdSubId to *		identify the board type for the user of the HwLib *		- HwLib will use BoardVersion internally to differentiate between *		boards with the same general functionality with small hardware differences. *		Ex: NETSTREAM2000_DEVICEID=0x13 is the DeviceId for all the analog overlay *		boards. BoardVersion can be NE2000, NE2000STPC, etc. *		Ex: VENTURA2000_DEVICEID=0x14 is the DeviceId for all the digital overlay *		boards. BoardVersion can be VE2000, GALAXY2000, CLARION, QUADMASTER, QUADSLAVE, etc. *		The user can get the BoardVersion using IDecoderBoard_GetBoardVersion, then *		ask for GetBoardDescription. * PARAMETERS *	IN IDecoderBoard* pIDecoderBoard - pointer to the board object *	DWORD dwInstance - passed down when create some new objects * RETURN VALUE *	If the function succeeds, the return value is Q_OK; * SEE ALSO *   IDecoderBoard_GetDeviceIdSubId/*****************************************************************************/QRESULT CQuasarBoard__FindDeviceIdSubId(IDecoderBoard* pIDecoderBoard, DWORD dwInstance){	CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard;	DWORD Mpeg4Bonding = 0;	DWORD MacrovisionBonding = 0;	DWORD MDConfig;	this->BoardVersion = UNKNOWN_BOARD;	this->DeviceId = UNKNOWN_DEVICEID;	this->SubId = UNKNOWN_BOARD;	// detect what bonding we have; Q3 rev A,B,C are used only like NetStream	// Starting from Q3 rev D read reg 1C08, bit7 = NS_ENABLE to find out if it is NetStream bonding	if(this->QuasarVersion == EM8400ABC_Q3)	{		MacrovisionBonding = 1;	}	else if( (this->QuasarVersion >= EM8400D_Q3) &&	(this->QuasarVersion <= EM8400F_Q3) )	{		MacrovisionBonding = IDecoder_ReadReg(this->m_pIDecoder, DRAM_startup) & 0x40;	}	else if( (this->QuasarVersion >= EM847XA_Q4) )	{		Mpeg4Bonding = IDecoder_ReadReg(this->m_pIDecoder, DRAM_startup) & 0x80;		MacrovisionBonding = IDecoder_ReadReg(this->m_pIDecoder, DRAM_startup) & 0x40;	}	else	{		QDbgLog((QLOG_TRACE, QDebugLevelWarning, TEXT("   >>> No Q3.A...F, No Q3.5.A, No Q4 No Jasper ??? <<<") ));		return Q_FAIL;	}	MDConfig = IDecoder_ReadReg(this->m_pIDecoder, DRAM_startup) & 0x3C;	switch(this->PciSubsystemID)	{		case 0x00:	// symphony		case 0x04:	// symphony2		case 0x05:	// melody		case 0x09:	// jasmine2		case 0x07:	// SONY_WEGA			return CSymphony__SpecificCreateInstance(pIDecoderBoard, dwInstance);		case 0x01:			return CXcard__SpecificCreateInstance(pIDecoderBoard, dwInstance);		case 0x02:			if(this->PciSubsystemVendorID == 0x1033)			{				return CNec__SpecificCreateInstance(pIDecoderBoard, dwInstance);			}			else			{				// Harmony board				return CDigPvr__SpecificCreateInstance(pIDecoderBoard, dwInstance);			}			break;		case 0x03:			return CBroadcaster__SpecificCreateInstance(pIDecoderBoard, dwInstance);		case 0x12:// VWEB board		case 0x06:// SONY_HAC		case 0x0a:// SONY_HVC			return CDigPvr__SpecificCreateInstance(pIDecoderBoard, dwInstance);		// old designs have 		case 0xFF:		case 0xF0:		case 0xF1:		case 0xF2:		case 0xF3:			switch (MDConfig)			{			case MDCFG_REFERENCE:				switch(this->PciSubsystemID)				{				case 0xFF:					// Galaxy2 - kind of Ventura 2MB=1M x 16bits no NovaLite					return CGalaxy2__SpecificCreateInstance(pIDecoderBoard, dwInstance);					break;				case 0xF0:				case 0xF1:				case 0xF2:				case 0xF3:					// Quad Quasar 480p 2MB=1M x 16bits with SubsystemIds: F0, F1, F2, F3					if( (this->QuasarVersion < EM847XA_Q4) )						return CQuad__SpecificCreateInstance(pIDecoderBoard, dwInstance);					else						return CQuad7x__SpecificCreateInstance(pIDecoderBoard, dwInstance);					break;				default:					QDbgLog((QLOG_TRACE, QDebugLevelWarning, TEXT("NO SUPPORT for this board") ));					return Q_FAIL;				}				break;			case MDCFG_VE200024:	// 480p 2MB=1M x 16bits with Audio I2S 24 bits			case MDCFG_VE2000:		// 480p 2MB=1M x 16bits with Audio I2S 16 bits				return CVE2000__SpecificCreateInstance(pIDecoderBoard, dwInstance);			case MDCFG_NE2000:				return CNE2000__SpecificCreateInstance(pIDecoderBoard, dwInstance);			case MDCFG_CLARION:		// 2MB=1M x 16bits no NovaLite				return CClarion__SpecificCreateInstance(pIDecoderBoard, dwInstance);			case MDCFG_NE2000TV:				return CNE2000TV__SpecificCreateInstance(pIDecoderBoard, dwInstance);			case MDCFG_ANLG_DIG_PVR:				{				BYTE Byte = 0;				IEeprom_Read( this->m_pIEeprom, 0x00, &Byte );				if( Byte == 0xBA )					return CAnlgPvr__SpecificCreateInstance(pIDecoderBoard, dwInstance);				else					return CDigPvr__SpecificCreateInstance(pIDecoderBoard, dwInstance);				}			case MDCFG_NE2000STPC:				return CNeStpc__SpecificCreateInstance(pIDecoderBoard, dwInstance);			case MDCFG_SYMPHONY:				return CSymphony__SpecificCreateInstance(pIDecoderBoard, dwInstance);			default:				QDbgLog((QLOG_TRACE, QDebugLevelWarning, TEXT("NO SUPPORT for this board") ));				return Q_FAIL;			}		default:			QDbgLog((QLOG_TRACE, QDebugLevelWarning, TEXT("NO SUPPORT for this board") ));			return Q_FAIL;		}}/****f* HwLib/CreateInstance * USAGE *	QRESULT CreateInstance(DWORD* pInstance, void* pHwLibConf) * DESCRIPTION *	CreateInstance - creates the DecoderBoard object. It autodetects what *	type of board is it and what objects are necessary to create: *		- Decoder object *		- Eeprom object *		- TvEncoder objects - one I2C accessible and/or the internal EM800 TvEncoder *		- AnalogOverlay objects - one scalable and/or one fullscreen. *		- Scanconverter object etc. *	If the function succeeds the user can query the pointers to the interfaces *	and use them to call the other functions in the library. *	The DecoderBoard object remains in the system until it have been deleted *	through a call to DeleteHardware using the Instance returned by CreateInstance * PARAMETERS *	OUT DWORD* pInstance - Points to a 32-bit variable that receives the instance created. *		Possible values between 0 and MAX_INSTANCES. *	IN void* pHwLibConf - Points to HWLIB_CONFIG structure, passing the PCI system resources. * RETURN VALUE *	If the function succeeds, the return value is Q_OK.  *	If the function fails, the return value is: *		E_TOO_MANY_INSTANCES;		// there are already created MAX_INSTANCES objects  *		E_CREATE_INSTANCE_FAILED;	// memory allocation failed *		E_GET_SYMBOLS_FAILED;		// the microcode is corrupted or the version is old *		To get extended error information, call GetLastQError.  * SEE ALSO *   DeleteHardware/*****************************************************************************/QRESULT CreateInstance(DWORD* pInstance, void* pHwLibConf){	IDecoderBoard* pIDecoderBoard;	CQuasarBoard* this;	QRESULT qr;	if( QFAILED (qr = CommonCreateInstance(pInstance, pHwLibConf)) )		return qr;	pIDecoderBoard = g_pIDecoderBoard[*pInstance];	this = (CQuasarBoard*) pIDecoderBoard;	// find board type and create specific objects	if( QFAILED( CQuasarBoard__FindDeviceIdSubId(pIDecoderBoard, *pInstance)) )	{		CQuasarBoard__DeleteObjects(pIDecoderBoard);		pIDecoderBoard = 0;		return E_CREATE_INSTANCE_FAILED;	}	QDbgLog((QLOG_TRACE, QDebugLevelWarning, TEXT(">>>DevId=0x%x SubId=0x%x BrdVers=0x%x %04x_%04x_%02x SubsystemId=%x SubsystemVendorID=%x<<<"),		this->DeviceId, this->SubId, this->BoardVersion,		this->HwLibConf.VendorID, this->HwLibConf.DeviceID, this->HwLibConf.RevisionID,		this->PciSubsystemID, this->PciSubsystemVendorID));	return Q_OK;}#endif	// ANY_BRD

⌨️ 快捷键说明

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