示例#1
0
static UINT32 as_frontend_tuning(struct as_module_info *info, T_NODE *tp)
{
    UINT32 time_out = 0;
	union ft_xpond *xponder = &info->xponder;
	struct ft_antenna *antenna = &info->antenna;

	//Set TP Info for DVB-S/C/T
	MEMSET(xponder, 0, sizeof(union ft_xpond));

	if(tp->ft_type == FRONTEND_TYPE_C)
	{
    	time_out = AS_TUNE_TIMEOUT_C;
    	xponder->c_info.type = tp->ft_type;
    	xponder->c_info.tp_id = tp->tp_id;
    	xponder->c_info.frq = tp->frq;
    	xponder->c_info.sym = tp->sym;
	//FEC_inner store modulation in this case
    	xponder->c_info.modulation = tp->FEC_inner;
	}

	//Set NIM
	frontend_set_nim(as_info->nim, antenna, xponder, 1);

	return time_out;
}
示例#2
0
/*DVBC and DVBT blind scan in fact is tp scan by bandwith step*/
static void as_dvbc_blind_tuning(void *param)
{
    	struct as_tuning_param *atp = (struct as_tuning_param *)param;
    	union ft_xpond xpond;

	//If Blind Scan Already Finished, then Return
    	if (atp->finish == TRUE)
    	{
        	return;
    	}

    MEMSET(&xpond, 0, sizeof(xpond));
    xpond.common.type = atp->ft_type = as_info->param.as_frontend_type;
    if(atp->ft_type==FRONTEND_TYPE_C)
    {
        xpond.c_info.frq = atp->pos;
        xpond.c_info.sym = as_info->param.ft.c_param.sym;
        xpond.c_info.modulation = as_info->param.ft.c_param.constellation;
    }
    else if(atp->ft_type==FRONTEND_TYPE_T)
    {

    }
    
    while(atp->pos <= atp->limit)
    {
        frontend_set_nim(as_info->nim, NULL, &xpond, 1);
	if((atp->ft_type==FRONTEND_TYPE_C) &&(as_info->param.as_handler))
	{
		as_info->param.as_handler(ASM_TYPE_INC_TRANSPONDER,atp->pos);
	}
        atp->timeout = osal_get_tick()+ AS_TUNE_TIMEOUT_C;
        atp->pos += atp->step;
        if(atp->ft_type==FRONTEND_TYPE_C)
        {
            if ((atp->pos>DVBC_FREQUENCY_VHF_HIGH)&&(atp->pos<DVBC_FREQUENCY_UHF_LOW))
            {
                		if (atp->limit >= DVBC_FREQUENCY_UHF_LOW)
                		{
                    			atp->pos = DVBC_FREQUENCY_UHF_LOW;
                		}
				else
				{
                    			return;
				}
            		}
        	}

        	if ((atp->pos < atp->limit) && (as_info->param.as_handler))
        	{
            		as_info->param.as_handler(ASM_TYPE_PROGRESS, 99*(atp->pos-atp->start)/(atp->limit-atp->start));
        	}
   
        return;
    }
    atp->finish = TRUE;
}
示例#3
0
static void as_dvbc_blind_tuning(void *param)
{
	struct as_tuning_param *atp = (struct as_tuning_param *)param;
	union ft_xpond xponder;

	UINT32 cnt_finish=0, cnt_band=0, cnt_ttl=0,index=0;

	//If Blind Scan Already Finished, then Return
	if(dvbc_bs_freq_end)
		atp->finish = TRUE;

	if (atp->finish == TRUE)
	{
		return;
	}

	MEMSET(&xponder, 0, sizeof(xponder));
	xponder.common.type = atp->ft_type = as_info->param.as_frontend_type;
	if(atp->ft_type==FRONTEND_TYPE_C)
	{
        atp->ft.c_param.sym = as_info->param.ft[atp->ft_count].c_param.sym;
        atp->ft.c_param.constellation = as_info->param.ft[atp->ft_count].c_param.constellation;

        xponder.c_info.frq = atp->pos;
        xponder.c_info.sym = atp->ft.c_param.sym;                   // as_info->param.ft.c_param.sym;
        xponder.c_info.modulation = atp->ft.c_param.constellation;	// as_info->param.ft.c_param.constellation;
	}

	//libc_printf("as_dvbc_blind_tuning frq:%d sym:%d modulation:%d timeout:%d\n",
	//	xponder.c_info.frq, xponder.c_info.sym,  xponder.c_info.modulation, atp->timeout);

	frontend_set_nim(as_info->nim, NULL, &xponder, 1);

	if(as_info->param.as_handler)
	{
		//as_info->param.as_handler(ASM_TYPE_SCANNING_INFO,1+c_srh_tp_step+((atp->cur_band&0x7f)<<8));

		for(index = 0; index < atp->band_count; index++)
		{
			cnt_band = 1+ atp->band_group_param[index].end_ch_no - atp->band_group_param[index].start_ch_no;

             //if(as_info->param.ft_count > 1)
             cnt_band *= as_info->param.ft_count;
			cnt_ttl += cnt_band;

			if(atp->cur_band>index)
				cnt_finish += cnt_band;
		}

         if(c_srh_tp_step != 0)
         {
            if(atp->ft_count == as_info->param.ft_count-1)
                 cnt_finish += c_srh_tp_step;
            else
                cnt_finish += (c_srh_tp_step - (as_info->param.ft_count-1 - atp->ft_count));
         }

		as_info->param.as_handler(ASM_TYPE_PROGRESS, 100*cnt_finish/cnt_ttl);
	}
	c_srh_tp_step++;

     if(as_info->param.ft_count > 1)
     {
        if(atp->cur_band < atp->band_count)
        {
            if(atp->ft_count < as_info->param.ft_count-1)
            {
                atp->ft_count++;
                //atp->ft.c_param.sym = as_info->param.ft[atp->ft_count].c_param.sym;
                //atp->ft.c_param.constellation = as_info->param.ft[atp->ft_count].c_param.constellation;
                atp->timeout = osal_get_tick()+ AS_TUNE_TIMEOUT_C;
                return;
            }
            else
            {
                atp->ft_count = 0;
               // atp->ft.c_param.sym = as_info->param.ft[0].c_param.sym;
               // atp->ft.c_param.constellation = as_info->param.ft[0].c_param.constellation;
            }
        }
    }

	while(atp->cur_band < atp->band_count)
	{
		if(atp->pos+atp->step <= atp->limit)
		{
			atp->timeout = osal_get_tick()+ AS_TUNE_TIMEOUT_C;
			atp->pos += atp->step;

			if(atp->start == atp->limit && atp->step==0) // only one frequency in this band
				atp->step = 1;
			return;
		}
		atp->cur_band++;
		if(atp->cur_band < atp->band_count)
		{
			atp->start = atp->band_group_param[atp->cur_band].start_freq;
			atp->limit = atp->band_group_param[atp->cur_band].end_freq;
			atp->step = atp->band_group_param[atp->cur_band].freq_step;
			atp->pos = atp->start- atp->step;
			c_srh_tp_step = 0;
		}
	}

	//if ((atp->pos < atp->limit) && (as_info->param.as_handler))
	//{
	//		as_info->param.as_handler(ASM_TYPE_PROGRESS, 99*(atp->pos-atp->start)/(atp->limit-atp->start));
	//}

	atp->timeout += AS_TUNE_TIMEOUT_C; // for the last frequency
	dvbc_bs_freq_end = 1;

}
示例#4
0
BOOL GetSignalStatus(  signal_lock_status* lock_flag,
                        signal_scramble_status* scramble_flag,
                        signal_lnbshort_status* lnbshort_flag,
                        signal_parentlock_status* parrentlock_flag)
{
    UINT8 lock;
    struct dmx_device * dmx_dev;
    signal_lnbshort_status lnbshort;
    SYSTEM_DATA* sys_data;
    sys_data = sys_data_get();    
    UINT8 scrabled,scrable_typ;
    P_NODE p_node;
    UINT16 cur_channel;
    struct VDec_StatusInfo curStatus;
    static UINT16 prechan;
    static UINT32 descDetTime = 0;
	struct nim_device* nim_dev;
#ifdef NEW_DEMO_FRAME
    static UINT32 unlock_times;
	INT32 ts_route_id;
	struct ts_route_info ts_route;
    struct nim_config nim_config;
#endif

	if(cur_tuner_idx == 0)
		nim_dev = g_nim_dev;
	else
		nim_dev = g_nim_dev2;	
    
#ifdef NEW_DEMO_FRAME
	MEMSET(&ts_route, 0, sizeof(struct ts_route_info));
	if(ts_route_get_by_type(TS_ROUTE_MAIN_PLAY, &ts_route_id, &ts_route) != RET_FAILURE)
	{
		nim_dev = (struct nim_device *)dev_get_by_id(HLD_DEV_TYPE_NIM, ts_route.nim_id);
	}
	else
	{
		nim_dev = (cur_tuner_idx == 0) ? g_nim_dev : g_nim_dev2;
	}
#endif

    
    lnbshort = SIGNAL_STATUS_LNBNORMAL;

#if(SYS_LNB_SHORT_DET == SYS_FUNC_ON)

    /*  
    if(sys_data->bLNB_power == LNB_POWER_ON)
    {
        if(LNB_state() == 1)//short
        {
            lnbshort = SIGNAL_STATUS_LNBSHORT;
        }
    }
    */
    lnbshort = lnb_power_short;    
#elif(SYS_12V_SHORT_DET == SYS_FUNC_ON)
	lnbshort = v12_power_short;
#endif

    if(lnbshort_flag != NULL)
        *lnbshort_flag = lnbshort;    
    SetSignalLNBShortStatus(lnbshort);

//    if(*lnbshort_flag  == SIGNAL_STATUS_LNBSHORT)
//        return TRUE;    
    
#ifdef NEW_DEMO_FRAME
	dmx_dev = (struct dmx_device *)dev_get_by_id(HLD_DEV_TYPE_DMX, ts_route.dmx_id);
#else
	dmx_dev = g_dmx_dev;
#endif

#ifdef DVR_PVR_SUPPORT
	if(singal_play_chan_nim_busy)
		lock = SIGNAL_STATUS_UNLOCK;
	else
#endif
    		nim_get_lock(nim_dev,&lock);
#if 0//def NEW_DEMO_FRAME  //reset diseqc, but it may hold this process, if attached to UI flow maybe cause bug!
	if(!lock)
		unlock_times++;
	else 
		unlock_times = 0;
	if((unlock_times > 10)&& sys_data->bLNB_power)
	{
		dev_get_nim_config(nim_dev, FRONTEND_TYPE_S, &nim_config);
		frontend_set_antenna(nim_dev, &nim_config.antenna, &nim_config.xpond, 1); 
		if(frontend_lnb_22k_ctl(&nim_config.antenna) || (nim_dev == g_nim_dev2))
			frontend_set_nim(nim_dev, &nim_config.antenna,&nim_config.xpond,1);
		
		nim_get_lock(nim_dev,&lock);
		unlock_times = 0;  
	}
#endif

    if (parrentlock_flag == NULL)
        lv_lock_status = lock? SIGNAL_STATUS_LOCK : SIGNAL_STATUS_UNLOCK;
    else
	    SetSignalLockStatus( lock? SIGNAL_STATUS_LOCK : SIGNAL_STATUS_UNLOCK);

	cur_channel = sys_data_get_cur_group_cur_mode_channel();
	get_prog_at(cur_channel,&p_node);

#if 0
	scrabled = 0;
	if(dmx_io_control(dmx_dev,IS_AV_SCRAMBLED,(UINT32)(&scrable_typ)) == RET_SUCCESS )
	{
		if(scrable_typ & (VDE_TS_SCRBL|VDE_PES_SCRBL))
			scrabled = 1;
		else
		{
			scrabled = 0;			
		}
	}
#else
    scrabled = key_get_dmx0_scramble(NULL);
#endif

#ifdef CI_SUPPORT2
	if ((parrentlock_flag == NULL) && (p_node.ca_mode) && (!scrabled) && lock && (screen_back_state == SCREEN_BACK_VIDEO) && (VIEW_MODE_FULL == hde_get_mode()) 
#ifdef DVR_PVR_SUPPORT
		&& !freeze_for_pvr //black screen result in pvr state trans!
		&& api_pvr_is_live_playing()
#endif
		)
	{
	    vdec_io_control(get_selected_decoder(), VDEC_IO_GET_STATUS, (UINT32)&curStatus);
		UINT32 freeze_flag = curStatus.display_idx;
		if((curStatus.uFirstPicShowed)  && (curStatus.uCurStatus == VDEC_DECODING)) //for scramble prog and freeze screen (show black screen and scramble osd) 
		{
			osal_task_sleep(100);
			//vdec_io_control(g_decv_dev, VDEC_IO_GET_STATUS, (UINT32)&curStatus);
			vdec_io_control(get_selected_decoder(), VDEC_IO_GET_STATUS, (UINT32)&curStatus);
			if(freeze_flag == curStatus.display_idx)
			{
				osal_task_sleep(100);
				//vdec_io_control(g_decv_dev, VDEC_IO_GET_STATUS, (UINT32)&curStatus);
				vdec_io_control(get_selected_decoder(), VDEC_IO_GET_STATUS, (UINT32)&curStatus);
				if(freeze_flag == curStatus.display_idx) // freeze screen state!
				{
					scrabled = 1;	
#ifdef DVR_PVR_SUPPORT //add to simulate monitor's function for video hold state because monitor is off under DVR project!
					if((!last_ca_pmt_cmd_time) || (last_ca_pmt_cmd_time && (osal_get_tick() > last_ca_pmt_cmd_time + 6000)))
					{
						if(ca_pmt_cmd_cnt >= 2)
						{
							UIChChgPlayProg(0,CC_CMD_RESET_CRNT_CH);
							ca_pmt_cmd_cnt = 0;
						}
						else
						{
							//cc_send_ca_pmt();
							cc_send_ca_pmt(p_node.prog_id);
							ca_pmt_cmd_cnt++;
						}
						last_ca_pmt_cmd_time = osal_get_tick();
					}
#endif
				}
                else
                {
                    ca_pmt_cmd_cnt = 0;
                }
			}
            else
            {
                ca_pmt_cmd_cnt = 0;
            }
		}
		else if(!curStatus.uFirstPicShowed) //for scramble prog and black screen
		{
			scrabled = 1;
            ca_pmt_cmd_cnt = 0;
		}
	}
#endif


#ifdef CTI_CA
{
	UINT32 freeze_flag = curStatus.display_idx;
	
    vdec_io_control(get_selected_decoder(), VDEC_IO_GET_STATUS, (UINT32)&curStatus);
	freeze_flag = curStatus.display_idx;
	if((curStatus.uFirstPicShowed)  && (curStatus.uCurStatus == VDEC_DECODING)) //for scramble prog and freeze screen (show black screen and scramble osd) 
	{
		osal_task_sleep(100);

		vdec_io_control(get_selected_decoder(), VDEC_IO_GET_STATUS, (UINT32)&curStatus);
		if(freeze_flag == curStatus.display_idx)
		{
			osal_task_sleep(100);

			vdec_io_control(get_selected_decoder(), VDEC_IO_GET_STATUS, (UINT32)&curStatus);
			if(freeze_flag == curStatus.display_idx) // freeze screen state!
			{
				scrabled = 1;	
			}
		}
	}
	else if(!curStatus.uFirstPicShowed) //for scramble prog and black screen
	{
		scrabled = 1;
	}

/*qjzheng 2010.5.7 BUG2003 不能播放加锁节目时, 有时提示是CA错误*/
	if( !lv_lock_status )
	{
		scrabled = 0;
	}
}
#endif


    if (parrentlock_flag)
    {
        if (scrabled)
        {
            if (lv_scramble_fake)
                scrabled = 0;
        }
    	SetSignalScrambleStatus(scrabled? SIGNAL_STATUS_SCRAMBLED : SIGNAL_STATUS_UNSCRAMBLED);
    }
    else
    {
        lv_scramble_status = scrabled? SIGNAL_STATUS_SCRAMBLED : SIGNAL_STATUS_UNSCRAMBLED;
    }

    /*Never in In multi-view mode*/
    if(lock && !scrabled && hde_get_mode()!=VIEW_MODE_MULTI)
    {
        if(p_node.ca_mode && sys_data_get_cur_chan_mode() == TV_CHAN)
        {
            if(!curStatus.uFirstPicShowed && curStatus.uCurStatus!=VDEC_PAUSED)
            {
                descDetTime ++;
                if(descDetTime == 1)
                    prechan = cur_channel;
                if(descDetTime >=3 && prechan == cur_channel)
                    scrabled = 1;
                else
                    descDetTime = 0;                    
            }
            else
                descDetTime = 0;
        }
    }   

    if(lock_flag != NULL)
        *lock_flag = lv_lock_status;
    if(scramble_flag != NULL)
        *scramble_flag = lv_scramble_status;
    if(parrentlock_flag != NULL)
        *parrentlock_flag = lv_parrentlock_status;
	
    if(lv_lock_status == SIGNAL_STATUS_LOCK 
        && lv_scramble_status == SIGNAL_STATUS_UNSCRAMBLED
        && lv_lnbshort_status == SIGNAL_STATUS_LNBNORMAL
        && lv_parrentlock_status == SIGNAL_STATUS_PARENT_UNLOCK)
        return FALSE;
    else
    	{	
	    	 return TRUE;        
    	}
       
}