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

📄 tm6000.c

📁 该代码介绍了天敏电视盒ut340的核心芯片tm6000在linux下的驱动代码
💻 C
📖 第 1 页 / 共 5 页
字号:
	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x25c2, 0x00, data, 0x8);	kfree(data);	ret = tm6000_snd_control_msg(tm6000_dev, 0x03, 0x0101, 0x01, 0x0, 0x0);	ret = tm6000_snd_control_msg(tm6000_dev, 0x03, 0x0101, 0x00, 0x0, 0x0);	data = kzalloc(0x1*sizeof(__u8), GFP_KERNEL);	data[0]=0x33;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x26c2, 0x00, data, 0x1);	kfree(data);	ret = tm6000_snd_control_msg(tm6000_dev, 0x03, 0x0101, 0x01, 0x0, 0x0);	ret = tm6000_snd_control_msg(tm6000_dev, 0x03, 0x0101, 0x00, 0x0, 0x0);	data = kzalloc(0x1*sizeof(__u8), GFP_KERNEL);	data[0]=0x06;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x29c2, 0x00, data, 0x1);	kfree(data);	ret = tm6000_snd_control_msg(tm6000_dev, 0x03, 0x0101, 0x01, 0x0, 0x0);	ret = tm6000_snd_control_msg(tm6000_dev, 0x03, 0x0101, 0x00, 0x0, 0x0);	data = kzalloc(0x1*sizeof(__u8), GFP_KERNEL);	data[0]=0x8c;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0xc2, 0x00, data, 0x1);	kfree(data);	ret = tm6000_snd_control_msg(tm6000_dev, 0x03, 0x0101, 0x01, 0x0, 0x0);	ret = tm6000_snd_control_msg(tm6000_dev, 0x03, 0x0101, 0x00, 0x0, 0x0);	data = kzalloc(0x3*sizeof(__u8), GFP_KERNEL);	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0xc2, 0x00, data, 0x3);	kfree(data);	ret = tm6000_snd_control_msg(tm6000_dev, 0x03, 0x0101, 0x01, 0x0, 0x0);	ret = tm6000_snd_control_msg(tm6000_dev, 0x03, 0x0101, 0x00, 0x0, 0x0);// 	data = kzalloc(3*sizeof(__u8), GFP_KERNEL);// 	data[0] = 0x2; // 	data[1] = 0x0;// 	data[2] = 0x0;// 	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x80c2, 0x00, data, 0x3);// 	kfree(data);// // 	ret = tm6000_snd_control_msg(tm6000_dev, 0x03, 0x0101, 0x01, 0x0, 0x0);// 	ret = tm6000_snd_control_msg(tm6000_dev, 0x03, 0x0101, 0x00, 0x0, 0x0);// // 	data = kzalloc(3*sizeof(__u8), GFP_KERNEL);// 	data[0] = 0x00; // 	data[1] = 0x2f;// 	data[2] = 0x50;// 	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x00c2, 0x00, data, 0x3);// 	kfree(data);	data = kzalloc(3*sizeof(__u8), GFP_KERNEL);	data[0] = 0x2; 	data[1] = 0x0;	data[2] = 0x0;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x00c2, 0x00, data, 0x3);	kfree(data);	ret = tm6000_snd_control_msg(tm6000_dev, 0x03, 0x0101, 0x01, 0x0, 0x0);	ret = tm6000_snd_control_msg(tm6000_dev, 0x03, 0x0101, 0x00, 0x0, 0x0);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x0b;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x501e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x80;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x551e, 0x00, data, 0x1);	kfree(data);	udelay(100);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x01;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0xea1e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x00;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0xea1e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x1c;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x561e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x40;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x5e1e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x35;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x641e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x5a;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x651e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0xe9;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x661e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x19;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6c1e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0xe9;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6d1e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x44;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x511e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x46;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x521e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x15;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x531e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x0f;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x541e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x86;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x5c1e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x01;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x701e, 0x00, data, 0x1);	kfree(data);	udelay(100);/*	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x00;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x701e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x35;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x641e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x5a;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x651e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0xe9;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x661e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x19;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6c1e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0xe9;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6d1e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x44;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x511e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x46;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x521e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x15;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x531e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x0f;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x541e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x86;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x5c1e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x01;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x701e, 0x00, data, 0x1);	kfree(data);*/// in the UK/*	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x0b;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x501e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x80;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x551e, 0x00, data, 0x1);	kfree(data);	udelay(100);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x01;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0xea1e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x00;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0xea1e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x1c;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x561e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x40;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x5e1e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x36;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x641e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x67;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x651e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0xe5;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x661e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x19;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6c1e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0xe9;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6d1e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x44;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x511e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x46;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x521e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x15;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x531e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x0f;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x541e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x75;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x5c1e, 0x00, data, 0x1);	kfree(data);	data = kzalloc(1*sizeof(__u8), GFP_KERNEL);	data[0] = 0x01;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x701e, 0x00, data, 0x1);	kfree(data);	udelay(100);*/	switch(p->u.ofdm.bandwidth) {		case BANDWIDTH_8_MHZ:			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0x00;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x701e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0x36;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x641e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0x67;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x651e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0xe5;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x661e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0x19;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6c1e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0xe9;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6d1e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0x44;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x511e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0x46;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x521e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0x15;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x531e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0x0f;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x541e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0x75;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x5c1e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0x01;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x701e, 0x00, data, 0x1);			kfree(data);		break;		default:			printk(KERN_ALERT "tm6000: bandwidth not supported\n");		case BANDWIDTH_7_MHZ:			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0x00;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x701e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0x35;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x641e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0x5a;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x651e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0xe9;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x661e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0x19;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6c1e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0xe9;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6d1e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0x44;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x511e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0x46;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x521e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0x15;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x531e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0x0f;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x541e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0x86;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x5c1e, 0x00, data, 0x1);			kfree(data);			data = kzalloc(1*sizeof(__u8), GFP_KERNEL);			data[0] = 0x01;			ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x701e, 0x00, data, 0x1);			kfree(data);		break;	}		data = kzalloc(3*sizeof(__u8), GFP_KERNEL);	data[0] = 0x2; 	data[1] = 0x0;	data[2] = 0x0;	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x80c2, 0x00, data, 0x3);	kfree(data);	ret = tm6000_snd_control_msg(tm6000_dev, 0x03, 0x0101, 0x01, 0x0, 0x0);	ret = tm6000_snd_control_msg(tm6000_dev, 0x03, 0x0101, 0x00, 0x0, 0x0);	data = kzalloc(3*sizeof(__u8), GFP_KERNEL);// 			frequency=(unsigned long long)f->frequency*1000/16*1000-2750000;//	frequencyToSet = (((p->frequency - (p->u.ofdm.bandwidth == BANDWIDTH_7_MHZ ?  2250000 : 2500000)) / 1000) * 64) / 1000;// 	value=(frequency+(TUNING_GRANULARITY/2))/TUNING_GRANULARITY;//	frequencyToSet = (((p->frequency - (p->u.ofdm.bandwidth == BANDWIDTH_7_MHZ ?  2250000 : 2750000))/16 + (TUNING_GRANULARITY/2) ) / TUNING_GRANULARITY ) * 16;	frequencyToSet = (p->frequency - (p->u.ofdm.bandwidth == BANDWIDTH_7_MHZ ?  2250000 : 2500000))  / TUNING_GRANULARITY;printk(KERN_ALERT "setting frequency %x\n", frequencyToSet);	data[0] = 0x00;	data[1] = (frequencyToSet & 0xff00) >> 8;	data[2] = frequencyToSet & 0xff;printk(KERN_ALERT "setting frequency %x %x\n", data[1], data[2]);	ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x00c2, 0x00, data, 0x3);	kfree(data);	ret = tm6000_snd_control_msg(tm6000_dev, 0x03, 0x0101, 0x01, 0x0, 0x0);	ret = tm6000_snd_control_msg(tm6000_dev, 0x03, 0x0101, 0x00, 0x0, 0x0);	return 0;};static int tm6000_set_frontend(struct dvb_frontend *fe,				  struct dvb_frontend_parameters *p){	struct tm6000_device *tm6000_dev = fe->dvb->priv;	u32 status;	if(p != NULL) {		mutex_lock(&tm6000_dev->mutex);		tm6000_zl10353_pll(tm6000_dev, p);		mutex_unlock(&tm6000_dev->mutex);	}	tm6000_dev->dvb_frontend->ops.read_status(tm6000_dev->dvb_frontend, &status);	printk(KERN_ALERT "demodulator status: FE_HAS_CARRIER %i \n", (status & FE_HAS_CARRIER));	printk(KERN_ALERT "demodulator status: FE_HAS_VITERBI %i \n", (status & FE_HAS_VITERBI));	printk(KERN_ALERT "demodulator status: FE_HAS_LOCK %i \n", (status & FE_HAS_LOCK));	printk(KERN_ALERT "demodulator status: FE_HAS_SYNC %i \n", (status & FE_HAS_SYNC));	printk(KERN_ALERT "demodulator status: FE_HAS_SIGNAL %i \n", (status & FE_HAS_SIGNAL));	return 0;}static int zl10353_read_status(struct dvb_frontend *fe, fe_status_t *status){//	struct zl10353_state *state = fe->demodulator_priv;	int s6, s7, s8;/*	if ((s6 = zl10353_read_register(state, STATUS_6)) < 0)		return -EREMOTEIO;

⌨️ 快捷键说明

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