📄 play_capture_sampleapp.c
字号:
/* * * Copyright (c) 2001-2007 Sigma Designs, Inc. * All Rights Reserved. Proprietary and Confidential. * *//** @file play_capture_sampleapp.c @brief sample application to show how to call play_capture_main.c @author Christian Wolff Sean.Sekwon.Choi*/// to enable or disable the debug messages of this source file, put 1 or 0 below#if 0#define LOCALDBG ENABLE#else#define LOCALDBG DISABLE#endif#include "sample_os.h"#define ALLOW_OS_CODE 1#include "../rua/include/rua.h"#include "../rua/include/rua_property.h"#include "../dcc/include/dcc.h"#include "../dcc/include/dcc_macros.h"#include "../rmcore/include/rmstatustostring.h"#include "../rmlibcw/include/rmlibcw.h"#include "../emhwlib_hal/pll/include/pll_hal.h"#include "command_ids.h"#include "get_key.h"#include "common.h"#include "play_capture_main.h"#include "play_capture_audio.h"#include "play_capture_video.h"// TODO to be removed later#include "play_capture_i2c.h"#include "play_capture_hdmi.h"#include "play_capture_SAA7119.h"#include "play_capture_MSP34x5.h"#include "play_capture_WM8775.h"#include "play_capture_SiI9031.h"#include "play_capture_AD9883.h"#include "play_capture_board_specific.h"////////////////////////////////////////////////////////////////////////////////////static RMuint32 I2C_ModuleID = I2C;struct RUA *pInstance = NULL;struct display_cmdline disp_opt;struct capture_cmdline capture_opt[2];struct audio_cmdline audio_opt;RMuint32 chip_num = 0;RMuint32 input_num = 0;struct local_cmdline { RMuint32 chip_num; RMuint32 TimerNumber; RMbool zoom_force; RMuint32 zoom_x; RMuint32 zoom_y; RMuint32 zoom_w; RMuint32 zoom_h; RMuint32 zoomstep; RMbool force_overscan_crop; RMuint32 overscan_crop_amount; RMuint32 overscan_crop; // percentage of frame size to crop around edge for overscanned pictures struct EMhwlibDisplayWindow *output_window; RMuint32 arg_vbi; RMbool parse_anc; RMbool print_anc; RMbool dump_vbi; RMbool i2c_init; RMuint32 i2c_module; // enum capture_board i2c_board; enum capsam_board i2c_board; enum capture_port i2c_port; enum capture_chip i2c_video_chip; RMuint8 i2c_video_dev; RMuint32 i2c_video_delay; enum capture_chip i2c_audio1_chip; RMuint8 i2c_audio1_dev; RMuint32 i2c_audio1_delay; enum capture_chip i2c_audio2_chip; RMuint8 i2c_audio2_dev; RMuint32 i2c_audio2_delay; RMbool enable_i2c_cc; RMbool enable_i2c_wss; struct EMhwlibInputReadbackI2CCC i2c_cc; RMbool ccfifo_print; RMuint32 use_soft_cc_decoder; RMuint32 ccfifo_id_in; RMuint32 ccfifo_id_send; RMuint32 ccfifo_id_out; RMuint32 ccfifo_addr_in; RMuint32 ccfifo_addr_out; RMuint32 VBIFlags; RMuint32 VBIPTS; RMuint32 VBISequence; RMuint32 VBISize; RMuint32 VBIOffs; RMuint16 *pVBIChunk; RMuint16 *pVBIData; FILE *vbidump; RMbool update; RMbool use_gpio_fid; RMbool invert_fid; RMbool last_hotplug; struct ReceiveObject_type *pR; struct RUABufferPool *pDmaReceive; RMbool force_active_format; enum EMhwlibActiveFormat active_format; RMbool force_wide_screen; RMbool wide_screen; RMuint32 wss_odd; RMuint32 wss_even; RMbool last_hdcp_ok; RMbool last_power; RMbool last_sync; RMbool last_clock; RMbool last_auth; RMbool last_crypt; RMbool break_hdcp; RMuint32 cable_eq; struct avi_info last_avi; RMbool new_avi; enum EMhwlibScanInfo last_scan; RMbool update_videomode; RMbool follow_vfreq; RMbool verbouse; RMbool intr_debug; RMbool green_bg;// enum hdmi_mode hdmi_mode; // TRUE: HDMI with info frames, audio etc. FALSE: DVI mode RMbool upsample_from_422; RMuint32 CurrChStat; RMuint16 CurrPc; RMuint8 last_isrc[32]; RMuint8 last_isrc_header; RMbool last_isrc2; RMuint8 intr_mask[6]; enum audio_state audio_state; RMuint64 audio_guard_time; RMbool restart_audio; // have to restart audio passthrough due to errors or changes RMbool audio_pll_locked; // stability of audio clock RMbool lpcm_24bit; enum EMhwlibTVStandard old_std; enum EMhwlibTVStandard prev_std; RMuint32 same_ct;}local_opt[2];#if 0// Example: DTV8624 board// This needs to come from a board dependent configuration filestruct capsam_access VideoInput[] = { { // HDMI 0 APIVersion: 1, // set to 1 access_type: capsam_access_type_hdmi, // digital or analog chip: capsam_chip_SiI9031, // capture chip specification input: capsam_input_hdmi, // input type input_number: 0, // arbitrary number to select one specific input of the specified type I2CModuleID: 0, // emhwlib Module ID of the I2C bus access I2CDevice: { // pI2CDevice.DevAddr contains the primaty I2C device address of the chip, the other members need to match the board specific environment APIVersion: 1, // set to 1 Clock: GPIOId_Sys_0, // GPIO of the I2C data line Data: GPIOId_Sys_1, // GPIO of the I2C clock line DevAddr: 0x60, // I2C device address (write uses DevAddr, read uses DevAddr + 1) Delay: 0, // I2C delay, in uSec Speed: 100 // frequency of the I2C bit transfer, in kHz (e.g. 100 or 400) } }, { // HDMI 1 APIVersion: 1, // set to 1 access_type: capsam_access_type_hdmi, // digital or analog chip: capsam_chip_SiI9031, // capture chip specification input: capsam_input_hdmi, // input type input_number: 1, // arbitrary number to select one specific input of the specified type I2CModuleID: 0, // emhwlib Module ID of the I2C bus access I2CDevice: { // pI2CDevice.DevAddr contains the primaty I2C device address of the chip, the other members need to match the board specific environment APIVersion: 1, // set to 1 Clock: GPIOId_Sys_0, // GPIO of the I2C data line Data: GPIOId_Sys_1, // GPIO of the I2C clock line DevAddr: 0x60, // I2C device address (write uses DevAddr, read uses DevAddr + 1) Delay: 0, // I2C delay, in uSec Speed: 100 // frequency of the I2C bit transfer, in kHz (e.g. 100 or 400) } }, { // CVBS APIVersion: 1, // set to 1 access_type: capsam_access_type_analog, // digital or analog chip: capsam_chip_SAA7119, // capture chip specification input: capsam_input_cvbs1, // input type input_number: 1, // arbitrary number to select one specific input of the specified type I2CModuleID: 31, // emhwlib Module ID of the I2C bus access I2CDevice: { // pI2CDevice.DevAddr contains the primaty I2C device address of the chip, the other members need to match the board specific environment APIVersion: 1, // set to 1 Clock: GPIOId_Sys_0, // GPIO of the I2C data line Data: GPIOId_Sys_1, // GPIO of the I2C clock line DevAddr: 0x40, // I2C device address (write uses DevAddr, read uses DevAddr + 1) Delay: 0, // I2C delay, in uSec Speed: 100 // frequency of the I2C bit transfer, in kHz (e.g. 100 or 400) } }, };struct capsam_access AudioInput[] = { { // audio 0 APIVersion: 1, // set to 1 access_type: capsam_access_type_analog, // digital or analog chip: capsam_chip_WM8775, // capture chip specification input: capsam_input_none, // input type input_number: 0, // arbitrary number to select one specific input of the specified type I2CModuleID: 31, // emhwlib Module ID of the I2C bus access I2CDevice: { // pI2CDevice.DevAddr contains the primaty I2C device address of the chip, the other members need to match the board specific environment APIVersion: 1, // set to 1 Clock: GPIOId_Sys_0, // GPIO of the I2C data line Data: GPIOId_Sys_1, // GPIO of the I2C clock line DevAddr: 0x60, // I2C device address (write uses DevAddr, read uses DevAddr + 1) Delay: 0, // I2C delay, in uSec Speed: 100 // frequency of the I2C bit transfer, in kHz (e.g. 100 or 400) } }, };#define I2C_ADDR_SiI9031 0x60#define I2C_ADDR_AD9380 0x98#define I2C_ADDR_SAA7119 0x40#define I2C_ADDR_WM8775 0x34#define I2C_ADDR_MSP34x5 0x80#define I2C_ADDR_TW9919 0x88struct capsam_board_config DTV8624[] = { { APIVersion: 1, XtalClock: 32110000, board: capsam_sigma844e1dtv, chip_hdmi_config:{ APIVersion: 1, // set to 1 access_type: capsam_access_type_hdmi, // digital or analog chip: capsam_chip_SiI9031,// capture chip specification input: capsam_input_hdmi, // input type input_number: 0, // arbitrary number to select one specific input of the specified type I2CModuleID: 0, // emhwlib Module ID of the I2C bus access I2CDevice: { // pI2CDevice.DevAddr contains the primaty I2C device address of the chip, the other members need to match the board specific environment APIVersion: 1, // set to 1 Clock: GPIOId_Sys_0, // GPIO of the I2C data line Data: GPIOId_Sys_1, // GPIO of the I2C clock line DevAddr: I2C_ADDR_SiI9031, // I2C device address (write uses DevAddr, read uses DevAddr + 1) Delay: 0, // I2C delay, in uSec Speed: 100 // frequency of the I2C bit transfer, in kHz (e.g. 100 or 400) } }, chip_analog_video_config: { APIVersion: 1, // set to 1 access_type: capsam_access_type_analog, // digital or analog chip: capsam_chip_SAA7119, input: capsam_input_cvbs1, input_number:0, I2CModuleID:31, I2CDevice:{ APIVersion: 1, // set to 1 Clock: GPIOId_Sys_0, // GPIO of the I2C data line Data: GPIOId_Sys_1, // GPIO of the I2C clock line DevAddr: I2C_ADDR_SAA7119, // I2C device address (write uses DevAddr, read uses DevAddr + 1) Delay: 0, // I2C delay, in uSec Speed: 100 } }, chip_analog_audio_config: { APIVersion: 1, // set to 1 access_type: capsam_access_type_analog, // digital or analog chip: capsam_chip_WM8775, input: capsam_input_cvbs1, input_number: 0, I2CModuleID: 31, I2CDevice:{ APIVersion: 1, // set to 1 Clock: GPIOId_Sys_0, // GPIO of the I2C data line Data: GPIOId_Sys_1, // GPIO of the I2C clock line DevAddr: I2C_ADDR_WM8775, // I2C device address (write uses DevAddr, read uses DevAddr + 1) Delay: 0, // I2C delay, in uSec Speed: 100 } }, chip_analog_audio_config2: { APIVersion: 1, // set to 1 access_type: capsam_access_type_analog, // digital or analog chip: capsam_chip_MSP34x5, input: 0, input_number: 0, I2CModuleID: 31, I2CDevice:{ APIVersion: 1, // set to 1 Clock: GPIOId_Sys_0, // GPIO of the I2C data line Data: GPIOId_Sys_1, // GPIO of the I2C clock line DevAddr: I2C_ADDR_MSP34x5, // I2C device address (write uses DevAddr, read uses DevAddr + 1) Delay: 0, // I2C delay, in uSec Speed: 100 } } },};struct capsam_board_config DTV8634[] = { { APIVersion: 1, XtalClock: 27110000, board: capsam_sigmaDTV8634, chip_hdmi_config:{ APIVersion: 1, // set to 1 access_type: capsam_access_type_hdmi, // digital or analog chip: capsam_chip_AD9380,// capture chip specification input: capsam_input_hdmi, // input type input_number: 1, // arbitrary number to select one specific input of the specified type I2CModuleID: 0, // emhwlib Module ID of the I2C bus access I2CDevice: { // pI2CDevice.DevAddr contains the primaty I2C device address of the chip, the other members need to match the board specific environment APIVersion: 1, // set to 1 Clock: GPIOId_Sys_0, // GPIO of the I2C data line Data: GPIOId_Sys_1, // GPIO of the I2C clock line DevAddr: I2C_ADDR_AD9380, // I2C device address (write uses DevAddr, read uses DevAddr + 1) Delay: 0, // I2C delay, in uSec Speed: 100 // frequency of the I2C bit transfer, in kHz (e.g. 100 or 400) } }, chip_analog_video_config: { APIVersion: 1, // set to 1 access_type: capsam_access_type_analog, // digital or analog chip: capsam_chip_TW9919, input: capsam_input_cvbs1, input_number:0, I2CModuleID:31, I2CDevice:{ APIVersion: 1, // set to 1 Clock: GPIOId_Sys_0, // GPIO of the I2C data line Data: GPIOId_Sys_1, // GPIO of the I2C clock line DevAddr: I2C_ADDR_TW9919, // I2C device address (write uses DevAddr, read uses DevAddr + 1) Delay: 0, // I2C delay, in uSec Speed: 100 } }, chip_analog_audio_config: { APIVersion: 1, // set to 1 access_type: capsam_access_type_analog, // digital or analog chip: capsam_chip_MSP34x5, input: 0, input_number: 0, I2CModuleID: 31, I2CDevice:{ APIVersion: 1, // set to 1 Clock: GPIOId_Sys_0, // GPIO of the I2C data line Data: GPIOId_Sys_1, // GPIO of the I2C clock line DevAddr: I2C_ADDR_MSP34x5, // I2C device address (write uses DevAddr, read uses DevAddr + 1) Delay: 0, // I2C delay, in uSec Speed: 100 } } },};#endif//////////////////////////////////////////////////////////////////////////////////// static function declarations//////////////////////////////////////////////////////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -