📄 cxcard.c
字号:
/******************************************************************************//* cxcard.c : specific code for XCARD board - the new name of hometheater* 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/CXcard_Implementation * DESCRIPTION * CXcard implementation of the IDecoderBoard interface. * XCARD uses EM847X to implement VGA full screen output, digital overlay output, * TV and Scart output, HDTV output. * Identified by HwLib reading MD5,MD4,MD3,MD2 pins = 0000 (MDCFG_REFERENCE) and * by PciSubsystemID = 0x01. * PIO0 - IIC Clock for Eeprom * PIO1 - IIC Data for Eeprom * PIO2 - hardware MUTE the AUDIO * PIO3 - for EM8470 = SYNC_RST (negative pulse to trigger VGA cable detection) * - for EM8475 = not used * PIO4 - for EM8470 = HS_DET ( read 0 for VGA cable connected ) * - for EM8475 = SCART_169_PIO EM8475 * PIO5 - for EM8470 = VS_DET ( read 0 for VGA cable connected ) * - for EM8475 = nSCART_EN_PIO EM8475 * PIO6 - for EM8470 = CABLE_DET ( read 0 for feature cable connected ) * - for EM8475 = nSCART_RGB_PIO EM8475 * PIO7 - VGA_FULLSCREEN_PIO = 1/0 Mpeg-fullscreen/Vga-desktop * PIO8 - for EM8470 = NA * - for EM8475 = SYNC_RST (negative pulse to trigger VGA cable detection) * PIO9 - for EM8470 = NA * - for EM8475 = HS_DET ( read 0 for VGA cable connected ) * PIO10- for EM8470 = NA * - for EM8475 = VS_DET ( read 0 for VGA cable connected ) * PIO11- for EM8470 = NA * - for EM8475 = CABLE_DET ( read 0 for feature cable connected ) * Implementation based on CVE2000. * Specific implementation: * QRESULT CXcard__VidSetVGATV(IDecoderBoard* pIDecoderBoard, DWORD VideoRunning, DWORD TvOut )/******************************************************************************/#include "pch.h"#if defined XCARD_BRD#include "cqsrbrd.h"// use predefined PIO0 and PIO1 for I2C_CLK_PIO, I2C_DATA_PIO#define MUTE_AUDIO_PIO PIO2#define SCART_169_PIO PIO4#define nSCART_EN_PIO PIO5#define nSCART_RGB_PIO PIO6#define VGA_FULLSCREEN_PIO PIO7#define MACROVISION_APS_MASK 0x03#define MACROVISION_APS_OFF 0x00QRESULT CXcard__VidSetVGATV(IDecoderBoard* pIDecoderBoard, DWORD VideoRunning, DWORD TvOut ){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; DWORD dwTemp; switch(TvOut) { case SET_HDTV_SUBD: case SET_VGA: this->TvOut = TvOut; // specific hdtv mode in this->HdtvMode // disable macrovision ITvEncoder_EnableMacrovision(this->m_pITvEncoder, 0); ITvEncoder_SetCurrentYcYuvRgb(this->m_pITvEncoder, COMPONENT_RGB_SCART); dwTemp = this->DigitalVideoDataNBits; this->DigitalVideoDataNBits = 24; C847xBrd__VidSetHdtv(pIDecoderBoard, VideoRunning); IDecoder_WritePIO(this->m_pIDecoder, VGA_FULLSCREEN_PIO, 1); this->DigitalVideoDataNBits = dwTemp; break; case SET_TV: this->TvOut = TvOut; ITvEncoder_EnableMacrovision(this->m_pITvEncoder, this->EnableMacrovision); ITvEncoder_SetCurrentYcYuvRgb(this->m_pITvEncoder, this->ReqYcYuvRgb); CVE2000__VidSetTV(pIDecoderBoard, VideoRunning); // update the scart without modifying the variable this->ScartStatus if( this->ReqYcYuvRgb == COMPONENT_RGB_SCART ) { // scart enable QDbgLog((QLOG_TRACE, QDebugLevelTrace, TEXT(" >>>>>>>>>>>>>>>>>>CXcard__VidSetVGATV: SET_TV scart enable") )); this->ScartStatus |= 0x0001; IDecoder_WritePIO(this->m_pIDecoder, nSCART_RGB_PIO, (this->ScartStatus == SCART_RGB)? 0:1); IDecoder_WritePIO(this->m_pIDecoder, SCART_169_PIO, (this->AspectRatio == VIDEO_ASPECT_RATIO_16_9)? 1:0); IDecoder_WritePIO(this->m_pIDecoder, nSCART_EN_PIO, 0); } else { // scart disable QDbgLog((QLOG_TRACE, QDebugLevelTrace, TEXT(" >>>>>>>>>>>>>>>>>>CXcard__VidSetVGATV: SET_TV scart disable") )); this->ScartStatus &= ~0x0001; IDecoder_WritePIO(this->m_pIDecoder, nSCART_EN_PIO, 1); } IDecoder_WritePIO(this->m_pIDecoder, VGA_FULLSCREEN_PIO, 0); break; case SET_HDTV: this->TvOut = TvOut; ITvEncoder_EnableMacrovision(this->m_pITvEncoder, this->EnableMacrovision); C847xBrd__CheckHdtvMcrvsn(pIDecoderBoard); C847xBrd__VidSetHdtv(pIDecoderBoard, VideoRunning); IDecoder_WritePIO(this->m_pIDecoder, VGA_FULLSCREEN_PIO, 0); break; case evOutputDevice_DigOvOnly: this->TvOut = TvOut;#if 0 // test progressive modes on a VGA screen // disable macrovision & display on VGA for test reasons ITvEncoder_EnableMacrovision(this->m_pITvEncoder, 0); ITvEncoder_SetCurrentYcYuvRgb(this->m_pITvEncoder, COMPONENT_RGB_SCART); IDecoder_WritePIO(this->m_pIDecoder, VGA_FULLSCREEN_PIO, 1);#else ITvEncoder_SetCurrentYcYuvRgb(this->m_pITvEncoder, this->ReqYcYuvRgb); IDecoder_WritePIO(this->m_pIDecoder, VGA_FULLSCREEN_PIO, 0);#endif return C847xBrd__DigOvOnly(pIDecoderBoard, VideoRunning); default: return E_NOT_SUPPORTED; } return Q_OK;}QRESULT CXcard__UpdateOverlay(IDecoderBoard* pIDecoderBoard){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; if ( this->TvOut == SET_TV ) CQuasarBoard__TVVMIUpdateVideoWindow(pIDecoderBoard); else CQuasarBoard__HdtvUpdateVideoWindow(pIDecoderBoard); return Q_OK;}QRESULT CXcard__SetVideoProperty(IDecoderBoard* pIDecoderBoard, DWORD PropSet, DWORD PropId, DWORD Flags, void* pData, DWORD dwSizeIn, DWORD* pdwSizeOut){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; // VIDEO use DWORD for changing information and size condition is already checked DWORD Value = *(DWORD*)pData; // QRESULT qr = Q_OK; QDbgLog((QLOG_TRACE, QDebugLevelTrace, TEXT(" --> CXcard__SetVideoProperty: set=%x id=%x flags=%x sz=%x value=%x"), PropSet, PropId, Flags, dwSizeIn, Value)); switch(PropId) { case evScartOutput: this->ScartStatus = Value & SCART_MASK; if((this->ScartStatus & 0x0001) == SCART_DISABLE) { IDecoder_WritePIO(this->m_pIDecoder, nSCART_EN_PIO, 1); QDbgLog((QLOG_TRACE, QDebugLevelTrace, TEXT(" >>>>>>>>>>>>>>>>>>CXcard__SetVideoProperty: scart disable") )); } else { QDbgLog((QLOG_TRACE, QDebugLevelWarning, TEXT(" >>>>>>>>>>>>>>>>>>CXcard__SetVideoProperty: scart enable") )); IDecoder_WritePIO(this->m_pIDecoder, nSCART_RGB_PIO, (this->ScartStatus == SCART_RGB)? 0:1); IDecoder_WritePIO(this->m_pIDecoder, SCART_169_PIO, (this->AspectRatio == VIDEO_ASPECT_RATIO_16_9)? 1:0); IDecoder_WritePIO(this->m_pIDecoder, nSCART_EN_PIO, 0); } break; default: return CQuasarBoard__SetVideoProperty(pIDecoderBoard, PropSet, PropId, Flags, pData, dwSizeIn, pdwSizeOut); } return Q_OK;}QRESULT CXcard__GetVideoProperty( IDecoderBoard* pIDecoderBoard, DWORD PropSet, DWORD PropId, DWORD Flags, void* pData, DWORD dwSizeIn, DWORD* pdwSizeOut){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; // VIDEO use DWORD for changing information and size condition is already checked DWORD Value; // QRESULT qr = Q_OK; switch(PropId) { case evScartOutput: Value = this->ScartStatus; break; case evDigitalCable: if( (IDecoder_ReadReg(this->m_pIDecoder, DRAM_startup) & 0x3C) == 0x00 ) { Value = evDigitalCable_Connected; // no hardware to detect -> suppose cable present break; } // detect the feature connector presence if( (this->PciDeviceID == 0x8470) || (this->PciDeviceID == 0x8471) ) { IDecoder_ReadPIO(this->m_pIDecoder, PIO6, &Value); } else if( (this->PciDeviceID == 0x8475) || (this->PciDeviceID == 0x8476) ) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -