Пример #1
0
Файл: box.c Проект: zonesan/ucos
//==================================================================================
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));
}
Пример #2
0
int tw2865_master_tk_pb_switch(char flag)
{
	int ret;
	unsigned char reg;

	ret = ReadAsicByte(TW2865_0,0xdb,&reg);
	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;
}
Пример #3
0
//输入制式检测
//pInput_mode 0-NTSC,1-PAL
int	GetVideoInputInfo(unsigned char ch,unsigned char *pInput_mode)
{
	int sadd=0,ret =-1;
	unsigned char tmp=-1;
	unsigned char	reg[4] ={0x00,0x10,0x20,0x30};
	if (NULL == pInput_mode)
	{
		return -1;
	}
	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 = ReadAsicByte(sadd,reg[ch],&tmp);
	if(ret  == -1)
	{
		return ret ;
	}
	tmp = tmp &0x01;/*0 = 60Hz source detected (NTSC), 1 = 50Hz source detected (PAL)*/
	*pInput_mode = tmp;
	return 0;
}
Пример #4
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,&reg);
	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,&reg);
	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,&reg);
	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;
}