Exemple #1
0
INT32 psi_module_init(struct dmx_device *dmx, struct nim_device *nim, 
	void *work_place, INT32 length)
{
	if (psi_flag ==OSAL_INVALID_ID) {
		psi_flag = osal_flag_create(PSI_FLAG_STAT_MUTEX);
		if (psi_flag == OSAL_INVALID_ID) {
			PSI_PRINTF("%s: psi_flag create failure!\n");
			return ERR_FAILUE;
		}
	} else {
		osal_flag_clear(psi_flag, 0xFFFFFFFF);
		osal_flag_set(psi_flag, PSI_FLAG_STAT_MUTEX);
	}
	
	if ((work_place==NULL)
		||(length<(INT32)sizeof(struct psi_module_info))) {
		PSI_PRINTF("%s: work_place parameter invalid!\n", __FUNCTION__);
		return ERR_FAILUE;
	}
	psi_info = (struct psi_module_info *)work_place;
	MEMSET(psi_info, 0, sizeof(struct psi_module_info));

	psi_info->dmx = dmx;
	psi_info->nim = nim;

	return SUCCESS;
}
Exemple #2
0
int tr_platform_init()
{
	if(g_trans_flag == INVALID_ID)
	{
		g_trans_flag = osal_flag_create(0);
	}
}
Exemple #3
0
*****************************************************************************/
static INT32 f_TC90512_open(struct nim_device *dev)
{

	UINT8	data = 0,i=0;
	UINT8	tdata ;
	UINT8	lock = 0;
	struct nim_TC90512_private * priv_mem = (struct nim_TC90512_private *)(dev->priv);
	struct COFDM_TUNER_CONFIG_API * config_info = &(priv_mem->Tuner_Control);
	INT32 wStatus=0;
	UINT8 wAdrs=0,wData=0;
	UINT8 iexdev=0;
	UINT8 ilpdev=0;
	UINT8 adciqin=0;
	UINT8 zifmd=0;
	UINT8 dif25m=0;
	UINT8 dif25v=0;
	UINT8 difpll=0;
	UINT8 vlfmd=0;
	UINT8 f_inv=0;	
	UINT16 hkfrq=0;
	UINT16 cpld_dt=0;
	UINT8 lpfsl=0;
	UINT16 affrq=0;
	UINT8 agcref1=0;
	UINT8 agcref2=0;

	
	NIM_PRINTF("f_TC90512_open\n");
	
	nim_TC90512_flag = osal_flag_create(NIM_TC90512_FLAG_ENABLE);//050513 Tom

	if (nim_TC90512_flag==OSAL_INVALID_ID)
		return ERR_FAILUE;
		

	TC90512_CurChannelInfo = (struct TC90512_Lock_Info *)MALLOC(sizeof(struct TC90512_Lock_Info));                                                     
	if (TC90512_CurChannelInfo == NULL)
	{
		NIM_PRINTF("f_TC90512_open MALLOC fail!\n");
		return ERR_FAILUE;
	}
	MEMSET(TC90512_CurChannelInfo, 0, sizeof(struct TC90512_Lock_Info));

	
//init TC90512
	for (i=0; i<IF_44m_25p4_ary_size;i++)
	{
		f_TC90512_write(dev->base_addr,IF_44m_25p4_ary_init[2*i],&IF_44m_25p4_ary_init[2*i+1],1);		
		f_TC90512_read(dev->base_addr,IF_44m_25p4_ary_init[2*i],&tdata,1);		
		NIM_TC90512_PRINTF("reg[%x] = %x\n",IF_44m_25p4_ary_init[2*i],tdata);
	}

        
        osal_flag_set(nim_TC90512_flag,NIM_TC90512_SCAN_END);
        
						
        return SUCCESS;
Exemple #4
0
static int ogg_play_file(char *filename, mp_callback_func cb)
{
	OSAL_T_CTSK										ogg_engine_play_task_attribute;
	unsigned long											ogg_engine_flag;

	PE_DBG_PRINTF("MusicEngine: ==> ogg_play_file()! \n");

	//check parameters
	if ((!filename) || (!cb) || (!ogg_file))
	{
		PE_DBG_PRINTF("MusicEngine: ogg_play_file() invalid parameter filename or cb or ogg_file! \n");
		return -1;
	}

	
	//init ogg_file
#ifdef ENABLE_PE_CACHE
	ogg_cache_id = pe_cache_open(filename, NULL, OGG_CACHE_SIZE, OGG_BLOCK_SIZE);
	if(ogg_cache_id < 0)
	{
		PE_DBG_PRINTF("MusicEngine: ogg_play_file() pe_cache_open failed! \n");
		return -1;
	}
	ogg_file->file = (FILE *)((UINT32)ogg_cache_id | PE_CACHE_ID_TAG);          //只有在作了这个操作之后,以后的文件系统函数才是pe_cache接口
#else
	ogg_file->file = fopen(filename, "rb");
	if (!ogg_file->file)
	{
		PE_DBG_PRINTF("MusicEngine: ogg_play_file() fopen failed! \n");
		return -1;
	}
#endif

	ogg_file->seek_to = 0;
	ogg_file->command = 0;
	ogg_file->stop_imm = TRUE;

	ogg_engine.ogg_engine_flag_id = OSAL_INVALID_ID;
	ogg_engine.ogg_engine_task_id = OSAL_INVALID_ID;

    deca_io_control((struct deca_device *)dev_get_by_id(HLD_DEV_TYPE_DECA, 0), DECA_SET_STR_TYPE, AUDIO_OGG );

	prev_sp_l = 0;
	prev_sp_r = 0;
    g_pcm_sample_num = 0;
    g_pcm_current_using = 0;
    g_temp_pcm_buff = (char *)(ogg_file->processed_pcm_buff+ON_PCM_BUFF_LEN*8);

	//code to create flag
	ogg_engine_flag = OGG_ENGINE_FLAG_INITIALIZE;
	ogg_engine.ogg_engine_flag_id = osal_flag_create(ogg_engine_flag);
	if ( ogg_engine.ogg_engine_flag_id == OSAL_INVALID_ID)
	{
		PE_DBG_PRINTF("MusicEngine: ogg_play_file() osal_flag_create failure! \n");
#ifdef ENABLE_PE_CACHE
		pe_cache_close(ogg_cache_id);
		ogg_cache_id = -1;
#else
		fclose(ogg_file->file);
#endif
		return -1;
	}


	//start thread
	ogg_engine_play_task_attribute.stksz	= OGG_ENGINE_PLAY_TASK_STACKSIZE*8;
	ogg_engine_play_task_attribute.quantum	= OGG_ENGINE_PLAY_TASK_QUANTUM;
	ogg_engine_play_task_attribute.itskpri	= OSAL_PRI_HIGH;//OSAL_PRI_NORMAL ;
	ogg_engine_play_task_attribute.para1	= (unsigned long)cb;
	//ogg_engine_play_task_attribute.para2	=;
	ogg_engine_play_task_attribute.name[0]	= 'O';
	ogg_engine_play_task_attribute.name[1]	= 'G';
	ogg_engine_play_task_attribute.name[2]	= 'G';
	ogg_engine_play_task_attribute.task = (FP)ogg_play_task;
	ogg_engine.ogg_engine_task_id = osal_task_create(&ogg_engine_play_task_attribute);
	if(ogg_engine.ogg_engine_task_id == OSAL_INVALID_ID)
	{
		PE_DBG_PRINTF("MusicEngine: ogg_play_file() osal_task_create failed! \n");
		
		osal_flag_delete(ogg_engine.ogg_engine_flag_id);
		ogg_engine.ogg_engine_flag_id = OSAL_INVALID_ID;

#ifdef ENABLE_PE_CACHE
		pe_cache_close(ogg_cache_id);
		ogg_cache_id = -1;
#else
		fclose(ogg_file->file);
#endif
		return -1;
	}

	//code to sync
	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);
	if (ogg_engine_flag != OGG_ENGINE_FLAG_SUCCESS)
	{		
		osal_flag_delete(ogg_engine.ogg_engine_flag_id);
		ogg_engine.ogg_engine_flag_id = OSAL_INVALID_ID;

		//fclose(ogg_file->file);

		return -1;
	}
	
	PE_DBG_PRINTF("MusicEngine: <== ogg_play_file()! \n");
	return 0;

}
Exemple #5
0
INT32 ali_ipanel_enter_mw(UINT32 param1, UINT32 param2)
{
	struct osd_device *osd_dev = NULL;
	INT32 ret = SUCCESS;
	VSCR *lpVscr;
	
	if (ali_ipanel_flag_id == OSAL_INVALID_ID)
	{
		ali_ipanel_flag_id = osal_flag_create(0);
		if (ali_ipanel_flag_id == OSAL_INVALID_ID)
		{
			IPANEL_PRINTF("%s() create flag failed\n", __FUNCTION__);
			return  - 1;
		}
	}
	//close lib monitor
	dm_set_onoff(0);

	stop_tdt();

	epg_off();

       sdt_monitor_off();

	//suspend key task
	key_task_suspend();

	//suspend ota task
	ota_task_suspend();

	//close sie to stop get si section
	/*if (SUCCESS != sie_close())
	{
		IPANEL_PRINTF("%s() close sie failed\n", __FUNCTION__);
		return  - 1;
	}*/

	//close vpo
	struct vpo_device *vpo_dev = (struct vpo_device *)dev_get_by_id ( HLD_DEV_TYPE_DIS, 0 );
	vpo_win_onoff(vpo_dev, FALSE);

#if(CAS_TYPE==CAS_CDCA3||CAS_TYPE == CAS_TF||CAS_TYPE==CAS_CDCA)
	ap_osd_layer2_exit();
#endif

	//close osd
	osd_dev = (struct osd_device *)dev_get_by_id(HLD_DEV_TYPE_OSD, 0);
	if(osd_dev!=NULL)
		OSDDrv_Close((HANDLE)osd_dev);
	osd_dev = (struct osd_device *)dev_get_by_id(HLD_DEV_TYPE_OSD, 1);
	if(osd_dev!=NULL)
		OSDDrv_Close((HANDLE)osd_dev);

#ifdef USE_LIB_GE
	 struct ge_device* ge_dev= (struct ge_device*)dev_get_by_id(HLD_DEV_TYPE_GE, 0);

     app_gui_release(1);
	 ge_close(ge_dev);     
#endif
	
	//free osd vscr buf
	OSD_TaskBuffer_Free(osal_task_get_current_id(), NULL);
	lpVscr = OSD_GetTaskVscr(osal_task_get_current_id());
	lpVscr->lpbScr = NULL;

    	recreate_prog_view(VIEW_ALL|PROG_ALL_MODE, 0);
	ipanel_porting_dmx_init();
	
	//call ipanel init
	ipanel_task_init(param1, param2);

	//suspend on ali_ipanel_flag_id wait ipanel exit
	ALI_IPANEL_ENTER_MUTEX(ALI_IPANEL_FLAG_EXIT_MW);

	osd_dev = (struct osd_device *)dev_get_by_id(HLD_DEV_TYPE_OSD, 0);
	if(osd_dev!=NULL)
        ap_osd_init();

	#if 0//ndef MIS_AD
	#ifdef MULTI_CAS
	#if((CAS_TYPE==CAS_CDCA)||(CAS_TYPE==CAS_TF)||(CAS_TYPE==CAS_DVT))
	osd_dev = (struct osd_device *)dev_get_by_id(HLD_DEV_TYPE_OSD, 1);
	if(osd_dev!=NULL)
		ap_osd_layer2_init();
	#endif
	#endif
	#endif

	return ret;
}