📄 dcc.c
字号:
DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_ForceInterlacedBoundary, &force_interlaced_boundary, sizeof(force_interlaced_boundary)); DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_Validate, NULL, 0); enable = TRUE; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_Enable, &enable, sizeof(enable)); /* -------------------------------- */ /* set up OSD Scaler and connect to Main Mixer */ scaler = EMHWLIB_MODULE(DispOSDScaler, 0); err = RUAExchangeProperty(pDCC->pRUA, mixer, RMGenericPropertyID_MixerSourceIndex, &scaler, sizeof(scaler), &src_index, sizeof(src_index)); if (err != RM_OK) { RMDBGLOG((ENABLE, "Cannot get scaler index, %s\n", RMstatusToString(err))); return err; } mixer = EMHWLIB_TARGET_MODULE(DispMainMixer, 0 , src_index); window.X = 0; window.Y = 0; window.Width = 4096; window.Height = 4096; window.XPositionMode = EMhwlibDisplayWindowPositionMode_FrontEdgeToBorder; window.YPositionMode = EMhwlibDisplayWindowPositionMode_FrontEdgeToBorder; window.XMode = EMhwlibDisplayWindowValueMode_Relative; window.YMode = EMhwlibDisplayWindowValueMode_Relative; window.WidthMode = EMhwlibDisplayWindowValueMode_Relative; window.HeightMode = EMhwlibDisplayWindowValueMode_Relative; DCCSP(pDCC->pRUA, mixer, RMGenericPropertyID_MixerSourceWindow, &window, sizeof(window)); state = EMhwlibMixerSourceState_Master; DCCSP(pDCC->pRUA, mixer, RMGenericPropertyID_MixerSourceState, &state, sizeof(state)); DCCSP(pDCC->pRUA, mixer, RMGenericPropertyID_Validate, NULL, 0); surface = 0; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_Surface, &surface, sizeof(surface)); window.X = 0; window.Y = 0; window.Width = 4096; window.Height = 4096; window.XPositionMode = EMhwlibDisplayWindowPositionMode_FrontEdgeToBorder; window.YPositionMode = EMhwlibDisplayWindowPositionMode_FrontEdgeToBorder; window.XMode = EMhwlibDisplayWindowValueMode_Relative; window.YMode = EMhwlibDisplayWindowValueMode_Relative; window.WidthMode = EMhwlibDisplayWindowValueMode_Relative; window.HeightMode = EMhwlibDisplayWindowValueMode_Relative; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_ScalerInputWindow, &window, sizeof(window)); scalingcfg.Taps = 1; scalingcfg.AdaptativeEnable = TRUE; scalingcfg.AntiFlickerColor = 2; scalingcfg.AntiFlickerAlpha = 2; DCCSP(pDCC->pRUA, scaler, RMDispOSDScalerPropertyID_ScalingConfig, &scalingcfg, sizeof(scalingcfg)); field_selection = EMhwlibScalerFieldSelection_BestFieldType; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_ScalerFieldSelection, &field_selection, sizeof(field_selection)); val = 0x80; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_Alpha0, &val, sizeof(val)); force_interlaced_boundary = 0x100; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_ForceInterlacedBoundary, &force_interlaced_boundary, sizeof(force_interlaced_boundary)); DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_Validate, NULL, 0); enable = TRUE; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_Enable, &enable, sizeof(enable)); /* -------------------------------- */ /* connect GFX Multi Scaler to Main Mixer */ scaler = EMHWLIB_MODULE(DispGFXMultiScaler, 0); brightness = 0; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_Brightness, &brightness, sizeof(brightness)); contrast = 0x80; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_Contrast, &contrast, sizeof(contrast)); saturation = 0x80; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_CbSaturation, &saturation, sizeof(saturation)); saturation = 0x80; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_CrSaturation, &saturation, sizeof(saturation)); val = 0x80; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_Alpha0, &val, sizeof(val)); force_interlaced_boundary = 0x100; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_ForceInterlacedBoundary, &force_interlaced_boundary, sizeof(force_interlaced_boundary)); enable = TRUE; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_Enable, &enable, sizeof(enable)); DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_Validate, NULL, 0); err = RUAExchangeProperty(pDCC->pRUA, mixer, RMGenericPropertyID_MixerSourceIndex, &scaler, sizeof(scaler), &src_index, sizeof(src_index)); if (err != RM_OK) { RMDBGLOG((ENABLE, "Cannot get scaler index, %s\n", RMstatusToString(err))); return err; } mixer = EMHWLIB_TARGET_MODULE(DispMainMixer, 0 , src_index); state = EMhwlibMixerSourceState_Slave; DCCSP(pDCC->pRUA, mixer, RMGenericPropertyID_MixerSourceState, &state, sizeof(state)); DCCSP(pDCC->pRUA, mixer, RMGenericPropertyID_Validate, NULL, 0);#ifdef RMFEATURE_HAS_SPU_SCALER /* connect SPU scaler to Main Mixer */ scaler = EMHWLIB_MODULE(DispSubPictureScaler, 0); enable = TRUE; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_Enable, &enable, sizeof(enable)); DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_Validate, NULL, 0); err = RUAExchangeProperty(pDCC->pRUA, mixer, RMGenericPropertyID_MixerSourceIndex, &scaler, sizeof(scaler), &src_index, sizeof(src_index)); if (err != RM_OK) { RMDBGLOG((ENABLE, "Cannot get scaler index, %s\n", RMstatusToString(err))); return err; } mixer = EMHWLIB_TARGET_MODULE(DispMainMixer, 0 , src_index); state = EMhwlibMixerSourceState_Slave; DCCSP(pDCC->pRUA, mixer, RMGenericPropertyID_MixerSourceState, &state, sizeof(state)); DCCSP(pDCC->pRUA, mixer, RMGenericPropertyID_Validate, NULL, 0);#endif /* basic init of other scaler */ #ifdef RMFEATURE_HAS_VCR_SCALER scaler = EMHWLIB_MODULE(DispVCRMultiScaler, 0); brightness = 0; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_Brightness, &brightness, sizeof(brightness)); contrast = 0x80; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_Contrast, &contrast, sizeof(contrast)); saturation = 0x80; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_CbSaturation, &saturation, sizeof(saturation)); saturation = 0x80; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_CrSaturation, &saturation, sizeof(saturation)); enable = TRUE; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_Enable, &enable, sizeof(enable)); val = 0x80; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_Alpha0, &val, sizeof(val)); force_interlaced_boundary = 0x100; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_ForceInterlacedBoundary, &force_interlaced_boundary, sizeof(force_interlaced_boundary)); DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_Validate, NULL, 0); err = RUAExchangeProperty(pDCC->pRUA, mixer, RMGenericPropertyID_MixerSourceIndex, &scaler, sizeof(scaler), &src_index, sizeof(src_index)); if (err != RM_OK) { RMDBGLOG((ENABLE, "Cannot get scaler index, %s\n", RMstatusToString(err))); return err; } mixer = EMHWLIB_TARGET_MODULE(DispMainMixer, 0 , src_index); state = EMhwlibMixerSourceState_Slave; DCCSP(pDCC->pRUA, mixer, RMGenericPropertyID_MixerSourceState, &state, sizeof(state)); DCCSP(pDCC->pRUA, mixer, RMGenericPropertyID_Validate, NULL, 0);#endif#ifdef RMFEATURE_HAS_CRT_SCALER scaler = EMHWLIB_MODULE(DispCRTMultiScaler, 0); brightness = 0; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_Brightness, &brightness, sizeof(brightness)); contrast = 0x80; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_Contrast, &contrast, sizeof(contrast)); saturation = 0x80; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_CbSaturation, &saturation, sizeof(saturation)); saturation = 0x80; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_CrSaturation, &saturation, sizeof(saturation)); force_interlaced_boundary = 0x100; DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_ForceInterlacedBoundary, &force_interlaced_boundary, sizeof(force_interlaced_boundary)); DCCSP(pDCC->pRUA, scaler, RMGenericPropertyID_Validate, NULL, 0);#endif return RM_OK;}RMstatus DCCInitMicroCode(struct DCC *pDCC){ return DCCInitMicroCodeEx(pDCC, DCCInitMode_LeaveDisplay);}RMstatus DCCInitMicroCodeEx(struct DCC *pDCC, enum DCCInitMode init_mode){ RMstatus err; RMDBGLOG((LOCALDBG, "dccInitMicroCodeEx DCC @ 0x%08lx\n", (RMuint32)pDCC)); // Initialize Demux microcode err = DCCInitSpecificMicroCode(pDCC, DCCMicrocode_Demux); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "Error %s: cannot initialize demux microcode.\n", RMstatusToString(err))); return err; } // Initialize MPEG engine (Video RISC) err = DCCInitSpecificMicroCode(pDCC, DCCMicrocode_Video); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "Error %s: cannot initialize video microcode.\n", RMstatusToString(err))); return err; } // resetting the Audio Engine(s) err = DCCInitSpecificMicroCode(pDCC, DCCMicrocode_Audio); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "Error %s: cannot initialize audio microcode.\n", RMstatusToString(err))); return err; } return DCCInitChainEx(pDCC, init_mode);}#ifndef WITH_XLOADED_UCODEstatic RMstatus init_video_microcode(struct DCC *pDCC){ enum ProcessorState run; RMstatus err = RM_OK; struct MpegEngine_MicrocodeDRAMSize_in_type video_size_in; struct MpegEngine_MicrocodeDRAMSize_out_type video0_size_out;#ifdef RMFEATURE_HAS_VIDEO_ENGINE_1 struct MpegEngine_MicrocodeDRAMSize_out_type video1_size_out;#endif struct MpegEngine_Microcode_type video_ucode; RMuint32 mpeg_engine0 = EMHWLIB_MODULE(MpegEngine, 0); #ifdef RMFEATURE_HAS_VIDEO_ENGINE_1 RMuint32 mpeg_engine1 = EMHWLIB_MODULE(MpegEngine, 1); #endif RMuint32 video_size_out; RMDBGLOG((LOCALDBG, "dcc_init_video_microcode DCC @ 0x%08lx\n", (RMuint32)pDCC)); // resetting the MPEG engine run = CPU_RESET; DCCSP(pDCC->pRUA, mpeg_engine0, RMMpegEnginePropertyID_State, &run, sizeof run); run = CPU_STOPPED; DCCSP(pDCC->pRUA, mpeg_engine0, RMMpegEnginePropertyID_State, &run, sizeof run);#ifdef RMFEATURE_HAS_VIDEO_ENGINE_1 run = CPU_RESET; DCCSP(pDCC->pRUA, mpeg_engine1, RMMpegEnginePropertyID_State, &run, sizeof(run)); run = CPU_STOPPED; DCCSP(pDCC->pRUA, mpeg_engine1, RMMpegEnginePropertyID_State, &run, sizeof(run));#endif video_size_in.MicrocodeVersion = 1; err = RUAExchangeProperty(pDCC->pRUA, mpeg_engine0, RMMpegEnginePropertyID_MicrocodeDRAMSize, &video_size_in, sizeof video_size_in, &video0_size_out, sizeof video0_size_out); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "Error getting property RMMpegEnginePropertyID_MicrocodeDRAMSize! %s\n", RMstatusToString(err))); return err; } video_size_out = video0_size_out.Size; #ifdef RMFEATURE_HAS_VIDEO_ENGINE_1 video_size_in.MicrocodeVersion = 1; // Same microcode for now; could be different in the future err = RUAExchangeProperty(pDCC->pRUA, mpeg_engine1, RMMpegEnginePropertyID_MicrocodeDRAMSize, &video_size_in, sizeof video_size_in, &video1_size_out, sizeof video1_size_out); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "Error getting property RMMpegEnginePropertyID_MicrocodeDRAMSize! %s\n", RMstatusToString(err))); return err; } // Allocate 4 more bytes to guaranty alignment for second microcode instance that // will be store at the address of the first microcode + size of the first microcode. // Microcode DRAM base address has to be aligned on 4 bytes. Failure to do this results. video_size_out += video1_size_out.Size + 2;#endif video_ucode.MicrocodeVersion = video_size_in.MicrocodeVersion; if (video_size_out) { /* allocate only once per DCC instance */ if (!pDCC->video_ucode_address) { pDCC->video_ucode_address = pDCC->rua_malloc(pDCC->pRUA, mpeg_engine0, 0, RUA_DRAM_CACHED, video_size_out); if (!pDCC->video_ucode_address) { RMDBGLOG((ENABLE, "ERROR: could not allocate 0x%08lX bytes in cached DRAM %d!\n", video_size_out, 0)); return RM_FATALOUTOFMEMORY; } } video_ucode.Address = pDCC->video_ucode_address; RMDBGLOG((LOCALDBG, "video ucode cached addr: 0x%08lX, size 0x%08lX, end: 0x%08lX\n", video_ucode.Address, video_size_out, video_ucode.Address + video_size_out)); } else { video_ucode.Address = 0; RMDBGLOG((LOCALDBG, "video ucode doesn't need DRAM\n")); } DCCSP(pDCC->pRUA, mpeg_engine0, RMMpegEnginePropertyID_Microcode, &video_ucode, sizeof video_ucode);#ifdef RMFEATURE_HAS_VIDEO_ENGINE_1 // Size may not be a multiple of 4. We need to align. video_ucode.Address = pDCC->video_ucode_address + ((video0_size_out.Size + 3) & 0xFFFFFFC); DCCSP(pDCC->pRUA, mpeg_engine1, RMMpegEnginePropertyID_Microcode, &video_ucode, sizeof video_ucode);#endif // starting the MPEG Engine run = CPU_RUNNING; DCCSP(pDCC->pRUA, mpeg_engine0, RMMpegEnginePropertyID_State, &run, sizeof(run));#ifdef RMFEATURE_HAS_VIDEO_ENGINE_1 DCCSP(pDCC->pRUA, mpeg_engine1, RMMpegEnginePropertyID_State, &run, sizeof(run));#endif#if (EM86XX_CHIP<EM86XX_CHIPID_TANGO2) { struct PLL_RouteClockFromPLL_type rcfp; rcfp.PLL = PLLGen_pll_3; rcfp.PLLOutput = PLLOut_1; rcfp.Clock = ClockSignal_sel; DCCSP(pDCC->pRUA, PLL, RMPLLPropertyID_RouteClockFromPLL, &rcfp, sizeof(rcfp)); }#endif return err;}static RMstatus init_audio_microcode(struct DCC *pDCC){ enum ProcessorState run; RMstatus err = RM_OK; struct AudioEngine_MicrocodeDRAMSize_in_type audio_size_in; struct AudioEngine_MicrocodeDRAMSize_out_type audio0_size_out;#ifdef RMFEATURE_HAS_AUDIO_ENGINE_1 struct AudioEngine_MicrocodeDRAMSize_out_type audio1_size_out;#endif struct AudioEngine_Microcode_type audio_ucode; RMuint32 audio_engine0 = EMHWLIB_MODULE(AudioEngine, 0); #ifdef RMFEATURE_HAS_AUDIO_ENGINE_1 RMuint32 audio_engine1 = EMHWLIB_MODULE(AudioEngine, 1); #endif RMuint32 audio_size_out; RMDBGLOG((LOCALDBG, "dcc_init_audio_microcode DCC @ 0x%08lx\n", (RMuint32)pDCC));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -