📄 csymphny.c
字号:
/******************************************************************************//* csymphny.c : specific code for SYMPHONY board* REALmagic Quasar Hardware Library* Created by Aurelia Popa-Radu* Copyright Sigma Designs Inc* Sigma Designs Proprietary and confidential* Created on 11/20/01* Description:/******************************************************************************//****h* HwLib/CSymphony_Implementation * DESCRIPTION * CSymphony implementation of the IDecoderBoard interface. CSymphony implements * both SYMPHONY and MELODY design. * SYMPHONY uses EM847X, EEPROM components to implement digital overlay output, * TV output, HDTV output. * For EM8475 we have VCXO and VideoIn connector ( 601,656, 8bits ). * For EM8470 NO VCXO and NO Videoin. * MELODY uses EM8470 or EM8471, with external audio DAC, audio clock from JDA1) * Identified by HwLib reading MD5,MD4,MD3,MD2 pins = 1011 (MDCFG_SYMPHONY) or * by (MD5,MD4,MD3,MD2 pins = 0000=MDCFG_REFERENCE and PciSubsystemID = 0x00). * PIO0 - IIC Clock for Eeprom * PIO1 - IIC Data for Eeprom * PIO2 - hardware MUTE the AUDIO * PIO14 - VCXO_PIO = 0, 3state, 1 = -100, 0, +100ppm. The Vcxo controls * a 27MHz clock connected to DAMCK * Implementation based on CVE2000. * Specific implementation: * QRESULT C847xDigBrd__VidSetVGATV(IDecoderBoard* pIDecoderBoard, DWORD VideoRunning, DWORD TvOut )/******************************************************************************/#include "pch.h"#ifdef DIGITAL_OVERLAY#include "cqsrbrd.h"QRESULT C847xDigBrd__VidSetVGATV(IDecoderBoard* pIDecoderBoard, DWORD VideoRunning, DWORD TvOut ){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; switch(TvOut) { case SET_TV: 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;}#endif // DIGITAL_OVERLAY#if defined SYMPHONY_BRD || defined DVD8500_BRD// use predefined PIO0 and PIO1 for I2C_CLK_PIO, I2C_DATA_PIO#define MUTE_AUDIO_PIO PIO2#define VCXO_PIO PIO14QRESULT CSymphony__HwReset(IDecoderBoard* pIDecoderBoard){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; QRESULT qr = Q_OK; DWORD Value; IDecoder_ReadPIO(this->m_pIDecoder, MUTE_AUDIO_PIO, &Value); qr = CVE2000__HwReset(pIDecoderBoard); IDecoder_WritePIO(this->m_pIDecoder, MUTE_AUDIO_PIO, 0); return qr;}QRESULT CJasmine2__HwReset(IDecoderBoard* pIDecoderBoard){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; QRESULT qr = Q_OK; DWORD Value; IDecoder_ReadPIO(this->m_pIDecoder, MUTE_AUDIO_PIO, &Value); qr = CVE2000__HwReset(pIDecoderBoard); // (PIO12=PIO4= AUDSEL1=0 & PIO13=PIO3=AUDSEL0=1 => DAMCK=VCXO) IDecoder_WritePIO(this->m_pIDecoder, PIO3, 1); IDecoder_WritePIO(this->m_pIDecoder, PIO4, 0); IDecoder_WritePIO(this->m_pIDecoder, MUTE_AUDIO_PIO, 0); return qr;}QRESULT CSymphony2__ExtVcxoAudioSetSampleRate(IDecoderBoard* pIDecoderBoard, DWORD Rate){#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 */#endif 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 CSymphony__InitVtable(IDecoderBoard* pIDecoderBoard){ CQuasarBoard* this = (CQuasarBoard*) pIDecoderBoard; DWORD MDConfig = IDecoder_ReadReg(this->m_pIDecoder, DRAM_startup); if(this->BoardVersion == JASMINE2) this->lpVtbl->HwReset = CJasmine2__HwReset; else this->lpVtbl->HwReset = CSymphony__HwReset; this->lpVtbl->UpdateOverlay = CVE2000__UpdateOverlay; this->lpVtbl->SetCustomTvHdtv = CVE2000__SetCustomTvHdtv; this->lpVtbl->SelectVClk = C847xBrd__SelectVClk; this->lpVtbl->AudioSetSampleRate = C847xBrd__AudioSetSampleRate; this->lpVtbl->VidSetVGATV = C847xDigBrd__VidSetVGATV; if(this->BoardVersion == SYMPHONY) this->lpVtbl->PrepareVideoIn = C847xBrd__PrepareVideoIn; if( (this->BoardVersion == SYMPHONY2) || (this->BoardVersion == SONY_WEGA) ) { if(MDConfig & MD2) // external VCXO { this->lpVtbl->AudioSetSampleRate= CSymphony2__ExtVcxoAudioSetSampleRate; this->lpVtbl->HwReset = CVE2000__HwReset; } this->lpVtbl->PrepareVideoIn = C847xBrd__PrepareVideoIn; }}QRESULT CSymphony__SpecificCreateInstance(IDecoderBoard* pIDecoderBoard, DWORD dwInstance){ CQuasarBoard* this = (CQuasarBoard*) pIDecoderBoard; DWORD Value; DWORD MDConfig = IDecoder_ReadReg(this->m_pIDecoder, DRAM_startup); 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; this->DeviceId = VENTURA2000_DEVICEID; if(this->PciSubsystemID == 5) this->BoardVersion = MELODY; else if(this->PciSubsystemID == 9) this->BoardVersion = JASMINE2; else if(this->PciSubsystemID == 4) this->BoardVersion = SYMPHONY2; else if(this->PciSubsystemID == 7) this->BoardVersion = SONY_WEGA; else this->BoardVersion = SYMPHONY; this->SubId = (this->BoardVersion>>8); if ((this->QuasarVersion == EM85XX_JASPER) || (this->BoardVersion == SYMPHONY2)) { // Create also Csii168 instance if( ModCreateInstance (dwInstance, &CLSID_CSII168, &IID_IDVITRANSMITTER, (void**)&this->m_pIDviTransmitter) != NOERROR ) { return Q_FAIL; } IDviTransmitter_Init(this->m_pIDviTransmitter); IDviTransmitter_InitPropertySet(this->m_pIDviTransmitter, this->pPropSetList, sizeof(PROPERTY_SET_ITEM)); this->BoardCapabilities |= MPEG_CAPABILITY_DVI; } if ( (this->QuasarVersion == EM85XX_JASPER) && (IDecoder_ReadReg(this->m_pIDecoder, DRAM_startup1) & 0x0800) ) // MD27 { // change the eeprom address I2cDeviceInit_type I2cDev; I2cDev.I2c_WriteAddress = 0xA4; I2cDev.I2c_ReadAddress = 0xA5; I2cDev.I2c_usDelay = 1; IDecoder_SetProperty(this->m_pIDecoder, EEPROM_SET, eEepromI2cInit, 0, &I2cDev, sizeof(I2cDev), NULL); } // overwrite necessary values CSymphony__InitVtable(pIDecoderBoard);#ifdef DEBUG if( ( (this->PciSubsystemID == 0xFF) && ((MDConfig & 0x3C) != MDCFG_SYMPHONY)) && (this->PciSubsystemID != 0x00) && (this->PciSubsystemID != 0x05) ) QDbgLog((QLOG_TRACE, QDebugLevelWarning, TEXT("\n\nERROR: Create SYMPHONY/MELODY is FORCED !") ));#endif switch (this->BoardVersion) { case MELODY: // external audio DAC this->AudioInOutConfig = eAudioInOut_BitClockInternDivMClk; // EM847xC, EM848x Value = I2S_SCkinJDA1CK_Jda1CkinGCK_ScinOUT_DamckOUT; // EM847xAB break; case JASMINE2: // external audio DAC // the 27 VCXO audio clock comes on DAMCK this->AudioInOutConfig = eAudioInOut_BitClockInternDivDAMCK;// EM847xC, EM848x ????? Value = I2S_SCkinJDA1CK_Jda1CkinDAMCK_ScinOUT_DamckIN; // EM847xAB // (PIO12=PIO4= AUDSEL1=0 & PIO13=PIO3=AUDSEL0=1 => DAMCK=VCXO) IDecoder_WritePIO(this->m_pIDecoder, PIO3, 1); IDecoder_WritePIO(this->m_pIDecoder, PIO4, 0); break; case SYMPHONY2: // external audio DAC, AudioIn slave to ADC case SONY_WEGA: // external audio DAC, AudioIn slave to ADC if ((this->QuasarVersion == EM848XA_Q4) || (this->QuasarVersion == EM847XC_Q4)) { this->AudioInParams.HwConfig = eAudioInConfig_Slave_MSBFirst; switch(MDConfig & (MD3|MD2)) { case 0: this->AudioInOutConfig = eAudioInOut_BitClockInternDivMClk; break; case MD2: this->AudioInOutConfig = eAudioInOut_BitClockDAMCK; // external VCXO break; case MD3: this->AudioInOutConfig = eAudioInOut_BitClockACLK; // external VCXO break; } } else // EM847xAB { if (MDConfig & MD2) // MD2 - external VCXO Value = I2S_SCkinDAMCK_ScinOUT_DamckIN; else Value = I2S_SCkinInternDivMclk_ScinOUT_DamckOUT; } break; case SYMPHONY: // external DAC if MD5 is high default: this->AudioInOutConfig = eAudioInOut_BitClockInternDivMClk;// EM847xC, EM848x Value = (MDConfig & MD5) ? I2S_SCkinJDA1CK_Jda1CkinGCK_ScinOUT_DamckOUT: JDA1_SCkinJDA1CK_Jda1CkinGCK_ScinOUT_DamckOUT; // EM847xAB break; } if ((this->QuasarVersion == EM848XA_Q4) || (this->QuasarVersion == EM847XC_Q4)) { CEM848x__SetAudioInOutConfig(this->m_pIDecoder, this->AudioInOutConfig, this->AudioInParams.HwConfig); } else // EM847xAB, EM85xx { 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 // SYMPHONY_BRD#if (defined SYMPHONY_BRD || defined DVD8500_BRD) && !defined ANY_BRDQRESULT CreateInstance(DWORD* pInstance, void* pHwLibConf){ QRESULT qr = CommonCreateInstance(pInstance, pHwLibConf); if( QSUCCEEDED(qr) ) qr = CSymphony__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 // SYMPHONY_BRD && !ANY_BRD
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -