//================================================================================== //void Run8ChCif(void) //{ // U8 _t1_, _t2_, _t3_; // U16 _dly_; // // _t1_ = ReadAsicByte(MASTER,DVC_PG1,0x54); // for(_t3_=0;_t3_<4;_t3_++){ // if(BitClear(_t1_,BIT0<<_t3_)){ //... check strobe done // DLY_FOR(DLY_SW_STRB); // _t2_ = ReadAsicByte(MASTER,DVC_PG0,0x0d+0x10*_t3_)^BIT3; // WriteAsicByte(MASTER,DVC_PG0,0x0d+0x10*_t3_,_t2_); //... analog switch // WriteAsicByte(MASTER,DVC_PG0,0x0d+0x10*_t3_,_t2_|BIT2); //... soft reset // if(b_ch_src == CH_SRC_LV){ // if(BitClear(_t2_,BIT3)) //... input A // WriteAsicByte(MASTER,DVC_PG1,0x04,(BIT0<<_t3_)); //... strobe on opposite ch // else //... input B // WriteAsicByte(MASTER,DVC_PG1,0x04,(BIT4<<_t3_)); //... strobe on opposite ch // } // WriteAsicByte(MASTER,DVC_PG1,0x54,(_t1_&0xf0)|(BIT0<<_t3_)); //... strobe on opposite ch // // if(_t3_ == 0) run_8ch_cnt_ana_sw++; // } // } //} //================================================================================== void Run8ChCif(void) { U8 _t1_, _t2_, _t3_; U16 _dly_; _t1_ = ReadAsicByte(MASTER,DVC_PG1,0x54); if(BitClear(_t1_,0x0f)){ //... check strobe done if(wndw_rc_fm_type == CIF_TYPE_FL) DLY_FOR(DLY_SW_STRB); //... about 1 field when non-realtime and CIF record for(_t3_=0;_t3_<4;_t3_++){ _t2_ = ReadAsicByte(MASTER,DVC_PG0,0x0d+0x10*_t3_)^BIT3; WriteAsicByte(MASTER,DVC_PG0,0x0d+0x10*_t3_,_t2_); //... analog switch WriteAsicByte(MASTER,DVC_PG0,0x0d+0x10*_t3_,_t2_|BIT2); //... soft reset if(b_ch_src == CH_SRC_LV){ if(BitClear(_t2_,BIT3)) //... input A WriteAsicByte(MASTER,DVC_PG1,0x04,(BIT0<<_t3_)); //... strobe on opposite ch else //... input B WriteAsicByte(MASTER,DVC_PG1,0x04,(BIT4<<_t3_)); //... strobe on opposite ch } WriteAsicByte(MASTER,DVC_PG1,0x54,(_t1_&0xf0)|(BIT0<<_t3_)); if(_t3_ == 0) run_8ch_cnt_ana_sw++; } // WriteAsicByte(MASTER,DVC_PG1,0x54,(_t1_&0xf0)|0x0f); } }
//设置图像饱和度 int Preview_SetVideo_Sat(unsigned char ch,unsigned char sat_data) { unsigned char sadd=0; unsigned char video_satU_reg[4] ={0x04,0x14,0x24,0x34}; unsigned char video_satV_reg[4] ={0x05,0x15,0x25,0x35}; int ret=0; if(ch<4) { sadd = TW2865_0_WRITE; } else if(ch<8) { ch = ch%4; sadd = TW2865_1_WRITE; } else if(ch<12) { ch = ch%4; sadd = TW2865_2_WRITE; } else { ch = ch%4; sadd = TW2865_3_WRITE; } ret = WriteAsicByte(sadd,video_satU_reg[ch],sat_data); if(ret == -1) return ret; ret = WriteAsicByte(sadd,video_satV_reg[ch],sat_data); return ret; }
//横向位移 int Preview_SetVideo_x(unsigned char ch,unsigned char x_data) { unsigned char sadd=0; unsigned char video_x_reg[4] ={0x0a,0x1a,0x2a,0x3a}; int ret=0; signed char valid_value_range_min = 1; signed char valid_value_range_max = 40; x_data = x_data*(valid_value_range_max-valid_value_range_min)/(PRV_X_OFFSET_MAX-PRV_X_OFFSET_MIN) + valid_value_range_min; if(ch<4) { sadd = TW2865_0_WRITE; } else if(ch<8) { ch = ch%4; sadd = TW2865_1_WRITE; } else if(ch<12) { ch = ch%4; sadd = TW2865_2_WRITE; } else { ch = ch%4; sadd = TW2865_3_WRITE; } ret = WriteAsicByte(sadd,video_x_reg[ch],x_data); return ret; }
//设置图像亮度 int Preview_SetVideo_Brt(unsigned char ch,unsigned char brt_data) { unsigned char sadd=0; unsigned char video_brt_reg[4] ={0x01,0x11,0x21,0x31}; int ret=0; if(ch<4) { sadd = TW2865_0_WRITE; } else if(ch<8) { ch = ch%4; sadd = TW2865_1_WRITE; } else if(ch<12) { ch = ch%4; sadd = TW2865_2_WRITE; } else { ch = ch%4; sadd = TW2865_3_WRITE; } brt_data = 0x80+brt_data; ret = WriteAsicByte(sadd,video_brt_reg[ch],brt_data); return ret; }
//设置图像对比度 int Preview_SetVideo_Cont(unsigned char ch,unsigned char cont_data) { unsigned char sadd=0; unsigned char video_cont_reg[4] ={0x02,0x12,0x22,0x32}; int ret=0; if(ch<4) { sadd = TW2865_0_WRITE; } else if(ch<8) { ch = ch%4; sadd = TW2865_1_WRITE; } else if(ch<12) { ch = ch%4; sadd = TW2865_2_WRITE; } else { ch = ch%4; sadd = TW2865_3_WRITE; } if(cont_data < 2) cont_data = 2; ret = WriteAsicByte(sadd,video_cont_reg[ch],cont_data); return ret; }
//纵向位移 int Preview_SetVideo_y(unsigned char ch,unsigned char y_data) { unsigned char sadd=0; unsigned char video_y_reg[4] ={0x08,0x18,0x28,0x38}; int ret=0; signed char valid_value_range_min = 3; signed char valid_value_range_max = 25; y_data = y_data*(valid_value_range_max-valid_value_range_min)/(PRV_Y_OFFSET_MAX-PRV_Y_OFFSET_MIN) + valid_value_range_min; if(ch<4) { sadd = TW2865_0_WRITE; } else if(ch<8) { ch = ch%4; sadd = TW2865_1_WRITE; } else if(ch<12) { ch = ch%4; sadd = TW2865_2_WRITE; } else { ch = ch%4; sadd = TW2865_3_WRITE; } ret = WriteAsicByte(sadd,video_y_reg[ch],y_data); return ret; }
//设置图像色度 int Preview_SetVideo_Hue(unsigned char ch,unsigned char hue_data) { unsigned char sadd=0; unsigned char video_hue_reg[4] ={0x06,0x16,0x26,0x36}; int ret=0; if(ch<4) { sadd = TW2865_0_WRITE; } else if(ch<8) { ch = ch%4; sadd = TW2865_1_WRITE; } else if(ch<12) { ch = ch%4; sadd = TW2865_2_WRITE; } else { ch = ch%4; sadd = TW2865_3_WRITE; } if(hue_data < 2) hue_data = 2; hue_data = 0x80+hue_data; ret = WriteAsicByte(sadd,video_hue_reg[ch],hue_data); return ret; }
int tw2865_master_pb_cfg(char flag) { int ret; unsigned char reg; ret = ReadAsicByte(TW2865_0,0xdc,®); if (0 == flag) //off { ret = WriteAsicByte(TW2865_0,0xdc,reg|0x10);//set reg[4] to 1: off } else //on { ret = WriteAsicByte(TW2865_0,0xdc,reg&0xef);//set reg[4] to 0: on } return ret; }
//================================================================================== //* void InitPg2(void) { U8 _t1_; //... OSD color index #if 0 InitOSDCol(); #else HwTW2835SetOSDColLUT(cmn_dvc, 1, color_init_index); HwTW2835SetOSDColLUT(cmn_dvc, 2, color_init_index); #endif WriteAsicByte(cmn_dvc,DVC_PG2,0x0f,0x0f); //... OSD Enable for Display/Capture // WriteAsicByte(cmn_dvc,DVC_PG2,0x0f,0x0c); //... OSD Enable for Display ---->> X // WriteAsicByte(cmn_dvc,DVC_PG2,0x0f,0x0a); //... OSD Enable for Display/Capture //... temporal WriteOSDClrX(cmn_dvc,0,0,45,31); //... max line num is 310 line for OSD #if defined(__16CH__) WriteOSDClrX(SLAVE1,0,0,45,31); //... max line num is 310 line for OSD WriteOSDClrX(SLAVE2,0,0,45,31); //... max line num is 310 line for OSD WriteOSDClrX(SLAVE3,0,0,45,31); //... max line num is 310 line for OSD #endif WriteOSDClrY(cmn_dvc,0,0,45,31); //... max line num is 310 line for OSD #if defined(__16CH__) WriteOSDClrY(SLAVE1,0,0,45,31); //... max line num is 310 line for OSD WriteOSDClrY(SLAVE2,0,0,45,31); //... max line num is 310 line for OSD WriteOSDClrY(SLAVE3,0,0,45,31); //... max line num is 310 line for OSD #endif // WriteAsicByte(cmn_dvc,DVC_PG2,0x10,0xb0); //... cursor WriteAsicByte(cmn_dvc,DVC_PG2,0x10,0xf0); //... cursor //... other ( mouse, single box, 2d box, mask ..) WriteAsicTable(cmn_dvc,DVC_PG2,0x10,tbl_pg2_mse_box,80); if(b_cmn_jp_vdo == VDO_NTSC){ WriteAsicTable(cmn_dvc,DVC_PG2,0x60,tbl_ntsc_pg2_2dbox,32); for(_t1_=0;_t1_<4;_t1_++) WriteAsicTable(cmn_dvc,DVC_PG2,0x80+0x20*_t1_,tbl_ntsc_pg2_mtn,32); } else{ WriteAsicTable(cmn_dvc,DVC_PG2,0x60,tbl_pal_pg2_2dbox,32); for(_t1_=0;_t1_<4;_t1_++) WriteAsicTable(cmn_dvc,DVC_PG2,0x80+0x20*_t1_,tbl_pal_pg2_mtn,32); } }
int tw2865_ain_cfg(unsigned int chip, unsigned char mask) { int ret; unsigned char reg; mask = ~mask; ret = ReadAsicByte(chip,0xdc,®); ret = WriteAsicByte(chip,0xdc,(mask&0x0f) | (reg&0xf0) ); return ret; }
int tw2865_master_tk_pb_switch(char flag) { int ret; unsigned char reg; ret = ReadAsicByte(TW2865_0,0xdb,®); if (0 == flag) { ret = WriteAsicByte(TW2865_0,0xdb,reg&0xef); } else if (1 == flag) { ret = WriteAsicByte(TW2865_0,0xdb,reg|0x10); } else { TRACE(SCI_TRACE_NORMAL, MOD_DRV, "tw2865_master_tk_pb_switch(char flag): bad flag:%d!!\n", flag); return -1; } return 0; }
//================================================================================== void Run8ChMux(void) //... frame by frame //... Auto strobe pseudo 8 ch & Mux //... use mux interrupt, not use que & internal trigger mode(period:01h). //... FLDENC signal interrupt { U8 _t1_, _t2_;//, _t3_; if(run_8ch_cnt_mux < 3) run_8ch_cnt_mux++; else run_8ch_cnt_mux = 0; if(run_8ch_cnt_mux == 0) run_8ch_cnt_ana_sw++; if(run_8ch_cnt_mux == 0) _t1_ = 2; else if(run_8ch_cnt_mux == 1) _t1_ = 3; else if(run_8ch_cnt_mux == 2) _t1_ = 0; else _t1_ = 1; _t2_ = ReadAsicByte(MASTER,DVC_PG1,0x59); WriteAsicByte(MASTER,DVC_PG1,0x59,(_t2_&0xf0)|BIT4|run_8ch_cnt_mux); //... mux interrupt _t2_ = ReadAsicByte(MASTER,DVC_PG0,0x0d+0x10*_t1_)^BIT3; WriteAsicByte(MASTER,DVC_PG0,0x0d+0x10*_t1_,_t2_); //... ANA_SW WriteAsicByte(MASTER,DVC_PG0,0x0d+0x10*_t1_,_t2_|BIT2); //... SW_RESET if(b_ch_src == CH_SRC_LV){ // _t3_ = ReadAsicByte(MASTER,DVC_PG1,REG_FUNC_MODE_X+(_t1_<<3));// ^ DMCH_PATH; // IfBitSet(_t2_,BIT2) SetBit(_t3_,DMCH_PATH);//BIT2); //... dummy channel // else ClearBit(_t3_,DMCH_PATH);//BIT2); //... main channel // WriteAsicByte(MASTER,DVC_PG1,REG_FUNC_MODE_X+(_t1_<<3),_t3_); // // _t1_ = ReadAsicByte(MASTER,DVC_PG1,REG_STRB_CTL_X); // WriteAsicByte(MASTER,DVC_PG1,REG_STRB_CTL_X,(_t2_&0xf0)|(BIT0<<run_8ch_cnt_mux)); //... SW_RESET|ANA_SW if(BitClear(_t2_,BIT3)) //... input A WriteAsicByte(MASTER,DVC_PG1,0x04,(BIT0<<run_8ch_cnt_mux)); //... strobe on opposite ch else //... input B WriteAsicByte(MASTER,DVC_PG1,0x04,(BIT4<<run_8ch_cnt_mux)); //... strobe on opposite ch } }
//================================================================================== void SetBoxPos(U8 _box_num, U16 _boxhl, U16 _boxvt) { U8 _rdat_; _rdat_ = ReadAsicByte(MASTER,DVC_PG2,0x21+_box_num*6); if(BitSet(_boxhl, BIT0)) SetBit(_rdat_, BIT3); else ClearBit(_rdat_, BIT3); if(BitSet(_boxvt, BIT0)) SetBit(_rdat_, BIT1); else ClearBit(_rdat_, BIT1); WriteAsicByte(MASTER,DVC_PG2,0x21+_box_num*6,_rdat_); WriteAsicByte(MASTER,DVC_PG2,0x22+_box_num*6,(U8)(_boxhl>>1)); WriteAsicByte(MASTER,DVC_PG2,0x24+_box_num*6,(U8)(_boxvt>>1)); }
//================================================================================== void SetBoxSize(U8 _box_num, U16 _boxhw, U16 _boxvw) { // WriteAsicByte(MASTER,DVC_PG2,REG_BOXHW+5*_box_num,_boxhw); // WriteAsicByte(MASTER,DVC_PG2,REG_BOXVW+5*_box_num,_boxvw); U8 _rdat_; _rdat_ = ReadAsicByte(MASTER,DVC_PG2,0x21+_box_num*6); if(BitSet(_boxhw, BIT0)) SetBit(_rdat_, BIT2); else ClearBit(_rdat_, BIT2); if(BitSet(_boxvw, BIT0)) SetBit(_rdat_, BIT0); else ClearBit(_rdat_, BIT0); WriteAsicByte(MASTER,DVC_PG2,0x21+_box_num*6,_rdat_); WriteAsicByte(MASTER,DVC_PG2,0x23+_box_num*6,(U8)(_boxhw>>1)); WriteAsicByte(MASTER,DVC_PG2,0x25+_box_num*6,(U8)(_boxvw>>1)); }
void InitPg0(void) { U8 _t1_; if(b_cmn_jp_vdo == VDO_NTSC){ for(_t1_=0;_t1_<4;_t1_++){ WriteAsicTable(cmn_dvc,DVC_PG0,0x00+0x10*_t1_,tbl_ntsc_pg0_cmn,15); WriteAsicByte(cmn_dvc,DVC_PG0,0x0c+0x10*_t1_,(_t1_<<6)|0x06); //... x path ANA_CH mux WriteAsicTable(cmn_dvc,DVC_PG0,0x80+0x10*_t1_,tbl_ntsc_pg0_scl,16); #if defined(__4CH__) WriteAsicByte(cmn_dvc,DVC_PG0,0x80+0x10*_t1_,(_t1_<<6)|0x01); //... x path scale filter : quad // WriteAsicByte(cmn_dvc,DVC_PG0,0x80+0x10*_t1_,(_t1_<<6)|0x06); //... x path scale filter : 1/3 size #elif defined(__16CH__) WriteAsicByte(cmn_dvc,DVC_PG0,0x80+0x10*_t1_,(_t1_<<6)|0x0b); //... x path scale filter : 1/4 #endif WriteAsicByte(cmn_dvc,DVC_PG0,0x8a+0x10*_t1_,(_t1_<<6)|0x31); //... y path scale filter : quad } WriteAsicTable(cmn_dvc,DVC_PG0,0x40,tbl_ntsc_pg0_sfr1,21); WriteAsicTable(cmn_dvc,DVC_PG0,0x60,tbl_ntsc_pg0_sfr2,21); WriteAsicTable(cmn_dvc,DVC_PG0,0xc0,tbl_ntsc_pg0_sfr3,11); } else{ //... PAL for(_t1_=0;_t1_<4;_t1_++){ WriteAsicTable(cmn_dvc,DVC_PG0,0x00+0x10*_t1_,tbl_pal_pg0_cmn,15); WriteAsicByte(cmn_dvc,DVC_PG0,0x0c+0x10*_t1_,(_t1_<<6)|0x06); //... x path ANA_CH mux WriteAsicTable(cmn_dvc,DVC_PG0,0x80+0x10*_t1_,tbl_pal_pg0_scl,16); #if defined(__4CH__) WriteAsicByte(cmn_dvc,DVC_PG0,0x80+0x10*_t1_,(_t1_<<6)|0x01); //... x path scale filter : quad // WriteAsicByte(cmn_dvc,DVC_PG0,0x80+0x10*_t1_,(_t1_<<6)|0x06); //... x path scale filter : 1/3 size #elif defined(__16CH__) WriteAsicByte(cmn_dvc,DVC_PG0,0x80+0x10*_t1_,(_t1_<<6)|0x0b); //... x path scale filter : 1/4 #endif WriteAsicByte(cmn_dvc,DVC_PG0,0x8a+0x10*_t1_,(_t1_<<6)|0x31); //... y path scale filter : quad } WriteAsicTable(cmn_dvc,DVC_PG0,0x40,tbl_pal_pg0_sfr1,21); WriteAsicTable(cmn_dvc,DVC_PG0,0x60,tbl_pal_pg0_sfr2,21); WriteAsicTable(cmn_dvc,DVC_PG0,0xc0,tbl_pal_pg0_sfr3,11); } }
//================================================================================== // //================================================================================== void Run8ChFast(void) { U8 _t1_, _t2_, _t3_; // U16 _dly_; _t1_ = ReadAsicByte(MASTER,DVC_PG1,0x04); for(_t3_=0;_t3_<4;_t3_++){ _t2_ = ReadAsicByte(MASTER,DVC_PG0,0x0d+0x10*_t3_); if(BitClear(_t2_,BIT3)){ //... input A if(BitClear(_t1_,BIT0<<_t3_)){ //... check strobe done // DLY_FOR(DLY_SW_STRB); _t2_ |= BIT3; //... change to input B WriteAsicByte(MASTER,DVC_PG0,0x0d+0x10*_t3_,_t2_); //... analog switch WriteAsicByte(MASTER,DVC_PG0,0x0d+0x10*_t3_,_t2_|BIT2); //... soft reset // WriteAsicByte(MASTER,DVC_PG1,0x04,_t1_|(BIT4<<_t3_)); //... strobe on opposite ch WriteAsicByte(MASTER,DVC_PG1,0x04,(BIT4<<_t3_)); //... strobe on opposite ch // WriteAsicByte(MASTER,DVC_PG1,0x54,(BIT0<<_t3_)); //... strobe on opposite ch if(_t3_ == 0) run_8ch_cnt_ana_sw++; } } else{ //... input B if(BitClear(_t1_,BIT4<<_t3_)){ //... check strobe done // DLY_FOR(DLY_SW_STRB); _t2_ &= ~BIT3; //... change to input A WriteAsicByte(MASTER,DVC_PG0,0x0d+0x10*_t3_,_t2_); //... analog switch WriteAsicByte(MASTER,DVC_PG0,0x0d+0x10*_t3_,_t2_|BIT2); //... soft reset // WriteAsicByte(MASTER,DVC_PG1,0x04,_t1_|(BIT0<<_t3_)); //... strobe on opposite ch WriteAsicByte(MASTER,DVC_PG1,0x04,(BIT0<<_t3_)); //... strobe on opposite ch // WriteAsicByte(MASTER,DVC_PG1,0x54,(BIT0<<_t3_)); //... strobe on opposite ch if(_t3_ == 0) run_8ch_cnt_ana_sw++; } } } }
void RunPopProc(void) { U8 _osd_pos_x_, _osd_pos_y_; U8 _pop_main_num_h_, _pop_main_num_v_; U8 _mn_crnt_pos_main_, _mn_crnt_pos_sub_; _osd_pos_x_ = GetMseOSDX(reg_crsr_pos_x); _osd_pos_y_ = GetMseOSDY(reg_crsr_pos_y); // if(b_mouse_status_path_popup == MOUSE_PATH_X){ // _pop_main_num_h_ = POP_X_MN_NUM_H; // _pop_main_num_v_ = POP_X_MN_NUM_V; // } // else{ // _pop_main_num_h_ = POP_Y_MN_NUM_H; // _pop_main_num_v_ = POP_Y_MN_NUM_V; // } _pop_main_num_h_ = POP_MN_NUM_H; _pop_main_num_v_ = POP_MN_NUM_V + cmn_vga_det; if(((_osd_pos_x_ >= mse_osd_x)&&(_osd_pos_x_ <= (mse_osd_x+_pop_main_num_h_))&& (_osd_pos_y_ >= mse_osd_y)&&(_osd_pos_y_ < (mse_osd_y+_pop_main_num_v_)))//){ && (b_mse_stts_pth_pop == b_mse_stts_pth)){ // && (((mse_flg&MSE_STTS_PTH_POP)>>1) == (mse_flg&MSE_STTS_PTH))){ SetBoxPopHLPos(BOX_POP_MN_HL,mse_osd_x,_osd_pos_y_,_pop_main_num_h_); _mn_crnt_pos_main_ = _osd_pos_y_ - mse_osd_y; if(wndw_mn_pos_crnt != _mn_crnt_pos_main_){ wndw_mn_pos_crnt = _mn_crnt_pos_main_; RemovePopSub(); if(b_mse_stts_pth_pop == MSE_PTH_X){ // if(BitClear(mse_flg,MSE_STTS_PTH_POP)){ if(_mn_crnt_pos_main_ == POP_POS_DS){ wndw_pop_sub_num_h = 6; wndw_pop_sub_num_v = 4; CreatePopSub(_mn_crnt_pos_main_); } else if(_mn_crnt_pos_main_ == POP_POS_MTN){ wndw_pop_sub_num_h = 6; wndw_pop_sub_num_v = 3; CreatePopSub(_mn_crnt_pos_main_); } #if defined(__WTH_ADO__) else if(_mn_crnt_pos_main_ == POP_POS_ADO){ wndw_pop_sub_num_h = 6; wndw_pop_sub_num_v = 3;//4; CreatePopSub(_mn_crnt_pos_main_); } #elif defined(__WTH_VGA__) // else if(_mn_crnt_pos_main_ == POP_POS_VGA){ else if((_mn_crnt_pos_main_ == POP_POS_VGA)&&(cmn_vga_det)){ wndw_pop_sub_num_h = 11;//15; wndw_pop_sub_num_v = 4; CreatePopSub(_mn_crnt_pos_main_); } #endif else{ wndw_pop_sub_num_h = 0; wndw_pop_sub_num_v = 0; } } else{ if(_mn_crnt_pos_main_ == POP_POS_RC){ wndw_pop_sub_num_h = 6; wndw_pop_sub_num_v = 3; CreatePopSub(_mn_crnt_pos_main_); } #if defined(__WTH_ADO__) else if(_mn_crnt_pos_main_ == POP_POS_ADO){ wndw_pop_sub_num_h = 6; wndw_pop_sub_num_v = 3;//4; CreatePopSub(_mn_crnt_pos_main_); } #elif defined(__WTH_VGA__) // else if(_mn_crnt_pos_main_ == POP_POS_VGA){ else if((_mn_crnt_pos_main_ == POP_POS_VGA)&&(cmn_vga_det)){ wndw_pop_sub_num_h = 11;//15; wndw_pop_sub_num_v = 4; CreatePopSub(_mn_crnt_pos_main_); } #endif else{ wndw_pop_sub_num_h = 0; wndw_pop_sub_num_v = 0; } } } //... left button function if(b_mse_btn_dwn_lb == 1){ b_mse_btn_dwn_lb = 0; // if(BitSet(mse_flg,MSE_BTN_DWN_LB)){ // ClearBit(mse_flg,MSE_BTN_DWN_LB); } if(b_mse_clk_lb == 1){ b_mse_clk_lb = 0; // if((_mn_crnt_pos_main_ == POP_POS_MTN)||(_mn_crnt_pos_main_ == POP_POS_VGA)||(_mn_crnt_pos_main_ == POP_POS_ADO)){ if(_mn_crnt_pos_main_ == POP_POS_MTN){ } #if defined(__WTH_ADO__) else if(_mn_crnt_pos_main_ == POP_POS_ADO){ //... no operation } #endif //#if defined(__4CH__) // else if((_mn_crnt_pos_main_ == POP_POS_CH)&&(wndw_ds_sc_fmt == SC_FMT_4CH)&&(b_ds_wth_4pb)){ // //... no operation // } //#elif defined(__16CH__) // else if((_mn_crnt_pos_main_ == POP_POS_CH)&&(wndw_ds_sc_fmt == SC_FMT_16CH)&&(b_ds_wth_16pb)){ // //... no operation // } //#endif else{ // if((b_mse_stts_pth_pop == MSE_PTH_Y)&&(_mn_crnt_pos_main_ == POP_POS_MTN)){ // //... no operation // } if((_mn_crnt_pos_main_ == POP_POS_DS)&&(b_mse_stts_pth_pop == MSE_PTH_X)){ //... no operation } else if((_mn_crnt_pos_main_ == POP_POS_RC)&&(b_mse_stts_pth_pop == MSE_PTH_Y)){ //... no operation } #if defined(__WTH_VGA__) else if((_mn_crnt_pos_main_ == POP_POS_VGA)&&(cmn_vga_det)){ //... no operation } #endif else{ RemovePopMain(); b_cmn_wndw_pop = OFF; // ClearBit(cmn_flg,CMN_WNDW_POP); b_mse_stts_pth_mn = b_mse_stts_pth_pop; // if(BitClear(mse_flg,MSE_STTS_PTH_POP)) ClearBit(mse_flg,MSE_STTS_PTH_MN); // else SetBit(mse_flg,MSE_STTS_PTH_MN); if(b_mse_stts_pth_mn == MSE_PTH_X){ // if(BitClear(mse_flg,MSE_STTS_PTH_MN)){ // if(_mn_crnt_pos_main_ == POP_POS_CH) CreateWndwCh(PTH_Y); // if(_mn_crnt_pos_main_ == POP_POS_ZM) CreateWndwZm(); // else if(_mn_crnt_pos_main_ == POP_POS_MTN) CreateWndwMtn(PTH_Y); if(_mn_crnt_pos_main_ == POP_POS_RC){ b_mse_stts_pth = MSE_PTH_Y; //... change to record path WriteAsicByte(cmn_dvc,DVC_PG1,0xa0,0xbb); #if defined(__4CH__) WriteAsicByte(cmn_dvc,DVC_PG1,0xa1,0x76); //... s-video (y path) //... 060705:temporal #elif defined(__16CH__) // WriteAsicByte(cmn_dvc,DVC_PG1,0xa1,0x67); //... s-video (y path) WriteAsicByte(MASTER,DVC_PG1,0xa1,0x67); //... WriteAsicByte(SLAVE1,DVC_PG1,0xa1,0xff); //... WriteAsicByte(SLAVE2,DVC_PG1,0xa1,0xff); //... WriteAsicByte(SLAVE3,DVC_PG1,0xa1,0xff); //... #endif WriteAsicByte(cmn_dvc,DVC_PG1,0xa2,0xd7); //... cvbs (y path) WriteAsicByte(cmn_dvc,DVC_PG1,0xa3,0x10); //... 656 output SetOSDNoMn(); wndw_mn_pos_crnt = 30; } // else if(_mn_crnt_pos_main_ == POP_POS_RG) CreateWndwRg(PTH_Y); else if(_mn_crnt_pos_main_ == (POP_POS_RG+cmn_vga_det)) CreateWndwRg(PTH_Y); // else if(_mn_crnt_pos_main_ == POP_POS_ABT) ;//CreateWndwAbt(PTH_Y); // if(_mn_crnt_pos_main_ == POP_POS_RG) CreateWndwRg(PTH_X); } else{ if(_mn_crnt_pos_main_ == POP_POS_DS){ b_mse_stts_pth = MSE_PTH_X; //... change to display path WriteAsicByte(cmn_dvc,DVC_PG1,0xa0,0x66); #if defined(__4CH__) WriteAsicByte(cmn_dvc,DVC_PG1,0xa1,0x32); //... s-video (x path) //... 060705:temporal #elif defined(__16CH__) // WriteAsicByte(cmn_dvc,DVC_PG1,0xa1,0x23); //... s-video (x path) WriteAsicByte(MASTER,DVC_PG1,0xa1,0x23); //... WriteAsicByte(SLAVE1,DVC_PG1,0xa1,0xff); //... WriteAsicByte(SLAVE2,DVC_PG1,0xa1,0xff); //... WriteAsicByte(SLAVE3,DVC_PG1,0xa1,0xff); //... #endif WriteAsicByte(cmn_dvc,DVC_PG1,0xa2,0x97); //... cvbs (x path) WriteAsicByte(cmn_dvc,DVC_PG1,0xa3,0x01); //... 656 output SetOSDNoMn(); wndw_mn_pos_crnt = 30; } // else if(_mn_crnt_pos_main_ == POP_POS_RG) CreateWndwRg(PTH_Y); else if(_mn_crnt_pos_main_ == (POP_POS_RG+cmn_vga_det)) CreateWndwRg(PTH_Y); // else if(_mn_crnt_pos_main_ == POP_POS_ABT) ;//CreateWndwAbt(PTH_Y); } } } } if(b_mse_pshng_clk_lb == 1){ b_mse_pshng_clk_lb = 0; // if(BitSet(mse_flg,MSE_PSHNG_CLK_LB)){ // ClearBit(mse_flg,MSE_PSHNG_CLK_LB); } //... right button function if(b_mse_btn_dwn_rb == 1){ b_mse_btn_dwn_rb = 0; } if(b_mse_clk_rb == 1){ b_mse_clk_rb = 0; } if(b_mse_pshng_clk_rb == 1){ b_mse_pshng_clk_rb = 0; } } else if(((_osd_pos_x_ >= mse_osd_x_sub)&&(_osd_pos_x_ <= (mse_osd_x_sub+wndw_pop_sub_num_h))&& (_osd_pos_y_ >= mse_osd_y_sub)&&(_osd_pos_y_ < (mse_osd_y_sub+wndw_pop_sub_num_v)))//){ && (b_mse_stts_pth_pop == b_mse_stts_pth)){ // && (((mse_flg&MSE_STTS_PTH_POP)>>1) == (mse_flg&MSE_STTS_PTH))){ SetBoxPopHLPos(BOX_POP_SB_HL,mse_osd_x_sub,_osd_pos_y_,wndw_pop_sub_num_h); _mn_crnt_pos_sub_ = _osd_pos_y_ - mse_osd_y_sub; //... left button function if(b_mse_btn_dwn_lb == 1){ b_mse_btn_dwn_lb = 0; // if(BitSet(mse_flg,MSE_BTN_DWN_LB)){ // ClearBit(mse_flg,MSE_BTN_DWN_LB); } if(b_mse_clk_lb == 1){ b_mse_clk_lb = 0; // if(BitSet(mse_flg,MSE_CLK_LB)){ // ClearBit(mse_flg,MSE_CLK_LB); _mn_crnt_pos_main_ = wndw_mn_pos_crnt&0x0f; wndw_mn_pos_crnt |= _mn_crnt_pos_sub_<<4; RemovePopSub(); RemovePopMain(); b_cmn_wndw_pop = OFF; // ClearBit(cmn_flg,CMN_WNDW_POP); b_mse_stts_pth_mn = b_mse_stts_pth_pop; // if(BitClear(mse_flg,MSE_STTS_PTH_POP)) ClearBit(mse_flg,MSE_STTS_PTH_MN); // else SetBit(mse_flg,MSE_STTS_PTH_MN); if(b_mse_stts_pth_mn == MSE_PTH_X){ // if(BitClear(mse_flg,MSE_STTS_PTH_MN)){ // if(_mn_crnt_pos_main_ == POP_POS_SCRN_X) CreateWndwScrnX(); if(wndw_mn_pos_crnt == POP_POS_DS_SC) CreateWndwDsSc(PTH_Y); // else if(wndw_mn_pos_crnt == POP_POS_DS_PB) CreateWndwDsPb(PTH_Y); else if(wndw_mn_pos_crnt == POP_POS_DS_SR){ #if defined(__4CH__) if((wndw_ds_sc_fmt == SC_FMT_4CH)&&(b_ds_wth_4pb)){ //... no operation } #elif defined(__16CH__) if((wndw_ds_sc_fmt == SC_FMT_16CH)&&(b_ds_wth_16pb)){ //... no operation } #endif else CreateWndwDsSr(PTH_Y); } else if(wndw_mn_pos_crnt == POP_POS_DS_IN) CreateWndwDsIn(PTH_Y); else if(wndw_mn_pos_crnt == POP_POS_ZM) CreateWndwZm(); else if(wndw_mn_pos_crnt == POP_POS_MTN_MD) CreateWndwMtnMd(PTH_Y); // else if(wndw_mn_pos_crnt == POP_POS_MTN_BD) CreateWndwMtnBd(PTH_Y); // else if(wndw_mn_pos_crnt == POP_POS_MTN_ND) CreateWndwMtnNd(PTH_Y); else if(wndw_mn_pos_crnt == POP_POS_MTN_BD) CreateWndwMtnBdNd(PTH_Y); else if(wndw_mn_pos_crnt == POP_POS_MTN_ND) CreateWndwMtnBdNd(PTH_Y); #if defined(__WTH_ADO__) else if(wndw_mn_pos_crnt == POP_POS_ADO_GN) CreateWndwAdoGn(PTH_Y); else if(wndw_mn_pos_crnt == POP_POS_ADO_LV) CreateWndwAdoLv(PTH_Y); else if(wndw_mn_pos_crnt == POP_POS_ADO_RC) CreateWndwAdoRc(PTH_Y); // else if(wndw_mn_pos_crnt == POP_POS_ADO_DT) CreateWndwAdoDt(PTH_Y); #elif defined(__WTH_VGA__) if((_mn_crnt_pos_main_ == POP_POS_VGA)&&(cmn_vga_det)){ if(wndw_mn_pos_crnt == POP_POS_VGA_OR) CreateWndwVGAOr(PTH_Y); else if(wndw_mn_pos_crnt == POP_POS_VGA_DI) CreateWndwVGADi(PTH_Y); else if(wndw_mn_pos_crnt == POP_POS_VGA_IE) CreateWndwVGAIe(PTH_Y); else if(wndw_mn_pos_crnt == POP_POS_VGA_NR) CreateWndwVGANr(PTH_Y); } #endif } else{ // if(_mn_crnt_pos_main_ == POP_POS_SCRN_Y) CreateWndwScrnY(); if(wndw_mn_pos_crnt == POP_POS_RC_FM) CreateWndwRcFm(PTH_Y); else if(wndw_mn_pos_crnt == POP_POS_RC_IN) CreateWndwRcIn(PTH_Y); else if(wndw_mn_pos_crnt == POP_POS_RC_NR) CreateWndwRcNr(PTH_Y); #if defined(__WTH_ADO__) else if(wndw_mn_pos_crnt == POP_POS_ADO_GN) CreateWndwAdoGn(PTH_Y); else if(wndw_mn_pos_crnt == POP_POS_ADO_LV) CreateWndwAdoLv(PTH_Y); else if(wndw_mn_pos_crnt == POP_POS_ADO_RC) CreateWndwAdoRc(PTH_Y); // else if(wndw_mn_pos_crnt == POP_POS_ADO_DT) CreateWndwAdoDt(PTH_Y); #elif defined(__WTH_VGA__) if((_mn_crnt_pos_main_ == POP_POS_VGA)&&(cmn_vga_det)){ if(wndw_mn_pos_crnt == POP_POS_VGA_OR) CreateWndwVGAOr(PTH_Y); else if(wndw_mn_pos_crnt == POP_POS_VGA_DI) CreateWndwVGADi(PTH_Y); else if(wndw_mn_pos_crnt == POP_POS_VGA_IE) CreateWndwVGAIe(PTH_Y); else if(wndw_mn_pos_crnt == POP_POS_VGA_NR) CreateWndwVGANr(PTH_Y); } #endif } } if(b_mse_pshng_clk_lb == 1){ b_mse_pshng_clk_lb = 0; // if(BitSet(mse_flg,MSE_PSHNG_CLK_LB)){ // ClearBit(mse_flg,MSE_PSHNG_CLK_LB); } //... right button function if(b_mse_btn_dwn_rb == 1){ b_mse_btn_dwn_rb = 0; } if(b_mse_clk_rb == 1){ b_mse_clk_rb = 0; } if(b_mse_pshng_clk_rb == 1){ b_mse_pshng_clk_rb = 0; } } else{ //... left button function if(b_mse_btn_dwn_lb == 1){ b_mse_btn_dwn_lb = 0; // if(BitSet(mse_flg,MSE_BTN_DWN_LB)){ // ClearBit(mse_flg,MSE_BTN_DWN_LB); } if(b_mse_clk_lb == 1){ b_mse_clk_lb = 0; // if(BitSet(mse_flg,MSE_CLK_LB)){ // ClearBit(mse_flg,MSE_CLK_LB); RemovePopSub(); RemovePopMain(); SetOSDNoMn(); wndw_mn_pos_crnt = 30; b_cmn_wndw_pop = OFF; // ClearBit(cmn_flg,CMN_WNDW_POP); } if(b_mse_pshng_clk_lb == 1){ b_mse_pshng_clk_lb = 0; // if(BitSet(mse_flg,MSE_PSHNG_CLK_LB)){ // ClearBit(mse_flg,MSE_PSHNG_CLK_LB); } //... right button function if(b_mse_btn_dwn_rb == 1){ b_mse_btn_dwn_rb = 0; // if(BitSet(mse_flg,MSE_BTN_DWN_RB)){ // ClearBit(mse_flg,MSE_BTN_DWN_RB); } if(b_mse_clk_rb == 1){ b_mse_clk_rb = 0; // if(BitSet(mse_flg,MSE_CLK_RB)){ // ClearBit(mse_flg,MSE_CLK_RB); RemovePopSub(); CreatePopMain(); wndw_mn_pos_crnt = 30; } if(b_mse_pshng_clk_rb == 1){ b_mse_pshng_clk_rb = 0; // if(BitSet(mse_flg,MSE_PSHNG_CLK_RB)){ // ClearBit(mse_flg,MSE_PSHNG_CLK_RB); } } }
//================================================================================== void InitPg1(void) { U8 _t1_;//, _t2_=0; #if defined(__4CH__) WriteAsicTable(cmn_dvc,DVC_PG1,0x01,tbl_pg1_x_cmn,47); WriteAsicTable(cmn_dvc,DVC_PG1,0x50,tbl_pg1_y_cmn,80); if(b_cmn_jp_vdo == VDO_NTSC){ WriteAsicTable(cmn_dvc,DVC_PG1,0x30,tbl_ntsc_pg1_pic_qd,16); //... normal quad // WriteAsicTable(cmn_dvc,DVC_PG1,0x30,tbl_ntsc_pg1_pic_9_lt,16); //... non-realtime WriteAsicTable(cmn_dvc,DVC_PG1,0x40,tbl_ntsc_pg1_pic_9_rb,16); WriteAsicTable(cmn_dvc,DVC_PG1,0xa0,tbl_ntsc_pg1_enc,16); WriteAsicByte(cmn_dvc,DVC_PG1,0x00,0x00); } else{ WriteAsicTable(cmn_dvc,DVC_PG1,0x30,tbl_pal_pg1_pic_qd,16); //... normal quad // WriteAsicTable(cmn_dvc,DVC_PG1,0x30,tbl_pal_pg1_pic_9_lt,16); //... non-realtime WriteAsicTable(cmn_dvc,DVC_PG1,0x40,tbl_pal_pg1_pic_9_rb,16); WriteAsicTable(cmn_dvc,DVC_PG1,0xa0,tbl_pal_pg1_enc,16); WriteAsicByte(cmn_dvc,DVC_PG1,0x00,0x80); } #elif defined(__16CH__) U8 _dvc_, _ch_; WriteAsicTable(cmn_dvc,DVC_PG1,0x01,tbl_pg1_x_cmn,47); WriteAsicTable(cmn_dvc,DVC_PG1,0x50,tbl_pg1_y_cmn,80); if(b_cmn_jp_vdo == VDO_NTSC){ WriteAsicTable(MASTER,DVC_PG1,0x30,tbl_ntsc_pg1_pic_16_0,16); WriteAsicTable(SLAVE1,DVC_PG1,0x30,tbl_ntsc_pg1_pic_16_1,16); WriteAsicTable(SLAVE2,DVC_PG1,0x30,tbl_ntsc_pg1_pic_16_2,16); WriteAsicTable(SLAVE3,DVC_PG1,0x30,tbl_ntsc_pg1_pic_16_3,16); // WriteAsicTable(cmn_dvc,DVC_PG1,0x40,tbl_ntsc_pg1_pic_9_rb,16); // WriteAsicTable(cmn_dvc,DVC_PG1,0xa0,tbl_ntsc_pg1_enc,16); // WriteAsicByte(SLAVE1|SLAVE2|SLAVE3,DVC_PG1,0xa1,0x88); WriteAsicTable(MASTER,DVC_PG1,0xa0,tbl_ntsc_pg1_enc_mstr,16); WriteAsicTable(SLAVE1|SLAVE2|SLAVE3,DVC_PG1,0xa0,tbl_ntsc_pg1_enc_slv,16); if(cmn_rc_md == RC_MD_120_FPS){ WriteAsicByte(MASTER,DVC_PG1,0x00,0x0c); WriteAsicByte(MASTER,DVC_PG1,0x7e,0xc9); WriteAsicByte(SLAVE1,DVC_PG1,0x00,0x0d); WriteAsicByte(SLAVE1,DVC_PG1,0x7e,0xa9); WriteAsicByte(SLAVE2,DVC_PG1,0x00,0x0e); WriteAsicByte(SLAVE2,DVC_PG1,0x7e,0x89); WriteAsicByte(SLAVE3,DVC_PG1,0x00,0x3f); WriteAsicByte(SLAVE3,DVC_PG1,0x7e,0x89); } else if(cmn_rc_md == RC_MD_240_FPS){ WriteAsicByte(MASTER,DVC_PG1,0x00,0x0c); WriteAsicByte(MASTER,DVC_PG1,0x7e,0xc9); WriteAsicByte(SLAVE1,DVC_PG1,0x00,0x1d); WriteAsicByte(SLAVE1,DVC_PG1,0x7e,0xa9); WriteAsicByte(SLAVE2,DVC_PG1,0x00,0x0e); WriteAsicByte(SLAVE2,DVC_PG1,0x7e,0x89); WriteAsicByte(SLAVE3,DVC_PG1,0x00,0x3f); WriteAsicByte(SLAVE3,DVC_PG1,0x7e,0x89); } else if(cmn_rc_md == RC_MD_480_FPS){ WriteAsicByte(MASTER,DVC_PG1,0x00,0x08); WriteAsicByte(MASTER,DVC_PG1,0x7e,0xc9); WriteAsicByte(SLAVE1,DVC_PG1,0x00,0x09); WriteAsicByte(SLAVE1,DVC_PG1,0x7e,0xa9); WriteAsicByte(SLAVE2,DVC_PG1,0x00,0x0a); WriteAsicByte(SLAVE2,DVC_PG1,0x7e,0x89); WriteAsicByte(SLAVE3,DVC_PG1,0x00,0x3b); WriteAsicByte(SLAVE3,DVC_PG1,0x7e,0x89); } } else{ WriteAsicTable(MASTER,DVC_PG1,0x30,tbl_pal_pg1_pic_16_0,16); WriteAsicTable(SLAVE1,DVC_PG1,0x30,tbl_pal_pg1_pic_16_1,16); WriteAsicTable(SLAVE2,DVC_PG1,0x30,tbl_pal_pg1_pic_16_2,16); WriteAsicTable(SLAVE3,DVC_PG1,0x30,tbl_pal_pg1_pic_16_3,16); // WriteAsicTable(cmn_dvc,DVC_PG1,0x40,tbl_pal_pg1_pic_9_rb,16); // WriteAsicTable(cmn_dvc,DVC_PG1,0xa0,tbl_pal_pg1_enc,16); // WriteAsicByte(SLAVE1|SLAVE2|SLAVE3,DVC_PG1,0xa1,0x88); WriteAsicTable(MASTER,DVC_PG1,0xa0,tbl_pal_pg1_enc_mstr,16); WriteAsicTable(SLAVE1|SLAVE2|SLAVE3,DVC_PG1,0xa0,tbl_pal_pg1_enc_slv,16); if(cmn_rc_md == RC_MD_120_FPS){ WriteAsicByte(MASTER,DVC_PG1,0x00,0x8c); WriteAsicByte(MASTER,DVC_PG1,0x7e,0xc9); WriteAsicByte(SLAVE1,DVC_PG1,0x00,0x8d); WriteAsicByte(SLAVE1,DVC_PG1,0x7e,0xa9); WriteAsicByte(SLAVE2,DVC_PG1,0x00,0x8e); WriteAsicByte(SLAVE2,DVC_PG1,0x7e,0x89); WriteAsicByte(SLAVE3,DVC_PG1,0x00,0xbf); WriteAsicByte(SLAVE3,DVC_PG1,0x7e,0x89); } else if(cmn_rc_md == RC_MD_240_FPS){ WriteAsicByte(MASTER,DVC_PG1,0x00,0x8c); WriteAsicByte(MASTER,DVC_PG1,0x7e,0xc9); WriteAsicByte(SLAVE1,DVC_PG1,0x00,0x9d); WriteAsicByte(SLAVE1,DVC_PG1,0x7e,0xa9); WriteAsicByte(SLAVE2,DVC_PG1,0x00,0x8e); WriteAsicByte(SLAVE2,DVC_PG1,0x7e,0x89); WriteAsicByte(SLAVE3,DVC_PG1,0x00,0xbf); WriteAsicByte(SLAVE3,DVC_PG1,0x7e,0x89); } else if(cmn_rc_md == RC_MD_480_FPS){ WriteAsicByte(MASTER,DVC_PG1,0x00,0x88); WriteAsicByte(MASTER,DVC_PG1,0x7e,0xc9); WriteAsicByte(SLAVE1,DVC_PG1,0x00,0x89); WriteAsicByte(SLAVE1,DVC_PG1,0x7e,0xa9); WriteAsicByte(SLAVE2,DVC_PG1,0x00,0x8a); WriteAsicByte(SLAVE2,DVC_PG1,0x7e,0x89); WriteAsicByte(SLAVE3,DVC_PG1,0x00,0xbb); WriteAsicByte(SLAVE3,DVC_PG1,0x7e,0x89); } } #endif //... queue setting // for(_t1_=0;_t1_<16;_t1_++){ // //... mux queue // WriteAsicByte(cmn_dvc,DVC_PG1,0x59,_t1_); //... queue data // WriteAsicByte(cmn_dvc,DVC_PG1,0x5a,0x80|_t1_); //... queue addr // //... popup queue //// if(_t1_<13){ //// WriteAsicByte(cmn_dvc,DVC_PG1,0x73,(_t1_<<4)|(_t1_+1)); //... queue data //// WriteAsicByte(cmn_dvc,DVC_PG1,0x74,((_t1_+2)<<4)|(_t1_+3)); //... queue data //// WriteAsicByte(cmn_dvc,DVC_PG1,0x75,0x80|_t1_); //... queue addr //// } // } // WriteAsicByte(cmn_dvc,DVC_PG1,0x73,0x01); //... queue data // WriteAsicByte(cmn_dvc,DVC_PG1,0x74,0x23); //... queue data // WriteAsicByte(cmn_dvc,DVC_PG1,0x75,0x80); //... queue addr // WriteAsicByte(cmn_dvc,DVC_PG1,0x73,0x12); //... queue data // WriteAsicByte(cmn_dvc,DVC_PG1,0x74,0x30); //... queue data // WriteAsicByte(cmn_dvc,DVC_PG1,0x75,0x81); //... queue addr // WriteAsicByte(cmn_dvc,DVC_PG1,0x73,0x23); //... queue data // WriteAsicByte(cmn_dvc,DVC_PG1,0x74,0x01); //... queue data // WriteAsicByte(cmn_dvc,DVC_PG1,0x75,0x82); //... queue addr // WriteAsicByte(cmn_dvc,DVC_PG1,0x73,0x30); //... queue data // WriteAsicByte(cmn_dvc,DVC_PG1,0x74,0x12); //... queue data // WriteAsicByte(cmn_dvc,DVC_PG1,0x75,0x83); //... queue addr // // WriteAsicByte(cmn_dvc,DVC_PG1,0x56,0x40); //... start internal trigger for mux queue #if defined(__4CH__) for(_t1_=0;_t1_<4;_t1_++){ WriteAsicByte(cmn_dvc,DVC_PG1,0x59,_t1_); //... WriteAsicByte(cmn_dvc,DVC_PG1,0x5a,BIT7|_t1_); //... } #elif defined(__16CH__) // WriteAsicByte(cmn_dvc,DVC_PG1,0x84,0xc1); //... invert FLDENCP // // WriteAsicByte(SLAVE1,DVC_PG1,0x8d,0x40); //... when cascade // WriteAsicByte(SLAVE1,DVC_PG1,0x8e,0x06); //... when cascade for(_t1_=0;_t1_<16;_t1_++){ SetCrntDvcCh(_t1_,&_dvc_,&_ch_); SetAsicFlgType(_dvc_,DVC_PG1,0x16+(_ch_<<3),0x0f,_t1_); } if(cmn_rc_md == RC_MD_120_FPS){ //... mux queue WriteAsicByte(cmn_dvc,DVC_PG1,0x57,0x0f); //... for(_t1_=0;_t1_<16;_t1_++){ WriteAsicByte(SLAVE3,DVC_PG1,0x59,_t1_); //... WriteAsicByte(SLAVE3,DVC_PG1,0x5a,BIT7|_t1_); //... } //... popup queue WriteAsicByte(cmn_dvc,DVC_PG1,0x71,0x03); //... WriteAsicByte(SLAVE3,DVC_PG1,0x73,0x01); //... WriteAsicByte(SLAVE3,DVC_PG1,0x74,0x23); //... WriteAsicByte(SLAVE3,DVC_PG1,0x75,BIT7); //... WriteAsicByte(SLAVE3,DVC_PG1,0x73,0x45); //... WriteAsicByte(SLAVE3,DVC_PG1,0x74,0x67); //... WriteAsicByte(SLAVE3,DVC_PG1,0x75,BIT7|0x01); //... WriteAsicByte(SLAVE3,DVC_PG1,0x73,0x89); //... WriteAsicByte(SLAVE3,DVC_PG1,0x74,0xab); //... WriteAsicByte(SLAVE3,DVC_PG1,0x75,BIT7|0x02); //... WriteAsicByte(SLAVE3,DVC_PG1,0x73,0xcd); //... WriteAsicByte(SLAVE3,DVC_PG1,0x74,0xef); //... WriteAsicByte(SLAVE3,DVC_PG1,0x75,BIT7|0x03); //... } else if(cmn_rc_md == RC_MD_240_FPS){ //... mux queue WriteAsicByte(cmn_dvc,DVC_PG1,0x57,0x07); //... for(_t1_=0;_t1_<8;_t1_++){ WriteAsicByte(SLAVE1,DVC_PG1,0x59,_t1_); //... WriteAsicByte(SLAVE3,DVC_PG1,0x59,_t1_+8); //... WriteAsicByte(cmn_dvc,DVC_PG1,0x5a,BIT7|_t1_); //... } //... popup queue WriteAsicByte(cmn_dvc,DVC_PG1,0x71,0x01); //... WriteAsicByte(SLAVE1,DVC_PG1,0x73,0x01); //... WriteAsicByte(SLAVE1,DVC_PG1,0x74,0x23); //... WriteAsicByte(SLAVE1,DVC_PG1,0x75,BIT7); //... WriteAsicByte(SLAVE1,DVC_PG1,0x73,0x45); //... WriteAsicByte(SLAVE1,DVC_PG1,0x74,0x67); //... WriteAsicByte(SLAVE1,DVC_PG1,0x75,BIT7|0x01); //... WriteAsicByte(SLAVE3,DVC_PG1,0x73,0x89); //... WriteAsicByte(SLAVE3,DVC_PG1,0x74,0xab); //... WriteAsicByte(SLAVE3,DVC_PG1,0x75,BIT7); //... WriteAsicByte(SLAVE3,DVC_PG1,0x73,0xcd); //... WriteAsicByte(SLAVE3,DVC_PG1,0x74,0xef); //... WriteAsicByte(SLAVE3,DVC_PG1,0x75,BIT7|0x01); //... } else{//if(cmn_rc_md == RC_MD_120_FPS){ //... mux queue WriteAsicByte(cmn_dvc,DVC_PG1,0x57,0x03); //... for(_t1_=0;_t1_<4;_t1_++){ WriteAsicByte(MASTER,DVC_PG1,0x59,_t1_); //... WriteAsicByte(SLAVE1,DVC_PG1,0x59,_t1_+4); //... WriteAsicByte(SLAVE2,DVC_PG1,0x59,_t1_+8); //... WriteAsicByte(SLAVE3,DVC_PG1,0x59,_t1_+12); //... WriteAsicByte(cmn_dvc,DVC_PG1,0x5a,BIT7|_t1_); //... } //... popup queue WriteAsicByte(cmn_dvc,DVC_PG1,0x71,0x00); //... WriteAsicByte(MASTER,DVC_PG1,0x73,0x01); //... WriteAsicByte(MASTER,DVC_PG1,0x74,0x23); //... WriteAsicByte(SLAVE1,DVC_PG1,0x73,0x45); //... WriteAsicByte(SLAVE1,DVC_PG1,0x74,0x67); //... WriteAsicByte(SLAVE2,DVC_PG1,0x73,0x89); //... WriteAsicByte(SLAVE2,DVC_PG1,0x74,0xab); //... WriteAsicByte(SLAVE3,DVC_PG1,0x73,0xcd); //... WriteAsicByte(SLAVE3,DVC_PG1,0x74,0xef); //... WriteAsicByte(cmn_dvc,DVC_PG1,0x75,BIT7); //... } // for(_t1_=0;_t1_<16;_t1_++){ // SetCrntDvcCh(_t1_,&_dvc_,&_ch_); // if(!(_t1_&0x03)){ // SetAsicFlgType(_dvc_,DVC_PG1,0x54,0x60,0x00); //... STRB_FLD=0 // SetAsicFlgType(_dvc_,DVC_PG1,0x57,BIT7,0x00); //... STRB_AUTO=0 // SetAsicFlgType(_dvc_,DVC_PG1,0x71,BIT5,0x00); //... POPUP_FLD=0 // } // WriteAsicByte(_dvc_,DVC_PG1,0x60+3*_ch_,0x80|_ch_); //... FUNC_MODE=0 // } WaitCmnFldOd(); WriteAsicByte(cmn_dvc,DVC_PG1,0x70,0xc0); //... POS_CTL_EN=1, POS_TRIG_MODE=1 #endif }
int tw2865_improve(unsigned char IIC) { /*for sharpness*/ WriteAsicByte(IIC, 0x03, 0x3f); WriteAsicByte(IIC, 0x13, 0x3f); WriteAsicByte(IIC, 0x23, 0x3f); WriteAsicByte(IIC, 0x33, 0x3f); /*for hue*/ WriteAsicByte(IIC, 0x06, 0xfb); WriteAsicByte(IIC, 0x16, 0xfb); WriteAsicByte(IIC, 0x26, 0xfb); WriteAsicByte(IIC, 0x36, 0xfb); /*for contrast*/ WriteAsicByte(IIC, 0x02, 0x7a); WriteAsicByte(IIC, 0x12, 0x7a); WriteAsicByte(IIC, 0x22, 0x7a); WriteAsicByte(IIC, 0x32, 0x7a); /*for vertical peaking level*/ WriteAsicByte(IIC, 0xAF, 0x33); WriteAsicByte(IIC, 0xB0, 0x33); return 0; }
int tw2865Init(unsigned char sysmode) { if (tw2865_fd < 0) { tw2865_fd = open(TW2865_DEVICE, O_RDWR); if (tw2865_fd < 0) { perror("open " TW2865_DEVICE " FAIL: "); return -1; } } #if defined(SN2116LE) || defined(SN2116LS) || defined(SN2116LP) || defined(SN2116HE) || defined(SN2116HS) || defined(SN2116HP) //|| defined(SN6116HE) WriteAsicByte(TW2865_0_WRITE,0xe0,0x14);//音频输出: Audio Out: Mixed tw2865_master_ain5_cfg(0);//关闭第5路对讲音频 tw2865_master_pb_cfg(0); //关闭回放音频 tw2865_ain_cfg(TW2865_0, 0x00);//关闭第一片TW2865音频预览 tw2865_ain_cfg(TW2865_1, 0x00);//关闭第二片TW2865音频预览 tw2865_ain_cfg(TW2865_2, 0x00);//关闭第三片TW2865音频预览 tw2865_ain_cfg(TW2865_3, 0x00);//关闭第四片TW2865音频预览 tw2865_improve(TW2865_0); tw2865_improve(TW2865_1); tw2865_improve(TW2865_2); tw2865_improve(TW2865_3); #elif defined(SN2016) || defined(SN2016HS) || defined(SN2016HE) || defined(SN2116V2) || defined(SN2016V2) || defined(SN6000) || defined(SN2008LE) || defined(SN8600) int i; unsigned char sharp = 0x0a; unsigned char opmode = 0x38; unsigned char Dec_count = 0x03; unsigned char Vpll_data = 0x06; unsigned char Max_fieled = 0x60; unsigned char Min_dur = 0x08; /* 0x60: Operation Mode Control - Force TVP5157 TV mode New V-Bit control algorithm (number of active lines per frame is constant as total LPF varies */ /* 0x19: Luminance Processing Control 2 - picture sharpness */ /* 0x88: F and V bits decoded from line count */ /* 0x89: V-PLL fast-lock disabled and windowed VSYNC pipe disabled */ /* 0x8B: Maximum field duration set to 788 for NTSC and 938 for PAL */ /* 0xD5: Minimum duration from F-bit falling edge to active video */ #if (DEV_TYPE == DEV_SN_9234_H4_1) { //int ret; unsigned char chip = TLV320AIC3104; //unsigned char reg; TRACE(SCI_TRACE_NORMAL, MOD_DRV, " TLV320AIC3104 CLCK init\n"); /*soft reset*/ WriteAsicByte(chip,0x1,0x80); usleep(50); /*CLKDIV_IN uses MCLK*/ WriteAsicByte(chip, 102, 0xc2);// #if 0 /*PLL enable MCLK = 54MHZ*/ WriteAsicByte(chip, 3, 0x85);/* new P=5 old P=2*/ WriteAsicByte(chip, 4, 0x24);/* old J=2 new J=9 第一第二位没用为0*/ WriteAsicByte(chip, 5, 0x0f);/*old 0x2c new 0x1f*/ WriteAsicByte(chip, 6, 0xf8);/* reg 5 and 6 set D=2818 newf8 D=1022 */ WriteAsicByte(chip, 11, 0x1);/* R=1 */ #else /*PLL enable MCLK = 66MHZ*/ WriteAsicByte(chip,102,0xC2);//PLLCLK_IN uses MCLK WriteAsicByte(chip, 3, 0x85);/* P=5 */ WriteAsicByte(chip, 4, 0x1C);/* J=7 */ //WriteAsicByte(chip, 5, 0x2A);/* D=2727=0xAA7*/ //WriteAsicByte(chip, 6, 0x9C);/* */ WriteAsicByte(chip, 5, 0x45);/* D=4473=0x1179*/ WriteAsicByte(chip, 6, 0xE4);/* */ WriteAsicByte(chip, 11, 0x1);/* R=1 */ #endif /*left and right DAC open*/ WriteAsicByte(chip, 7, 0xa);/* FSref = 48 kHz */ /*sample*/ WriteAsicByte(chip, 2, 0xaa);/* FS = FSref/6 */ /*ctrl mode*/ WriteAsicByte(chip, 8, 0xf0);/* master mode */ /*Audio Serial Data Interface Control*/ WriteAsicByte(chip, 9, 0xf);/* old I2S mode,16bit new 0xf */ /*Audio Codec Digital Filter Control Register*/ WriteAsicByte(chip, 12, 0x50); WriteAsicByte(chip, 25, 0x0); WriteAsicByte(chip, 17, 0xf); WriteAsicByte(chip, 18, 0xf0); WriteAsicByte(chip, 15, 0x0); WriteAsicByte(chip, 16, 0x0); WriteAsicByte(chip, 19, 0x7c); WriteAsicByte(chip, 22, 0x7c); WriteAsicByte(chip, 28, 0x0); WriteAsicByte(chip, 31, 0x0); /*out ac-coupled*/ WriteAsicByte(chip, 14, 0x80); /*left and right DAC power on*/ WriteAsicByte(chip, 37, 0x80); //new 0x80 old 0xc0 /*old:0xc0 new:0x80*/ /*out common-mode voltage*/ WriteAsicByte(chip, 40, 0x80); /*out path select*/ // WriteAsicByte(chip, 41, 0x1); WriteAsicByte(chip, 41, 0x40); /*old:0x1 new:0x40, Left-DAC output selects DAC_L3 path to left line output driver*/ /*out path select*/ WriteAsicByte(chip, 42, 0xa8); /*left DAC not muted*/ WriteAsicByte(chip, 43, 0x0); /*right DAC not muted*/ WriteAsicByte(chip, 44, 0x0); WriteAsicByte(chip, 47, 0x80); /*HPLOUT is not muted*/ WriteAsicByte(chip, 51, 0x9f); WriteAsicByte(chip, 64, 0x80); /*HPROUT is not muted*/ WriteAsicByte(chip, 65, 0x9f); /*out short circuit protection*/ // WriteAsicByte(chip, 38, 0x3e); WriteAsicByte(chip, 86, 0x09);//LEFT_LOP/M Output Level Control Register } #endif for (i=0;i<4;i++) { __tw2865_write_reg(TW2865_0, i, 0x60, opmode); __tw2865_write_reg(TW2865_0, i, 0x19, sharp); __tw2865_write_reg(TW2865_0, i, 0x88, Dec_count); __tw2865_write_reg(TW2865_0, i, 0x89, Vpll_data); __tw2865_write_reg(TW2865_0, i, 0x8b, Max_fieled); __tw2865_write_reg(TW2865_0, i, 0xd5, Min_dur); #ifdef SN2008LE __tw2865_read_reg(TW2865_0, i, 0xC4); __tw2865_write_reg(TW2865_0, i, 0xC4, 0x02); #endif } for (i=0;i<4;i++) { __tw2865_write_reg(TW2865_1, i, 0x60, opmode); __tw2865_write_reg(TW2865_1, i, 0x19, sharp); __tw2865_write_reg(TW2865_1, i, 0x88, Dec_count); __tw2865_write_reg(TW2865_1, i, 0x89, Vpll_data); __tw2865_write_reg(TW2865_1, i, 0x8b, Max_fieled); __tw2865_write_reg(TW2865_1, i, 0xd5, Min_dur); #ifdef SN2008LE __tw2865_write_reg(TW2865_1, i, 0xC8, 0x01); __tw2865_write_reg(TW2865_1, i, 0xc5, 0x0f); __tw2865_read_reg(TW2865_1, i, 0xC8); __tw2865_read_reg(TW2865_1, i, 0xC5); __tw2865_read_reg(TW2865_1, i, 0xC3); __tw2865_read_reg(TW2865_1, i, 0xC3); __tw2865_read_reg(TW2865_1, i, 0xC4); __tw2865_write_reg(TW2865_1, i, 0xC4, 0x02); #endif } for (i=0;i<4;i++) { __tw2865_write_reg(TW2865_2, i, 0x60, opmode); __tw2865_write_reg(TW2865_2, i, 0x19, sharp); __tw2865_write_reg(TW2865_2, i, 0x88, Dec_count); __tw2865_write_reg(TW2865_2, i, 0x89, Vpll_data); __tw2865_write_reg(TW2865_2, i, 0x8b, Max_fieled); __tw2865_write_reg(TW2865_2, i, 0xd5, Min_dur); } for (i=0;i<4;i++) { __tw2865_write_reg(TW2865_3, i, 0x60, opmode); __tw2865_write_reg(TW2865_3, i, 0x19, sharp); __tw2865_write_reg(TW2865_3, i, 0x88, Dec_count); __tw2865_write_reg(TW2865_3, i, 0x89, Vpll_data); __tw2865_write_reg(TW2865_3, i, 0x8b, Max_fieled); __tw2865_write_reg(TW2865_3, i, 0xd5, Min_dur); } #else #error "Unknown DEV_TYPE!" #endif return 0; }
/*音频回放开关控制.*/ int tw2865_master_pb_cfg(char flag) { #if defined(SN6104) || defined(SN8604D) || defined(SN8604M) ||defined(SN2008LE) int ret; unsigned int reg; unsigned char chip = TLV320AIC3104; unsigned char addr = CODEC_MUTE_ADDR;/*Page 0/Register 43: Left-DAC Digital Volume Control Register*/ TRACE(SCI_TRACE_NORMAL, MOD_DRV, "tw2865_master_pb_cfg ALC5627: chip = %d\n",chip); ret = tw2865_read_reg3(chip,addr,®); if (0 == flag) //off { ret = tw2865_write_reg3(chip,addr,reg|REG_OFFSET);//set reg[7] to 1: off } else //on { ret = tw2865_write_reg3(chip,addr,reg&(~REG_OFFSET));//set reg[7] to 0: on } #elif defined(Hi3520) int ret; unsigned char reg; unsigned char chip = TLV320AIC3104; unsigned char addr = CODEC_MUTE_ADDR;/*Page 0/Register 43: Left-DAC Digital Volume Control Register*/ TRACE(SCI_TRACE_NORMAL, MOD_DRV, "tw2865_master_pb_cfg TLV320AIC3104: chip = %d\n",chip); ret = ReadAsicByte(chip,addr,®); if (0 == flag) //off { ret = WriteAsicByte(chip,addr,reg|REG_OFFSET);//set reg[7] to 1: off } else //on { ret = WriteAsicByte(chip,addr,reg&(~REG_OFFSET));//set reg[7] to 0: on } #elif defined(Hi3531) int ret; unsigned char reg; unsigned char chip = TLV320AIC3104; unsigned char addr = CODEC_MUTE_ADDR;/*Page 0/Register 43: Left-DAC Digital Volume Control Register*/ TRACE(SCI_TRACE_NORMAL, MOD_DRV, "tw2865_master_pb_cfg TLV320AIC3104: chip = %d\n",chip); ret = ReadAsicByte(chip,addr,®); if (0 == flag) //off { ret = WriteAsicByte(chip,addr,reg&(~REG_OFFSET));//set reg[3] to 0: off } else //on { ret = WriteAsicByte(chip,addr,reg|REG_OFFSET);//set reg[7] to 1: on } #elif defined(Hi3535) int ret; unsigned int value = 0; if(flag == 0) { ret = testmod_reg_rw(0, 0x20680000, 0x2000, &value); if(ret == 0) { value |= 0x3<<16; ret = testmod_reg_rw(1, 0x20680000, 0x2000, &value); } ret = testmod_reg_rw(0, 0x20680000, 0x2100, &value); if(ret == 0) { value |= 0x3<<16; ret = testmod_reg_rw(1, 0x20680000, 0x2100, &value); } } else { ret = testmod_reg_rw(0, 0x20680000, 0x2000, &value); if(ret == 0) { value &= ~(0x3<<16); ret = testmod_reg_rw(1, 0x20680000, 0x2000, &value); } ret = testmod_reg_rw(0, 0x20680000, 0x2100, &value); if(ret == 0) { value &= ~(0x3<<16); ret = testmod_reg_rw(1, 0x20680000, 0x2100, &value); } } #endif return 0; }
/*音频预览通道控制.reg 0xc5 [0~3]-ain1~4,[4~7]-reserved mask[0~3]: 0-on, 1-mute*/ int tw2865_ain_cfg(unsigned int chip, unsigned char mask) { unsigned char addr = 0xc5; return WriteAsicByte(chip, addr, 0x0f & ~mask); }