Exemplo n.º 1
0
static INT32 as_blind_scan()
{
    UINT32 from = as_info->param.as_from;
    UINT32 to = as_info->param.as_to;
    UINT32 loop;
    INT32 ret = SUCCESS;
    struct NIM_Auto_Scan *as_para = &as_info->nim_para;

	if ((get_LNB_ctrl(as_info->antenna.lnb_type) != LNB_CTRL_22K)
		&&(get_LNB_ctrl(as_info->antenna.lnb_type) != LNB_CTRL_UNICABLE) /* Unicable */
			||(!as_info->dual_LNB)) 
	{
        if (as_info->voltage_ctrl)
        {
            loop = as_info->cur_sat.pol;
            as_info->polar = as_info->cur_sat.pol - 1;
            if (as_info->dual_LNB)
            {
                if (as_info->polar == 0) 
                    to = 1550;
                else
                    from = 1551;
            }
        }
        else
        {
            as_info->polar = 0;
            loop = as_info->dual_LNB? 1: 2;
        }
    }
    else
    {
        if (as_info->voltage_ctrl)
        {
            loop = as_info->cur_sat.pol;
            as_info->polar = as_info->cur_sat.pol - 1;
        }
        else
        {
            as_info->polar = 0;
            loop = 2;
        }
    }
	if (get_LNB_ctrl(as_info->cur_sat.lnb_type)==LNB_CTRL_22K
		|| (get_LNB_ctrl(as_info->cur_sat.lnb_type)==LNB_CTRL_UNICABLE
		   && as_info->dual_LNB)/* Unicable */)
	{
        as_info->antenna.k22 = as_info->cur_sat.k22 = 0;
        if (as_info->cur_sat.lnb_low>as_info->cur_sat.lnb_high)
            to = KU_LNB_22K_EDGE_FREQUENCY-as_info->cur_sat.lnb_high;
        else
            to = KU_LNB_22K_EDGE_FREQUENCY-as_info->cur_sat.lnb_low;

        from = as_info->param.as_from;
    }
    while (!as_info->stop_scan_signal)
    {
        for(; as_info->polar<loop; as_info->polar++)
        {
			if (as_info->antenna.pol != LNB_POL_POFF) {
          /* it is not good... */
				if (as_para->unicable)	//Unicable
					as_info->antenna.pol = as_info->polar;
				else
					as_info->antenna.pol = as_info->polar+1;
			}
       
			if (!as_para->unicable)	//Unicable
			{
				set_antenna(&as_info->antenna);
				wait_nim_ready();
				//osal_task_sleep(350);
			}
//            as_info->param.as_from = from;
//            as_info->param.as_to = to;

            if (as_info->stop_scan_signal)
            	break;

            // make up the autoscan parameter list
            as_para->sfreq = from;
            as_para->efreq = to;
            as_para->callback = dvbs_as_callback;
            ret = nim_ioctl_ext(as_info->nim, NIM_DRIVER_AUTO_SCAN, as_para);
            if (ret!=SUCCESS)
            	break;
            dvbs_as_callback(AS_SGN_INIT, 0, 0, 0, 0);
        }
		if (get_LNB_ctrl(as_info->cur_sat.lnb_type)==LNB_CTRL_UNICABLE
			&& !as_info->dual_LNB) /* Unicable */		
			break;		
		else if (ret||(as_info->cur_sat.k22 == 1)||
			((get_LNB_ctrl(as_info->cur_sat.lnb_type)!=LNB_CTRL_22K)
			&&(get_LNB_ctrl(as_info->cur_sat.lnb_type)!=LNB_CTRL_UNICABLE)/*Unicable*/))
			break;
		else 
        {
            as_info->antenna.k22 = as_info->cur_sat.k22 = 1;
            if (as_info->cur_sat.lnb_low>as_info->cur_sat.lnb_high)
            from = KU_LNB_22K_EDGE_FREQUENCY-as_info->cur_sat.lnb_low;
            else
            from = KU_LNB_22K_EDGE_FREQUENCY-as_info->cur_sat.lnb_high;

            to = as_info->param.as_to;
            if (as_info->voltage_ctrl)
            {
                loop = as_info->cur_sat.pol;
                as_info->polar = loop - 1;
            }
            else
            {
                as_info->polar = 0;
                loop = 2;
            }
        }
    }
    
    return ret;
}
Exemplo n.º 2
0
static INT32 as_dvbs_blind_scan(struct ft_antenna *antenna)
{
    UINT32 from = as_info->param.as_from;
    UINT32 to = as_info->param.as_to;	
    UINT32 loop = 0;
    INT32 ret = SUCCESS;
    struct NIM_Auto_Scan *as_para = &as_info->nim_para;

    MEMSET(&(as_info->xponder),0,sizeof(union ft_xpond));
    //as_info->polar: 0-H;1-V. antenna->pol: 0-auto;1-H;2-V
    //for single lnb,scan IF from 950~2150
    if(antenna->lnb_type==LNB_CTRL_STD)
    {
        //use forced H or V voltage,scan 1 time
        if(as_info->voltage_ctrl)
        {
            as_info->polar = antenna->pol - 1;
            loop = antenna->pol;
        }
        //use both H and V,scan 2 times
        else
        {
            as_info->polar = 0;
            loop = 2;
        }
    }
    //for pol controled 2-band lnb
    else if(antenna->lnb_type==LNB_CTRL_POL)
    {
        if(as_info->voltage_ctrl)
        {
            as_info->polar = antenna->pol - 1;
            loop = antenna->pol;
            //forced H voltage, scan IF from 950~1550 1 time
            if(as_info->polar==0)
            		{
                		to = 1550;
            		}
            		//Forced V Voltage, Scan IF 1551~2150 1 time
            		else if(as_info->polar == 1)
                	{
                		from = 1551;
            		}
        	}
        else
        {
            as_info->polar = 0;
            loop = 1;
        }
    }
    //for ku universal lnb
    else if((antenna->lnb_type==LNB_CTRL_22K)||(antenna->lnb_type==LNB_CTRL_UNICABLE))
    {
        if(as_info->voltage_ctrl)
        {
            as_info->polar = antenna->pol - 1;
            loop = antenna->pol;
        }
        else
        {
            as_info->polar = 0;
            loop = 2;
        }
        //firstly,scan low lnb to 22k_edge tp frq with 22k off
        antenna->k22 = 0;
        from = as_info->param.as_from;
        	if(antenna->lnb_low < antenna->lnb_high)
        	{
            		to = KU_LNB_22K_EDGE_FREQUENCY - antenna->lnb_low;
        	}
        	else
        	{
            		to = KU_LNB_22K_EDGE_FREQUENCY - antenna->lnb_high;
        	}
    	}
	 else if((antenna->lnb_type==LNB_CTRL_MDU_1) ||(antenna->lnb_type==LNB_CTRL_MDU_2)
	 	||(antenna->lnb_type==LNB_CTRL_MDU_3)||(antenna->lnb_type==LNB_CTRL_MDU_4))
	 {
	 	as_info->polar = 0;
            loop = 1;
	 }
    //scan loop  
    while(!as_info->stop_scan_signal)
    {
        for(; as_info->polar<loop; as_info->polar++)
        {
            as_info->param.as_from = from;
            as_info->param.as_to = to;
            		if(as_info->stop_scan_signal)
            		{
                		break;   
            		}
            as_info->xponder.s_info.pol = as_info->polar;
            frontend_set_antenna(as_info->nim, antenna, &as_info->xponder, 1);
            osal_task_sleep(AS_TUNE_TIMEOUT_S);
            // make up the autoscan parameter list
            as_para->sfreq = from;
            as_para->efreq = to;
            as_para->callback = dvbs_as_callback;
            ret = nim_ioctl_ext(as_info->nim, NIM_DRIVER_AUTO_SCAN, as_para);
            if(ret!=SUCCESS)
            		{
                		break;
            		}
            dvbs_as_callback(AS_SGN_INIT, 0, 0, 0, 0);
        }
    	if (antenna->lnb_type==LNB_CTRL_UNICABLE && !as_info->dual_LNB) /* Unicable */		
		    break;	
        else if(ret||(antenna->k22==1)
            ||((antenna->lnb_type!=LNB_CTRL_22K)&&(antenna->lnb_type!=LNB_CTRL_UNICABLE)))
		{
            		break;
		}
        	else
        	{
            		//Second, Scan High LNB from 22k_edge to 2150 TP Frequency with 22k On
            		antenna->k22 = 1;
                    as_info->xponder.s_info.frq = KU_LNB_22K_EDGE_FREQUENCY+1;//switch to high band,turn on 22K
            		if(antenna->lnb_low < antenna->lnb_high)
            		{
                		from = KU_LNB_22K_EDGE_FREQUENCY - antenna->lnb_high;
            		}
            		else
            		{
                		from = KU_LNB_22K_EDGE_FREQUENCY - antenna->lnb_low;
            		}
            to = as_info->param.as_to;
            if(as_info->voltage_ctrl)
            {
                loop = antenna->pol;
                as_info->polar = antenna->pol - 1;
            }
            else
            {
                as_info->polar = 0;
                loop = 2;
            }
        }
    }
    
    return ret;
}
Exemplo n.º 3
0
BOOL new_win_signal_update()
{
	POBJECT_HEAD pObj;
	PROGRESS_BAR *bar;
	TEXT_FIELD *txt;

	UINT16 cn_noise, level;
	UINT32 ber;
	INT32 temp = 0;
	UINT32 dot = 0;
	char str[20];
	struct nim_device *nim_dev;
	UINT8 lock, cn_noise_maped = 0, level_maped = 0;
	UINT16 level_shIdx,quality_shIdx,ber_idx;
    
	pObj = (POBJECT_HEAD) &g_new_signal_test;//lin
	if (pObj->pRoot == NULL)
		return FALSE;

	if (cur_tuner_idx == 0)
		nim_dev = g_nim_dev;
	else
		nim_dev = g_nim_dev2;

	nim_get_lock(nim_dev, &lock);
    nim_ioctl_ext(nim_dev, NIM_DRIVER_GET_RF_LEVEL, (void*) &level);
        
	if (lock)
	{
		level_shIdx = PROGRESS_COLOR_GREEN;
		quality_shIdx = LOCK_IDX;
		ber_idx = PROGRESS_COLOR_BLUE;
        nim_ioctl_ext(nim_dev, NIM_DRIVER_GET_CN_VALUE, (void*) &cn_noise);    
		nim_ioctl_ext(nim_dev, NIM_DRIVER_GET_BER_VALUE, (void*) &ber);
	}
	else
	{
		level_shIdx = UNLOCK_IDX;
		quality_shIdx = UNLOCK_IDX;
		ber_idx = UNLOCK_IDX;
		cn_noise = 0;
		ber = 0;
	}

	//update the text value & uint for each item
	if(lock)
	{
		sprintf(str, "%d.%d ", cn_noise / 10, cn_noise % 10);
	}
	else
	{
		sprintf(str, "0");
	}
	txt = &new_sig_txt_CN0;//sig_txt_CN_uint;
	OSD_SetTextFieldContent(txt, STRING_ANSI, (UINT32)str);


	sprintf(str, "%d ", ber);
	txt = &new_sig_txt_BER0;//sig_txt_BER_uint;
	OSD_SetTextFieldContent(txt, STRING_ANSI, (UINT32)str);
            
    if (level % 10)
    {
		temp = (107-level / 10) - 1; //107
		dot = 10-level % 10;
	}
	else
	{
		temp = 107-level / 10; //107
		dot = 0;
	}

    if(temp<0)
        temp= -temp;  //temp=0; //avoid the negative value

	sprintf(str, "%d.%d", temp, dot);
	txt = &new_sig_txt_level0;//sig_txt_level_uint;
	OSD_SetTextFieldContent(txt, STRING_ANSI, (UINT32)str);

//draw SNR bar
	nim_get_SNR(nim_dev, &cn_noise_maped);
	bar = &new_sig_bar_CN;//sig_bar_CN;  
    if(0==cn_noise)
    {
        OSD_SetProgressBarPos(bar, cn_noise_maped);
        bar->wTickFg = quality_shIdx;
    }
    else
    {
	    OSD_SetProgressBarPos(bar, cn_noise_maped); //OSD_SetProgressBarPos(bar, cn_noise_maped);
	    bar->wTickFg = quality_shIdx;
    }


//Draw the signal error bar
	bar = &new_sig_bar_BER;//sig_bar_BER;
	ber = new_map_ber_value(&ber);
	OSD_SetProgressBarPos(bar, ber);
	bar->wTickFg = ber_idx;

//Draw the signal intensity bar
    level_maped = temp *100 / 107;  
//    if((level_maped>=0)&&(level_maped<30))
    if(level_maped<30)
    {
        level_maped = 5*level_maped/2;  
    }
    else if((level_maped>=30)&&(level_maped<60))
    {
        level_maped = 75 + (level_maped - 30)/3; 
    }
    else
    {
        level_maped = 95 + (level_maped - 60)/20;
    }
    
	if (level_maped > 100)
	{
		level_maped = 100;
//        osal_task_sleep(10);
    } 
    
	bar = &new_sig_bar_level;//sig_bar_level; 
	OSD_SetProgressBarPos(bar, level_maped);
	bar->wTickFg = level_shIdx;

//draw them all
	OSD_DrawObject(pObj, C_UPDATE_ALL);

	return TRUE;
}