📄 cdigpvr.c
字号:
/********************************************************************************************//* cdigpvr.c : specific code for DIGITAL_PVR 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/CDigPvr_Implementation * DESCRIPTION * CDigPvr implementation of the IDecoderBoard interface. * Digital Overlay PVR = HARMONY uses EM847X, Saa7114, SM2288, Sii168 components * to implement video/audio encoding, digital overlay output, TV and scart output, * HDTV output, DVI output. * Identified by HwLib reading MD5,MD4,MD3,MD2 pins = 0111 (MDCFG_ANLG_DIG_PVR) * and first EEPROM location (not 0xBA) and by PciSubsystemID = 0x02. * PIO0 - IIC Clock for Saa7114, Eeprom, Sii168 * PIO1 - IIC Data for Saa7114, Eeprom, Sii168 * PIO2 - hardware MUTE the AUDIO * PIO8 - SEL_DIG_AUDIO_IN_PIO * PIO12 - AUDSEL1_PIO * PIO13 - AUDSEL0_PIO * PIO14 - VCXO_PIO = 0, 3state, 1 = -100, 0, +100ppm. The Vcxo controls * a 27MHz clock connected to DAMCK * Implementation is based on VE2000: * Specific implementation: * QRESULT CDigPvr__VidSetVGATV(IDecoderBoard* pIDecoderBoard, * DWORD VideoRunning, DWORD TvOut) * QRESULT CDigPvr__PrepareLBCCapture(IDecoderBoard* pIDecoderBoard, DWORD config)/******************************************************************************/#include "pch.h"#if defined DIGITAL_PVR_BRD || defined PVR8500_BRD#include "cqsrbrd.h"#include "regs847x.h"#include "em847x.h"// use predefined PIO0 and PIO1 for I2C_CLK_PIO, I2C_DATA_PIO#define MUTE_AUDIO_PIO PIO2#define SEL_DIG_AUDIO_IN_PIO PIO8#define AUDSEL1_PIO PIO12#define AUDSEL0_PIO PIO13#define VCXO_PIO PIO14QRESULT CDigPvr__PrepareLBCCapture(IDecoderBoard* pIDecoderBoard, DWORD config){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; if( config & DIGITAL_AUDIO_IN_CAPTURE) IDecoder_WritePIO(this->m_pIDecoder, SEL_DIG_AUDIO_IN_PIO, 1); // enable digital in else IDecoder_WritePIO(this->m_pIDecoder, SEL_DIG_AUDIO_IN_PIO, 0); // enable stereo in return Q_OK;}QRESULT CDigPvr__SetAudioProperty(IDecoderBoard* pIDecoderBoard, DWORD PropSet, DWORD PropId, DWORD Flags, void* pData, DWORD dwSizeIn, DWORD* pdwSizeOut){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; // AUDIO use DWORD for changing information and size condition is already checked DWORD Value = *(DWORD*)pData; // QRESULT qr = Q_OK; DWORD dwTemp; DWORD i2s = IDecoder_ReadReg(this->m_pIDecoder, DRAM_startup) & MD5; QDbgLog((QLOG_TRACE, QDebugLevelTrace, TEXT(" --> CDigPvr__SetAudioProperty: set=%x id=%x flags=%x sz=%x value=%x"), PropSet, PropId, Flags, dwSizeIn, Value)); switch(PropId) { case eaInOutConfig: if( (this->PciSubsystemID) != 0x02 ) // old board cannot set different clocks return E_NOT_SUPPORTED; switch(Value) { case eAudioInOutDefault: // normal playback using GCK=27MHz dwTemp = i2s ? I2S_SCkinJDA1CK_Jda1CkinGCK_ScinOUT_DamckOUT: JDA1_SCkinJDA1CK_Jda1CkinGCK_ScinOUT_DamckOUT; IDecoder_WritePIO(this->m_pIDecoder, AUDSEL1_PIO, 1); IDecoder_WritePIO(this->m_pIDecoder, AUDSEL0_PIO, 1); break; case eAudioInOutVcxoJda1Ckin: // playback using VCXO=27M on DAMCK dwTemp = i2s ? I2S_SCkinJDA1CK_Jda1CkinDAMCK_ScinOUT_DamckIN: JDA1_SCkinJDA1CK_Jda1CkinDAMCK_ScinOUT_DamckIN; IDecoder_WritePIO(this->m_pIDecoder, AUDSEL1_PIO, 0); IDecoder_WritePIO(this->m_pIDecoder, AUDSEL0_PIO, 1); break; case eAudioInOutSCkinCapture: // playback using DAMCK for Sckin (capture) dwTemp = i2s ? I2S_SCkinDAMCK_Jda1CkinGCK_ScinOUT_DamckIN: JDA1_SCkinDAMCK_Jda1CkinGCK_ScinOUT_DamckIN; IDecoder_WritePIO(this->m_pIDecoder, AUDSEL1_PIO, 1); IDecoder_WritePIO(this->m_pIDecoder, AUDSEL0_PIO, 0); break; case eAudioInOutExternJda1Ckin: // playback using 1.5x(40M) on DAMCK dwTemp = i2s ? I2S_SCkinJDA1CK_Jda1CkinDAMCK_ScinOUT_DamckIN: JDA1_SCkinJDA1CK_Jda1CkinDAMCK_ScinOUT_DamckIN; IDecoder_WritePIO(this->m_pIDecoder, AUDSEL1_PIO, 0); IDecoder_WritePIO(this->m_pIDecoder, AUDSEL0_PIO, 0); break; default: return E_NOT_SUPPORTED; } IDecoder_SetProperty(this->m_pIDecoder, DECODER_SET, edecAudioInOutConfig, 0, &dwTemp, sizeof(dwTemp), NULL); CQuasar__SetAudioModeOrFormat(this->m_pIDecoder); // edecAudioInOutConfig affects the Audio_Serial_Control0 and Audio_Serial_Control1 symbols //ccc force the microcode to update the new settings if( CQuasar__GetStatus( this->m_pIDecoder, AUDIO ) == AUDIO_PLAY ) { CQuasar__AudioWriteCommand(this->m_pIDecoder, AUDIO_PAUSE); CQuasar__AudioWriteCommand(this->m_pIDecoder, AUDIO_PLAY); } break; default: return CQuasarBoard__SetAudioProperty(pIDecoderBoard, PropSet, PropId, Flags, pData, dwSizeIn, pdwSizeOut); } return Q_OK;}QRESULT CDigPvr__GetAudioProperty( IDecoderBoard* pIDecoderBoard, DWORD PropSet, DWORD PropId, DWORD Flags, void* pData, DWORD dwSizeIn, DWORD* pdwSizeOut){ // CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; // AUDIO use DWORD for changing information and size condition is already checked DWORD Value; // QRESULT qr = Q_OK; switch(PropId) { case eaInOutConfig: return E_NOT_SUPPORTED; default: return CQuasarBoard__GetAudioProperty(pIDecoderBoard, PropSet, PropId, Flags, pData, dwSizeIn, pdwSizeOut); } *(DWORD*)pData = Value; QDbgLog((QLOG_TRACE, QDebugLevelTrace, TEXT(" <-- CDigPvr__GetAudioProperty: set=%x id=%x flags=%x sz=%x value=%x"), PropSet, PropId, Flags, dwSizeIn, Value)); return Q_OK;}QRESULT CDigPvr__HwReset(IDecoderBoard* pIDecoderBoard){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; QRESULT qr = Q_OK; DWORD Value; AudioInOutConfig_type AConf = eAudioInOutDefault; IDecoder_ReadPIO(this->m_pIDecoder, MUTE_AUDIO_PIO, &Value); qr = CVE2000__HwReset(pIDecoderBoard); IDecoderBoard_SetProperty(pIDecoderBoard, AUDIO_SET, eaInOutConfig, 0, &AConf, sizeof(AConf), NULL); IDecoder_WritePIO(this->m_pIDecoder, MUTE_AUDIO_PIO, 0); return qr;}/****h* HwLib/CSonyHAC_implementation * DESCRIPTION * CSonyHAC implementation of the IDecoderBoard interface. * SonyHAC is very similar to HARMONY. It has EM847X, Saa7114, SM2288, Sii168 components * to implement video/audio encoding, digital overlay output, TV and scart output, * HDTV output, DVI output. * Identified by HwLib by PciSubsystemID = 0x06 * PIO0 - IIC Clock for Saa7114, Eeprom, Sii168 * PIO1 - IIC Data for Saa7114, Eeprom, Sii168 * PIO2 - TV Tuner Stereo/Mono flag * PIO3 - TV Tuner Bilingual flag * PIO4 - TV Tuner force mono * PIO5 - Video multiplex (selection of analog video source) * PIO6 - Video sel (selection of digital video source) * PIO7 - DLINE2 (interlace/progressive selection) * PIO8 - DLINE3 (aspect ratio selection) * PIO9 - not used yet * PIO10 - 44.1/48 SEL(L:44.1kHz/H:48kHz) * PIO11 - 256fs/512fs SEL (H:512fs/L:256fs) * PIO12 - VOMUTE (video muting at rec out) * PIO13 - not used yet * PIO14 - not used yet * PIO15 - TEST (pull down for normal mode)) * Implementation is based on CDigPvr. * Specific implementation (PIOs changed): * QRESULT CSony__AudioSetSampleRate(IDecoderBoard* pIDecoderBoard, DWORD Rate) * QRESULT CSony__PrepareLBCCapture(IDecoderBoard* pIDecoderBoard, DWORD config)/******************************************************************************//****h* HwLib/CSonyHVC_implementation * DESCRIPTION * CSonyHVC implementation of the IDecoderBoard interface. * SonyHVC is very similar to HARMONY. It has EM847X, Saa7114, SM2288, Sii168 components * to implement video/audio encoding, digital overlay output, TV and scart output, * HDTV output, DVI output. * Identified by HwLib by PciSubsystemID = 0x0a * PIO0 - IIC Clock for Saa7114, Eeprom, Sii168 - not used yet ? * PIO1 - IIC Data for Saa7114, Eeprom, Sii168 - not used yet ? * PIO2 - not used yet * PIO3 - not used yet * PIO4 - not used yet * PIO5 - not used yet * PIO6 - not used yet * PIO7 - not used yet * PIO8 - not used yet * PIO9 - not used yet * PIO10 - 44.1/48 SEL (L:44.1kHz / H:48kHz) * PIO11 - 256fs/512fs SEL (H:512fs / L:256fs)) * PIO12 - not used yet * PIO13 - not used yet * PIO14 - not used yet * PIO15 - connected to VSS * Implementation is based on CDigPvr. * Specific implementation (PIOs changed): * QRESULT CSony__AudioSetSampleRate(IDecoderBoard* pIDecoderBoard, DWORD Rate) * QRESULT CSony__PrepareLBCCapture(IDecoderBoard* pIDecoderBoard, DWORD config)/******************************************************************************/QRESULT CSony__AudioSetSampleRate(IDecoderBoard* pIDecoderBoard, DWORD Rate){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; DWORD Pio_Sel48_44, Pio_Sel512_256; DWORD Val_Sel48_44, Val_Sel512_256; if( (!(this->BoardAudioRate & FORCED_HW_UPDATE)) && (this->BoardAudioRate == Rate) ) return Q_OK;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -