Exemplo n.º 1
0
static void win_miscset_save_setting(void)
{
	MULTISEL	*msel;
	SYSTEM_DATA* sys_data;
	UINT32 val;

	sys_data = sys_data_get();

#ifndef NEW_DEMO_FRAME
	struct nim_lnb_info lnb_info;
	for(i=0;i<2;i++)
	{
        lib_nimg_get_lnb_info(i+1,&lnb_info);
        if(LNB_POWER_OFF == sys_data->bLNB_power)
            lnb_info.lnb_power_off = 1;
        else
            lnb_info.lnb_power_off = 0;                      
		lib_nimg_set_lnb_info(i+1,&lnb_info);
	}
#else
	struct nim_config lnb_info;
	struct nim_device *nim;
UINT16 i;
	for(i=0;i<2;i++)
	{
        nim = (struct nim_device *)dev_get_by_id(HLD_DEV_TYPE_NIM, i);
        dev_get_nim_config(nim,FRONTEND_TYPE,&lnb_info);
        if(LNB_POWER_OFF == sys_data->bLNB_power)
            lnb_info.antenna.antenna_enable = /*0*/1;   //Seiya fix BUG37540:
        else
            lnb_info.antenna.antenna_enable = 1;                   
	    dev_set_nim_config(nim, FRONTEND_TYPE, &lnb_info);
	}
#endif

	msel =&miscset_sel1;
	val = OSD_GetMultiselSel(msel);
	sys_data->chan_sw = val;
	
	msel =&miscset_sel2;
	val = OSD_GetMultiselSel(msel);
	sys_data->chchgvideo_type = val;

#ifdef CHANCHG_VIDEOTYPE_SUPPORT
#ifndef NEW_DEMO_FRAME
	UIChChgSetVideoType(sys_data->chchgvideo_type);
#endif
#endif
	
	msel =&miscset_sel3;
	val = OSD_GetMultiselSel(msel);
	sys_data->install_beep = val;

    msel =&miscset_sel4;
	val = OSD_GetMultiselSel(msel);
	sys_data->auto_standby_en= val;


#ifdef ORDER_GZ1207009
	   msel =&miscset_sel6;
	val = OSD_GetMultiselSel(msel);
	sys_data->standbymode= val;
#endif

#ifdef RAM_TMS_TEST
    msel =&miscset_sel5;
	val = OSD_GetMultiselSel(msel);

	char rec_part[16];
	char tms_part[16];

	if (sys_data->ram_tms_en != val) // detach tms part
	{
		rec_part[0] = tms_part[0] = 0;
		pvr_get_cur_mode(rec_part, tms_part);
		if (tms_part[0] != 0)
		{
			if (STRCMP(rec_part, tms_part) == 0)
				pvr_set_disk_use(PVR_REC_ONLY_DISK, rec_part);
			else
				pvr_detach_part(tms_part, PVR_TMS_ONLY_DISK);
			api_pvr_adjust_tms_space();
		}
	}
	
	if (sys_data->ram_tms_en == 0 && val == 1) // enable RAM disk timeshift
	{
		UINT32 ram_len = RAM_DISK_SIZE;	
		UINT32 ram_addr = (void *)(RAM_DISK_ADDR & 0x0fffffff | 0x80000000);

		ramdisk_create((UINT32)ram_addr, ram_len);

		struct pvr_register_info pvr_reg_info;
		MEMSET(&pvr_reg_info, 0, sizeof(struct pvr_register_info));
		STRCPY(pvr_reg_info.mount_name, "/mnt/rda1");
		pvr_reg_info.disk_usage = PVR_TMS_ONLY_DISK;
		pvr_reg_info.sync = 1;
		pvr_reg_info.init_list = 0;
		pvr_reg_info.check_speed = 0;
		pvr_register((UINT32)&pvr_reg_info, 0);
	}
	else if (sys_data->ram_tms_en == 1 && val == 0) // disable RAM disk timeshift
	{
		ramdisk_delete();
	}

	if (sys_data->ram_tms_en != val)
	{
		if (val == 0) // disable RAM disk timeshift, select PVR partition again
		{
			UINT8 back_saved;
			rec_part[0] = tms_part[0] = 0;
			pvr_select_part(rec_part, tms_part);
			if (rec_part[0] != 0 || tms_part[0] != 0)
			{
				win_compopup_init(WIN_POPUP_TYPE_SMSG); 					   
				win_compopup_set_msg_ext("Init PVR partitions, please wait...", NULL, 0);
				win_compopup_open_ext(&back_saved);
				if (STRCMP(rec_part, tms_part) == 0)
				{
					pvr_change_part(rec_part, PVR_REC_AND_TMS_DISK);
				}
				else
				{
					pvr_change_part(rec_part, PVR_REC_ONLY_DISK);
					pvr_change_part(tms_part, PVR_TMS_ONLY_DISK);
				}
				win_compopup_smsg_restoreback();
			}
		}
		
		struct dvr_HDD_info hdd_info;
		pvr_get_HDD_info(&hdd_info);
		api_pvr_check_level(&hdd_info);
		if (pvr_get_cur_mode(NULL, NULL) == PVR_DISK_INVALID)
		{
			api_pvr_clear_up_all();
		}
	}
	sys_data->ram_tms_en = val;
#endif

    sys_data_save(1);
    
}
Exemplo n.º 2
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;        
    	}
       
}