UINT8 gyca_delmail_one_from_ram(UINT8 index) { UINT8 ret = 0xff; UINT8 i; gyca_mutex_lock(); ret = gyca_getmail_num_from_ram(); if((flashbuf[index].flg != 1) || (index>ret-1)) { gyca_mutex_unlock(); return 1; } //gyca_mutex_lock(); if(index == (ret-1)) MEMSET(&flashbuf[index], 0, sizeof(gycamail)); else { for(i=index; i<ret; i++) { MEMCPY(&flashbuf[i], &flashbuf[i+1], sizeof(gycamail)); } MEMSET(&flashbuf[i], 0, sizeof(gycamail)); } gyca_write_enable_time = osal_get_tick(); gyca_write_enable = TRUE; gyca_mutex_unlock(); return 0; }
static void as_dvbs_preset_tuning(void *param) { struct as_tuning_param *atp; T_NODE *tp; atp = (struct as_tuning_param *)param; if (atp->finish == TRUE) { return; } while ((INT32)atp->pos <= as_info->tp_nr) { tp = &as_info->xp; if (get_tp_by_id(as_info->tp_id[atp->pos], tp)!=SUCCESS) { break; } atp->nit_enable = as_info->tp_nit[atp->pos]; atp->si_enable = as_info->tp_si[atp->pos]; atp->tp_id = as_info->tp_id[atp->pos++]; atp->timeout = as_frontend_tuning(as_info, tp) + osal_get_tick(); return; } atp->finish = TRUE; }
UINT8 cas_flash_status_check() { INT32 ret; UINT32 param,flash_cmd; UINT32 tick = cas_flashwrite_time; //record the last time that libcore write UINT32 pdwStartAddr = CAS_flash_start_addr; struct sto_device *sto_flash_dev = NULL; if (FALSE == cas_flashwrite_enable) return CAS_FAIL; if (osal_get_tick()-tick < CAS_FLASHWRITE_INTERVAL) return CAS_FAIL; CAS_NVM_PRINTF("%s: Start to write flash!\n", __FUNCTION__); sto_flash_dev = (struct sto_device *)dev_get_by_type(NULL, HLD_DEV_TYPE_STO); if(NULL == sto_flash_dev) { CAS_NVMERR_PRINTF("TFSTBCA_WriteBuffer: dev_get_by_name failed!\n"); return CAS_FAIL; } if (sto_open(sto_flash_dev) != SUCCESS) { CAS_NVMERR_PRINTF("%s: sto_open failed!\n", __FUNCTION__); return CAS_FAIL; } if(sto_flash_dev->totol_size <= 0x400000) { param = pdwStartAddr << 10; param |= CAS_CHUNK_SIZE >> 10; flash_cmd = STO_DRIVER_SECTOR_ERASE; }
UINT32 cmd_process_monitor(unsigned int argc, unsigned char *argv[]) { UINT32 data[6 * 2]; UINT32 i, j = 0x00000003; UINT32 ptm = osal_get_tick(); MEMSET(data, 0, sizeof(data)); pan_display(g_pan_dev, "Pdon", 4); // done, all ok! for(i = 0; i<6; i++) { UINT32 pm_finish = 0; UINT32 pm2_finish = 0; *((volatile UINT32 *)0xb8000300) = (j|i<<16); while(1) { pm_finish = *((volatile UINT32 *)0xb8000304); pm2_finish = *((volatile UINT32 *)0xb800030c); if(1==(pm_finish&0x1)&&1==(pm2_finish&0x1)) break; // if((osal_get_tick()-ptm) > 2000) break; osal_task_sleep(1); } data[2 * i] = pm_finish>>16; data[2 * i + 1] = pm2_finish>>16; //libc_printf("PM_COUNT: \t=\t 0x%04x, \tPM_SEL = \t%d\n", pm_finish>>16, i); //libc_printf("PM_COUNT2: \t=\t 0x%04x, \tPM_SEL2 = \t%d\n", pm2_finish>>16, i); *((volatile UINT32 *)0xb8000300) = 0; } SendDataPacket(0, (unsigned char *)data, sizeof(data)); return 0; }
static void as_blind_tuning_multisym_multiqam(void *param,UINT8 i,UINT8 j) { struct as_tuning_param *atp = (struct as_tuning_param *)param; UINT32 pre_pos = atp->pos; if (atp->finish == TRUE) return; while(atp->pos <= atp->limit) { if(as_info->param.as_sym>0) nim_channel_change(as_info->nim, atp->pos, as_info->param.as_sym, as_info->param.as_constellation); //libc_printf("pos:%d,sym:%d,qam:%d\n",atp->pos, as_info->param.as_sym,as_info->param.as_constellation); atp->timeout = osal_get_tick()+ AS_TUNE_TIMEOUT; #ifndef DVBC_INDIA if((i%SCAN_SYMBOL_NUM)==(SCAN_SYMBOL_NUM-1)&&(j%SCAN_QAM_NUM)==(SCAN_QAM_NUM-1)) atp->pos += atp->step; if ((atp->pos>DVBC_FREQUENCY_VHF_HIGH)&&(atp->pos<DVBC_FREQUENCY_UHF_LOW)) { if (atp->limit>=DVBC_FREQUENCY_UHF_LOW) atp->pos=DVBC_FREQUENCY_UHF_LOW; else return; } #else if((i%SCAN_SYMBOL_NUM)==(SCAN_SYMBOL_NUM-1)&&(j%SCAN_QAM_NUM)==(SCAN_QAM_NUM-1)) { #ifndef DVBC_FP if(atp->pos> (DVBC_FREQUENCY_VHF_HIGH-800)&&atp->pos< DVBC_FREQUENCY_UHF_LOW) { atp->pos +=700; atp->pos = atp->pos -(atp->pos-DVBC_FREQUENCY_VHF_HIGH)%700; //if((atp->pos-DVBC_FREQUENCY_VHF_LOW)%700 != 0) //atp->pos +=700; } else #endif atp->pos += atp->step; if(atp->limit<atp->pos) return; } #endif if (pre_pos<atp->limit) { as_info->param.as_handler(ASM_TYPE_PROGRESS, 99*(pre_pos+(i*atp->step/SCAN_SYMBOL_NUM)-atp->start)/(atp->limit-atp->start+atp->step)); } return; } atp->finish = TRUE; }
/*DVBC and DVBT blind scan in fact is tp scan by bandwith step*/ static void as_dvbc_blind_tuning(void *param) { struct as_tuning_param *atp = (struct as_tuning_param *)param; union ft_xpond xpond; //If Blind Scan Already Finished, then Return if (atp->finish == TRUE) { return; } MEMSET(&xpond, 0, sizeof(xpond)); xpond.common.type = atp->ft_type = as_info->param.as_frontend_type; if(atp->ft_type==FRONTEND_TYPE_C) { xpond.c_info.frq = atp->pos; xpond.c_info.sym = as_info->param.ft.c_param.sym; xpond.c_info.modulation = as_info->param.ft.c_param.constellation; } else if(atp->ft_type==FRONTEND_TYPE_T) { } while(atp->pos <= atp->limit) { frontend_set_nim(as_info->nim, NULL, &xpond, 1); if((atp->ft_type==FRONTEND_TYPE_C) &&(as_info->param.as_handler)) { as_info->param.as_handler(ASM_TYPE_INC_TRANSPONDER,atp->pos); } atp->timeout = osal_get_tick()+ AS_TUNE_TIMEOUT_C; atp->pos += atp->step; if(atp->ft_type==FRONTEND_TYPE_C) { if ((atp->pos>DVBC_FREQUENCY_VHF_HIGH)&&(atp->pos<DVBC_FREQUENCY_UHF_LOW)) { if (atp->limit >= DVBC_FREQUENCY_UHF_LOW) { atp->pos = DVBC_FREQUENCY_UHF_LOW; } else { return; } } } if ((atp->pos < atp->limit) && (as_info->param.as_handler)) { as_info->param.as_handler(ASM_TYPE_PROGRESS, 99*(atp->pos-atp->start)/(atp->limit-atp->start)); } return; } atp->finish = TRUE; }
UINT8 gyca_delmail_all_from_ram(void) { gyca_mutex_unlock(); MEMSET(flashbuf, 0, sizeof(gycamail)*GYCA_EMAIL_MAX_CNT); gyca_write_enable_time = osal_get_tick(); gyca_write_enable = TRUE; gyca_mutex_unlock(); return 0; }
//char* net_buf_ptr=0; //BOOL url_lock_flag_1=FALSE; FILE *url_open(const char *path, unsigned char* buffer, unsigned int buf_len, unsigned int offset) { UINT32 handle; FILE *tmp = NULL; UINT32 time_tick, loop_cnt=0x0000ffff; BOOL bret =FALSE; g_sock = -1; NET_DOWNLOAD_STATUS=FALSE; libc_printf("url_open !!!!\n"); libnet_set_wait_flag(TRUE); u2b_play_video_handle=libnet_download_to_pecache((char *)path, buffer, buf_len, offset); time_tick = osal_get_tick(); while(osal_get_tick()-time_tick < url_timeout) { if(get_net_dl_status()) { //url connet is ok bret= TRUE; break; } if(abort_url_read) { abort_url_read=FALSE; break; } } if(bret) { tmp=(FILE*)MALLOC(sizeof(FILE)); if(tmp) { MEMSET(tmp, 0, sizeof(FILE)); LIBNET_DEBUG("url_open OK !!!!\n"); } } else { LIBNET_DEBUG("url_open time out %d ms!!!!\n",url_timeout); } LIBNET_DEBUG("url_open return\n"); return tmp; }
BOOL storage_switch_sd_ide_proc(UINT8 sd_active, BOOL first) { char hint[64]; UINT8 back_saved; win_popup_choice_t choice = WIN_POP_CHOICE_YES; if (first) { UINT32 cnt = osal_get_tick(); win_compopup_init(WIN_POPUP_TYPE_SMSG); sprintf(hint, "Please wait %s initial",sd_active?"SD Card":"Hard Disk"); win_compopup_set_msg(hint, NULL, 0); win_compopup_open(); storage_switch_sd_ide(sd_active, TRUE); while(osal_get_tick()-cnt < 2000) { osal_task_sleep(10); } win_msg_popup_close(); return TRUE; } else { win_compopup_init(WIN_POPUP_TYPE_OKNO); sprintf(hint, "Are you sure to switch to %s?",sd_active?"SD Card":"Hard Disk"); win_compopup_set_msg(hint, NULL, 0); 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("Please wait, maybe it will take a long time!", NULL, 0); win_compopup_open(); storage_switch_sd_ide(sd_active, first); sys_data_set_sd_ide_statue(sd_active); win_msg_popup_close(); return TRUE; } } return FALSE; }
unsigned long double_time(void) { unsigned long tm; #ifdef WIN32 tm = GetTickCount(); #else tm = osal_get_tick(); #endif return tm; }
RET_CODE win_image_file_play(char *file, unsigned char rotate) { int ret_val; struct image_slideshow_effect effect; effect.mode = osal_get_tick() % 5 + 1; switch(effect.mode) { case M_SHUTTERS: effect.mode_param.shuttles_param.direction = osal_get_tick() % 2; effect.mode_param.shuttles_param.time = 100; break; case M_BRUSH: effect.mode_param.brush_param.direction = osal_get_tick() % 2; effect.mode_param.brush_param.time = 3; break; case M_SLIDE: effect.mode_param.slide_param.direction = osal_get_tick() % 2; effect.mode_param.slide_param.time = 10; break; case M_RANDOM: effect.mode_param.random_param.type = osal_get_tick() % 3; effect.mode_param.random_param.time = 1; break; case M_FADE: effect.mode_param.fade_param.type = 0; effect.mode_param.fade_param.time = 0; break; default: break; } ret_val = image_decode_ex(file, IMAGEDEC_FULL_SRN, 0, 0, 720, 576, rotate, &effect); if(ret_val < 0) { return RET_FAILURE; } return RET_SUCCESS; }
/*DVBC and DVBT blind scan in fact is tp scan by bandwith step*/ static void as_blind_tuning(void *param) { #ifndef DVBC_AUTOSCAN_MULTI_SYMBOL_QAM struct as_tuning_param *atp = (struct as_tuning_param *)param; if (atp->finish == TRUE) return; while(atp->pos <= atp->limit) { #if (SYS_PROJECT_FE == PROJECT_FE_DVBC) nim_channel_change(as_info->nim, atp->pos, as_info->param.as_sym, as_info->param.as_constellation); atp->timeout = osal_get_tick()+ AS_TUNE_TIMEOUT; #ifndef DVBC_INDIA atp->pos += atp->step; if ((atp->pos>DVBC_FREQUENCY_VHF_HIGH)&&(atp->pos<DVBC_FREQUENCY_UHF_LOW)) { if (atp->limit>=DVBC_FREQUENCY_UHF_LOW) atp->pos=DVBC_FREQUENCY_UHF_LOW; else return; } #else #ifndef DVBC_FP if(atp->pos> (DVBC_FREQUENCY_VHF_HIGH-800)&&atp->pos< DVBC_FREQUENCY_UHF_LOW) { atp->pos +=700; atp->pos = atp->pos -(atp->pos-DVBC_FREQUENCY_VHF_HIGH)%700; //if((atp->pos-DVBC_FREQUENCY_VHF_LOW)%700 != 0) //atp->pos +=700; } else #endif atp->pos += atp->step; if(atp->limit<atp->pos) return; #endif #endif if (atp->pos<atp->limit) as_info->param.as_handler(ASM_TYPE_PROGRESS, 99*(atp->pos-atp->start)/(atp->limit-atp->start)); return; } atp->finish = TRUE; #endif }
/*------------------------Internal function----------------------------------*/ UINT8 CAS_WriteEnable() { UINT32 temp; #ifdef CAS_NVM_MEMONLY return CDCA_FALSE; #else if (FALSE ==CAS_write_enable) return CDCA_FALSE; else { temp = osal_get_tick() - CAS_flashwrite_time; if (temp >CAS_FLASHWRITE_INTERVAL) return CDCA_TRUE; else return CDCA_FALSE; } #endif }
UINT8 gyca_setmail_one_oldstatus_ram(UINT8 index) { UINT8 ret = 0xff; gyca_mutex_lock(); ret = gyca_getmail_num_from_ram(); if((flashbuf[index].flg != 1) || (index>ret-1)) { gyca_mutex_unlock(); return 1; } //gyca_mutex_lock(); flashbuf[index].status = 0; gyca_write_enable_time = osal_get_tick(); gyca_write_enable = TRUE; gyca_mutex_unlock(); return 0; }
UINT8 gyca_addmail_one_to_ram(T_CAMailInfo *data) { UINT8 i; UINT8 ret = 0xff; if(!MEMCMP(&premail, data, sizeof(T_CAMailInfo))) return 1; gyca_mutex_lock(); ret = gyca_getmail_num_from_ram(); if(GYCA_EMAIL_MAX_CNT == ret) { gyca_mutex_unlock(); return 2; } i = ret ; //gyca_mutex_lock(); flashbuf[i].flg = 1; flashbuf[i].status = 1; MEMCPY(&flashbuf[i].info, data, sizeof(T_CAMailInfo)); gyca_write_enable_time = osal_get_tick(); gyca_write_enable = TRUE; gyca_mutex_unlock(); return 0; }
HRESULT DVTSTBCA_WriteDataBuffer(const char * pStartAddr, long * plDataLen, const BYTE * pData) { INT32 ret; UINT32 offset = 0;//StartAddr = (UINT32)pStartAddr; CAS_NVM_PRINTF("%s: pStartAddr=%08x, *plDataLen:%08x\n", __FUNCTION__, pStartAddr, *plDataLen); if((pStartAddr == NULL)||(pData == NULL)||(*plDataLen == 0)) { CAS_NVMERR_PRINTF("Err: %s parameter error!\n", __FUNCTION__); return CAS_FAIL; } if(((UINT32)pStartAddr-CAS_flash_start_addr+*plDataLen)> CAS_FLASH_MAXSIZE) { CAS_NVMERR_PRINTF("Err: %s overflow!\n", __FUNCTION__); *plDataLen = CAS_FLASH_MAXSIZE; } offset= (UINT32)pStartAddr-CAS_flash_start_addr; MEMCPY(&cas_flash_buff[offset], pData, *plDataLen); cas_flashwrite_enable = TRUE; cas_flashwrite_time = osal_get_tick(); return CAS_SUCCESS; }
/* description : auto scan main routine for command parsing and switching.*/ static void as_main(struct mid27_cmd *cmd) { INT32 i; INT32 j; INT32 ret; INT32 method; INT32 tp_nr; INT32 as_method; UINT16 sat_id; T_NODE *tp; S_NODE *sat; UINT8 dmx_mode_need_resume = 0; UINT32 dmx_dma_mode; as_update_event_t event_handler; extern BOOL cc_stop_channel(BOOL, BOOL); #ifdef BASE_TP_HALF_SCAN_SUPPORT if(cmd->cmd_type == MID27_CMD_AS_HL_START) { as_bastp_halfscan(cmd); return; } #endif AS_PRINTF("start time stamp = %d\n", osal_get_tick()); cc_stop_channel(0, 0); /*get default nim, for dual nim projects, will get correct nim later below*/ as_info->nim = (struct nim_device *)dev_get_by_id(HLD_DEV_TYPE_NIM, 0); as_info->dmx = (struct dmx_device *)dev_get_by_id(HLD_DEV_TYPE_DMX, 0); //fix BUG20874: init psi info to avoid dmx changed by video playing #ifdef BASE_TP_HALF_SCAN_SUPPORT psi_info_init(as_info->dmx, as_info->nim, (void *)__MM_PSI_START_ADDR, 280*1024); #else psi_info_init(as_info->dmx, as_info->nim,(void *)__MM_PSI_START_ADDR, 180*1024); #endif dmx_io_control(as_info->dmx, DMX_CHK_BUF_MODE, (UINT32)&dmx_dma_mode); if(dmx_dma_mode == DMX_DIVIDED_BUFF_MODE) { dmx_io_control(as_info->dmx, DMX_SWITCH_TO_UNI_BUF, 0); dmx_mode_need_resume = 1; } tp = &as_info->cur_tp; sat = &as_info->cur_sat; as_method = as_info->param.as_method; event_handler = as_info->param.as_handler; event_handler(ASM_TYPE_PROGRESS, AS_PROGRESS_SCANSTART); for(i = 0; i<as_info->sat_nr; i++) { sat_id = as_info->sat_id[i]; db_search_create_tp_view(sat_id); #if (SYS_PROJECT_FE == PROJECT_FE_DVBS||SYS_PROJECT_FE == PROJECT_FE_DVBS2) event_handler(ASM_TYPE_SATELLITE, sat_id); get_sat_by_id(sat_id, sat); /*get correct nim*/ as_select_nim(sat); #endif AS_DUMP_SAT(sat); if ((AS_METHOD_FFT == as_method)||(AS_METHOD_MULTI_FFT == as_method)) { method = AS_METHOD_FFT; } else { as_info->tp_nr = 0; MEMSET(as_info->tp_nit, 0,AS_MODULE_MAX_T_NUM*sizeof(UINT8)); if ((AS_METHOD_TP == as_method)||(AS_METHOD_TP_PID == as_method) ||(AS_METHOD_NIT_TP== as_method)||(AS_METHOD_NVOD == as_method)) { as_info->tp_nr = 1; as_info->tp_id[0] = as_info->param.as_from; if (AS_METHOD_NIT_TP == as_method) event_handler(ASM_TYPE_INC_TRANSPONDER, 0); } else if ((AS_METHOD_SAT_TP == as_method)||(AS_METHOD_NIT == as_method) ||(AS_METHOD_MULTI_TP == as_method)||(AS_METHOD_MULTI_NIT == as_method) ||(AS_METHOD_NVOD_MULTI_TP==as_method)) { tp_nr = get_tp_num_sat(sat_id); for(j=0; j<tp_nr; j++) { get_tp_at(sat_id, j, tp); if (FALSE == tp_sanity_check(as_info,tp, sat)) continue; AS_DUMP_TP(tp); #ifdef NVOD_FEATURE if(tp->nvod_flg==1) #endif as_info->tp_id[as_info->tp_nr++] = tp->tp_id; if (AS_MODULE_MAX_T_NUM == as_info->tp_nr) AS_PRINTF("%s: tp exceed AS_MODULE_MAX_T_NUM!\n", __FUNCTION__); } } if ((AS_METHOD_NIT == as_method)||(AS_METHOD_NIT_TP == as_method) ||(AS_METHOD_MULTI_NIT == as_method)) { MEMSET(as_info->tp_nit, 1, as_info->tp_nr); } method = AS_METHOD_TP; } ret = as_scan(sat_id, sat, method, as_method != AS_METHOD_NVOD); update_data( ); if (ret||as_info->stop_scan_signal) break; } #ifdef KAON_SAVE_USE event_handler(ASM_TYPE_PROGRESS, AS_PROGRESS_SCANOVER|(prog_num << 16)); #else event_handler(ASM_TYPE_PROGRESS, AS_PROGRESS_SCANOVER); #endif dmx_io_control(as_info->dmx, CLEAR_STOP_GET_SECTION, 0); if(dmx_mode_need_resume) dmx_io_control(as_info->dmx, DMX_SWITCH_TO_DVI_BUF, 0); sie_open(as_info->dmx, MAX_FILTER_NUMBER, NULL, 0); osal_task_dispatch_off(); if ((as_info->param.as_method == AS_METHOD_NVOD) ||(as_info->param.as_method==AS_METHOD_NVOD_MULTI_TP)) { nim_io_control(as_info->nim, NIM_DRIVER_STOP_ATUOSCAN, 0); as_info = NULL; AS_PRINTF("end time stamp = %d\n", osal_get_tick()); mid27_declare_cmd_finish(MID27_FLG_AS_NVOD); } else { nim_io_control(as_info->nim, NIM_DRIVER_STOP_ATUOSCAN, 0); as_info = NULL; AS_PRINTF("end time stamp = %d\n", osal_get_tick()); } osal_task_dispatch_on(); }
static void as_dvbc_blind_tuning(void *param) { struct as_tuning_param *atp = (struct as_tuning_param *)param; union ft_xpond xponder; UINT32 cnt_finish=0, cnt_band=0, cnt_ttl=0,index=0; //If Blind Scan Already Finished, then Return if(dvbc_bs_freq_end) atp->finish = TRUE; if (atp->finish == TRUE) { return; } MEMSET(&xponder, 0, sizeof(xponder)); xponder.common.type = atp->ft_type = as_info->param.as_frontend_type; if(atp->ft_type==FRONTEND_TYPE_C) { atp->ft.c_param.sym = as_info->param.ft[atp->ft_count].c_param.sym; atp->ft.c_param.constellation = as_info->param.ft[atp->ft_count].c_param.constellation; xponder.c_info.frq = atp->pos; xponder.c_info.sym = atp->ft.c_param.sym; // as_info->param.ft.c_param.sym; xponder.c_info.modulation = atp->ft.c_param.constellation; // as_info->param.ft.c_param.constellation; } //libc_printf("as_dvbc_blind_tuning frq:%d sym:%d modulation:%d timeout:%d\n", // xponder.c_info.frq, xponder.c_info.sym, xponder.c_info.modulation, atp->timeout); frontend_set_nim(as_info->nim, NULL, &xponder, 1); if(as_info->param.as_handler) { //as_info->param.as_handler(ASM_TYPE_SCANNING_INFO,1+c_srh_tp_step+((atp->cur_band&0x7f)<<8)); for(index = 0; index < atp->band_count; index++) { cnt_band = 1+ atp->band_group_param[index].end_ch_no - atp->band_group_param[index].start_ch_no; //if(as_info->param.ft_count > 1) cnt_band *= as_info->param.ft_count; cnt_ttl += cnt_band; if(atp->cur_band>index) cnt_finish += cnt_band; } if(c_srh_tp_step != 0) { if(atp->ft_count == as_info->param.ft_count-1) cnt_finish += c_srh_tp_step; else cnt_finish += (c_srh_tp_step - (as_info->param.ft_count-1 - atp->ft_count)); } as_info->param.as_handler(ASM_TYPE_PROGRESS, 100*cnt_finish/cnt_ttl); } c_srh_tp_step++; if(as_info->param.ft_count > 1) { if(atp->cur_band < atp->band_count) { if(atp->ft_count < as_info->param.ft_count-1) { atp->ft_count++; //atp->ft.c_param.sym = as_info->param.ft[atp->ft_count].c_param.sym; //atp->ft.c_param.constellation = as_info->param.ft[atp->ft_count].c_param.constellation; atp->timeout = osal_get_tick()+ AS_TUNE_TIMEOUT_C; return; } else { atp->ft_count = 0; // atp->ft.c_param.sym = as_info->param.ft[0].c_param.sym; // atp->ft.c_param.constellation = as_info->param.ft[0].c_param.constellation; } } } while(atp->cur_band < atp->band_count) { if(atp->pos+atp->step <= atp->limit) { atp->timeout = osal_get_tick()+ AS_TUNE_TIMEOUT_C; atp->pos += atp->step; if(atp->start == atp->limit && atp->step==0) // only one frequency in this band atp->step = 1; return; } atp->cur_band++; if(atp->cur_band < atp->band_count) { atp->start = atp->band_group_param[atp->cur_band].start_freq; atp->limit = atp->band_group_param[atp->cur_band].end_freq; atp->step = atp->band_group_param[atp->cur_band].freq_step; atp->pos = atp->start- atp->step; c_srh_tp_step = 0; } } //if ((atp->pos < atp->limit) && (as_info->param.as_handler)) //{ // as_info->param.as_handler(ASM_TYPE_PROGRESS, 99*(atp->pos-atp->start)/(atp->limit-atp->start)); //} atp->timeout += AS_TUNE_TIMEOUT_C; // for the last frequency dvbc_bs_freq_end = 1; }
static INT32 as_enum_scan(UINT16 sat_id, UINT16 type, psi_tuning_t tuning_fn) { BOOL db_ret = TRUE; INT32 ret = 0; INT32 func_ret = 0; UINT32 search_scheme; UINT8 lock_stat; struct as_tuning_param *atp = &as_info->atp; as_update_event_t update_event = as_info->param.as_handler; AS_PRINTF("start at %d\n", osal_get_tick()); if(update_event != NULL) { update_event(ASM_TYPE_PROGRESS, AS_PROGRESS_SCANSTART+1); } //Set First TP Info if(tuning_fn != NULL) { tuning_fn(atp); } //TP Scan Loop while((atp->finish == FALSE) && (ret == 0)) { //Set Search Scheme, that is whether Search NIT or not search_scheme = as_info->param.as_prog_attr; if (atp->nit_enable) { if (atp->si_enable) { search_scheme |= P_SEARCH_NIT; } else { search_scheme = P_SEARCH_NIT; } } AS_PRINTF("id=%d, t_nr=%d\n",atp->tp_id, as_info->tp_nr); lock_stat = 0; //Show New TP for DVB-S by Upper Layer if ((tuning_fn == as_dvbs_preset_tuning) && (update_event)) { update_event(ASM_TYPE_ADD_TRANSPONDER, atp->tp_id); } //Try to Lock Signal do { nim_get_lock(as_info->nim, &lock_stat); if((lock_stat) || (as_info->stop_scan_signal)) { break; } osal_task_sleep(1); } while((INT32)osal_get_tick() < (INT32)atp->timeout); AS_PRINTF("lock stat = %d\n", lock_stat); if (!as_info->stop_scan_signal) { //If Lock Signal, then Search Prog in this TP if (lock_stat) { //Scan from Start Frq to End Frq for DVB-C and DVB-T if (type == ATP_TYPE_STEP) { //For DVB-C, Set TP Info according to as_info if(as_info->param.as_frontend_type == FRONTEND_TYPE_C) { db_ret = dvbc_alloc_transponder(as_info, atp, &as_info->xp, sat_id); } if (db_ret != TRUE) { ret = 1; break; } //Show New TP for DVB-C and DVB-T by Upper Layer if(update_event) { update_event(ASM_TYPE_ADD_TRANSPONDER, atp->tp_id);//notify ap show tp } } //Prog Search in this TP #if (defined(SUPPORT_MTILINGUAL_SERVICE_NAME)) psi_module_init(as_info->dmx, as_info->nim, (void *)__MM_PSI_START_ADDR, 400*1024); #else psi_module_init(as_info->dmx, as_info->nim, (void *)__MM_PSI_START_ADDR, 180*1024); #endif func_ret = psi_search_start(sat_id, atp->tp_id, search_scheme, as_info->param.as_p_add_cfg, psi_callback, tuning_fn, atp); if (SI_STOFULL == func_ret) { ret= 1; } } //Not Lock Signal, then Switch to next TP else { #ifdef NIT_AUTO_SEARCH_SUPPORT if(tuning_fn== as_dvbc_blind_tuning && b_found_nit_tp) {// because doing auto scan,so atp->pos must > AS_MIN_CAB_FREQUENCY and we need to change to nit search. if(atp->pos > AS_MIN_CAB_FREQUENCY) atp->pos = 0; tuning_fn = as_dvbs_preset_tuning; } #endif tuning_fn(atp); } } if (as_info->stop_scan_signal || ret) { break; } //Show Scan Progress by Upper Layer if ((!as_info->tp_nit[0]) && (type == ATP_TYPE_DBASE) && (update_event)) { update_event(ASM_TYPE_PROGRESS, atp->pos*99/(as_info->tp_nr+2)); } } #ifdef NIT_AUTO_SEARCH_SUPPORT b_found_nit_tp = FALSE; // nit search done #endif AS_PRINTF("end at %d\n", osal_get_tick()); return ret; }
/* description : auto scan main routine for command parsing and switching.*/ static void as_main(struct libpub_cmd *cmd) { INT32 i, j; INT32 ret; INT32 method; INT32 tp_nr; INT32 as_method; UINT16 sat_id; UINT8 dmx_mode_need_resume = 0; UINT32 dmx_dma_mode; as_update_event_t event_handler; struct dmx_device *dmx = NULL; T_NODE *tp = &as_info->cur_tp;; S_NODE *sat = &as_info->cur_sat; struct ft_antenna *antenna = &as_info->antenna; AS_PRINTF("start time stamp = %d\n", osal_get_tick()); as_method = as_info->param.as_method; event_handler = as_info->param.as_handler; if(event_handler!=NULL) { event_handler(ASM_TYPE_PROGRESS, AS_PROGRESS_SCANSTART); } //Select DMX dmx = dev_get_by_id(HLD_DEV_TYPE_DMX, 0); if(dmx == NULL) { AS_PRINTF("%s(): select dmx failed!\n"); return; } as_info->dmx = dmx; //fix BUG20874: init psi info to avoid dmx changed by video playing psi_info_init(as_info->dmx, as_info->nim, (void *)__MM_PSI_START_ADDR, 180*1024); //Check and Switch Buffer Mode of Dmx (From Divided Buffer To Union Buffer) dmx_io_control(as_info->dmx, DMX_CHK_BUF_MODE, (UINT32)&dmx_dma_mode); if(dmx_dma_mode == DMX_DIVIDED_BUFF_MODE) { dmx_io_control(as_info->dmx, DMX_SWITCH_TO_UNI_BUF, 0); dmx_mode_need_resume = 1; } for(i = 0; i<as_info->sat_nr; i++) { //For Each Satellite, Create its TP View, Set Antenna sat_id = as_info->sat_id[i]; db_search_create_tp_view(sat_id); if(event_handler != NULL) { event_handler(ASM_TYPE_SATELLITE, sat_id); } //Set Antenna Information according to Satellite Information MEMSET(sat, 0, sizeof(S_NODE)); get_sat_by_id(sat_id, sat); AS_DUMP_SAT(sat); MEMSET(antenna, 0, sizeof(struct ft_antenna)); sat2antenna(sat, antenna); as_info->dual_LNB = (antenna->lnb_high>0) && (antenna->lnb_low>0) && (antenna->lnb_high != antenna->lnb_low); as_info->voltage_ctrl = (antenna->pol==LNB_POL_H)||(antenna->pol==LNB_POL_V); //>>> Unicable begin if(antenna->lnb_type == LNB_CTRL_UNICABLE) { as_info->nim_para.unicable = 1; as_info->nim_para.Fub = antenna->unicable_freq; } else as_info->nim_para.unicable = 0; //<<< Unicable end //select right nim and dmx as_select_nim(sat); if(as_info->nim ==NULL) { AS_PRINTF("%s(): select nim failed!\n"); continue; } //for 29E 2-Tuner the dmx path may not same as default!! tsi_dmx_src_select(TSI_DMX_0, TSI_TS_A); //blind scan if((AS_METHOD_FFT==as_method)||(AS_METHOD_MULTI_FFT==as_method)) { method = AS_METHOD_FFT; } else { as_info->tp_nr = 0; MEMSET(as_info->tp_nit, 0,AS_MODULE_MAX_T_NUM*sizeof(UINT8)); //single tp scan if((AS_METHOD_TP==as_method)||(AS_METHOD_TP_PID==as_method) ||(AS_METHOD_NIT_TP==as_method)||(AS_METHOD_NVOD==as_method)) { as_info->tp_nr = 1; as_info->tp_id[0] = as_info->param.as_from; if ((AS_METHOD_NIT_TP==as_method)&&(event_handler!=NULL)) { event_handler(ASM_TYPE_INC_TRANSPONDER, 0); } } //multi tp scan else if((AS_METHOD_SAT_TP==as_method)||(AS_METHOD_NIT==as_method) ||(AS_METHOD_MULTI_TP==as_method)||(AS_METHOD_MULTI_NIT==as_method) ||(AS_METHOD_NVOD_MULTI_TP==as_method)) { tp_nr = get_tp_num_sat(sat_id); for(j=0; j<tp_nr; j++) { get_tp_at(sat_id, j, tp); if(as_info->param.as_frontend_type==FRONTEND_TYPE_S) { if(dvbs_tp_sanity_check(as_info->voltage_ctrl,tp, sat)==FALSE) { continue; } } else if(as_info->param.as_frontend_type == FRONTEND_TYPE_C) { if(dvbc_tp_sanity_check(FALSE, tp, NULL) == FALSE) { continue; } } AS_DUMP_TP(tp); #ifdef NVOD_FEATURE if((AS_METHOD_NVOD_MULTI_TP == as_method) && (tp->nvod_flg == 1)) #endif { as_info->tp_id[as_info->tp_nr++] = tp->tp_id; } if (AS_MODULE_MAX_T_NUM == as_info->tp_nr) { AS_PRINTF("%s: tp exceed AS_MODULE_MAX_T_NUM!\n", __FUNCTION__); } } } if((AS_METHOD_NIT==as_method)||(AS_METHOD_NIT_TP==as_method) ||(AS_METHOD_MULTI_NIT==as_method)) { MEMSET(as_info->tp_nit, 1, as_info->tp_nr); } method = AS_METHOD_TP; } ret = as_scan(sat_id, sat, method, 0); update_data( ); if (ret || as_info->stop_scan_signal) { break; } } //Show Scan Over by Upper Layer if(event_handler != NULL) { event_handler(ASM_TYPE_PROGRESS, AS_PROGRESS_SCANOVER); } dmx_io_control(as_info->dmx, CLEAR_STOP_GET_SECTION, 0); //Switch Buffer Mode of Dmx (From Union Buffer to Divided Buffer) if(dmx_mode_need_resume) { dmx_io_control(as_info->dmx, DMX_SWITCH_TO_DVI_BUF, 0); } sie_open(as_info->dmx, MAX_FILTER_NUMBER, NULL, 0); osal_task_dispatch_off(); nim_io_control(as_info->nim, NIM_DRIVER_STOP_ATUOSCAN, 0); as_info = NULL; AS_PRINTF("end time stamp = %d\n", osal_get_tick()); osal_task_dispatch_on(); }
static INT32 as_enum_scan(UINT16 sat_id, UINT16 type, psi_tuning_t tuning_fn) { BOOL db_ret = TRUE; INT32 ret = 0; UINT32 search_scheme; UINT8 lock_stat; struct as_tuning_param *atp = &as_info->atp; as_update_event_t update_event = as_info->param.as_handler; AS_PRINTF("start at %d\n", osal_get_tick()); if(update_event != NULL) { update_event(ASM_TYPE_PROGRESS, AS_PROGRESS_SCANSTART+1); } //Set First TP Info if(tuning_fn != NULL) { tuning_fn(atp); } //TP Scan Loop while((atp->finish == FALSE) && (ret == 0)) { //Set Search Scheme, that is whether Search NIT or not search_scheme = as_info->param.as_prog_attr; if (atp->nit_enable) { search_scheme |= P_SEARCH_NIT; } AS_PRINTF("id=%d, t_nr=%d\n",atp->tp_id, as_info->tp_nr); lock_stat = 0; //Show New TP for DVB-S by Upper Layer if ((tuning_fn == as_dvbs_preset_tuning) && (update_event)) { update_event(ASM_TYPE_ADD_TRANSPONDER, atp->tp_id); } //Try to Lock Signal do { nim_get_lock(as_info->nim, &lock_stat); if((lock_stat) || (as_info->stop_scan_signal)) { break; } osal_task_sleep(1); } while((INT32)osal_get_tick() < (INT32)atp->timeout); // fix a bug of 3501B tp scan, it need more time. (3501 SSI to SPI 8bit mode, for some coderate). if(atp->ft_type == FRONTEND_TYPE_S) { osal_task_sleep(1200); } AS_PRINTF("lock stat = %d\n", lock_stat); if (!as_info->stop_scan_signal) { //If Lock Signal, then Search Prog in this TP if (lock_stat) { //Scan from Start Frq to End Frq for DVB-C and DVB-T if (type == ATP_TYPE_STEP) { //For DVB-C, Set TP Info according to as_info if(as_info->param.as_frontend_type == FRONTEND_TYPE_C) { db_ret = dvbc_alloc_transponder(as_info, atp, &as_info->xp, sat_id); } else if(as_info->param.as_frontend_type == FRONTEND_TYPE_T) { } if (db_ret != TRUE) { ret = 1; break; } //Show New TP for DVB-C and DVB-T by Upper Layer if(update_event) { update_event(ASM_TYPE_ADD_TRANSPONDER, atp->tp_id); } } //Prog Search in this TP psi_module_init(as_info->dmx, as_info->nim, (void *)__MM_PSI_START_ADDR, 180*1024); if (SI_STOFULL == psi_search_start(sat_id, atp->tp_id, search_scheme, as_info->param.as_p_add_cfg, psi_callback, tuning_fn, atp)) { ret= 1; } } //Not Lock Signal, then Switch to next TP else { tuning_fn(atp); } } if (as_info->stop_scan_signal || ret) { break; } //Show Scan Progress by Upper Layer if ((!as_info->tp_nit[0]) && (type == ATP_TYPE_DBASE) && (update_event)) { update_event(ASM_TYPE_PROGRESS, atp->pos*99/(as_info->tp_nr+2)); } } AS_PRINTF("end at %d\n", osal_get_tick()); return ret; }
static int SetSSIGap(unsigned int argc, unsigned char *argv[]) { UINT32 gap; struct nim_device *nim_dev = dev_get_by_id(HLD_DEV_TYPE_NIM, nim_id); if (argc != 2) { SH_PRINTF("Usage: SetPara <clk>\n"); return -1; } else if(nim_dev == NULL) { SH_PRINTF("Nim1 status error\n"); return -1; } if(strcasecmp("gap",argv[1])) { gap = ATOI(&(argv[1][3])); nim_io_control(nim_dev, NIM_DRIVER_CHANGE_TS_GAP, gap); } else { SH_PRINTF("parameter error\n"); return -3; } #if 1//path for lock delay UINT8 lock; UINT32 pre_tick = osal_get_tick(); while((osal_get_tick()-pre_tick)>=SSI_GAP_TIMEOUT) { nim_get_lock(nim_dev,&lock); if(lock) break; osal_delay(30); } #endif LIB_ASH_OC('S'); LIB_ASH_OC('e'); LIB_ASH_OC('t'); LIB_ASH_OC(' '); LIB_ASH_OC('S'); LIB_ASH_OC('S'); LIB_ASH_OC('I'); LIB_ASH_OC(' '); LIB_ASH_OC('G'); LIB_ASH_OC('a'); LIB_ASH_OC('p'); LIB_ASH_OC(' '); LIB_ASH_OC('t'); LIB_ASH_OC('o'); LIB_ASH_OC(' '); LIB_ASH_OC('g'); LIB_ASH_OC('a'); LIB_ASH_OC('p'); if(gap<10) { LIB_ASH_OC((gap + '0')); } else { LIB_ASH_OC(((UINT8)gap/10 + '0')); LIB_ASH_OC(((UINT8)gap%10 + '0')); } LIB_ASH_OC('\r'); LIB_ASH_OC('\n'); reset_perflag(); return 0; }
int ogg_decoder(const char *ogg_file, const char *pcm_file) { OggVorbis_File vf; int eof = 0; int current_section; int tm1, tm2; FILE *fin, *fout; //open the ogg file fin = fopen(ogg_file, "rb"); if (fin == NULL) { libc_printf("open the ogg file: %s failed!\n", ogg_file); return -1; } //create the pcm file #if 0 fout = fopen(pcm_file, "wb"); if (fout == NULL) { libc_printf("open the ogg file: %s failed!\n", pcm_file); return -1; } #endif if (ov_open(fin, &vf, NULL, 0) < 0) { libc_printf("Input does not appear to be an Ogg bitstream.\n"); return -1; } /* Throw the comments plus a few lines about the bitstream we're decoding */ { char **ptr = ov_comment(&vf, -1)->user_comments; vorbis_info *vi = ov_info(&vf, -1); while (*ptr) { libc_printf("%s\n", *ptr); ++ptr; } libc_printf("\nBitstream is %d channel, %ldHz\n", vi->channels, vi->rate); libc_printf("\nDecoded length: %ld samples\n", (long)ov_pcm_total(&vf, -1)); libc_printf("Encoded by: %s\n\n", ov_comment(&vf, -1)->vendor); } tm1 = osal_get_tick(); while (!eof) { long ret = ov_read(&vf, pcmout, sizeof(pcmout), ¤t_section); if (ret == 0) { libc_printf("file end!\n"); /* EOF */ eof = 1; } else if (ret < 0) { libc_printf("error!!!\n"); /* error in the stream. Not a problem, just reporting it in case we (the app) cares. In this case, we don't. */ } else { /* we don't bother dealing with sample rate changes, etc, but you'll have to*/ //fwrite(pcmout, ret, 1, fout); } } /* cleanup */ ov_clear(&vf); tm2 = osal_get_tick(); libc_printf("decoding time: %dms [%d ~ %d]\n", tm2 - tm1, tm1, tm2); //fclose(fout); libc_printf("Done.\n"); return(0); }
static PRESULT slide_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; UINT16 slide_interval; PlayListLoopType loop_type; struct osd_device *osd_dev; struct OSDRect pRect; struct OSDPara OpenPara; UINT32 region_id =0; VACTION unact; FileInfo file_node; char image_name[FULL_PATH_SIZE]; int next_image; static UINT8 timer_start_flag = 0; UINT32 file_idx; SYSTEM_DATA *sys_cfg = sys_data_get(); switch(event) { case EVN_PRE_OPEN: imageslide_timer_id = OSAL_INVALID_ID; imageslide_proc_id = OSAL_INVALID_ID; if(from_imagepreview == TRUE) { imageslide_pause_state = IMG_PAUSE_STATE; } else { imageslide_pause_state = IMG_UNPAUSE_STATE; } win_imageslide_showpause(); api_set_preview_vpo_color(FALSE); vpo_aspect_mode((struct vpo_device *)dev_get_by_id(HLD_DEV_TYPE_DIS,0), TV_4_3, NORMAL_SCALE); #ifdef DUAL_VIDEO_OUTPUT vpo_aspect_mode((struct vpo_device *)dev_get_by_id(HLD_DEV_TYPE_DIS,1), TV_4_3, NORMAL_SCALE); #endif break; case EVN_POST_OPEN: image_rot_ang = ANG_ORI; loop_type = image_slide_setting.bRepeat ? PLAY_LIST_REPEAT : PlAY_LIST_SEQUENCE; set_play_list_info(cur_playlist_image,&cur_image_idx,&loop_type); get_file_from_play_list(cur_playlist_image, cur_image_idx, &file_node); win_get_fullname(image_name, file_node.path, file_node.name); // while(jpeg_decoder_task_not_over) // { // libc_printf("error condition!\n"); // osal_task_sleep(20); // } image_abort(); timer_slide = osal_get_tick(); win_image_file_play(image_name, image_rot_ang); slideidx_display(TRUE); decode_finish_flag = FALSE; break; case EVN_UNKNOWN_ACTION: unact = (VACTION)(param1>>16); ret = win_imageslide_unkown_act_proc(unact); break; case EVN_PRE_CLOSE: g_from_imageslide = TRUE; imagedec_ioctl(1, IMAGEDEC_IO_CMD_CLEAN_FRM, TRUE); //when quit win_slide, clean 2 frm buffer if(image_folderloop_flag == 1)//filelist { get_file_from_play_list(cur_playlist_image, cur_image_idx, &file_node); win_get_fullname(image_name, file_node.path, file_node.name); usblist_set_filelist_param(image_name); } image_abort(); ///* #ifdef DUAL_ENABLE #ifdef PNG_GIF_TEST pRect.uLeft =136; pRect.uTop = 40; pRect.uWidth = 1008;//OSD_MAX_WIDTH;//608; pRect.uHeight = 640;//OSD_MAX_HEIGHT;//430; OpenPara.eMode = OSD_HD_ARGB1555; OpenPara.uGAlpha = 0x0f; OpenPara.uGAlphaEnable = 0; OpenPara.uPalletteSel = 0; osd_dev = (struct osd_device *)dev_get_by_id(HLD_DEV_TYPE_OSD, 0); if (osd_dev != NULL) { OSDDrv_Close((HANDLE)osd_dev); //AD_GIF_PRINTF("%s() OSD_layer2 is closed!\n", __FUNCTION__); } OSDDrv_Open((HANDLE)osd_dev, &OpenPara); osal_task_sleep(20); //trans_color = OSD_GetTransColor(OpenPara.eMode,TRUE); OSDDrv_IoCtl((HANDLE)osd_dev, OSD_IO_SET_TRANS_COLOR, 0x00); OSDDrv_CreateRegion((HANDLE)osd_dev, region_id, &pRect, NULL); pRect.uLeft = pRect.uTop = 0; OSDDrv_RegionFill((HANDLE)osd_dev,region_id,&pRect,0x00); OSDDrv_ShowOnOff((HANDLE)osd_dev, TRUE); #endif #endif //*/ api_stop_timer(&imageslide_timer_id); api_stop_timer(&imageslide_proc_id); timer_start_flag = 0; imageslide_timer_id = OSAL_INVALID_ID; imageslide_proc_id = OSAL_INVALID_ID; win_set_image_multiview_firstidx(); sys_cfg = sys_data_get(); sys_data_set_display_mode(&(sys_cfg->avset)); OSD_ClearObject((POBJECT_HEAD)&imageslide_idx,C_UPDATE_ALL); OSD_ClearObject((POBJECT_HEAD)&imageslide_pause,C_UPDATE_ALL); OSD_ClearObject((POBJECT_HEAD)&decode_txt_progress,C_UPDATE_ALL); OSD_ClearObject((POBJECT_HEAD)&decode_bmp_progress,C_UPDATE_ALL); break; case EVN_POST_CLOSE: image_restore_vpo_rect();//TODO break; case EVN_MSG_GOT: if(param1 == CTRL_MSG_SUBTYPE_CMD_STO && param2 == USB_STATUS_OVER) { //storage_dev_mount_hint(1); file_list_check_storage_device(FALSE, FALSE); } else if(param1 == CTRL_MSG_SUBTYPE_STATUS_IMAGEOVER) { if(param2 > timer_slide) { image_abort(); } else { libc_printf("slide @@@@@@@@@@@@@@ es case\n"); break; } decode_finish_flag = TRUE; if(imageslide_pause_state == IMG_UNPAUSE_STATE) { slide_interval = (image_slide_setting.uTime_gap * 1000); if(0 != slide_interval) imageslide_timer_id = api_start_timer("IMAGESLIDE",slide_interval,win_imageslide_handler); else { imageslide_pause_state = IMG_PAUSE_STATE; win_imageslide_showpause(); } } } else if (param1 == CTRL_MSG_SUBTYPE_STATUS_IMGTOOVER) // timer timeouts { //TODO: play next // while(jpeg_decoder_task_not_over) // { // libc_printf("\n%%%%%%%%%%%%%%%%%%%%%%%%%\n"); // osal_task_sleep(20); // } image_abort(); next_image = get_next_index_from_play_list(cur_playlist_image); if (next_image != -1) { cur_image_idx = next_image; set_play_list_info(cur_playlist_image,&cur_image_idx,NULL); get_file_from_play_list(cur_playlist_image, cur_image_idx, &file_node); win_get_fullname(image_name, file_node.path, file_node.name); win_image_file_play(image_name, image_rot_ang); decode_finish_flag = FALSE; ap_send_msg(CTRL_MSG_SUBTYPE_CMD_UPDATE_VIEW, 0, TRUE); } else { ap_send_msg(CTRL_MSG_SUBTYPE_CMD_EXIT, 0,TRUE); } } else if(param1 == CTRL_MSG_SUBTYPE_CMD_EXIT) { if(from_imagepreview == TRUE) back_to_filelist = TRUE; ret = PROC_LEAVE; } else if(param1 == CTRL_MSG_SUBTYPE_CMD_UPDATE_VIEW) { slideidx_display(TRUE); ret = PROC_LOOP; } else if(param1 == CTRL_MSG_SUBTYPE_STATUS_MP3OVER) { win_play_next_music_ex(); } else if(param1 == CTRL_MSG_SUBTYPE_STATUS_PROC_UPDATE) { OSD_SetBitmapContent(&decode_bmp_progress, loading_bmp_ids[proc_cnt]); OSD_DrawObject((POBJECT_HEAD)&decode_bmp_progress,C_UPDATE_ALL); proc_cnt ++; if(proc_cnt >= LOADING_MAX) proc_cnt = 0; } if ((param1 == CTRL_MSG_SUBTYPE_STATUS_JPEG_DEC_PROCESS) || (param1 == CTRL_MSG_SUBTYPE_STATUS_IMAGEOVER)) { if ((param2 < 100) && (param1 == CTRL_MSG_SUBTYPE_STATUS_JPEG_DEC_PROCESS)) { loading_progress = (param2 * LOADING_MAX)/100; if (loading_progress > LOADING_MAX - 1) loading_progress = LOADING_MAX - 1; if(0 == timer_start_flag) { imageslide_proc_id = OSAL_INVALID_ID; imageslide_proc_id = api_start_cycletimer("SLIDE_PROC", 200, win_imageslide_proc_handler); timer_start_flag = 1; } // OSD_SetBitmapContent(&decode_bmp_progress, loading_bmp_ids[loading_progress]); // OSD_DrawObject((POBJECT_HEAD)&decode_bmp_progress,C_UPDATE_ALL); } else if((param2 >= 100) || (param1 == CTRL_MSG_SUBTYPE_STATUS_IMAGEOVER)) { OSD_ClearObject((POBJECT_HEAD)&decode_bmp_progress,C_UPDATE_ALL); api_stop_timer(&imageslide_proc_id); imageslide_proc_id = OSAL_INVALID_ID; timer_start_flag = 0; proc_cnt = 0; // imageslide_proc_id = OSAL_INVALID_ID; } } break; default: break; } return ret; }
PRESULT ap_cas_fingerprint_proc(UINT8 newinfo) { static UINT8 disp_flag = 0, pos_flag = 0; static UINT32 duration = 6000, xpos = 450; POBJECT_HEAD top_handle = menu_stack_get_top(); static UINT8 finger_nuf[11] = {1,0}; UINT8 i; if (1 == newinfo) { /*qjzheng 20100427 BUG1005, 解决指纹内容显示错误,len由原来的10改成11,finger_nuf[0]不应该在这里直接赋值*/ //finger_nuf[0]=0; cas_get_fingerprint_req(finger_nuf,11); pos_flag = 1;//need to display in a new x position //finger_start_time =0; #if 0 libc_printf("finger_nuf %d pos:%d content: ",finger_nuf[0], finger_nuf[1]); for(i=2; i<11;i++) libc_printf("0x%x, ",finger_nuf[i]); libc_printf("\n"); #endif } else if( (2 == newinfo) && (0 == finger_nuf[0]) ) { libc_printf("to clear finger print\n"); show_finger_print(0, NULL,50+finger_nuf[1]); return; } else if( 3 == newinfo ) { libc_printf("to clear finger buf\n"); finger_nuf[0] =1; //show_finger_print(0, NULL,50+finger_nuf[1]); //return; } #if 0 if ((MAIN_MENU_HANDLE == menu_stack_get(0)) ||(EPG_HANDLE == menu_stack_get_top()) ||(PROG_DETAIL_HANDLE == menu_stack_get_top()) ||(LIT_CHAN_LIST_HANDLE == menu_stack_get_top()) ||(CHAN_LIST_HANDLE == menu_stack_get_top()) ||(SEARCHN_HANDLE == menu_stack_get_top()) ||(WELCOME_MENU_HANDLE == menu_stack_get_top()) ||(AUDIO_HANDLE == menu_stack_get_top()) ||(SUBT_HANDLE == menu_stack_get_top()) ||(IPPV_HANDLE == menu_stack_get_top())) { return; } #else if ((NULL != menu_stack_get(0)) &&(CHANNEL_BAR_HANDLE != top_handle) &&((POBJECT_HEAD)&g_win_volume != top_handle )) { return 1; } #endif if (0 == finger_nuf[0]) { if(1 == pos_flag) { MEMSET(smcstr, 0, sizeof(smcstr)); sprintf(smcstr, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",finger_nuf[1],/*finger_nuf[1] --> THE POS*/ finger_nuf[2],finger_nuf[3],finger_nuf[4],finger_nuf[5],finger_nuf[6], finger_nuf[7],finger_nuf[8],finger_nuf[9],finger_nuf[10]); finger_start_time = osal_get_tick(); finger_end_time = finger_start_time + 10*1000; pos_flag = 0; } if (osal_get_tick() < finger_end_time) { show_finger_print(1,smcstr, 50+finger_nuf[1]); //libc_printf("to disp %s\n",smcstr); } else { finger_nuf[0] = 1; finger_end_time = 0; finger_start_time = 0; show_finger_print(0, NULL,50+finger_nuf[1]); } } else if(1 == finger_nuf[0]) { finger_nuf[0] =2; show_finger_print(0, NULL,50+finger_nuf[1]); } return 0; }
static INT32 as_enum_scan(UINT16 sat_id, UINT16 type) { INT32 db_ret; INT32 ret=0; UINT32 search_scheme; UINT8 lock_stat; struct as_tuning_param *atp = &as_info->atp; UINT8 i,j; psi_tuning_t tuning_fn = NULL; as_update_event_t update_event = as_info->param.as_handler; AS_PRINTF("start at %d\n", osal_get_tick()); update_event(ASM_TYPE_PROGRESS, AS_PROGRESS_SCANSTART+1); MEMSET(atp, 0, sizeof(as_info->atp)); if (type == ATP_TYPE_DBASE) { if (as_info->tp_nr<=0) { AS_PRINTF("no preset transponder on this satellite!\n"); return ret; } tuning_fn = as_preset_tuning; } else if (type == ATP_TYPE_STEP) { #if (SYS_PROJECT_FE == PROJECT_FE_DVBC) if (dvbc_init_search_param(atp, as_info->param.as_from,as_info->param.as_to) == FALSE) return ret; #endif tuning_fn = as_blind_tuning; } #ifndef DVBC_AUTOSCAN_MULTI_SYMBOL_QAM tuning_fn(atp); #else if(type == ATP_TYPE_DBASE) tuning_fn(atp); autoscan_symbol[0]=as_info->param.as_sym; autoscan_symbol[1]=as_info->param.as_sym2; autoscan_symbol[2]=as_info->param.as_sym3; #endif while((atp->finish==FALSE)&&(ret==0)) { search_scheme = as_info->param.as_prog_attr; if (atp->nit_enable) search_scheme |= P_SEARCH_NIT; AS_PRINTF("id=%d, t_nr=%d\n",atp->tp_id, as_info->tp_nr); lock_stat = 0; if (tuning_fn == as_preset_tuning) update_event(ASM_TYPE_ADD_TRANSPONDER, atp->tp_id); #ifdef DVBC_AUTOSCAN_MULTI_SYMBOL_QAM if(type == ATP_TYPE_STEP) { for(i = 0; i < SCAN_SYMBOL_NUM; i++) { for(j=0;j<SCAN_QAM_NUM;j++) { as_info->param.as_sym = autoscan_symbol[i]; as_info->param.as_constellation=autoscan_qam[j]; if(as_info->param.as_sym==0&&((i != SCAN_SYMBOL_NUM-1)||(j!=SCAN_QAM_NUM-1))) continue; as_blind_tuning_multisym_multiqam(atp,i,j); lock_stat = 0; do { nim_get_lock(as_info->nim, &lock_stat); if((lock_stat)||(as_info->stop_scan_signal)) { break; } osal_task_sleep(1); }while((INT32)osal_get_tick()<(INT32)atp->timeout); AS_PRINTF("lock stat = %d\n", lock_stat); if (!as_info->stop_scan_signal) { if (lock_stat) { db_ret = dvbc_alloc_transponder(as_info, atp, &as_info->xp, sat_id); if (db_ret != TRUE) { ret = 1; break; } update_event(ASM_TYPE_ADD_TRANSPONDER, atp->tp_id); #ifdef BASE_TP_HALF_SCAN_SUPPORT psi_module_init(as_info->dmx, as_info->nim,(void *)__MM_PSI_START_ADDR, 280*1024); #else psi_module_init(as_info->dmx, as_info->nim,(void *)__MM_PSI_START_ADDR, 180*1024); #endif if (SI_STOFULL == psi_search_start(sat_id, atp->tp_id, search_scheme, as_info->param.as_p_add_cfg, psi_callback, tuning_fn, atp)) {ret= 1;} break; } } } if(lock_stat) break; } if((i < SCAN_SYMBOL_NUM-1||j<SCAN_QAM_NUM-1)) { if(atp->pos < atp->limit) as_blind_tuning_multisym_multiqam(atp,SCAN_SYMBOL_NUM-1,SCAN_QAM_NUM-1); else if(atp->pos >= atp->limit) atp->finish=TRUE; } } else #endif { do { nim_get_lock(as_info->nim, &lock_stat); if((lock_stat)||(as_info->stop_scan_signal)) break; osal_task_sleep(1); } while((INT32)osal_get_tick()<(INT32)atp->timeout); AS_PRINTF("lock stat = %d\n", lock_stat); if (!as_info->stop_scan_signal) { if (lock_stat) { #if (SYS_PROJECT_FE == PROJECT_FE_DVBC) if (type == ATP_TYPE_STEP) { db_ret = dvbc_alloc_transponder(as_info,atp, &as_info->xp, sat_id); if (db_ret != TRUE) { ret = 1; break; } update_event(ASM_TYPE_ADD_TRANSPONDER, atp->tp_id); } #endif #ifdef BASE_TP_HALF_SCAN_SUPPORT psi_module_init(as_info->dmx, as_info->nim,(void *)__MM_PSI_START_ADDR, 280*1024); #else psi_module_init(as_info->dmx, as_info->nim,(void *)__MM_PSI_START_ADDR, 180*1024); #endif if (SI_STOFULL == psi_search_start(sat_id,atp->tp_id, search_scheme, as_info->param.as_p_add_cfg,psi_callback, tuning_fn, atp)) { ret= 1; } } else tuning_fn(atp); } } if (as_info->stop_scan_signal||ret) break; if ((!as_info->tp_nit[0])&&(type == ATP_TYPE_DBASE)) update_event(ASM_TYPE_PROGRESS,atp->pos*99/(as_info->tp_nr+2)); } AS_PRINTF("end at %d\n", osal_get_tick()); return ret; }
PRESULT ap_cas_mail_detitle_proc() { static UINT8 flag = 1; static UINT8 flag2 = 0; //static UINT8 dtl_flag = 1; //static UINT8 dtl_flag2 = 0; static UINT32 time_flag=0; #if 0 if ((MAIN_MENU_HANDLE == menu_stack_get(0)) ||(EPG_HANDLE == menu_stack_get_top()) ||(LIT_CHAN_LIST_HANDLE == menu_stack_get_top()) ||(CHAN_LIST_HANDLE == menu_stack_get_top()) ||(SEARCHN_HANDLE == menu_stack_get_top()) ||(WELCOME_MENU_HANDLE == menu_stack_get_top()) ||(MAIL_HANDLE == menu_stack_get(0)) ||(SUBT_HANDLE == menu_stack_get_top()) ||(AUDIO_HANDLE == menu_stack_get_top()))//BY LMC { return; } #else if ((NULL != menu_stack_get(0)) &&(CHANNEL_BAR_HANDLE != menu_stack_get_top()) &&(VOLUMEBAR_HANDLE != menu_stack_get_top()) /* alfred.wu 20100313 OSD的测试还没有开始先关闭掉这些可以冲突的地方 等以后发现了Bug再打开*/ &&(AUDIO_HANDLE != menu_stack_get_top()) &&(FIND_HANDLE != menu_stack_get_top())) { return; } #endif //first Email proc if (Email_IconHide == MAIL_ICON_STATUS) { if (flag2) { /*alfred.wu 函数在win_mail_icon.c中*/ ShowBMailOSDOnOff(0); flag2 = 0; } } else if (Email_New == MAIL_ICON_STATUS) { ShowBMailOSDOnOff(1); flag2 = 1; } else if (Email_SpaceExhaust == MAIL_ICON_STATUS) { ShowBMailOSDOnOff(flag); if(osal_get_tick()-time_flag>500) { time_flag = osal_get_tick(); flag = !flag; } flag2 = 1; } }
extern void CDSTBCA_ScrSetCW(CDCA_U16 wEcmPID, const CDCA_U8* pbyOddKey, const CDCA_U8* pbyEvenKey, CDCA_U8 byKeyLen, CDCA_BOOL bTapingEnabled) { UINT8 i; UINT16 ret; UINT8 rating; UINT8 pin[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; struct dmx_device *dmx_dev; #ifdef CHCHG_TICK_PRINTF libc_printf("####CHCHG %s():line%d, ecmPID0x%x, tick=%d\n", __FUNCTION__,__LINE__, wEcmPID,osal_get_tick()); #endif CAS_DMX_PRINTF("STBCA_ScrSetCW:ecmPID:%04x @%d\n", wEcmPID,osal_get_tick()); dmx_dev = (struct dmx_device *)dev_get_by_type(NULL, HLD_DEV_TYPE_DMX); if(dmx_dev == NULL) { CAS_DMXERR_PRINTF("STBCA_ScrSetCW: Dev_get_by_type error!\n"); return; } if(RET_SUCCESS!=dmx_io_control(dmx_dev, DMX_IS_TS_ENTER_CSA, 0)) dmx_io_control(dmx_dev, DMX_BYPASS_CSA, 0); // CAS_DMX_PRINTF("Odd : "); // CAS_DMX_DUMP(pbyOddKey, byKeyLen); // CAS_DMX_PRINTF("Even: "); // CAS_DMX_DUMP(pbyEvenKey, byKeyLen); for(i=0; i<2;i++) { if(cas_ecm_pid.uniform_ecm_pid == wEcmPID) { dmx_cfg_cw(dmx_dev, DES_VIDEO, 2, (UINT32 *)pbyEvenKey); dmx_cfg_cw(dmx_dev, DES_VIDEO, 3, (UINT32 *)pbyOddKey); dmx_cfg_cw(dmx_dev, DES_AUDIO, 2, (UINT32 *)pbyEvenKey); dmx_cfg_cw(dmx_dev, DES_AUDIO, 3, (UINT32 *)pbyOddKey); dmx_cfg_cw(dmx_dev, DES_TTX, 2, (UINT32 *)pbyEvenKey); dmx_cfg_cw(dmx_dev, DES_TTX, 3, (UINT32 *)pbyOddKey); dmx_cfg_cw(dmx_dev, DES_SUP, 2, (UINT32 *)pbyEvenKey); dmx_cfg_cw(dmx_dev, DES_SUP, 3, (UINT32 *)pbyOddKey); } else if(cas_ecm_pid.video_ecm_pid == wEcmPID) { dmx_cfg_cw(dmx_dev, DES_VIDEO, 2, (UINT32 *)pbyEvenKey); dmx_cfg_cw(dmx_dev, DES_VIDEO, 3, (UINT32 *)pbyOddKey); } else if(cas_ecm_pid.audio_ecm_pid == wEcmPID) { dmx_cfg_cw(dmx_dev, DES_AUDIO, 2, (UINT32 *)pbyEvenKey); dmx_cfg_cw(dmx_dev, DES_AUDIO, 3, (UINT32 *)pbyOddKey); } else if(cas_ecm_pid.ttx_ecm_pid == wEcmPID) { dmx_cfg_cw(dmx_dev, DES_TTX, 2, (UINT32 *)pbyEvenKey); dmx_cfg_cw(dmx_dev, DES_TTX, 3, (UINT32 *)pbyOddKey); } else if(cas_ecm_pid.subt_ecm_pid == wEcmPID) { dmx_cfg_cw(dmx_dev, DES_SUP, 2, (UINT32 *)pbyEvenKey); dmx_cfg_cw(dmx_dev, DES_SUP, 3, (UINT32 *)pbyOddKey); } } return; }
*****************************************************************************/ static INT32 f_TC90512_channel_change(struct nim_device *dev, UINT32 freq, UINT32 bandwidth, UINT8 guard_interval, UINT8 fft_mode, UINT8 modulation, UINT8 fec, UINT8 usage_type, UINT8 inverse,UINT8 priority) { UINT8 data[6]; //51117-01Angus UINT32 temp; UINT8 ret_flag = SCAN_TIMEOUT;// LOCK_OK; UINT32 start_time, temp_time; struct nim_TC90512_private *dev_priv; //51117-01Angus UINT8 code_rate,Tuner_Retry=0,Demod_Retry=0,hier=0; UINT8 lock=0,i=0; dev_priv = (struct nim_TC90512_private *)dev->priv; UINT32 tuner_id = 0;//dev_priv->tuner_id; osal_flag_clear(nim_TC90512_flag, NIM_TC90512_CHECKING); NIM_TC90512_PRINTF("freq %d, bandwidth %d\n",freq,bandwidth); osal_flag_clear(nim_TC90512_flag,NIM_TC90512_SCAN_END); TC90512_CurChannelInfo->Frequency = freq; TC90512_CurChannelInfo->ChannelBW = bandwidth; dev_priv = dev->priv; /*-------------------------------------------------------------------------*/ /* (1)Set demod */ /*-------------------------------------------------------------------------*/ if(bandwidth!=6) return ERR_FAILED; //data[0]=0x00; // f_TC90512_write(dev->base_addr, 0x03, data,1); /*-------------------------------------------------------------------------*/ /* (2)Set Tuner & Channel Acquisition: */ /*-------------------------------------------------------------------------*/ //f_TC90512_PassThrough(dev,TRUE); if(dev_priv->Tuner_Control.nim_Tuner_Control(tuner_id, freq,bandwidth,FAST_TIMECST_AGC,data,_1st_i2c_cmd)!=SUCCESS) { NIM_TC90512_PRINTF("WRITE tuner fail\n"); } sembsl_tc90512_reset(dev); /*-------------------------------------------------------------------------*/ /* (3)WAIT TUNER_LOCK */ /*-------------------------------------------------------------------------*/ //start_time = osal_get_tick(); Tuner_Retry=0; do { //if((dev_priv->Tuner_Control.tuner_config.cChip)==Tuner_Chip_INFINEON|| (dev_priv->Tuner_Control.tuner_config.cChip)==Tuner_Chip_MAXLINEAR) Tuner_Retry++; //f_TC90512_PassThrough(dev,TRUE); if(dev_priv->Tuner_Control.nim_Tuner_Status(tuner_id ,&lock)==ERR_FAILUE) { NIM_TC90512_PRINTF("read tuner fail\n"); ; } //f_TC90512_PassThrough(dev,FALSE); NIM_TC90512_PRINTF("Wait Tuner:lock=%d\n ",lock); if(lock==1) break; else if(Tuner_Retry>5) { NIM_TC90512_PRINTF("Tuner_ULock\n"); osal_flag_set(nim_TC90512_flag,NIM_TC90512_SCAN_END); return ERR_FAILED; } }while(lock==0); /*-------------------------------------------------------------------------*/ /* (4)WAIT SYNC_LOCK */ /*-------------------------------------------------------------------------*/ start_time = osal_get_tick(); Demod_Retry=0; while(1) { f_TC90512_read(dev->base_addr,0x96,data,1); if(data[0]&0xE0) { ret_flag = LOCK_OK; break; } f_TC90512_read(dev->base_addr,0xB0,data,1); data[0]&=0x0F; /*Demod_Retry++; if((Demod_Retry>20) &&(data[0]<8)) { Demod_Retry=0; libc_printf("NO TP\n"); return ERR_FAILED; }*/ temp_time = osal_get_tick(); if(temp_time >= start_time ? ( temp_time - start_time >1024) : (start_time - temp_time < 0xFFFFFFFF - 1024)) { ret_flag = SCAN_TIMEOUT; NIM_TC90512_PRINTF("TC90512_SYMBOL_NO_LOCK data[0] =0x%x ,ret=%d \n", data[0],ret_flag); osal_flag_set(nim_TC90512_flag,NIM_TC90512_SCAN_END); return ERR_FAILED; } } /*-------------------------------------------------------------------------*/ /* (7)Status update: */ /*-------------------------------------------------------------------------*/ if (ret_flag == LOCK_OK || ret_flag == TPS_UNLOCK || ret_flag == FEC_UNLOCK) { TC90512_CurChannelInfo->Frequency = freq; TC90512_CurChannelInfo->ChannelBW = (UINT8)bandwidth; f_TC90512_getinfo(dev, &code_rate, &guard_interval, &fft_mode, &modulation,&hier); //MT352_CurChannelInfo->HPRates = code_rate; TC90512_CurChannelInfo->Guard= guard_interval; TC90512_CurChannelInfo->Mode= fft_mode; TC90512_CurChannelInfo->Modulation= modulation; TC90512_CurChannelInfo->FECRates = code_rate; TC90512_CurChannelInfo->Hierarchy = hier; TC90512_CurChannelInfo->Priority=priority; TC90512_CurChannelInfo->lock_status=1; NIM_TC90512_PRINTF("SUCCESS end_time = %d\n",osal_get_tick()-start_time); osal_flag_set(nim_TC90512_flag,NIM_TC90512_SCAN_END); return SUCCESS; } else { TC90512_CurChannelInfo->lock_status=0; NIM_TC90512_PRINTF("ERR_FAILED end_time = %d ret=%d\n",osal_get_tick()-start_time,ret_flag); osal_flag_set(nim_TC90512_flag,NIM_TC90512_SCAN_END); return ERR_FAILED; }
static PRESULT ci_info_event_proc(POBJECT_HEAD pObj, UINT32 msg_type, UINT32 msg_code) { PRESULT ret = PROC_LOOP; UINT16 msg; UINT8 cur_slot; UINT8 focusID; struct ci_menu * menu; struct ci_enquiry * enquiry; UINT8 *tmp_buf; static UINT32 m_enquiry_dlg_show_time; if((msg_type & 0xffff) == CTRL_MSG_SUBTYPE_STATUS_CI) { cur_slot = msg_code >> 16; msg = msg_code & 0xFFFF; if (win_ci_info_modal == WIN_CI_INFO_SHOW_AS_MODAL) ci_slot = cur_slot; switch(msg) { case API_MSG_MENU_UPDATE: if (win_ci_info_modal == WIN_CI_INFO_SHOW_AS_MODAL && win_ci_info_show == 0) { break; } if (ci_enquiry_dlg_show) break; if(reading_dlg_shown) reading_dlg_close(); tmp_buf = win_ci_get_tmp_buf(); menu = api_ci_get_menu((void*)(tmp_buf), CI_DATA_BUFFER_LEN, cur_slot); if(menu != NULL) { ci_info_set_menu(menu); ci_info_display(); } break; case API_MSG_ENQUIRY_UPDATE: tmp_buf = win_ci_get_tmp_buf(); enquiry = api_ci_get_enquiry((void*)tmp_buf, CI_DATA_BUFFER_LEN, cur_slot); if(enquiry != NULL) { #ifdef DVR_PVR_SUPPORT #ifdef CI_SLOT_DYNAMIC_DETECT if (win_ci_info_modal == WIN_CI_INFO_SHOW_AS_MODAL) cc_tsg_ci_slot_select(cur_slot); #endif #endif ci_info_set_enquiry(enquiry); if(reading_dlg_shown) reading_dlg_close(); ci_enquiry_dlg_open(); m_enquiry_dlg_show_time = osal_get_tick(); } break; case API_MSG_ENQUIRY_EXIT: if (ci_enquiry_dlg_show) { if (ci_enquiry_dlg_input == 1 || osal_get_tick() < (m_enquiry_dlg_show_time + 6000)) { break; } } ci_enquiry_dlg_close(); break; case API_MSG_CAMOUT: case API_MSG_DTC: case API_MSG_EXIT_MENU: if(reading_dlg_shown) reading_dlg_close(); ret = PROC_LEAVE; break; default: break; } }