⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch.c

📁 一个比较好用的TW2835音视频芯片开发板的程序,
💻 C
📖 第 1 页 / 共 2 页
字号:
				_picvb_ = cmn_bot>>1;
			}
		}
		WriteAsicByte(_dvc,DVC_PG1,0x6c,_rdat_);
	}
}
//==================================================================================
//==================================================================================
void	SetPicRto(U8 _pth, U8 _dvc, U8 _ch, U8 _pichl, U8 _picvt, U8 _rto_x, U8 _rto_y)
{
	SetPicPos(_pth,_dvc,_ch,_pichl,_picvt);
	SetPicSzRto(_pth,_dvc,_ch,_rto_x,_rto_y);
}
//==================================================================================
void	SetChFl(U8 _pth, U8 _dvc, U8 _ch)
{
		SetSclRto(_pth,_dvc,_ch,0x11,0x11);
	SetPicRto(_pth,_dvc,_ch,0,0,0x11,0x11);
}
//==================================================================================
void	SetChQdPos(U8 _pth, U8 _dvc, U8 _ch, U8 _cnt_pos)
{
	U8 _pichl, _picvt;

	if(_cnt_pos == 0){
		_pichl = 0;	_picvt = 0;
	}
	else if(_cnt_pos == 1){
		_pichl = 90;	_picvt = 0;
	}
	else if(_cnt_pos == 2){
		_pichl = 0;	_picvt = cmn_bot>>1;
	}
	else if(_cnt_pos == 3){
		_pichl = 90;	_picvt = cmn_bot>>1;
	}
	else if(_cnt_pos == 4){
		_pichl = 45;	_picvt = cmn_bot>>2;
	}
	
//		SetSclRto(_pth,_dvc,_ch,0x12,0x12);
	SetPicRto(_pth,_dvc,_ch,_pichl,_picvt,0x12,0x12);
}
//==================================================================================
void	SetChQd(U8 _pth, U8 _dvc, U8 _ch, U8 _cnt_pos)
{
//	U8 _pichl, _picvt;
//
//	if(_cnt_pos == 0){
//		_pichl = 0;	_picvt = 0;
//	}
//	else if(_cnt_pos == 1){
//		_pichl = 90;	_picvt = 0;
//	}
//	else if(_cnt_pos == 2){
//		_pichl = 0;	_picvt = cmn_bot>>1;
//	}
//	else if(_cnt_pos == 3){
//		_pichl = 90;	_picvt = cmn_bot>>1;
//	}
//	else if(_cnt_pos == 4){
//		_pichl = 45;	_picvt = cmn_bot>>2;
//	}
	
		SetSclRto(_pth,_dvc,_ch,0x12,0x12);
//	SetPicRto(_pth,_dvc,_ch,_pichl,_picvt,0x12,0x12);
	SetChQdPos(_pth,_dvc,_ch,_cnt_pos);
}
//==================================================================================
void	SetChNinePos(U8 _pth, U8 _dvc, U8 _ch, U8 _cnt_pos)
{
	U8 _pichl, _picvt;

//	_pichl = (_cnt_pos%3)*60;
//	_picvt = (_cnt_pos/3)*(cmn_bot/3);
	_pichl = (_cnt_pos&0x03)*60;
	if(b_cmn_jp_vdo == VDO_NTSC)	_picvt = (_cnt_pos/3)*40;
	else	_picvt = (_cnt_pos/3)*48;
//		SetSclRto(_pth,_dvc,_ch,0x13,0x13);
	SetPicRto(_pth,_dvc,_ch,_pichl,_picvt,0x13,0x13);
}
//==================================================================================
void	SetChNine(U8 _pth, U8 _dvc, U8 _ch, U8 _cnt_pos)
{
//	U8 _pichl, _picvt;
//
//	_pichl = (_cnt_pos%3)*60;
//	_picvt = (_cnt_pos/3)*(cmn_bot/3);
	
		SetSclRto(_pth,_dvc,_ch,0x13,0x13);
//	SetPicRto(_pth,_dvc,_ch,_pichl,_picvt,0x13,0x13);
	SetChNinePos(_pth,_dvc,_ch,_cnt_pos);
}
//==================================================================================
#if defined(__16CH__)
void	SetChPIP(U8 _pth, U8 _dvc, U8 _ch, U8 _cnt_pos)
{
	U8 _pichl, _picvt;

	_pichl = (_cnt_pos&0x03)*45;
	_picvt = (_cnt_pos>>2)*(cmn_bot>>2);
	
		SetSclRto(_pth,_dvc,_ch,0x14,0x14);
	SetPicRto(_pth,_dvc,_ch,_pichl,_picvt,0x14,0x14);
}
//==================================================================================
void	SetCh36Pos(U8 _pth, U8 _dvc, U8 _ch, U8 _cnt_pos)
{
	U8 _pichl, _picvt;

	_pichl = (_cnt_pos%6)*30;
//	_picvt = (_cnt_pos/6)*(cmn_bot/6);
	if(b_cmn_jp_vdo == VDO_NTSC)	_picvt = (_cnt_pos/6)*20;
	else	_picvt = (_cnt_pos/6)*24;												//... _picvt = (_cnt_pos/6)*(144/6) = _cnt_pos*4;

	SetPicRto(_pth,_dvc,_ch,_pichl,_picvt,0x16,0x16);
}
//==================================================================================
void	SetCh36(U8 _pth, U8 _dvc, U8 _ch, U8 _cnt_pos)
{
	
		SetSclRto(_pth,_dvc,_ch,0x16,0x16);
	SetCh36Pos(_pth,_dvc,_ch,_cnt_pos);
}
#endif
//==================================================================================
//void	SetChCIF(U8 _pth, U8 _dvc, U8 _ch, U8 _cnt_pos)
//{
////	U8 _pichl;
//
//	if(_cnt_pos == 0){
//		SetPicRto(_pth,_dvc,_ch,0,0,0x12,0x12);
//	}
//	else if(_cnt_pos == 1){
//		SetPicRto(_pth,_dvc,_ch,90,0,0x12,0x12);
//	}
//	else if(_cnt_pos == 2){
//		SetPicRto(_pth,_dvc,_ch,0,cmn_bot>>1,0x12,0x12);
//	}
//	else if(_cnt_pos == 3){
//		SetPicRto(_pth,_dvc,_ch,90,cmn_bot>>1,0x12,0x12);
//	}
//
//		SetSclRto(_pth,_dvc,_ch,0x12,0x11);
////	SetPicRto(_pth,_dvc,_ch,_pichl,0,0x12,0x11);
//}
//==================================================================================
/*
void	SetChDVR(U8 _pth, U8 _dvc, U8 _ch, U8 _pos_count)
{
	U8 _picvt;

	if(_pos_count == 0)	_picvt = 0;
	else if(_pos_count == 1)	_picvt = cmn_bot>>1;
	
		SetSclRto(_pth,_dvc,_ch,0x11,0x12);
	SetPicRto(_pth,_dvc,_ch,0,_picvt,0x11,0x12);
}
//==================================================================================
void	SetCh1213(U8 _pth, U8 _dvc, U8 _ch, U8 _cnt_pos)
{
	U8 _pichl, _picvt;

	_pichl = (_cnt_pos&0x01)*90;
	_picvt = (_cnt_pos>>1)*(cmn_bot/3);
	
//		SetSclRto(_pth,_dvc,_ch,0x12,0x13);
	SetPicRto(_pth,_dvc,_ch,_pichl,_picvt,0x12,0x13);
}
//	*/
//==================================================================================
void	WaitChStrbDoneX(U16 _flg_ch)
{
	U16 _dly_;
	U16 _t1_;
	U8 _t2_, _t3_;
	U8 _dvc_, _ch_;
	
	for(_dly_=0;_dly_<30000;_dly_++){											//... check finishing strobe for max 30000 times
		_t1_=0;
//		_t1_ |= GetAsicFlgType(MASTER,DVC_PG1,0x04,_flg_ch);
//#if	defined(__16CH__)
//		_t1_ |= GetAsicFlgType(SLAVE1,DVC_PG1,0x04,_flg_ch);
//		_t1_ |= GetAsicFlgType(SLAVE2,DVC_PG1,0x04,_flg_ch);
//		_t1_ |= GetAsicFlgType(SLAVE3,DVC_PG1,0x04,_flg_ch);
//#endif
		for(_t2_=0;_t2_<cmn_max_ch;_t2_++){
			if(_flg_ch&(BIT0<<_t2_)){
				SetCrntDvcCh(_t2_,&_dvc_,&_ch_);
				_t3_ = GetAsicFlgType(_dvc_,DVC_PG1,0x04,BIT0<<_ch_);
				_t1_ |= _t3_<<(_t2_&0x0c);
			}
		}
		if(!_t1_)	break;
	}
}
//==================================================================================
void	WaitChStrbDoneY(U16 _flg_ch)
{
	U16 _dly_;
	U16 _t1_;
	U8 _t2_, _t3_;
	U8 _dvc_, _ch_;
	
	for(_dly_=0;_dly_<30000;_dly_++){											//... check finishing strobe for max 30000 times
		_t1_=0;
//		_t1_ |= GetAsicFlgType(MASTER,DVC_PG1,0x54,_flg_ch);
//#if	defined(__16CH__)
//		_t1_ |= GetAsicFlgType(SLAVE1,DVC_PG1,0x54,_flg_ch);
//		_t1_ |= GetAsicFlgType(SLAVE2,DVC_PG1,0x54,_flg_ch);
//		_t1_ |= GetAsicFlgType(SLAVE3,DVC_PG1,0x54,_flg_ch);
//#endif
		for(_t2_=0;_t2_<cmn_max_ch;_t2_++){
			if(_flg_ch&(BIT0<<_t2_)){
				SetCrntDvcCh(_t2_,&_dvc_,&_ch_);
				_t3_ = GetAsicFlgType(_dvc_,DVC_PG1,0x54,BIT0<<_ch_);
				_t1_ |= _t3_<<(_t2_&0x0c);
			}
		}
		if(!_t1_)	break;
	}
}
//==================================================================================
//*
void InitChScaleAdapt(U8 _dvc, U8 _ch)
{
	U16 _wt1_ = 65536/cmn_bot;
	U8 _hl_, _hr_, _vt_, _vb_;
	U8 _t1_;

	_hl_ = ReadAsicByte(_dvc,DVC_PG1,0x30+(_ch<<2));
	_hr_ = ReadAsicByte(_dvc,DVC_PG1,0x31+(_ch<<2));
	_vt_ = ReadAsicByte(_dvc,DVC_PG1,0x32+(_ch<<2));
	_vb_ = ReadAsicByte(_dvc,DVC_PG1,0x33+(_ch<<2));
//#if	defined(__4CH__)
//	if(b_jp_4pb == OFF){
//#endif
//		if(GetAsicFlgType(_dvc,DVC_PG0,0x38,BIT0<<_ch)){				//... when enable pb
		if(GetAsicFlgType(_dvc,DVC_PG1,0x10+(_ch<<3),BIT2)){				//... when enable pb
//			if(wndw_ds_pb_inpt == PB_INPT_REC){
//				if(b_rc_fm_type == FM_TYPE_CIF){
				if((wndw_rc_fm_type == CIF_TYPE_FR)||(wndw_rc_fm_type == CIF_TYPE_FL)){
					if((_hr_-_hl_) > 90){													//... max h size
						_hr_ = _hl_ + 90;
						WriteAsicByte(_dvc,DVC_PG1,0x31+(_ch<<2),_hr_);
					}
					_hr_ = (_hr_-_hl_)<<1;
					
					if((_vb_-_vt_) > (cmn_bot>>1)){									//... max v size
						_vb_ = _vt_ + (cmn_bot>>1);
						WriteAsicByte(_dvc,DVC_PG1,0x33+(_ch<<2),_vb_);
					}
					_vb_ = (_vb_-_vt_)<<1;
					
//					if(wndw_rc_fm_cif_type == CIF_TYPE_FR){
					if(wndw_rc_fm_type == CIF_TYPE_FR){
						//... update:050707 Rev2.0
#if	defined(__4CH__)
						_t1_ = 0x00;
#elif	defined(__16CH__)
						if(_vb_ <= (cmn_bot>>1)){										//... if(realsize <= pip size)
							_vb_ <<= 1;
							_t1_ = BIT5;
						}
						else	_t1_ = 0x00;
#endif
						SetAsicFlgType(_dvc,DVC_PG1,0x12+(_ch<<3),BIT5,_t1_);
					}
					else{
						SetAsicFlgType(_dvc,DVC_PG1,0x12+(_ch<<3),BIT5,BIT5);
					}
				}
				else{																	//... update (date:050401 Rev1.2)
					_hr_ = _hr_-_hl_;
					_vb_ = _vb_-_vt_;
					//... update:050706 Rev2.0
					if(_vb_ > (cmn_bot>>1))	SetAsicFlgType(_dvc,DVC_PG1,0x12+(_ch<<3),BIT5,0x00);
					else{
						_vb_ <<= 1;
						SetAsicFlgType(_dvc,DVC_PG1,0x12+(_ch<<3),BIT5,BIT5);
					}
				}
//			}
//			else if(wndw_ds_pb_inpt == PB_INPT_MUX){							//... update (date:050401 Rev1.2)
//				_hr_ = _hr_-_hl_;
//				_vb_ = _vb_-_vt_;
//				//... update:050706 Rev2.0
//				if(_vb_ > (cmn_bot>>1))	SetAsicFlgType(_dvc,DVC_PG1,0x12+(_ch<<3),BIT5,0x00);
//				else{
//					_vb_ <<= 1;
//					SetAsicFlgType(_dvc,DVC_PG1,0x12+(_ch<<3),BIT5,BIT5);
//				}
//			}
//			else{
//				if((_hr_-_hl_) > 90){													//... max h size
//					_hr_ = _hl_ + 90;
//					WriteAsicByte(_dvc,DVC_PG1,0x31+(_ch<<2),_hr_);
//				}
//				_hr_ = (_hr_-_hl_)<<1;
//				
//				if((_vb_-_vt_) > (cmn_bot>>1)){									//... max v size
//					_vb_ = _vt_ + (cmn_bot>>1);
//					WriteAsicByte(_dvc,DVC_PG1,0x33+(_ch<<2),_vb_);
//				}
//				_vb_ = (_vb_-_vt_)<<1;
//				
//				if(wndw_rc_fm_cif_type == CIF_TYPE_FR){
//						//... update:050707 Rev2.0
//#if	defined(__4CH__)
//					_t1_ = 0x00;
//#elif	defined(__16CH__)
//					if(_vb_ <= (cmn_bot>>1)){										//... if(realsize <= pip size)
//						_vb_ <<= 1;
//						_t1_ = BIT5;
//					}
//					else	_t1_ = 0x00;
//#endif
//					SetAsicFlgType(_dvc,DVC_PG1,0x12+(_ch<<3),BIT5,_t1_);
//				}
//				else{
//					SetAsicFlgType(_dvc,DVC_PG1,0x12+(_ch<<3),BIT5,BIT5);
//				}
//			}
			SetSclH(PTH_PB,_dvc,_ch,_hr_*0x016c);	// 0x016c(65536/180=364.09)
			SetSclV(PTH_PB,_dvc,_ch,_vb_*_wt1_);
		}
		else{
			SetAsicFlgType(_dvc,DVC_PG1,0x12+(_ch<<3),BIT5,0x00);
			_hr_ = _hr_-_hl_;
			_vb_ = _vb_-_vt_;

			SetSclH(PTH_X,_dvc,_ch,_hr_*0x016c);	// 0x016c(65536/180=364.09)
			SetSclV(PTH_X,_dvc,_ch,_vb_*_wt1_);
		}
////#if	defined(__4CH__)
////	}
////	else{
////		SetAsicFlgType(_dvc,DVC_PG1,0x12+(_ch<<3),BIT5,0x00);
////		_hr_ = _hr_-_hl_;
////		_vb_ = _vb_-_vt_;
////	}
////#endif
//	SetSclH(PTH_X,_dvc,_ch,_hr_*0x016c);	// 0x016c(65536/180=364.09)
//	SetSclV(PTH_X,_dvc,_ch,_vb_*_wt1_);
//
////	if(GetAsicFlgType(_dvc,DVC_PG1,0x12+(_ch<<3),BIT5))
////		SetAsicFlgType(_dvc,DVC_PG0,0x15+0x40*_ch,BIT5,BIT5);				// set 2 for V_ALIAS_X(page0) when FIELD_OP(page1) == 1.
}
//	*/
//==================================================================================

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -