Exemple #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);
    
}
Exemple #2
0
void sys_data_load(void)
{
	AV_Set *av_set;
	//	tDspMode 			aspect_mode;
	BOOL create_view, grp_exst;
	S_NODE s_node;
	UINT8 group_idx, group_type, group_pos;
	UINT16 channel;
	UINT16 langclass;
	INT32 hoffset, moffset;
	UINT8 GMTOffset;
	date_time dt;
	enum TVSystem eTVSys;
	prog_id_t *prog_id;
	UINT8 av_mode;
	UINT8 pre_chan_mode, boot_chan_node;
	UINT16 chan_idx[2], boot_group_idx;

	
	/* Load data here */
	if(load_tmp_data((UINT8*)&system_config,sizeof(system_config))!=SUCCESS)
	{
		osal_task_sleep(50);
		if(load_tmp_data((UINT8*)&system_config,sizeof(system_config))!=SUCCESS)
		{
			osal_task_sleep(50);
			erase_tmp_sector();
			//if load tmp data fail, set to default 
			sys_data_factroy_init();
			save_tmp_data((UINT8*)&system_config,sizeof(system_config));
		}
	}

#ifdef NVOD_FEATURE
	nvod_release();
	nvod_init(system_config.main_frequency, system_config.main_symbol, system_config.main_qam);
#endif
	//SetNvodScanOverFlag(FALSE);
  
	if (CUR_CHAN_MODE > TV_CHAN)
		CUR_CHAN_MODE = TV_CHAN;

	if (get_prog_num(VIEW_ALL | CUR_CHAN_MODE, 0) != 0)
		create_view = TRUE;
	else
		create_view = FALSE;

	if (system_config.startup_switch && system_config.startup_mode <= 2)
	{
		boot_chan_node = pre_chan_mode = CUR_CHAN_MODE;
		if (system_config.startup_mode == RADIO_CHAN)
		{
			CUR_CHAN_MODE = RADIO_CHAN;
			pre_chan_mode = CUR_CHAN_MODE;
		}
		else if (system_config.startup_mode == TV_CHAN)
		{
			CUR_CHAN_MODE = TV_CHAN;
			pre_chan_mode = CUR_CHAN_MODE;
		}
		
		if (CUR_CHAN_GROUP_INDEX >= MAX_GROUP_NUM+MAX_FAVGROUP_NUM)
			CUR_CHAN_GROUP_INDEX = 0;
		boot_group_idx = CUR_CHAN_GROUP_INDEX;

		CUR_CHAN_GROUP_INDEX = 0;/* Force to all sate group*/

		if ( system_config.startup_mode == RADIO_CHAN
		        || system_config.startup_mode == 2 ) //both
		{

			sys_data_set_cur_chan_mode(RADIO_CHAN);
			recreate_prog_view(VIEW_ALL | RADIO_CHAN, 0);
			prog_id = &system_config.statup_chsid[0];
			//chan_idx[0] = get_prog_pos_ext(prog_id->sat_id,prog_id->tp_id,prog_id->prog_number);
			if (get_prog_num(VIEW_ALL | RADIO_CHAN, 0) > 0)
				chan_idx[0] = 0;
			else
				chan_idx[0] = 0xFFFF;
			if (chan_idx[0] != P_INVALID_ID)
				system_config.cur_chan_group[CUR_CHAN_GROUP_INDEX].radio_channel = chan_idx[0];
		}

		if ( system_config.startup_mode == TV_CHAN
		        || system_config.startup_mode == 2 ) //both

		{
			sys_data_set_cur_chan_mode(TV_CHAN);
			recreate_prog_view(VIEW_ALL | TV_CHAN, 0);
			prog_id = &system_config.statup_chsid[1];
			//chan_idx[1]  = get_prog_pos_ext(prog_id->sat_id,prog_id->tp_id,prog_id->prog_number);
			if (get_prog_num(VIEW_ALL | TV_CHAN, 0) > 0)
				chan_idx[0] = 0;
			else
				chan_idx[0] = 0xFFFF;
			if (chan_idx[1] != P_INVALID_ID)
				system_config.cur_chan_group[CUR_CHAN_GROUP_INDEX].tv_channel = chan_idx[1];
		}

		if (chan_idx[pre_chan_mode] != P_INVALID_ID)
		{
			sys_data_set_cur_chan_mode(pre_chan_mode);
			//recreate_prog_view(CREATE_VIEW_ALL_SAT,0);
			create_view = TRUE;
		}
		else
		{
			CUR_CHAN_GROUP_INDEX = boot_group_idx;
			sys_data_set_cur_chan_mode(boot_chan_node);
			system_config.startup_switch = 0;
		}

	}

	api_feed_power_onoff(system_config.feed_power);

	sys_data_set_cur_chan_mode(CUR_CHAN_MODE);

	if (CUR_CHAN_GROUP_INDEX >= MAX_GROUP_NUM+MAX_FAVGROUP_NUM)
		CUR_CHAN_GROUP_INDEX = 0;

	sys_data_check_channel_groups();

	group_idx = sys_data_get_cur_group_index();
	if (group_idx >= sys_data_get_group_num()&&group_idx<MAX_GROUP_NUM)//当group_idx为fav的时候不需要重新设置为0
		sys_data_set_cur_group_index(0);

	if (sys_data_get_group_num() > 0)
		create_view = TRUE;

	if (create_view)
	{
		group_idx = sys_data_get_cur_group_index();

		grp_exst = sys_data_get_cur_mode_group_infor(group_idx, &group_type, &group_pos, &channel);

		if (!grp_exst)
		{
			CUR_CHAN_GROUP_INDEX = 0;
			group_type = ALL_GROUP_TYPE;
		}

		if (group_type == ALL_GROUP_TYPE)
		{
			recreate_prog_view(VIEW_ALL | CUR_CHAN_MODE, 0);
		}
/*
		else if (group_type == SATE_GROUP_TYPE)
		{
			get_sat_at(group_pos, VIEW_ALL, &s_node);
			recreate_prog_view(VIEW_SINGLE_SAT | CUR_CHAN_MODE, s_node.sat_id);
		}
*/
		else
		{
			recreate_prog_view(VIEW_FAV_GROUP | CUR_CHAN_MODE, group_pos);
		}

	}

	MEMCPY(&system_config_bak, &system_config, sizeof(system_config));

    /*display effect setting*/
    sys_data_load_display_effect(TRUE);
	
	/* Load system time*/
	dt = system_config.sys_dt;
	if ( dt.year < 1900 || dt.year > 2100 || dt.month < 1 || dt.month > 12 || dt.day < 1 || dt.day > 31
	        || dt.hour > 23 || dt.min > 59 || dt.sec > 59 )
	{
		/* If system is invalid,set system to initial time*/
		dt.year = DEFAULT_YEAR;
		dt.month = DEFAULT_MONTH;
		dt.day = DEFAULT_DAY;
		dt.hour = 0;
		dt.min = 0;
		dt.sec = 0;
	}
	set_STC_time(&dt);
	init_UTC(&dt);

	if (system_config.local_time.buseGMT)
	{
		sys_data_gmtoffset_2_hmoffset(&hoffset, &moffset);
		set_STC_offset(hoffset, moffset, 0);
		enable_summer_time(system_config.local_time.SummerTime);
	}
	else
	{

		disable_time_parse();
	}

	/* Video Setting */
	av_set = &system_config.avset;
	//	if ( !firsttime )
	api_video_set_tvout(av_set->tv_mode);

	sys_data_set_display_mode(av_set);
    #if(SYS_DEFINE_NULL != SYS_RFM_MODULE)
	sys_data_set_rf(av_set->rf_mode, av_set->rf_channel);
    #endif


	/* Audio Setting */
	api_audio_set_volume(system_config.volume);


	OSD_SetLangEnvironment(system_config.lang.OSD_lang);
	sys_data_select_audio_language(system_config.lang.Audio_lang_1, system_config.lang.Audio_lang_2);

	sys_data_set_palette(0);

	if (system_config.rcupos > MAX_RCU_POSNUM)
		system_config.rcupos = 0;


#ifdef CHANCHG_VIDEOTYPE_SUPPORT
	UIChChgSetVideoType(system_config.chchgvideo_type);
#endif

}