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; }
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 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; }