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

📄 osd.c

📁 TECHWELL 之tw2835 四画面合一之驱动代码,CCIR656输出,KEIL C51 平台编译,
💻 C
📖 第 1 页 / 共 3 页
字号:
				WriteAsicByteOSD(_dvc,0x05,_pos_x+(_num_h_>>1));
	//			WriteAsicByteOSD(_dvc,0x06,_pos_x+_num_h_);
				
				WriteAsicByteOSD(_dvc,0x07,(_pos_y+(_num_v_>>1))&0xff);
	//			WriteAsicByteOSD(_dvc,0x08,(_pos_y+_num_v_)&0xff);
	//			WriteAsicByteOSD(_dvc,0x09,0x0a|((((_pos_y+_num_v_)>>8)<<2)+((_pos_y+_num_v_)>>8)));
				WriteAsicByteOSD(_dvc,0x09,0x0a|(((_pos_y+(_num_v_>>1))>>8)<<2));
	
//				WriteAsicByteOSD(_dvc,0x0a,0xe0);					//... y path
				WriteAsicByteOSD(_dvc,0x0a,0xa0);					//... y path
				while(ReadAsicOSDMemWr(_dvc)&BIT7);								//... wait finishing write for even field
			}
		}
	}

#if	defined(__EN_ISR__)
//	EA = 1;
#endif
}
//==================================================================================
//==================================================================================
//void WriteOSDBmp(U8 _pth, U8 _dvc, U8 _pos_x, U16 _pos_y, U8 _prp, U8 _indx)
//{
//	if(BitSet(_pth,PTH_X))	WriteOSDBmpX(_dvc,_pos_x,_pos_y,_prp,_indx);
//	if(BitSet(_pth,PTH_Y))	WriteOSDBmpY(_dvc,_pos_x,_pos_y,_prp,_indx);
//}
//==================================================================================
void WriteOSDFntX(U8 _dvc, U8 _pos_x, U16 _pos_y, U8 _prp, U8 _indx)	//... only one _pth at once
{
	U8 _wdat_;
//	U8 _ta1_[4];
	U8 _t1_;//, _t2_;
	U8 _num_h_, _num_v_;//, num_ofst;
	U16 _ofst_indx_, _ofst_v_;
//	U8 _pos_x_, _pos_y_;
//	U8 _prp_, _indx_;
	
#if	defined(__EN_ISR__)
//	EA = 0;
#endif

//	rINTMSK = 0xffffffff;
	
	
	
	
//	_pos_x_ = (_pos>>16)<<2;												//... (_pos>>16)*4 -> 4 pixel * 4 -> 16 pixel char
////	if(_pos_x_ > 175)	_pos_x_ = 175;
//	_pos_y_ = ((_pos&0xffff)<<1)+((_pos&0xffff)<<3);				//... (_pos&0xffff)*(2+8)
////	if(_pos_y_ > ((cmn_bot<<1)-11))	_pos_y_ = (cmn_bot<<1)-11;
	_pos_x <<= 2;														//... (_pos_x)*4 -> 4 pixel * 4 -> 16 pixel char
	_pos_y = (_pos_y<<1)+(_pos_y<<3);							//... (_pos_y)*(2+8)

//	_prp_ = _prp_indx>>16;
//	_indx_ = _prp_indx&0xffff;

//	_ofst_indx_ = (((4*10)*8) * (_indx/8)) + ((_indx%8)*4);
	_ofst_indx_ = (320 * (_indx>>3)) + ((_indx&0x07)<<2);

	WriteAsicByteOSD(_dvc,0x06,0x00);
	WriteAsicByteOSD(_dvc,0x08,0x00);

	for(_num_v_=0;_num_v_<10;_num_v_++){
		_ofst_v_ = _num_v_<<5;	// _num_v_ * 32;	// 
		
		for(_num_h_=0;_num_h_<4;_num_h_++){

			_wdat_ = tbl_osd_16x20_odd[_ofst_indx_+_ofst_v_+_num_h_];
//			_wdat_ = tbl_osd_tmp_odd[_ofst_indx_+_ofst_v_+_num_h_];

			_t1_ = (_wdat_&0xc0)>>6;
			if(!_t1_)	_t1_ = 0xff;
			WriteAsicByteOSD(_dvc,0x00,_prp|_t1_);					//... 1st pixel
			_t1_ = (_wdat_&0x30)>>4;
			if(!_t1_)	_t1_ = 0xff;
			WriteAsicByteOSD(_dvc,0x01,_prp|_t1_);					//... 2nd pixel
			_t1_ = (_wdat_&0xc)>>2;
			if(!_t1_)	_t1_ = 0xff;
			WriteAsicByteOSD(_dvc,0x02,_prp|_t1_);					//... 3rd pixel
			_t1_ = _wdat_&0x3;
			if(!_t1_)	_t1_ = 0xff;
			WriteAsicByteOSD(_dvc,0x03,_prp|_t1_);					//... 4th pixel
//			_ta1_[0] = (_wdat_&0xc0)>>6;
//			_ta1_[1] = (_wdat_&0x30)>>4;
//			_ta1_[2] = (_wdat_&0xc)>>2;
//			_ta1_[3] = _wdat_&0x3;
//			if(b_cmn_wndw_mn == ON){
//				if(!_ta1_[0])	_ta1_[0] = OSD_MIX|OSD_COL_BLU;
//				if(!_ta1_[1])	_ta1_[1] = OSD_MIX|OSD_COL_BLU;
//				if(!_ta1_[2])	_ta1_[2] = OSD_MIX|OSD_COL_BLU;
//				if(!_ta1_[3])	_ta1_[3] = OSD_MIX|OSD_COL_BLU;
//			}
//			else{
//				if(!_ta1_[0])	_ta1_[0] = 0xff;
//				if(!_ta1_[1])	_ta1_[1] = 0xff;
//				if(!_ta1_[2])	_ta1_[2] = 0xff;
//				if(!_ta1_[3])	_ta1_[3] = 0xff;
//			}
//			WriteAsicByteOSD(_dvc,0x00,_prp|_ta1_[0]);					//... 1st pixel
//			WriteAsicByteOSD(_dvc,0x01,_prp|_ta1_[1]);					//... 2nd pixel
//			WriteAsicByteOSD(_dvc,0x02,_prp|_ta1_[2]);					//... 3rd pixel
//			WriteAsicByteOSD(_dvc,0x03,_prp|_ta1_[3]);					//... 4th pixel


	//... acceleration 阑 荤侩且 版快 buffer write 苞沥 积帆啊瓷.
			WriteAsicByteOSD(_dvc,0x04,0x80);					//... write to buffer
			
			WriteAsicByteOSD(_dvc,0x05,_pos_x+_num_h_);
//			WriteAsicByteOSD(_dvc,0x06,_pos_x+_num_h_);
			
			WriteAsicByteOSD(_dvc,0x07,(_pos_y+_num_v_)&0xff);
//			WriteAsicByteOSD(_dvc,0x08,(_pos_y+_num_v_)&0xff);
//			WriteAsicByteOSD(_dvc,0x09,(((_pos_y+_num_v_)>>8)<<2)+((_pos_y+_num_v_)>>8));
			WriteAsicByteOSD(_dvc,0x09,((_pos_y+_num_v_)>>8)<<2);			//... start: OSD_POS_V_ODD, end: OSD_POS_V_ODD

//			WriteAsicByteOSD(_dvc,0x0a,0xc0);					//... x path
			WriteAsicByteOSD(_dvc,0x0a,0x80);					//... x path
			while(ReadAsicOSDMemWr(_dvc)&BIT7);								//... wait finishing write for odd field


//			_wdat_ = tbl_osd_16x20_even[_ofst_indx_+_ofst_v_+_num_h_];
////			_wdat_ = tbl_osd_tmp_even[_ofst_indx_+_ofst_v_+_num_h_];
//			
//			_t1_ = (_wdat_&0xc0)>>6;
//			if(!_t1_)	_t1_ = 0xff;
//			WriteAsicByteOSD(_dvc,0x00,_prp|_t1_);					//... 1st pixel
//			_t1_ = (_wdat_&0x30)>>4;
//			if(!_t1_)	_t1_ = 0xff;
//			WriteAsicByteOSD(_dvc,0x01,_prp|_t1_);					//... 2nd pixel
//			_t1_ = (_wdat_&0xc)>>2;
//			if(!_t1_)	_t1_ = 0xff;
//			WriteAsicByteOSD(_dvc,0x02,_prp|_t1_);					//... 3rd pixel
//			_t1_ = _wdat_&0x3;
//			if(!_t1_)	_t1_ = 0xff;
//			WriteAsicByteOSD(_dvc,0x03,_prp|_t1_);					//... 4th pixel
//			
//	//... acceleration 阑 荤侩且 版快 buffer write 苞沥 积帆啊瓷.
//			WriteAsicByteOSD(_dvc,0x04,0x80);					//... write to buffer
//			
//			WriteAsicByteOSD(_dvc,0x05,_pos_x+_num_h_);
////			WriteAsicByteOSD(_dvc,0x06,_pos_x+_num_h_);
//			
//			WriteAsicByteOSD(_dvc,0x07,(_pos_y+_num_v_)&0xff);
////			WriteAsicByteOSD(_dvc,0x08,(_pos_y+_num_v_)&0xff);
////			WriteAsicByteOSD(_dvc,0x09,0x0a|((((_pos_y+_num_v_)>>8)<<2)+((_pos_y+_num_v_)>>8)));
//			WriteAsicByteOSD(_dvc,0x09,0x0a|(((_pos_y+_num_v_)>>8)<<2));	//... start: OSD_POS_V_EVEN, end: OSD_POS_V_EVEN
//
////			WriteAsicByteOSD(_dvc,0x0a,0xc0);					//... x path
//			WriteAsicByteOSD(_dvc,0x0a,0x80);					//... x path
//			while(ReadAsicOSDMemWr(_dvc)&BIT7);								//... wait finishing write for even field
		}
	}

#if	defined(__EN_ISR__)
//	EA = 1;
#endif





//	rINTMSK &= ~(BIT_EINT4_7|BIT_EINT8_23);								//... disable mask bit EINT8_23
}
//==================================================================================
void WriteOSDFntY(U8 _dvc, U8 _pos_x, U16 _pos_y, U8 _prp, U8 _indx)	//... only one _pth at once
{
	U8 _wdat_;
	U8 _t1_;//, _t2_;
	U8 _num_h_, _num_v_;//, num_ofst;
	U16 _ofst_indx_, _ofst_v_;
//	U8 _pos_x_, _pos_y_;
//	U8 _prp_, _indx_;
	
#if	defined(__EN_ISR__)
//	EA = 0;
#endif

//	rINTMSK = 0xffffffff;
	
	
	
	
//	_pos_x_ = (_pos>>16)<<1;												//... (_pos>>16)*2 -> 8 pixel * 2 -> 16 pixel char
////	if(_pos_x_ > 175)	_pos_x_ = 175;
//	_pos_y_ = ((_pos&0xffff)<<1)+((_pos&0xffff)<<3);				//... (_pos&0xffff)*(2+8)
////	if(_pos_y_ > ((cmn_bot<<1)-11))	_pos_y_ = (cmn_bot<<1)-11;
	_pos_x <<= 1;														//... (_pos_x)*2 -> 8 pixel * 2 -> 16 pixel char
	_pos_y = (_pos_y<<1)+(_pos_y<<3);							//... (_pos_y)*(2+8)

	_prp |= _prp>>4;
//	_indx_ = _prp_indx&0xffff;

//	_ofst_indx_ = (((4*10)*8) * (_indx/8)) + ((_indx%8)*4);
	_ofst_indx_ = (320 * (_indx>>3)) + ((_indx&0x07)<<2);

	WriteAsicByteOSD(_dvc,0x06,0x00);
	WriteAsicByteOSD(_dvc,0x08,0x00);

	for(_num_v_=0;_num_v_<10;_num_v_++){
		_ofst_v_ = _num_v_<<5;	// _num_v_ * 32;	// 
		
		for(_num_h_=0;_num_h_<4;_num_h_+=2){

			_wdat_ = tbl_osd_16x20_odd[_ofst_indx_+_ofst_v_+_num_h_];

			_t1_ = ((_wdat_&0xc0)>>2)+((_wdat_&0x30)>>4);
			if(!(_t1_&0x30))	_t1_ |= 0xf0;
			if(!(_t1_&0x03))	_t1_ |= 0x0f;
			WriteAsicByteOSD(_dvc,0x00,_prp|_t1_);					//... 1st, 2nd pixel
			_t1_ = ((_wdat_&0x0c)<<2)+(_wdat_&0x03);
			if(!(_t1_&0x30))	_t1_ |= 0xf0;
			if(!(_t1_&0x03))	_t1_ |= 0x0f;
			WriteAsicByteOSD(_dvc,0x01,_prp|_t1_);					//... 3rd, 4th pixel

			_wdat_ = tbl_osd_16x20_odd[_ofst_indx_+_ofst_v_+_num_h_+1];

			_t1_ = ((_wdat_&0xc0)>>2)+((_wdat_&0x30)>>4);
			if(!(_t1_&0x30))	_t1_ |= 0xf0;
			if(!(_t1_&0x03))	_t1_ |= 0x0f;
			WriteAsicByteOSD(_dvc,0x02,_prp|_t1_);					//... 5th, 6th pixel
			_t1_ = ((_wdat_&0x0c)<<2)+(_wdat_&0x03);
			if(!(_t1_&0x30))	_t1_ |= 0xf0;
			if(!(_t1_&0x03))	_t1_ |= 0x0f;
			WriteAsicByteOSD(_dvc,0x03,_prp|_t1_);					//... 7th, 8th pixel
			
	//... acceleration 阑 荤侩且 版快 buffer write 苞沥 积帆啊瓷.
			WriteAsicByteOSD(_dvc,0x04,0x80);					//... write to buffer
			
			WriteAsicByteOSD(_dvc,0x05,_pos_x+(_num_h_>>1));
//			WriteAsicByteOSD(_dvc,0x06,_pos_x+_num_h_);
			
			WriteAsicByteOSD(_dvc,0x07,(_pos_y+_num_v_)&0xff);
//			WriteAsicByteOSD(_dvc,0x08,(_pos_y+_num_v_)&0xff);
//			WriteAsicByteOSD(_dvc,0x09,(((_pos_y+_num_v_)>>8)<<2)+((_pos_y+_num_v_)>>8));
			WriteAsicByteOSD(_dvc,0x09,((_pos_y+_num_v_)>>8)<<2);			//... start: OSD_POS_V_ODD, end: OSD_POS_V_ODD

//			WriteAsicByteOSD(_dvc,0x0a,0xe0);					//... y path
			WriteAsicByteOSD(_dvc,0x0a,0xa0);					//... y path
			while(ReadAsicOSDMemWr(_dvc)&BIT7);								//... wait finishing write for odd field


			_wdat_ = tbl_osd_16x20_even[_ofst_indx_+_ofst_v_+_num_h_];

			_t1_ = ((_wdat_&0xc0)>>2)+((_wdat_&0x30)>>4);
			if(!(_t1_&0x30))	_t1_ |= 0xf0;
			if(!(_t1_&0x03))	_t1_ |= 0x0f;
			WriteAsicByteOSD(_dvc,0x00,_prp|_t1_);					//... 1st, 2nd pixel
			_t1_ = ((_wdat_&0x0c)<<2)+(_wdat_&0x03);
			if(!(_t1_&0x30))	_t1_ |= 0xf0;
			if(!(_t1_&0x03))	_t1_ |= 0x0f;
			WriteAsicByteOSD(_dvc,0x01,_prp|_t1_);					//... 3rd, 4th pixel

			_wdat_ = tbl_osd_16x20_even[_ofst_indx_+_ofst_v_+_num_h_+1];

			_t1_ = ((_wdat_&0xc0)>>2)+((_wdat_&0x30)>>4);
			if(!(_t1_&0x30))	_t1_ |= 0xf0;
			if(!(_t1_&0x03))	_t1_ |= 0x0f;
			WriteAsicByteOSD(_dvc,0x02,_prp|_t1_);					//... 5th, 6th pixel
			_t1_ = ((_wdat_&0x0c)<<2)+(_wdat_&0x03);
			if(!(_t1_&0x30))	_t1_ |= 0xf0;
			if(!(_t1_&0x03))	_t1_ |= 0x0f;
			WriteAsicByteOSD(_dvc,0x03,_prp|_t1_);					//... 7th, 8th pixel
			
	//... acceleration 阑 荤侩且 版快 buffer write 苞沥 积帆啊瓷.
			WriteAsicByteOSD(_dvc,0x04,0x80);					//... write to buffer
			
			WriteAsicByteOSD(_dvc,0x05,_pos_x+(_num_h_>>1));
//			WriteAsicByteOSD(_dvc,0x06,_pos_x+_num_h_);
			
			WriteAsicByteOSD(_dvc,0x07,(_pos_y+_num_v_)&0xff);
//			WriteAsicByteOSD(_dvc,0x08,(_pos_y+_num_v_)&0xff);
//			WriteAsicByteOSD(_dvc,0x09,0x0a|((((_pos_y+_num_v_)>>8)<<2)+((_pos_y+_num_v_)>>8)));
			WriteAsicByteOSD(_dvc,0x09,0x0a|(((_pos_y+_num_v_)>>8)<<2));	//... start: OSD_POS_V_EVEN, end: OSD_POS_V_EVEN

//			WriteAsicByteOSD(_dvc,0x0a,0xe0);					//... y path
			WriteAsicByteOSD(_dvc,0x0a,0xa0);					//... y path
			while(ReadAsicOSDMemWr(_dvc)&BIT7);								//... wait finishing write for even field
		}
	}

#if	defined(__EN_ISR__)
//	EA = 1;
#endif





//	rINTMSK &= ~(BIT_EINT4_7|BIT_EINT8_23);								//... disable mask bit EINT8_23
}
//==================================================================================
void WriteOSDFnt(U8 _pth, U8 _dvc, U8 _pos_x, U16 _pos_y, U8 _prp, U8 _indx)
{
	if(BitSet(_pth,PTH_X))	WriteOSDFntX(_dvc,_pos_x,_pos_y,_prp,_indx);
	if(BitSet(_pth,PTH_Y))	WriteOSDFntY(_dvc,_pos_x,_pos_y,_prp,_indx);
}
//==================================================================================
void WriteOSDStrX(U8 _dvc, U8 _pos_x, U8 _pos_y, U8 _prp, U8 code *_str_ptr)
{
	U8 _lngth_ = GetCodeLength(_str_ptr);
	U8 _indx_;
	U8 _t1_;
	
	for(_t1_=0;_t1_<_lngth_;_t1_++){
		_indx_ = _str_ptr[_t1_]-0x20;				//... expand U8 to U8, but not sign bit(MSB of 8bit)
		WriteOSDFntX(_dvc,_pos_x+_t1_,_pos_y,_prp,_indx_);
	}
}
//==================================================================================
void WriteOSDStrY(U8 _dvc, U8 _pos_x, U8 _pos_y, U8 _prp, U8 code *_str_ptr)
{
	U8 _lngth_ = GetCodeLength(_str_ptr);
	U8 _indx_;
	U8 _t1_;
	
	for(_t1_=0;_t1_<_lngth_;_t1_++){
		_indx_ = _str_ptr[_t1_]-0x20;				//... expand U8 to U8, but not sign bit(MSB of 8bit)
		WriteOSDFntY(_dvc,_pos_x+_t1_,_pos_y,_prp,_indx_);
	}
}
//==================================================================================
void WriteOSDStr(U8 _pth, U8 _dvc, U8 _pos_x, U8 _pos_y, U8 _prp, U8 code *_str_ptr)
{
	if(BitSet(_pth,PTH_X))	WriteOSDStrX(_dvc,_pos_x,_pos_y,_prp,_str_ptr);
	if(BitSet(_pth,PTH_Y))	WriteOSDStrY(_dvc,_pos_x,_pos_y,_prp,_str_ptr);
}
//==================================================================================
void WriteOSDClrX(U8 _dvc, U8 _pos_x, U16 _pos_y, U8 _wdth, U16 _hght)	//... only one _pth at once
{

⌨️ 快捷键说明

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