예제 #1
0
/* API for Stop Auto Scan */
INT32 as_service_stop()
{
    	struct nim_device *nim = NULL;
    
    	osal_task_dispatch_off();
    	if (as_info != NULL)
    	{
        	as_info->stop_scan_signal = 1;
		if(as_info->nim!=NULL)
		{
			nim = as_info->nim;
       	 	nim_io_control(nim, NIM_DRIVER_STOP_ATUOSCAN, 1);
		}
    	}
    	osal_task_dispatch_on();

    	if (as_info != NULL)
    	{
        	psi_search_stop();//stop getting psi section
    	}

    	while (as_info)
        	osal_task_sleep(AS_MODULE_SLEEP_SLICE);

#ifndef __MM_VBV_START_ADDR
		if(NULL != as_buf)
		{
			FREE(as_buf);
			as_buf = NULL;
		}		
#endif

    	return SUCCESS;
}
예제 #2
0
static void ogg_seek(int time)
{
	if (ogg_file)
	{
		osal_task_dispatch_off();
		ogg_file->seek_to = time;
		osal_task_dispatch_on();
		//for sync
		while (ogg_file->seek_to != 0)
		{
			osal_task_sleep(10);
		}		
	}
}
예제 #3
0
static void ogg_stop(void)
{
	unsigned long									ogg_engine_flag;
	if (ogg_file && ogg_file->command != OGG_CMD_STOP)
	{
		osal_task_dispatch_off();
		ogg_file->command = OGG_CMD_STOP;
		osal_task_dispatch_on();
		
		osal_flag_wait(&ogg_engine_flag, ogg_engine.ogg_engine_flag_id, OGG_ENGINE_FLAG_MASK, OSAL_TWF_ORW | OSAL_TWF_CLR, OSAL_WAIT_FOREVER_TIME);
		
		ogg_engine.ogg_engine_task_id = OSAL_INVALID_ID;
		osal_flag_delete(ogg_engine.ogg_engine_flag_id);
		ogg_engine.ogg_engine_flag_id = OSAL_INVALID_ID;

	}
}
예제 #4
0
static void epg_list_service(eit_service_info_t *sp)
{
	eit_event_info_t *ep=sp->pf_event_header;
	osal_task_dispatch_off();

	soc_printf(" service: 0x%x\n  sch_cur_section[0]=%d\n  sch_cur_section[1]=%d \n",sp->service_id,sp->sch_cur_sec_num[0],sp->sch_cur_sec_num[1]);
	soc_printf("--------------------------------pf event------------------------------------------------------------------------------\n");
	while (ep!=NULL)
	{
		epg_printf_event(ep);
		ep=ep->next;
	}
	ep=sp->sch_event_header[0];
	soc_printf("--------------------------------schedule event table_id 0x50--------------------------------\n");
	while(ep!=NULL)
	{
		epg_printf_event(ep);
		ep=ep->next;
	}
	ep=sp->sch_event_header[1];
	soc_printf("--------------------------------schedule event table_id 0x51--------------------------------\n");
	while(ep!=NULL)
	{
		epg_printf_event(ep);
		ep=ep->next;
	}
	ep=sp->sch_event_header[2];
	soc_printf("--------------------------------schedule event table_id 0x52--------------------------------\n");
	while(ep!=NULL)
	{
		epg_printf_event(ep);
		ep=ep->next;
	}
	ep=sp->sch_event_header[3];
	soc_printf("--------------------------------schedule event table_id 0x53--------------------------------\n");
	while(ep!=NULL)
	{
		epg_printf_event(ep);
		ep=ep->next;
	}
	soc_printf("---------------------------------------------------------------------------------------------------------------------\n\n");
	osal_task_dispatch_on();

}
예제 #5
0
void cas_demxu_set_mv(struct restrict *mask_value, UINT8 index, UINT8* value, UINT8* mask, UINT8 mask_len)
{
	UINT8 i;
	if((mask_value->tb_flt_msk & (1<<index)) != 0)
	{
		CAS_DMX_PRINTF("cas_demxu_set_mv: filter will be resetted\n");
	}
	mask_value->mask_len = MAX_SEC_MASK_LEN;
	if(mask_len > MAX_SEC_MASK_LEN)
		mask_len = MAX_SEC_MASK_LEN;
	osal_task_dispatch_off();
	for(i=0; i<mask_len; i++)
	{
		mask_value->value[index][i] = value[i];
		mask_value->multi_mask[index][i] = mask[i];
	}
	mask_value->tb_flt_msk |= 1<<index;
	osal_task_dispatch_on();
	return;
}
예제 #6
0
INT32 as_service_stop()
{
    struct nim_device *nim = NULL;
    
    osal_task_dispatch_off();
    if (as_info != NULL)
    {
        nim = as_info->nim;
        as_info->stop_scan_signal = 1;
        nim_io_control(nim, NIM_DRIVER_STOP_ATUOSCAN, 1);
    }
    osal_task_dispatch_on();

    if (as_info != NULL)
    {
        psi_search_stop();
    }

    while (as_info)
        osal_task_sleep(AS_MODULE_SLEEP_SLICE);

    return SUCCESS;
}
예제 #7
0
파일: alloc.c 프로젝트: Janesak1977/ali3602
__ptr_t malloc (__malloc_size_t size)
{
	__ptr_t result;
	__malloc_size_t block, blocks, lastblocks, start;
	register __malloc_size_t i;
	struct list *next;

	/* ANSI C allows `malloc (0)' to either return NULL, or to return a
	valid address you can realloc and free (though not dereference).

	It turns out that some extant code (sunrpc, at least Ultrix's version)
	expects `malloc (0)' to return non-NULL and breaks otherwise.
	Be compatible.  */

///
//ddd_test();
///
//	libc_printf("%s RAMSIZE 0x%x heap_ptr 0x%x",__FUNCTION__,RAMSIZE,heap_ptr);
#if	0
	if (size == 0)
		return NULL;
#endif
	if (size == 0)
	{
		libc_printf("malloc size: 0, please check the application!\n");
	}
	osal_task_dispatch_off();

	if (__malloc_hook != NULL)
	{
		result =  (*__malloc_hook) (size);
		osal_task_dispatch_on();
		return result;
	}


	if (!__malloc_initialized)
		if (!initialize ())
		{
			osal_task_dispatch_on();
			return NULL;
		}

	if (size < sizeof (struct list))	// round up
		size = sizeof (struct list);

#ifdef SUNOS_LOCALTIME_BUG
	if (size < 16)
		size = 16;
#endif

	/* Determine the allocation policy based on the request size.  */
	if (size <= BLOCKSIZE / 2)	//2 need fragment of a block
	{
		/* Small allocation to receive a fragment of a block.
		Determine the logarithm to base two of the fragment size. */
		register __malloc_size_t log = 1;
		--size;
		while ((size /= 2) != 0)
			++log;

		/* Look in the fragment lists for a
		free fragment of the desired size. */
		next = _fraghead[log].next;
		if (next != NULL)
		{
			/* There are free fragments of this size.
			Pop a fragment out of the fragment list and return it.
			Update the block's nfree and first counters. */
			result = (__ptr_t) next;
			next->prev->next = next->next;
			if (next->next != NULL)
				next->next->prev = next->prev;
			block = BLOCK (result);
			if (--_heapinfo[block].busy.info.frag.nfree != 0)
				_heapinfo[block].busy.info.frag.first = (unsigned long int)
														((unsigned long int) ((char *) next->next - (char *) NULL)
														 % BLOCKSIZE) >> log;

			/* Update the statistics.  */
			++_chunks_used;
			_bytes_used += 1 << log;
			--_chunks_free;
			_bytes_free -= 1 << log;
		}
		else
		{
예제 #8
0
static void search_callback(UINT8 aue_type, UINT32 aue_value)
{
	union as_message msg;
	static UINT32 as_progress=0;
	UINT8 result = PROC_LOOP;
	UINT16 progress;
	UINT32 moving_disk_time;

	DBG_PRINTF("Enter %s....\n",__FUNCTION__);

#ifndef MULTITASK_DRAW_OSD_SUPPORT
	win_search_capture_semaphore();  
#endif

	//OSD_TaskBuffer_Init(osal_task_get_current_id(),NULL);
	if (aue_type == ASM_TYPE_PROGRESS)
	{
		if (as_progress>=aue_value)
		{
			as_progress = aue_value;

#ifndef MULTITASK_DRAW_OSD_SUPPORT
			win_search_release_semaphore();
#endif
			DBG_PRINTF("Exit %s....\n",__FUNCTION__);
			return;
		}
		/*
		 * without the following line will cause
		 * percentage inverse here.
		 */
		as_progress = aue_value;
	}

	msg.decode.asm_type = aue_type;
	msg.decode.asm_value = aue_value;

    switch(msg.decode.asm_type)
    {
        case ASM_TYPE_SATELLITE:
        	osal_task_dispatch_off();
        	if(!win_search_stop_signal)
        	{
        		cur_srch_sat ++;
        		moving_disk = 1;
        		/* !!!!!! */
        		osal_task_dispatch_on();
        		#ifndef MULTITASK_DRAW_OSD_SUPPORT
        		win_search_release_semaphore();
        		#endif
        		ap_clear_all_message();
        		ap_send_msg(CTRL_MSG_SUBTYPE_CMD_SCAN, msg.msg_encode,TRUE);
        		moving_disk_time = 0;
            }
        	else
        	{
        		osal_task_dispatch_on();
        		#ifndef MULTITASK_DRAW_OSD_SUPPORT
        		win_search_release_semaphore();
        		#endif
            }
            while(moving_disk)
            {
        		osal_task_sleep(10);
        		moving_disk_time++ ;
            }
            as_progress = 0;
            break;
        case ASM_TYPE_PROGRESS:
            if(msg.decode.asm_value == 100 || msg.decode.asm_value == 150)
            {
                ap_send_msg(CTRL_MSG_SUBTYPE_CMD_SCAN, msg.msg_encode,TRUE);
            }
            else
            {
                if(win_search_param.as_method != AS_METHOD_MULTI_FFT 
                    && win_search_param.as_method != AS_METHOD_MULTI_NIT  
                    && win_search_param.as_method != AS_METHOD_MULTI_TP)
                    progress = msg.decode.asm_value;
                else
                {
#ifdef NEW_DEMO_FRAME
                progress = (100* (cur_srch_sat- 1)+ msg.decode.asm_value)/win_search_param.as_sat_cnt;
#else
                    progress = (100* (cur_srch_sat- 1)+ msg.decode.asm_value)/win_search_param.as_sat_id;
#endif
                    if(progress>= 100)
                        progress = 99;
                }
                //result = win_search_update_progress(progress);//msg.decode.asm_value);
                msg.decode.asm_value = progress;
		ap_send_msg(CTRL_MSG_SUBTYPE_CMD_SCAN, msg.msg_encode,TRUE);			
            }
            break;
        case ASM_TYPE_ADD_PROGRAM:
            //win_search_program_append(0xFFFFFFFF, msg.decode.asm_value);
            ap_send_msg(CTRL_MSG_SUBTYPE_CMD_SCAN, msg.msg_encode,TRUE);
            break;
        case ASM_TYPE_ADD_TRANSPONDER:
            //win_search_program_append(msg.decode.asm_value, INVALID_ID);
            ap_send_msg(CTRL_MSG_SUBTYPE_CMD_SCAN, msg.msg_encode,TRUE);
            break;
        default:
                ;
    }
#if 0
    //OSD_UpdateWinVscr(&win_search, FALSE);

    if(msg.decode.asm_type ==ASM_TYPE_PROGRESS && result == PROC_LEAVE)
        ap_send_msg(CTRL_MSG_SUBTYPE_CMD_EXIT_TOP, 0,TRUE);


    if(msg.decode.asm_type != ASM_TYPE_SATELLITE)
    {
        OSD_ObjProc( (POBJECT_HEAD)&g_win_search, 0xFFFFFFFF, 0xFFFFFFFF,0xFFFFFFFF);

#ifndef MULTITASK_DRAW_OSD_SUPPORT
        win_search_release_semaphore();
#endif
    }
#endif
	DBG_PRINTF("Exit %s....\n",__FUNCTION__);

}
예제 #9
0
static PRESULT srch_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2)
{
	PRESULT ret = PROC_PASS;
	UINT16 title_id;
	POBJECT_HEAD mainmenu;
	UINT8 av_flag;
	UINT16 cur_chan;
	UINT8 back_saved;
	
	switch(event)
	{
	case EVN_PRE_OPEN:
		system_state = SYS_STATE_SEARCH_PROG;
		if(win_search_param.as_method == AS_METHOD_TP
			 || win_search_param.as_method == AS_METHOD_NIT_TP) // tp scan
				title_id = RS_INSTALLATION_TP_SCAN;
		else if(win_search_param.as_method == AS_METHOD_FFT 
	        || win_search_param.as_method == AS_METHOD_MULTI_FFT)//auto scan
	        title_id = RS_INSTALLATION_AUTO_SCAN; 
		else if(win_search_param.as_method == AS_METHOD_SAT_TP
	        ||win_search_param.as_method == AS_METHOD_MULTI_TP
	        || win_search_param.as_method == AS_METHOD_NIT
	        || win_search_param.as_method == AS_METHOD_MULTI_NIT)//preset scan
			title_id = RS_INSTALLATION_PRESET_SCAN;
		else
			title_id = RS_INSTALLATION_AUTO_SCAN;		
		wincom_open_subtitle(pObj,title_id,0);
/*Remove progress bar when search type is AS_METHOD_NIT_TP/AS_METHOD_NIT/AS_METHOD_MULTI_NIT*/
		if(win_search_param.as_method == AS_METHOD_NIT_TP ||
			win_search_param.as_method == AS_METHOD_NIT||
			win_search_param.as_method == AS_METHOD_MULTI_NIT)
		{
            OSD_SetAttr(&srch_progress_txt, C_ATTR_HIDDEN);
            OSD_SetAttr(&srch_progress_bar, C_ATTR_HIDDEN);
		}
        else
        {
            OSD_SetAttr(&srch_progress_txt, C_ATTR_ACTIVE);
            OSD_SetAttr(&srch_progress_bar, C_ATTR_ACTIVE);
        }

		key_pan_display("srch", 4);
		
		epg_off();
		stop_tdt();

#ifdef AUTOSCAN_BYPASS_CI
        // Before Autoscan, DMX0 bypass CI
		if(win_search_param.as_method == AS_METHOD_FFT 
	        || win_search_param.as_method == AS_METHOD_MULTI_FFT)//auto scan
		{
            tsi_dmx_src_select(TSI_DMX_0, TSI_TS_B);
            tsi_para_src_select(TSI_SPI_1,0);
            api_set_nim_ts_type(2, 0x03);			
		}
#endif
#ifdef HW_SS830C
            tsi_dmx_src_select(TSI_DMX_0, TSI_TS_B);	
	     api_set_nim_ts_type(2, 0x03);						
#endif

		break;
	case EVN_POST_OPEN:
		win_search_init();
		break;
	case EVN_PRE_CLOSE:
        win_search_pre_close = 1;
		osal_task_dispatch_off();
		moving_disk = 0;/*Clear moving dish flag*/
		win_search_stop_signal = 1;
		osal_task_dispatch_on();
		as_service_stop();
		db_search_exit();
		//api_stop_timer(&win_search_tmr_id);
		/* Make OSD not flickering */
		*((UINT32*)param2) &= ~C_CLOSE_CLRBACK_FLG;			

		prog_callback_unregister();
		pid_search_flg = 0;
		break;
	case EVN_POST_CLOSE:
		if((srch_ch_cnt[0] != 0x0)
			|| (srch_ch_cnt[1] != 0x0))
		{
            win_search_last_tp_ok_failed(srch_tp_cnt);

			win_compopup_init(WIN_POPUP_TYPE_SMSG);
			win_compopup_set_msg(NULL, NULL, RS_MSG_WAIT_FOR_SAVING);
			//win_compopup_open();
			win_compopup_open_ext(&back_saved);
			
			update_data();

			win_compopup_smsg_restoreback();
			win_compopup_init(WIN_POPUP_TYPE_OK);
			win_compopup_set_msg("Search End", NULL, 0);
			win_compopup_open_ext(&back_saved);

			/* Change to all satellite group */
            UINT32 grp_idx = sys_data_get_cur_group_index();

			sys_data_check_channel_groups();
			sys_data_set_cur_group_index(grp_idx);

			av_flag = sys_data_get_cur_chan_mode();

			if(sys_data_get_sate_group_num(av_flag) == 0)
			{
				av_flag = (av_flag == TV_CHAN)? RADIO_CHAN : TV_CHAN;
				sys_data_set_cur_chan_mode(av_flag);
			}
			if(av_flag == RADIO_CHAN && (srch_ch_cnt[1] != 0x0))        //guop add  20101231
			{
				av_flag = TV_CHAN;
				sys_data_set_cur_chan_mode(av_flag);
			}

			sys_data_change_group(grp_idx);

			if(srch_ch_cnt[av_flag] > 0)
			{
				cur_chan = get_prog_pos(win_search_cur_prog[av_flag].prog_id);
				if(cur_chan == 0xFFFF)
				{
                    grp_idx = get_sat_pos(cur_sat_id) + 1;
        			sys_data_change_group(grp_idx);
    				cur_chan = get_prog_pos(win_search_cur_prog[av_flag].prog_id);
                    if (cur_chan == 0xFFFF)
                    {
            			sys_data_change_group(0);
        				cur_chan = get_prog_pos(win_search_cur_prog[av_flag].prog_id);
                        if (cur_chan == 0xffff)
    					    cur_chan = 0;
                    }
				}
				sys_data_set_cur_group_channel(cur_chan);
			}
			else if(sys_data_get_sate_group_num(av_flag))
				key_pan_display("noCH", 4);
			else
				key_pan_display("----", 4);
			sys_data_save(1);
			epg_reset();
		}

		OSD_ClearObject( (POBJECT_HEAD)&srch_progress_bar, C_UPDATE_ALL);
		OSD_ClearObject( (POBJECT_HEAD)&srch_progress_txt, C_UPDATE_ALL);

		mainmenu = (POBJECT_HEAD)&g_win_mainmenu;
		OSD_TrackObject(mainmenu,C_UPDATE_ALL);

#ifdef AUTOSCAN_BYPASS_CI
        // After Autoscan, DMX0 NOT bypass CI
		if(win_search_param.as_method == AS_METHOD_FFT 
	        || win_search_param.as_method == AS_METHOD_MULTI_FFT)//auto scan
		{
            tsi_dmx_src_select(TSI_DMX_0, TSI_TS_A);
            tsi_para_src_select(TSI_SPI_1,0);
		}
#endif
		start_tdt();
		system_state = SYS_STATE_NORMAL;
		
		break;
	case EVN_MSG_GOT:
		ret = win_search_message_proc(param1,param2);		
		break;

	}

	return ret;
}
예제 #10
0
/* 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();
}
예제 #11
0
/* 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();
}
예제 #12
0
파일: lib_subt.c 프로젝트: alkap007/ali3606
void subt_unreg_callback()
{
	osal_task_dispatch_off();
	subt_event_callback = NULL;
	osal_task_dispatch_on();
}
예제 #13
0
파일: lib_subt.c 프로젝트: alkap007/ali3606
void subt_reg_callback(SUBT_EVENT_CALLBACK callback)
{
	osal_task_dispatch_off();
	subt_event_callback = callback;
	osal_task_dispatch_on();
}
예제 #14
0
static void ogg_play_task(mp_callback_func cb)
{
	long							ret = 0;
	int							current_section = 0;
	double						time_seek_to = 0;
	vorbis_info					*vi;
	struct snd_device				*sound_dev;
	int							*processed_pcm;
	double						song_time;
	
	PE_DBG_PRINTF("MusicEngine: ==> ogg_play_task()! \n");

	sound_dev = (struct snd_device*)dev_get_by_type(NULL, HLD_DEV_TYPE_SND);
	processed_pcm = (int*)ogg_file->processed_pcm_buff;

	if (ov_open(ogg_file->file, &ogg_file->vf, NULL, 0) < 0)
	{
		PE_DBG_PRINTF("MusicEngine: ogg_play_task() ov_open failed! \n");
#ifdef ENABLE_PE_CACHE
		pe_cache_close(ogg_cache_id);                   // 这个ogg_cache_id是在play_file时打开
		ogg_cache_id = -1;
#else
		fclose(ogg_file->file);
#endif
		//FREE(processed_pcm);
		osal_flag_set(ogg_engine.ogg_engine_flag_id, OGG_ENGINE_FLAG_UNSUCCESSFUL);
		return;
	}
	else
	{
		PE_DBG_PRINTF("MusicEngine: ov_opened \n");

		{

		vorbis_info *vi = ov_info(&ogg_file->vf, -1);
		if (!vi)
		{
			PE_DBG_PRINTF("MusicEngine: ov_info failed!\n");
			ov_clear(&ogg_file->vf);
			osal_flag_set(ogg_engine.ogg_engine_flag_id, OGG_ENGINE_FLAG_UNSUCCESSFUL);
			return;
		}
		ogg_file->samplerate = vi->rate;
		ogg_file->channel = vi->channels;

		PE_DBG_PRINTF("\nBitstream is %d channel, %ldHz\n", vi->channels, vi->rate);
		song_time = ov_time_total(&ogg_file->vf, -1);
		if (song_time <= 0)
		{
			PE_DBG_PRINTF("MusicEngine: ov_info failed!\n");
			ov_clear(&ogg_file->vf);
			osal_flag_set(ogg_engine.ogg_engine_flag_id, OGG_ENGINE_FLAG_UNSUCCESSFUL);
		}
		
		}

		osal_flag_set(ogg_engine.ogg_engine_flag_id, OGG_ENGINE_FLAG_SUCCESS);
	}

	//all work success, we can start to play
	while (ogg_file->command  != OGG_CMD_STOP)
	{
		if (ogg_file->seek_to != 0)
		{
			time_seek_to = ov_time_tell(&ogg_file->vf);
			time_seek_to = time_seek_to + (ogg_file->seek_to * 1000);
	
			if (time_seek_to < 0)
			{
				time_seek_to = 0;
			}
			else if (time_seek_to > song_time)
			{
				time_seek_to = song_time;
			}

			ret = ov_time_seek(&ogg_file->vf, time_seek_to);
			if (ret < 0)
			{
				//seek failed
			}
			osal_task_dispatch_off();
			ogg_file->seek_to = 0;
			osal_task_dispatch_on();
		}

		if (ogg_file->command  == OGG_CMD_NONE)
		{
			ret = ov_read(&ogg_file->vf, (void *)ogg_file->pcm_out_buff, 2304, &current_section);
			if (ret == 0)
			{
				PE_DBG_PRINTF("file end!\n");
				//EOF we need call back
				
							
				osal_task_dispatch_off();
				if (ogg_file->command != OGG_CMD_STOP)
				{
					ogg_file->command  = OGG_CMD_WAIT_FOR_STOP;
				}
				osal_task_dispatch_on();
				
				cb(MP_MUSIC_PLAYBACK_END, 0);
							
				osal_task_sleep(10);
			}
			else if (ret < 0)
			{ 
				PE_DBG_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. */

				osal_task_dispatch_off();
				if (ogg_file->command != OGG_CMD_STOP)
				{
					ogg_file->command  = OGG_CMD_WAIT_FOR_STOP;
				}
				osal_task_dispatch_on();
				
				cb(MP_MUSIC_PLAYBACK_END, 0);

				osal_task_sleep(10);
			}
			else
			{
				/* we don't bother dealing with sample rate changes, etc, but you'll have to*/
				process_ogg_pcm(sound_dev, ret, processed_pcm);
			}
		}
		else
		{
			osal_task_sleep(10);
		}

	}

	ov_clear(&ogg_file->vf);
	ogg_avoid_under_run = 0;
	snd_io_control(sound_dev, SND_CC_MUTE, 0);
	snd_stop(sound_dev);
	//FREE(processed_pcm);
	osal_flag_set(ogg_engine.ogg_engine_flag_id, OGG_ENGINE_FLAG_TASK_EXIT);            // task结束,发出EXIT消息
	PE_DBG_PRINTF("MusicEngine: <== ogg_play_task()! \n");
	
}
예제 #15
0
UINT32 cmd_stbid(unsigned int argc, unsigned char *argv[])
{
	UINT8 i = 0, j = 0, ch = 0xff;
	UINT8 *_stbid_flag = "SRI";
	INT32 _stbid_flag_len = 3;
	UINT8 _serial_data[1024]; // max receive 1KB data
	UINT32 timeout = 1000, stbid_offset = STB_HWINFO_SERIAL_OFF, _stbid_crc = 0, _stbid_len = 0, _serial_len = 0, _crc = 0, _crc_pos = 0;
	UINT8 *buffer = NULL;
	UINT32 nReturn = SUCCESS;
	UINT32 nPacketNum = 0;
	PACKET packet;
	UINT32 tick = osal_get_tick();
	UINT8 retry_num = 5, _tr_num = 5;
	ID _task_id = g_com_ash_id;
	
	osal_task_dispatch_off();	
	
	SendStatusPacket(COMMAND_STATUS_OK,  0);
	pan_display(g_pan_dev, "Stb-", 4);
	
RETRY:	
	_tr_num = 5;
	
	//transfer data
	MEMSET(&packet, 0, sizeof(PACKET));
	
	nReturn = packet_receive(&packet, 5 * 1000);
	if(SUCCESS != nReturn)
	{
		SERIAL_DEBUG("receive packet fail!\n");	
		retry_num--;
		goto RETURN;
	}
	
	if(packet.packet_type == PACKET_DATA)
	{	
		_serial_len = packet.packet_length-4;
		MEMCPY(_serial_data, packet.data_buffer+4, packet.packet_length-4);
	}
	else
	{
		SERIAL_DEBUG("receive %d packet, ignore!\n", packet.packet_type);
		retry_num--;
		goto RETURN;
	}
	
	SERIAL_DEBUG("stbid get data total len %d finish, data: \n", _serial_len);
	for(i=0; i<_serial_len; i++)
	{
		SERIAL_DEBUG("%c", _serial_data[i]);
	}
	SERIAL_DEBUG("\n");
	
	pan_display(g_pan_dev, "GET", 4);
	if((_serial_data[0] != _stbid_flag[0]) || (_serial_data[1] != _stbid_flag[1]) || (_serial_data[2] != _stbid_flag[2])) // received flag tag
	{
		SERIAL_DEBUG("Error: SRI flag missing!\n");	
		retry_num--;
		goto RETURN;
	}
	
	pan_display(g_pan_dev, "FLAG", 4);
	_stbid_len = _serial_len-4-8;
	if(_stbid_len > STB_HWINFO_MAC_OFF)
	{
		SERIAL_DEBUG("Error: stbid len %d != [%d], please resend cmd!\n", _stbid_len, STB_HWINFO_MAC_OFF);
		retry_num--;
		goto RETURN;
	}
	
	pan_display(g_pan_dev, "LENG", 4);
	
	// do crc check
	_crc_pos = _stbid_flag_len+1+_stbid_len;
	_stbid_crc = 0;
	for(i=0; i<8; i++)
	{
		_stbid_crc |= (((_serial_data[_crc_pos+i]>'9') ? (_serial_data[_crc_pos+i]-'A'+10) : (_serial_data[_crc_pos+i]-'0'))<<((7-i)*4));
	}
	
	_crc = MG_Table_Driven_CRC(0xFFFFFFFF, _serial_data, _crc_pos);
	if(_stbid_crc != _crc)
	{
		// fail, need re-trans
		SERIAL_DEBUG("stbid crc fail, calcu = 0x%x!\n", _crc);
		retry_num--;
		goto RETURN;
	}
	
	pan_display(g_pan_dev, "CRC", 4);
	// burn code, enable drive auto-erase
	for(i=0; i<(STB_HWINFO_OUI_OFF-STB_HWINFO_MAC_OFF); i++) // init mac
	{
		ch = _serial_data[STB_HWINFO_MAC_OFF+4-12+i*2];
		_serial_data[i+STB_HWINFO_MAC_OFF+4] = (((ch>'9') ? ((ch>='a') ? (ch-'a'+10) : (ch-'A'+10)) : (ch-'0'))<<4);
		ch = _serial_data[STB_HWINFO_MAC_OFF+4-12+i*2+1];
		_serial_data[i+STB_HWINFO_MAC_OFF+4] |= ((ch>'9') ? ((ch>='a') ? (ch-'a'+10) : (ch-'A'+10)) : (ch-'0'));
	}
	
	buffer = MALLOC(64*1024);
	if(buffer == NULL)
	{
		SDBBP();
	}
	
	sto_io_control(g_sto_dev, STO_DRIVER_SECTOR_BUFFER, (UINT32)buffer);
	sto_io_control(g_sto_dev, STO_DRIVER_SET_FLAG, STO_FLAG_AUTO_ERASE|STO_FLAG_SAVE_REST);
	
	SERIAL_DEBUG("Now burn stbid: ");	
	for(i=0; i<STB_HWINFO_OUI_OFF; i++)
	{
		SERIAL_DEBUG("%c", _serial_data[i+_stbid_flag_len+1]);
	}
	SERIAL_DEBUG("\n");
	
	sto_put_data(g_sto_dev, STB_HWINFO_BASE_ADDR, &_serial_data[_stbid_flag_len+1], STB_HWINFO_OUI_OFF);	
	if(buffer)
	{
		FREE(buffer);
		buffer = NULL;
		sto_io_control(g_sto_dev, STO_DRIVER_SECTOR_BUFFER, 0);
		sto_io_control(g_sto_dev, STO_DRIVER_SET_FLAG, 0);
	}
	
	if(g_stb_hwinfo != NULL)
	{
		FREE(g_stb_hwinfo);
		g_stb_hwinfo = NULL;
	}
	
	pan_display(g_pan_dev, "-tr-", 4);
	SERIAL_DEBUG("stbid finish, task %d deleted!\n", g_com_ash_id);
	SERIAL_DEBUG("cmd_stbid takes %dms\n", osal_get_tick()-tick);
	retry_num = 0;

RESEND:	
	SendStatusPacket(COMMAND_STATUS_DONE, 0);
	MEMSET(&packet, 0, sizeof(PACKET));
	osal_task_sleep(100);
	
	nReturn = packet_receive(&packet, 5 * 1000);
	if((SUCCESS != nReturn) || (packet.packet_type != PACKET_STATUS))
	{
		if(_tr_num-- > 0)
		{
			SERIAL_DEBUG("stbid finish, but signal send fail, now re-send!\n");
			goto RESEND;
		}
		else
		{
			pan_display(g_pan_dev, "dStb", 4); // done, but notice fail!
		}
	}
	else
	{
		pan_display(g_pan_dev, "-Stb", 4); // done, all ok!
	}
	
RETURN:
	if(retry_num >0)
	{
		SendStatusPacket(COMMAND_STATUS_ERROR, 0);
		goto RETRY;
	}
	else
	{
		SERIAL_DEBUG("error, please redo!\n");
		api_set_com_check_flag(COM_MONITOR_CHECK_STBID);
	}
	
	g_com_ash_id = INVALID_ID;
	osal_task_dispatch_on();
	osal_task_delete(_task_id);
}