Exemplo n.º 1
0
void sys_data_save(INT32 block)
{
	//Save system_config here
	if (MEMCMP(&system_config_bak, &system_config, sizeof(system_config)))
	{
		save_tmp_data((UINT8*) &system_config, sizeof(system_config));
		MEMCPY(&system_config_bak, &system_config, sizeof(system_config));
	}
}
Exemplo n.º 2
0
/*
 * name		: as_service_save_tmp
 * description	: save tmp information.
 * parameter	: 3
 *	IN	UINT8 *data:	the content.
 *	IN	UINT32 len:	content length.
 *	IN	INT32 block:	the saving should work in block mode (!=0 )or not(0).
 * return value : INT32
 *	SUCCESS	: the tmp information is saved.
 *	other	: the data is not saved.
 */
INT32 as_service_save_tmp(UINT8 *data, UINT32 len, INT32 block)
{
	return save_tmp_data(data, len);	
}
Exemplo n.º 3
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

}