static INT32 win_otaupg_reboot(void) { ota_proc_ret = 0; ota_user_stop = 0; //ota_proc_step = OTA_STEP_BURNFLASH; osal_flag_clear(g_ota_flg_id,OTA_FLAG_PTN); key_pan_display("OFF ",4); osal_task_sleep(500); power_off_process(); sys_data_factroy_init(); sys_data_set_factory_reset(TRUE); sys_data_set_cur_chan_mode(TV_CHAN); power_on_process(); while(1) ; }
static PRESULT factoryset_btn_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; //PRESULT ret = PROC_LEAVE; VACTION unact; UINT8 bID,back_saved; win_popup_choice_t choice; UINT32 chunk_id, default_db_addr, default_db_len; bID = OSD_GetObjID(pObj); switch(event) { case EVN_UNKNOWN_ACTION: unact = (VACTION)(param1>>16); if(unact == VACT_ENTER) { ret = PROC_LEAVE; if(bID == BTN_NO_ID) { break; } //win_compopup_init(WIN_POPUP_TYPE_OKNO); //win_compopup_set_msg(NULL, NULL, RS_DISPLAY_SURE_TO_DELETE); //win_compopup_set_default_choice(WIN_POP_CHOICE_NO); //choice = win_compopup_open_ext(&back_saved); //if(choice == WIN_POP_CHOICE_YES) { win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_msg(NULL,NULL, RS_MSG_SAVING_DATA); win_compopup_open_ext(&back_saved); chunk_id = 0x03FC0100; api_get_chunk_add_len(chunk_id, &default_db_addr, &default_db_len); //here may reset CI+ Service Shunning parameter, 20100803 #ifdef CI_PLUS_SERVICESHUNNING ci_service_shunning_reset(); #endif set_default_value(DEFAULT_ALL_PROG,default_db_addr + 16); sys_data_factroy_init(); //sys_data_set_factory_reset(TRUE); sys_data_set_cur_chan_mode(TV_CHAN); sys_data_save(TRUE); sys_data_load(); if(GetMuteState()) SetMuteOnOff(FALSE); if(GetPauseState()) SetPauseOnOff(FALSE); win_compopup_smsg_restoreback(); power_off_process(); //初始化后重新启动xiaosaifei power_on_process(); // PRESULT ret = PROC_LEAVE; //ap_send_msg(CTRL_MSG_SUBTYPE_CMD_EXIT_ROOT, (UINT32)&g_win_PALNTSC,FALSE); } #ifdef SHOW_WELCOME_SCREEN POBJECT_HEAD submenu; extern void set_win_lang_as_welcome(BOOL iswelcome); set_win_lang_as_welcome(TRUE); submenu = (POBJECT_HEAD) & win_lan_con; if (OSD_ObjOpen(submenu, 0xFFFFFFFF) != PROC_LEAVE) { menu_stack_pop(); menu_stack_push(submenu); ret = PROC_LOOP; } #endif } break; } return ret; }
static PRESULT factoryset_btn_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; VACTION unact; UINT8 bID,back_saved; UINT32 chunk_id, default_db_addr, default_db_len; S_NODE s_node; bID = OSD_GetObjID(pObj); INT16 i,n; UINT8 back_saved1; UINT16 sat_id;//-a by wangyang 2011-11-03 for factory set del sat program win_popup_choice_t choice = WIN_POP_CHOICE_NO; switch(event) { case EVN_UNKNOWN_ACTION: unact = (VACTION)(param1>>16); if(unact == VACT_ENTER) { switch(bID) { case IDC_CON1: win_compopup_init(WIN_POPUP_TYPE_OKNO); win_compopup_set_msg(NULL, NULL, RS_DISPLAY_SURE_TO_DELETE); win_compopup_set_default_choice(WIN_POP_CHOICE_NO); choice = win_compopup_open_ext(&back_saved1); if(choice == WIN_POP_CHOICE_YES) { win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_msg(NULL,NULL, RS_MSG_SAVING_DATA); win_compopup_open_ext(&back_saved); chunk_id = 0x03FC0100; api_get_chuck_addlen(chunk_id, &default_db_addr, &default_db_len); set_default_value(DEFAULT_ALL_PROG,default_db_addr + 16); sys_data_factroy_init(); sys_data_set_cur_chan_mode(TV_CHAN); sys_data_save(TRUE); sys_data_load(); if(GetMuteState()) SetMuteOnOff(FALSE); if(GetPauseState()) SetPauseOnOff(FALSE); win_compopup_smsg_restoreback(); #ifdef LOGO_IN_RAM api_show_Test_logo_2(MM_tool3,get_logo_h_file_size(3)); #endif OSD_TrackObject( (POBJECT_HEAD) &g_win_mainmenu, C_UPDATE_ALL); wincom_open_subtitle((POBJECT_HEAD)&win_factoryset_con,RS_TOOLS_FACTORY_SETTING, 0); OSD_TrackObject( (POBJECT_HEAD) &win_factoryset_con, C_UPDATE_ALL); #if defined(ORDER_GZ1010010)||defined(ORDER_GZ1011005)||defined(ORDER_GZ1104005) system_config.tv_scan_mode = 0; #endif // Restart the unit after Factory Default in any case osal_task_sleep(1200); power_off_process(); power_on_process(); } break; case IDC_CON2: win_compopup_init(WIN_POPUP_TYPE_OKNO); win_compopup_set_msg(NULL, NULL, RS_DISPLAY_SURE_TO_DELETE); win_compopup_set_default_choice(WIN_POP_CHOICE_NO); choice = win_compopup_open_ext(&back_saved1); if(choice == WIN_POP_CHOICE_YES) { win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_msg(NULL,NULL, RS_MSG_SAVING_DATA); win_compopup_open_ext(&back_saved); osal_task_sleep(1500); si_monitor_off(0xFFFFFFFF); n = get_sat_num(VIEW_ALL); recreate_prog_view(VIEW_ALL | PROG_TV_MODE,0); for(i=0;i<n;i++) { get_sat_at(i, VIEW_ALL,&s_node); del_child_prog(TYPE_SAT_NODE, s_node.sat_id); } update_data(); sys_data_check_channel_groups(); win_compopup_smsg_restoreback(); // Restart the unit after Factory Default in any case osal_task_sleep(1200); power_off_process(); power_on_process(); } break; case IDC_CON3: win_compopup_init(WIN_POPUP_TYPE_OKNO); win_compopup_set_msg(NULL, NULL, RS_DISPLAY_SURE_TO_DELETE); win_compopup_set_default_choice(WIN_POP_CHOICE_NO); choice = win_compopup_open_ext(&back_saved1); if(choice == WIN_POP_CHOICE_YES) { win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_msg(NULL,NULL, RS_MSG_SAVING_DATA); win_compopup_open_ext(&back_saved); osal_task_sleep(1500); si_monitor_off(0xFFFFFFFF); n = get_sat_num(VIEW_ALL); recreate_prog_view(VIEW_ALL | PROG_RADIO_MODE,0); for(i=0;i<n;i++) { get_sat_at(i, VIEW_ALL,&s_node); del_child_prog(TYPE_SAT_NODE, s_node.sat_id); } update_data(); sys_data_check_channel_groups(); win_compopup_smsg_restoreback(); // Restart the unit after Factory Default in any case osal_task_sleep(1200); power_off_process(); power_on_process(); } break; case IDC_CON4: win_compopup_init(WIN_POPUP_TYPE_OKNO); win_compopup_set_msg(NULL, NULL, RS_DISPLAY_SURE_TO_DELETE); win_compopup_set_default_choice(WIN_POP_CHOICE_NO); choice = win_compopup_open_ext(&back_saved1); if(choice == WIN_POP_CHOICE_YES) { win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_msg(NULL,NULL, RS_MSG_SAVING_DATA); win_compopup_open_ext(&back_saved); sys_data_factroy_init(); sys_data_set_cur_chan_mode(TV_CHAN); sys_data_save(TRUE); sys_data_load(); win_compopup_smsg_restoreback(); #ifdef LOGO_IN_RAM api_show_Test_logo_2(MM_tool3,get_logo_h_file_size(3)); #endif OSD_TrackObject( (POBJECT_HEAD) &g_win_mainmenu, C_UPDATE_ALL); wincom_open_subtitle((POBJECT_HEAD)&win_factoryset_con,RS_TOOLS_FACTORY_SETTING, 0); OSD_TrackObject( (POBJECT_HEAD) &win_factoryset_con, C_UPDATE_ALL); // Restart the unit after Factory Default in any case osal_task_sleep(1200); power_off_process(); power_on_process(); } break; //-a by wangyang 2011-11-03 for factory set del sat program{{ case IDC_CON5: if(OSD_GetMultiselCount(&factoryset_sel5)==0) { win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_msg(NULL,NULL, RS_MSG_NO_CHANNELS); win_compopup_open_ext(&back_saved1); osal_task_sleep(1000); win_compopup_smsg_restoreback(); } else { sat_id=OSD_GetMultiselSel(&factoryset_sel5); win_compopup_init(WIN_POPUP_TYPE_OKNO); win_compopup_set_msg(NULL, NULL, RS_DISPLAY_SURE_TO_DELETE); win_compopup_set_default_choice(WIN_POP_CHOICE_NO); choice = win_compopup_open_ext(&back_saved1); if(choice == WIN_POP_CHOICE_YES) { // mm_enter_stop_mode(FALSE); // api_show_menu_logo(); if(api_is_playing_tv() || api_is_playing_radio()) { api_stop_play(1); } win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_msg(NULL,NULL, RS_MSG_SAVING_DATA); win_compopup_open_ext(&back_saved); osal_task_sleep(1500); si_monitor_off(0xFFFFFFFF); //n = get_sat_num(VIEW_ALL); recreate_prog_view(VIEW_ALL | PROG_TVRADIO_MODE,0); //for(i=0;i<n;i++) { get_sat_at(sat_id, SET_SELECTED,&s_node); del_child_prog(TYPE_SAT_NODE, s_node.sat_id); } update_data(); sys_data_check_channel_groups(); win_compopup_smsg_restoreback(); // Restart the unit after Factory Default in any case osal_task_sleep(1200); power_off_process(); power_on_process(); } } break; //-a by wangyang 2011-11-03 for factory set del sat program}} default: break; } } break; } return ret; }
void power_switch(UINT32 mode) { unsigned long keycode; SYSTEM_DATA* sys_data; UINT32 vkey; UINT32 times = 0,display_type=0; date_time dt; UINT32 hh,mm,ss; char time_str[10]; struct pan_key key_struct; UINT32 timer; struct sf_panel_attr panel_attr; /*alfred.wu 1.0版本的MCU程序因为待机时间不能超过256小时*/ #ifdef MCUSTANDBY struct sf_panel_time time; date_time sRecentTime; UINT32 nDurationTime = 0; UINT32 nYear = 0; UINT32 nMonth = 0; UINT32 nDay = 0; UINT32 nHour = 0; UINT32 nMin = 0; UINT32 nSec = 0; struct sf_standby_param standby_param; /*Note: For the limited memory size of MCU, if using led panel, the maximum IR key num is 5 and for vfd panel the size is 2. */ struct sf_power_ir_key ir_key[] = \ { #ifdef RC04_A {0x007f, 0x1c}, /*RC04_A*/ #endif #ifdef RC09_A {0x00FD, 0x1A}, /*RC09_A*/ #endif #ifdef RC11_A {0x00ff, 0x54}, /*RC11_A*/ #endif #ifdef RC19_D {0x01fe, 0x00}, /*RC11_A*/ #endif #ifdef RC01_A_02 {0x807f, 0x0a}, /*RC01_A_02*/ #endif #ifdef ORDER_GZ1010001 {0x007f, 0x1c}, /*RC04_A*/ #else {0x007f, 0x0a}, /*RC01_A*/ #endif {0x01FE, 0x01}, /*REMOTE02420100*/ {0x06FB, 0x0E}, /*ALI_RCU_60_KEY*/ }; #endif sys_data = sys_data_get(); sys_data->bstandmode = 1; sys_data_save(1); system_state = SYS_STATE_POWER_OFF; /*Archer:The following process is unnessary when using mcu standby resolution.*/ #if 0 power_off_process(); power_off_process2(); #endif #ifndef MCUSTANDBY if(mode != 1) key_pan_display("off ", 4); key_pan_display_standby(1); key_pan_display_lock(0); api_standby_led_onoff(TRUE); #else #if 0 get_local_time(&dt); nDurationTime = api_get_recently_timer(); POWER_PRINTF("nDurationTime = 0x%x\n",nDurationTime); if(0 != nDurationTime) { sRecentTime.year = YEAR(nDurationTime); sRecentTime.month= MONTH(nDurationTime); sRecentTime.day= DAY(nDurationTime); sRecentTime.hour= HOUR(nDurationTime); sRecentTime.min= MIN(nDurationTime); sRecentTime.sec= SEC(nDurationTime); POWER_PRINTF("RecentTime:%d-%d-%d %d:%d:%d\n",sRecentTime.year,sRecentTime.month,\ sRecentTime.day, sRecentTime.hour,sRecentTime.min,sRecentTime.sec); get_time_offset(&dt,&sRecentTime,&nDay,&nHour,&nMin,&nSec); //standby_param.standby_time_sec = nHour*60*60+nMin*60; standby_param.standby_time_sec = 60; POWER_PRINTF("standby:hour:%d, minute:%d, total secs:%d\n",nHour,nMin, standby_param.standby_time_sec); //pan_set_standby_time((struct pan_device*)dev_get_by_id(HLD_DEV_TYPE_PAN,0),&sPanelTime); } else { POWER_PRINTF("no timer\n"); } #endif //pan_display(g_pan_dev, " ", 8);//albert.li del 2011.1.25 /*albert.li add 2011.1.25*/ get_local_time(&dt); time.hour = dt.hour; time.min= dt.min; time.sec = dt.sec; #ifndef FAKE_STANDBY sf_panel_clear(); reset_sf_panel_all_led(); /*albert.li add end*/ sf_panel_display_time(&time); sf_panel_term(); #else pan_io_control(g_pan_dev, PAN_DRIVER_GET_ATTRIBUTE, &panel_attr); if (panel_attr.type == SF_PANEL_TYPE_LED) { pan_display(g_pan_dev,"OFF ", 4); } else { pan_display(g_pan_dev,"STANDBY", 7); } #endif power_off_process(); //S5PanelStandby(g_pan_dev,(const)&sPanIRSpecialKey,2);//guop edit standby_param.ir_key_num = sizeof(ir_key)/sizeof(struct sf_power_ir_key); standby_param.ir_key_list = ir_key; standby_param.standby_time_sec = 0; #ifndef FAKE_STANDBY sf_power_down(&standby_param); #else //zhouxp fake standby { while (1) { ControlMsg_t msg; times++; times = times % 100; osal_delay(5000); vkey = V_KEY_NULL; if(key_get_key(&key_struct,0)) { keycode = scan_code_to_msg_code(&key_struct); ap_hk_to_vk(0, keycode, &vkey); } else keycode = PAN_KEY_INVALID; if(vkey == V_KEY_POWER) { power_on_process(); } ap_receive_msg( &msg, 10); libc_printf("got msg type=%d\n",msg.msgType); if(msg.msgType== CTRL_MSG_SUBTYPE_CMD_TIMER_WAKEUP) power_on_process(); } } #endif #endif #ifndef MCUSTANDBY if(1) /* Real Standby*//*alfred.wu ali的IC真待机处理流程在MCUSTANDBY后不会执行*/ { UINT32 cur_time, target_time; get_local_time(&dt); pan_close(g_pan_dev); timer = api_get_recently_timer(); // disable interrupt osal_interrupt_disable(); cur_time = (dt.sec & 0x3F ) | ((dt.min & 0x3F )<<6) | ((dt.hour & 0x1F )<<12) | ((dt.day & 0x1F)<<17) | ((dt.month & 0xF) << 22) | (((dt.year % 100) & 0x3F)<<26); sys_ic_enter_standby(timer, cur_time); // enable interrupt osal_interrupt_enable(); } while (1) { times++; times = times % 100; osal_delay(5000); if(times==0) { //get_cur_time(&hh,&mm,&ss); get_local_time(&dt); hh = dt.hour; mm = dt.min; if(display_type==0) sprintf(time_str,"%02d%02d ",hh,mm); else sprintf(time_str,"%02d.%02d",hh,mm); key_pan_display(time_str, 5); display_type++; display_type %= 2; } vkey = V_KEY_NULL; if(key_get_key(&key_struct,0)) { keycode = scan_code_to_msg_code(&key_struct); ap_hk_to_vk(0, keycode, &vkey); } else keycode = PAN_KEY_INVALID; if(vkey == V_KEY_POWER) { power_on_process(); } } #endif }