void nmi_memcpy(void *pu8Des, void *pu8Src, uint32_t len)
{
	nmi_tuner_os_memcpy(pu8Des,pu8Src,len);
	/*
	uint32_t i=0;
	uint8_t* tmpDes = pu8Des;
	uint8_t* tmpSrc = pu8Src;
	for(i=0;i<len;i++)
	{
		tmpDes[i] = tmpSrc[i];
	}
	*/
}
Esempio n. 2
0
uint8_t Nmi_Tuner_Interface_Tuning(tNMI_TUNE_PARAM* param)
{
	uint8_t ret;

	if(!nmi_tuner_os_get_mutex(&gChipNowInfo.mutex))
	{
		nmi_tuner_os_log("Obtain NMI Mutex failed\n");
		return FALSE;
	}
	
	gChipNowInfo.bdemodlock = FALSE;
	ret = Nmi_Tuner_Interface_SelfTune(param);
	gChipNowInfo.btuned = TRUE;
	nmi_tuner_os_memcpy((void*)&gChipNowInfo.orgparam,param,sizeof(tNMI_TUNE_PARAM));

	nmi_tuner_os_release_mutex(&gChipNowInfo.mutex);
	
	return ret;
}
uint8_t MDrv_NMI120_Tuner_SetTuner(uint32_t dwFreq, uint8_t ucBw,uint8_t type)//MHZ
{
	tNMI_TUNE_PARAM param;
	uint8_t ret = FALSE;

	nmi_tuner_os_memset((void *)&param, 0x00, sizeof(tNMI_TUNE_PARAM));

	param.freq = dwFreq;//hz
	param.if_freq = 5000000;
	param.dacsel =  nDac2;
	param.if_freq_invert = FALSE;
	param.freq_invert = FALSE;
	param.ucBw = ucBw;
	param.output = nIf;
	param.freq_invert = FALSE;
	param.tvstd       = type;	//NMI_DVBT;

	if(param.tvstd == NMI_DVBT || param.tvstd == NMI_DVBT2)
		nmi_tuner_os_memcpy((void*)&param.poll_param,&SwrfliArg,sizeof(tNmiSwrfliArg));
	if(param.tvstd == NMI_DVBT2)
	{
		param.scan_aci[0] = 0x07;//6mhz
		param.scan_aci[1] = 0x0a;//7mhz
		param.scan_aci[2] = 0x04;//8mhz
		
		param.play_aci[0] = 0x07;//6mhz
		param.play_aci[1] = 0x0a;//7mhz
		param.play_aci[2] = 0x04;//8mhz
	}	
	else if(param.tvstd == NMI_DVBT || param.tvstd == NMI_DVBC)
	{
		param.scan_aci[0] = 0x07;//6mhz
		param.scan_aci[1] = 0x0a;//7mhz
		param.scan_aci[2] = 0x04;//8mhz
		
		param.play_aci[0] = 0x07;//6mhz
		param.play_aci[1] = 0x0a;//7mhz
		param.play_aci[2] = 0x04;//8mhz
	}	
	else
	{
		param.scan_aci[0] = 0x01;//6mhz
		param.scan_aci[1] = 0x03;//7mhz
		param.scan_aci[2] = 0x05;//8mhz
		
		param.play_aci[0] = 0x01;//6mhz
		param.play_aci[1] = 0x03;//7mhz
		param.play_aci[2] = 0x05;//8mhz
	}
	nmi_tuner_os_log("tune: rf=%d, if=%d, bw=%d, tvstd=%d\n", param.freq, param.if_freq, param.ucBw, param.tvstd);
	ret = Nmi_Tuner_Interface_Tuning(&param);

	Nmi_Tuner_Interface_Wreg(0x35,0x18);//0x18 ~ 0x10, 0x5f~ 0x50
	Nmi_Tuner_Interface_Wreg(0x164,0x400);

	if((param.freq >666000000-1500000) &&(param.freq <666000000+1500000))
	{
		Nmi_Tuner_Interface_Wreg(0x05,0x5);
	}

	return ret;

}
Esempio n. 4
0
static uint8_t Nmi_Tuner_Interface_SelfTune(tNMI_TUNE_PARAM* param)
{
	uint8_t ret = TRUE;
	tTnrTune tune;

	nmi_tuner_os_memset((void *)&tune, 0x00, sizeof(tTnrTune));
	tune.aif = param->aif;
	tune.dacSel = param->dacsel;
	tune.is_stereo = param->is_stereo;
	tune.output = param->output;
	tune.rf = param->freq;
	tune.vif = param->if_freq;
	tune.rfinvert = param->freq_invert;
		
	switch(param->tvstd)
	{
		case NMI_NTSC: 
			{
			    //add codes	
				tune.std = nNTSC;
			}
			break;
		case NMI_PAL_G: 
			{
			    //add codes	
			}
			break;
		case NMI_PAL_M: 
			{
			    //add codes	
			}
			break;
		case NMI_PAL_N: 
			{
			    //add codes	
			}
			break;
		case NMI_PAL_K: 
			{
			    //add codes	
			}
			break;
		case NMI_PAL_L: 
			{
			    //add codes	
			}
			break;
		case NMI_PAL_D: 
			{
			    //add codes	
			}
			break;
		case NMI_SECAM_L: 
			{
			    //add codes	
			}
			break;
		case NMI_SECAM_B: 
			{
			    //add codes	
			}
			break;
		case NMI_SECAM_D: 
			{
			    //add codes	
			}
			break;
		case NMI_ATSC_8VSB: 
		case NMI_ATSC_64QAM: 
		case NMI_ATSC_256QAM: 
			{
			    //add codes
				nmi_tuner_os_log("mode NMI_ATSC %d\n",param->ucBw);
			    	switch(param->ucBw)
				{
					case 0:
					case 6: tune.std = nDTV_6; break;
					case 1:
					case 7: tune.std = nDTV_7; break;
					case 2:
					case 8:
					default:
					tune.std = nDTV_8; break;
				}
			}
			break;
		case NMI_DVBT: 
		case NMI_DVBT2: 
			{
			    //add codes	
				switch(param->ucBw)
				{
					case 0:
					case 6: tune.std = nDTV_6; break;
					case 1:
					case 7: tune.std = nDTV_7; break;
					case 2:
					case 8:
					default:
					tune.std = nDTV_8; break;
				}
			}
			break;
		case NMI_DVBC:
			{
				//add codes	
				uint32_t tempfreq;
				tempfreq = tune.rf/1000000;
				if(tempfreq%3 != 0)
				{
					tune.rf = tune.rf + 1000;
				}

				switch(param->ucBw)
				{
					case 0:
					case 6: tune.std = nDTV_6; break;
					case 1:
					case 7: tune.std = nDTV_7; break;
					case 2:
					case 8:
					default:
					tune.std = nDTV_8; break;
				}
			}
			break;
		case NMI_DTMB: 
			{
			    //add codes	
				switch(param->ucBw)
				{
					case 0:
					case 6: tune.std = nDTV_6; break;
					case 1:
					case 7: tune.std = nDTV_7; break;
					case 2:
					case 8:
					default:
					tune.std = nDTV_8; break;
				}
			}
			break;
		case NMI_ISDBT: 
			{
			    //add codes	
			}
			break;
		default: 
			{
			    //add codes	
			}
			break;
	}

	if(param->tvstd <= NMI_SECAM_D &&( param->output == nCvbsSif || param->output == nCvbsBBAud))
	{
		if(nmi_drv_ctl(NMI_DRV_TUNE, &tune) == 0)
		{
			nmi_tuner_os_log("\n tuneFail......\n");
			ret =  FALSE;
		}
	}
      else
      	{
      		if(nmi_drv_ctl(NMI_DRV_TUNE, &tune) < 0)
		{
			nmi_tuner_os_log("\n tuneFail......\n");
			ret = FALSE;
		}
			
		if(param->if_freq_invert == TRUE)
		{
			int spectrum = 1;
			nmi_drv_ctl(NMI_DRV_INVERT_SPECTRUM, (void *)(&spectrum));
			nmi_tuner_os_log("\n swan if invert \n");
		}
      	}
	if(param->tvstd == NMI_DVBC)//yao jin  masic bugs  //swan 2012_5_14  honestar
	{
		uint32_t tempfreq;
		tempfreq = tune.rf/1000000;
		if(tempfreq%3 == 0)
		{
			Nmi_Tuner_Interface_Wreg(0x1b,0x08);
		}
		else
		{
			Nmi_Tuner_Interface_Wreg(0x1b,0x0e);
		}
		if(tempfreq<726)
		{
			if(tempfreq == 602 || tempfreq ==650  || tempfreq ==690  || tempfreq ==698 || tempfreq ==706)
			{
				Nmi_Tuner_Interface_Wreg(0x05,0x85);
			}
			else
			{
				Nmi_Tuner_Interface_Wreg(0x05,0x05);
			}
		}
		else
		{
				Nmi_Tuner_Interface_Wreg(0x05,0x85);
		}
	}
	if(param->tvstd == NMI_DTMB)//swan 2012_6_1  honestar for C/N
	{
		Nmi_Tuner_Interface_Wreg(0x0e,0x25);
	}
	nmi_tuner_os_log("gChipNowInfo.currentparam.freq(%d) \n",gChipNowInfo.currentparam.freq);
	nmi_tuner_os_memcpy((void*)&gChipNowInfo.currentparam,param,sizeof(tNMI_TUNE_PARAM));

	return ret;
}