static void hddfmt_start() { UINT8 back_saved; win_popup_choice_t choice; UINT8 mode; struct dvr_HDD_info hdd_info; char volume_name[48]; char osd_name[48]; char hint[64]; BOOL ret; disk_format_mode_num = get_fsystem_installed(disk_mode, 8); //sprintf(temp, "%s", disk_mode[input]); storage_index_to_osd_string((UINT8)hddfmt_cur_volume,osd_name); sprintf(hint, "Are you sure to format the %s?", osd_name); if(disk_format_mode_num == 1) { win_compopup_init(WIN_POPUP_TYPE_OKNO); win_compopup_set_btnstr_ext(0, disk_mode[0]); win_compopup_set_default_choice(WIN_POP_CHOICE_NO); } else if(disk_format_mode_num == 2) { win_compopup_init(WIN_POPUP_TYPE_OKNOCANCLE); win_compopup_set_btnstr_ext(0, disk_mode[0]); win_compopup_set_btnstr_ext(1, disk_mode[1]); win_compopup_set_default_choice(WIN_POP_CHOICE_CANCEL); } win_compopup_set_msg(hint, NULL, 0); choice = win_compopup_open_ext(&back_saved); if(((disk_format_mode_num == 1) && (choice == WIN_POP_CHOICE_YES)) || ((disk_format_mode_num == 2) && ((choice == WIN_POP_CHOICE_YES) || (choice == WIN_POP_CHOICE_NO)))) { if(choice == WIN_POP_CHOICE_YES) mode = 1; else mode = 2; storage_index2volume((UINT8)hddfmt_cur_volume,volume_name); storage_add_parent_dir(volume_name); win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_frame(GET_MID_L(286), GET_MID_T(130), 286, 130); win_compopup_set_msg_ext("formating wait!",NULL,0); win_compopup_open_ext(&back_saved); ret = pvr_format_multi_hdd(mode, volume_name); win_compopup_smsg_restoreback(); if(!ret) { win_compopup_init(WIN_POPUP_TYPE_OK); sprintf(hint, "Format %s error?", osd_name); win_compopup_set_msg(hint, NULL, 0); win_compopup_set_default_choice(WIN_POP_CHOICE_CANCEL); win_compopup_open_ext(&back_saved); return; } if(STRCMP((char *)pvr_get_mout_prefix(), volume_name)==0) { if(pvr_get_HDD_info(&hdd_info)) { api_pvr_check_level(&hdd_info); ap_clear_all_message();//or usb reflash msg maybe send fail pvr_evnt_callback(0, PVR_HDD_FORMATTED); } } win_hddfmt_draw_disk_infor(); } }
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); }
/* change partition @part_path to @part_mode, for pvr */ int pvr_change_part(const char *part_path, UINT8 part_mode) { struct dvr_HDD_info hdd_info; struct pvr_register_info pvr_reg_info; char rec_part[16], tms_part[16]; enum PVR_DISKMODE cur_pvr_mode; SYSTEM_DATA *sys_data; BOOL register_part = FALSE; int ret = 0; if (part_path == NULL || part_path[0] == 0) return -1; DM_DEBUG("%s() change %s to %d\n", __FUNCTION__, part_path, part_mode); sys_data = sys_data_get(); cur_pvr_mode = pvr_get_cur_mode(rec_part, tms_part); MEMSET(&pvr_reg_info, 0, sizeof(struct pvr_register_info)); STRCPY(pvr_reg_info.mount_name, part_path); pvr_reg_info.disk_usage = part_mode; pvr_reg_info.sync = 1; switch (part_mode) { case PVR_REC_AND_TMS_DISK: if (cur_pvr_mode == PVR_DISK_REC_AND_TMS) { pvr_detach_part(rec_part, PVR_REC_AND_TMS_DISK); } else { pvr_detach_part(rec_part, PVR_REC_ONLY_DISK); pvr_detach_part(tms_part, PVR_TMS_ONLY_DISK); } pvr_reg_info.init_list = 1; #ifndef PVR_SPEED_PRETEST_DISABLE /* --doy, 2011-3-21*/ pvr_reg_info.check_speed = 1; #endif if (pvr_register((UINT32)&pvr_reg_info, 0) != SUCCESS) { api_pvr_clear_up_all(); ret = -1; } STRCPY(sys_data->rec_disk, part_path); STRCPY(sys_data->tms_disk, part_path); sys_data_save(0); break; case PVR_REC_ONLY_DISK: if ((STRLEN(rec_part) > 0) && (STRCMP(rec_part, part_path) == 0)) { // same partition if ((cur_pvr_mode == PVR_DISK_ONLY_REC) || (cur_pvr_mode == PVR_DISK_REC_WITH_TMS)) { break; } else if (cur_pvr_mode == PVR_DISK_REC_AND_TMS) { pvr_set_disk_use(PVR_REC_ONLY_DISK, part_path); } else { DM_DEBUG("rec_part: %s, mount_name: %s, mode: %d, %d\n", rec_part, part_path, cur_pvr_mode, part_mode); register_part = TRUE; //SDBBP(); } } else // diff partition { register_part = TRUE; if (cur_pvr_mode == PVR_DISK_REC_AND_TMS) { pvr_set_disk_use(PVR_TMS_ONLY_DISK, tms_part); } if ((cur_pvr_mode == PVR_DISK_ONLY_REC) || (cur_pvr_mode == PVR_DISK_REC_WITH_TMS)) { pvr_detach_part(rec_part, PVR_REC_ONLY_DISK); } if ((STRCMP(tms_part, part_path) == 0) && ((cur_pvr_mode == PVR_DISK_ONLY_TMS) || (cur_pvr_mode == PVR_DISK_REC_WITH_TMS))) { pvr_detach_part(tms_part, PVR_TMS_ONLY_DISK); } } if (register_part) { pvr_reg_info.init_list = (part_mode != PVR_TMS_ONLY_DISK); #ifndef PVR_SPEED_PRETEST_DISABLE /* --doy, 2011-3-21*/ pvr_reg_info.check_speed = 1; #endif //osal_task_sleep(1000); // wait for pvr cleanup finished if (pvr_register((UINT32)&pvr_reg_info, 0) != SUCCESS) { ret = -1; } } STRCPY(sys_data->rec_disk, part_path); if(!STRCMP(sys_data->tms_disk, part_path)) STRCPY(sys_data->tms_disk, ""); sys_data_save(0); break; case PVR_TMS_ONLY_DISK: if ((STRLEN(tms_part) > 0) && (STRCMP(tms_part, part_path) == 0)) { // same partition if ((cur_pvr_mode == PVR_DISK_ONLY_TMS) || (cur_pvr_mode == PVR_DISK_REC_WITH_TMS)) { break; } else if (cur_pvr_mode == PVR_DISK_REC_AND_TMS) { pvr_set_disk_use(PVR_TMS_ONLY_DISK, part_path); } else { DM_DEBUG("rec_part: %s, mount_name: %s, mode: %d, %d\n", rec_part, part_path, cur_pvr_mode, part_mode); register_part = TRUE; //SDBBP(); } } else // diff partition { register_part = TRUE; if (cur_pvr_mode == PVR_DISK_REC_AND_TMS) { pvr_set_disk_use(PVR_REC_ONLY_DISK, rec_part); } if ((cur_pvr_mode == PVR_DISK_ONLY_TMS) || (cur_pvr_mode == PVR_DISK_REC_WITH_TMS)) { pvr_detach_part(tms_part, PVR_TMS_ONLY_DISK); } if ((STRCMP(rec_part, part_path) == 0) && ((cur_pvr_mode == PVR_DISK_ONLY_REC) || (cur_pvr_mode == PVR_DISK_REC_WITH_TMS))) { pvr_detach_part(rec_part, PVR_REC_ONLY_DISK); } } if (register_part) { pvr_reg_info.init_list = (part_mode != PVR_TMS_ONLY_DISK); #ifndef PVR_SPEED_PRETEST_DISABLE /* --doy, 2011-3-21*/ pvr_reg_info.check_speed = 1; #endif //osal_task_sleep(1000); // wait for pvr cleanup finished if (pvr_register((UINT32)&pvr_reg_info, 0) != SUCCESS) { ret = -1; } } STRCPY(sys_data->tms_disk, part_path); if(!STRCMP(sys_data->rec_disk, part_path)) STRCPY(sys_data->rec_disk, ""); sys_data_save(0); break; default: break; } api_pvr_adjust_tms_space(); pvr_get_HDD_info(&hdd_info); api_pvr_check_level(&hdd_info); return ret; }
void win_pvr_setting_right_key(POBJECT_HEAD pObj,UINT8 id) { SYSTEM_DATA* p_sys_data=sys_data_get(); UINT8 input; struct dvr_HDD_info hdd_info; switch(id) { case MENU_PVR_SETTING_TIMESHIFT: sys_data_set_tms(!sys_data_get_tms()); win_pvr_setting_timeshift_set_string(sys_data_get_tms()); OSD_TrackObject(pObj,C_UPDATE_ALL); if (sys_data_get_tms()) { api_pvr_adjust_tms_space(); if (pvr_get_HDD_info(&hdd_info) && (hdd_info.tms_size == 0)) { pvr_set_tms_size(hdd_info.free_size); // set free space to tms pvr_get_HDD_info(&hdd_info); } } else { pvr_set_tms_size(0); pvr_get_HDD_info(&hdd_info); } api_pvr_check_level(&hdd_info); break; case MENU_PVR_SETTING_JUMP: input = sys_data_get_jumpstep(); input = (input+1)%5; sys_data_set_jumpstep(input); win_pvr_setting_jumpstep_set_string(input); OSD_TrackObject(pObj,C_UPDATE_ALL); break; case MENU_PVR_SETTING_SCRAMBLE_MODE: input = sys_data_get_scramble_record_mode(); input = !input; sys_data_set_scramble_record_mode(input); pvr_r_set_scramble_ext(!input); win_pvr_setting_scramble_record_mode_set_string(input); OSD_TrackObject(pObj,C_UPDATE_ALL); break; case MENU_PVR_SETTING_TS_FILE_SIZE: input = sys_data_get_record_ts_file_size(); input = (input+1)%4; sys_data_set_record_ts_file_size(input); win_pvr_setting_ts_file_size_set_string(input); OSD_TrackObject(pObj,C_UPDATE_ALL); break; case MENU_PVR_SETTING_TMS_2_REC: sys_data_set_tms2rec(!sys_data_get_tms2rec()); win_pvr_setting_tms2rec_set_string(sys_data_get_tms2rec()); OSD_TrackObject(pObj,C_UPDATE_ALL); break; case MENU_PVR_SETTING_TTX_SUBT: input = sys_data_get_record_ttx_subt(); input = !input; sys_data_set_record_ttx_subt(input); win_pvr_setting_ttx_subt_set_string(input); OSD_TrackObject(pObj,C_UPDATE_ALL); break; case MENU_PVR_SETTING_REC_NUM: sys_data_set_rec_num(3 - sys_data_get_rec_num()); win_pvr_setting_rec_num_set_string(sys_data_get_rec_num()); OSD_TrackObject(pObj,C_UPDATE_ALL); break; case MENU_PVR_SETTING_REC_PS: sys_data_set_rec_ps(!sys_data_get_rec_ps()); win_pvr_setting_record_ps_set_string(sys_data_get_rec_ps()); OSD_TrackObject(pObj,C_UPDATE_ALL); break; default: break; } }
/* Un-register pvr volume if necessary * 1. it should be call when disk detach */ static int pvr_disk_detach_proc() { struct statvfs buf; enum PVR_DISKMODE pvr_mode; char rec_vol[16], tms_vol[16], initing_vol[16]; UINT8 initing_vol_usage = 0; BOOL b_pvr_part_detached = FALSE; DM_DEBUG("Enter %s() ...\n", __FUNCTION__); if (pvr_part_init_task_id != OSAL_INVALID_ID) { DM_DEBUG("pvr partition %s is initializing to %d\n", l_pvr_reg_info.mount_name, l_pvr_reg_info.disk_usage); STRCPY(initing_vol, l_pvr_reg_info.mount_name); initing_vol_usage = l_pvr_reg_info.disk_usage; } else { initing_vol[0] = 0; } pvr_mode = pvr_get_cur_mode(rec_vol, tms_vol); BOOL rec_vol_detach = ((rec_vol[0] != 0) && (fs_statvfs(rec_vol, &buf) < 0)); BOOL tms_vol_detach = ((tms_vol[0] != 0) && (fs_statvfs(tms_vol, &buf) < 0)); if ((initing_vol[0] != 0) && (fs_statvfs(initing_vol, &buf) < 0)) { if (STRCMP(initing_vol, rec_vol) != 0) { DM_DEBUG("pvr detach initializing volume %s\n", initing_vol); pvr_detach_part(initing_vol, initing_vol_usage); b_pvr_part_detached = TRUE; } initing_vol[0] = 0; } if (rec_vol_detach || tms_vol_detach) { /* a disk that used by pvr is detached */ if (STRCMP(rec_vol, tms_vol) == 0) { DM_DEBUG("pvr detach %s\n", rec_vol); pvr_detach_part(rec_vol, PVR_REC_AND_TMS_DISK); b_pvr_part_detached = TRUE; } else { if (rec_vol_detach) { DM_DEBUG("pvr detach %s\n", rec_vol); pvr_detach_part(rec_vol, PVR_REC_ONLY_DISK); b_pvr_part_detached = TRUE; } if (tms_vol_detach) { DM_DEBUG("pvr detach %s\n", tms_vol); pvr_detach_part(tms_vol, PVR_TMS_ONLY_DISK); b_pvr_part_detached = TRUE; } } } if ((pvr_get_cur_mode(rec_vol, tms_vol) == PVR_DISK_INVALID) && (initing_vol[0] == 0)) { DM_DEBUG("pvr detach all volume, do clean up!\n"); api_pvr_clear_up_all(); } if (b_pvr_part_detached) { struct dvr_HDD_info hdd_info; pvr_get_HDD_info(&hdd_info); api_pvr_check_level(&hdd_info); } return 0; }