📄 cquad7x.c
字号:
/******************************************************************************//* cquad7x.c : specific code for (Quad + EM847X) 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/CQuad7x_Implementation * DESCRIPTION * CQuad7x implementation of the IDecoderBoard interface. * QUAD7x uses four EM847X, EM9038, AD7177 components to implement 4 digital overlay output, * 4 independent TV output, 4 Tv video multiplexed in one Tv output, * 4 video multiplexed in one 480P output. * QUAD7x hardware board should be treated by the HwLib's user like 4 independent boards: * - one QUADMASTER - this EM847X owns and controls EM9038, AD7177 and switches the * necessary hardware signals for the other three EM847X. * - three QUADSLAVEs - switching modes should be in sync for all 4 EM847X. * Identified by HwLib reading MD5,MD4,MD3,MD2 pins = 0000 (MDCFG_REFERENCE) * version of the EM84 and by the PCI cofiguration SubsystemID = 0xF0 for * QUADMASTER and 0xF1, 0xF2,0xF3 for QUADSLAVEs. * PIO0 - IIC Clock for EM9038, Eeprom * PIO1 - IIC Data for EM9038, Eeprom * PIO2 - * PIO3 - * PIO4 - nDIGENABLE_PIO = 1/0 disable/enable digital Vga header * PIO5 - * PIO6 - * PIO7 - DVCLKSEL_27MHz_PCLK_PIO = 1/0 selects 27 MHz / PCLK0 for VClk for the 3 slaves * Implementation is based on CQuad. * Specific implementation: * QRESULT CQuad7x__VidSetVGATV(IDecoderBoard* pIDecoderBoard, DWORD VideoRunning, DWORD TvOut)/******************************************************************************/#include "pch.h"#if defined QUAD7X_BRD#include "cqsrbrd.h"#define DVCLKSEL_27MHz_PCLK_PIO PIO7QRESULT CQuad7x__VidSetVGATV(IDecoderBoard* pIDecoderBoard, DWORD VideoRunning, DWORD TvOut ){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; DWORD ccir; if(TvOut == SET_VGA) return E_NOT_SUPPORTED; this->TvOut = TvOut; if(VideoRunning & RST_DC) IDecoder_StopDisplayController(this->m_pIDecoder); switch(this->TvOut) { case SET_TV: ccir = this->pRegistry->Ccir_656 | (this->pRegistry->InvertField << 12) | (this->pRegistry->SyncEnable << 4); IDecoderBoard_SelectVClk(pIDecoderBoard, TvVClk, NULL, 0); // SigmaTv master, Quasar slave 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); if( this->BoardVersion == QUADMASTER ) { // Hyde Mpeg FullScreen on VGA monitor and power down the Dacs for NovaLite IAnalogOverlay_SetTv(this->m_pINovaLite); IDecoder_WritePIO(this->m_pIDecoder, DVCLKSEL_27MHz_PCLK_PIO, 1); // 27 MHz for slaves } CQuasarBoard__TVVMIUpdateVideoWindow(pIDecoderBoard); break; case SET_HDTV_SUBD: case SET_HDTV: ccir = CCIR_601 | NO_INVERT_FIELD | SYNC_ENABLE_1; IDecoderBoard_SelectVClk(pIDecoderBoard, VgaVClk, NULL, 0); // QUADMASTER master, QUADSLAVE slaves, SigmaTv slave CQuad__InitMasterParams480P(pIDecoderBoard); ITvEncoder_SetCurrentYcYuvRgb(this->m_pITvEncoder, this->ReqYcYuvRgb); ITvEncoder_ProgramTV(this->m_pISigmaTv, TVSLAVE, 8, ccir, this->Standard_TvOut, 0); if( this->BoardVersion == QUADMASTER ) { IDecoder_WritePIO(this->m_pIDecoder, DVCLKSEL_27MHz_PCLK_PIO, 0); // PCLK0 for slaves // Mpeg FullScreen on VGA monitor for NovaLite IAnalogOverlay_SetVGA(this->m_pINovaLite); // Quasar master progressive VSync=60Hz, HSync=32KHz, PixelFreq=27MHz IDecoder_QuasarMaster( this->m_pIDecoder, 16, ccir | INVERT_VVLD | USE_VVLD_PIXEL_ENABLE, &this->MasterParams, DISPLAY_NONINTERLACED, VSHS_ACTIVE_LOW, Q3CTRL2_NOINTERLACED | Q3CTRL2_PIXCLK_POLARITY | DIGITAL_DATA_ENABLE); } else // QUADSLAVE { // Quasar slave progressive VSync=60Hz, HSync=32KHz, PixelFreq=27MHz IDecoder_QuasarSlave( this->m_pIDecoder, 16, ccir | INVERT_VVLD | USE_VVLD_PIXEL_ENABLE, &this->MasterParams, VSHS_ACTIVE_LOW, Q3CTRL2_NOINTERLACED | Q3CTRL2_PIXCLK_POLARITY | DIGITAL_DATA_ENABLE); } this->HFrequency = this->MasterParams.HFrequency; CQuad__HdtvUpdateVideoWindow(pIDecoderBoard); break; } return Q_OK;}void CQuad7x__InitVtable(IDecoderBoard* pIDecoderBoard){ CQuasarBoard* this = (CQuasarBoard*) pIDecoderBoard; this->lpVtbl->HwReset = CVE2000__HwReset; this->lpVtbl->SetCustomTvHdtv = CVE2000__SetCustomTvHdtv; this->lpVtbl->UpdateOverlay = CQuad__UpdateOverlay; this->lpVtbl->VidSetVGATV = CQuad7x__VidSetVGATV; this->lpVtbl->AudioSetSampleRate = C847xBrd__AudioSetSampleRate; this->lpVtbl->SelectVClk = C847xBrd__SelectVClk;}QRESULT CQuad7x__SpecificCreateInstance(IDecoderBoard* pIDecoderBoard, DWORD dwInstance){ CQuasarBoard* this = (CQuasarBoard*) pIDecoderBoard; this->BoardCapabilities |= MPEG_CAPABILITY_480P; 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 = 0; // by default disable VS,HS,VVLD for 656 this->pRegistry->TvOut = SET_TV | SET_NTSC | SET_ONETOONE; this->TvOut = SET_TV; // overwrite necessary values CQuad7x__InitVtable(pIDecoderBoard); this->DeviceId = VENTURA2000_DEVICEID; if( this->PciSubsystemID == 0xF0 ) // QUAD master { this->BoardVersion = QUADMASTER; // Create CNovaLite instance if( ModCreateInstance (dwInstance, &CLSID_CNOVALITE, &IID_IANALOGOVERLAY, (void**)&this->m_pINovaLite) != NOERROR ) { return Q_FAIL; } ISetI2CpIO_SetI2C_params( this->m_pISetI2CpIO, SECOND_I2C_DATA_PIO, SECOND_I2C_PIO_CLOCK); IAnalogOverlay_Init(this->m_pINovaLite, NULL); IAnalogOverlay_SetRegistry(this->m_pINovaLite, this->pRegistry); } else if( (this->PciSubsystemID & 0xFC) == 0xF0 ) // QUAD slaves { this->BoardVersion = QUADSLAVE; } else return Q_FAIL; this->SubId = (this->BoardVersion>>8); if( ((IDecoder_ReadReg(this->m_pIDecoder, DRAM_startup) & 0x3C) != MDCFG_REFERENCE) || ((this->PciSubsystemID & 0xFC) != 0xF0) ) QDbgLog((QLOG_TRACE, QDebugLevelWarning, TEXT("\n\nERROR: Create QUAD7x is FORCED !") )); { DWORD Value = JDA1_SCkinJDA1CK_Jda1CkinGCK_ScinOUT_DamckOUT; 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 // QUAD7X_BRD#if defined QUAD7X_BRD && !defined ANY_BRDQRESULT CreateInstance(DWORD* pInstance, void* pHwLibConf){ QRESULT qr = CommonCreateInstance(pInstance, pHwLibConf); if( QSUCCEEDED(qr) ) qr = CQuad7x__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 // QUAD7X_BRD && !ANY_BRD
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -