Esempio n. 1
0
static void catch_up_list_display(void)
{
	CONTAINER* con;
	TEXT_FIELD* text;
	OBJLIST* ol;
	UINT16 i,top,cnt,page,index,curitem,valid_idx;	
	struct catch_up_list_node_s *catch_up_list_node;
	char name[50] = {0};
	char time[50] = {0};

	ol = &ol_catch_up;

	cnt = OSD_GetObjListCount(ol);
	page = OSD_GetObjListPage(ol); 
	top = OSD_GetObjListTop(ol);
	curitem = OSD_GetObjListNewPoint(ol);
	
	for(i=0;i<page;i++)
	{
		con = (CONTAINER *)catch_up_items[i];
		index = top + i;

		if(index < cnt)
			valid_idx = 1;
		else
			valid_idx = 0;	

		/* IDX */
		text = (TEXT_FIELD*)OSD_GetContainerNextObj(con);
		
		if(valid_idx)
			OSD_SetTextFieldContent(text, STRING_NUMBER, index+ 1);
		else
			OSD_SetTextFieldContent(text, STRING_ANSI, (UINT32)"");

		/* Name**/
		text = (TEXT_FIELD*)OSD_GetObjpNext(text);
		
		if(valid_idx)
		{
			catch_up_list_node = catch_up_query(index);
			OSD_SetTextFieldContent(text, STRING_ANSI, (UINT32)(catch_up_list_node->data));
			memset(name, 0x0, sizeof(name));
			memset(time, 0x0, sizeof(time));
			catch_up_get_prog_name_time(catch_up_list_node->data, name, time);
			libc_printf("name = %s, time = %s\n", name, time);
		}
		else
			OSD_SetTextFieldContent(text, STRING_ANSI, (UINT32)"");
	}    
}
Esempio n. 2
0
//joey, 20111101, for AC information proc.
static INT32 nim_s3821_ac_info_proc(struct nim_device *dev)
{
    UINT8 data = 0;
    UINT8 tmp_arr[4];
    UINT8 ac_len = 0;
    UINT8 i = 0;

    //step 1. read out interrupt information.
    nim_s3821_read(dev, 0x02, &data, 1);
    if (0x08 == (data & 0x08)) // means AC buffer overflow.
    {
        //clear interrupt bit.
        data = data & 0xf7;
        nim_s3821_write(dev, 0x02, &data, 1);
        libc_printf("AC buffer overflow interrupt!!!!!!!!!!!!!!!!!!!!!\n");
    }
    else if (0x10 == (data & 0x10)) // means AC info arrive.
    {
        //clear interrupt bit.
        data = data & 0xef;
        nim_s3821_write(dev, 0x02, &data, 1);

        //read out current ac len.
        nim_s3821_read(dev, 0x11f, &data, 1);
        ac_len = (data & 0x3f);

        //real read ac info action
        for (i = 0; i < ac_len; i++)
        {
            nim_s3821_read(dev, 0x120, tmp_arr, 4);
            libc_printf("AC data[31:0]: 0x%2x, 0x%2x, 0x%2x, 0x%2x! \n", tmp_arr[3], 
	               tmp_arr[2], tmp_arr[1], tmp_arr[0]);
        }
    }

    return SUCCESS;

}
Esempio n. 3
0
void print_freemem_size()
{
	UINT32 db_cnt = 0;
	UINT32 db_max = 0;
	struct content_t *list;
	list = alloc_obj.free_list;
	while (list != NULL) {
		db_cnt += list->len;
		if (list->len > db_max)
			db_max = list->len;
		list = list->next;
	}
	libc_printf("FreeMem: %d, Mxnode: %d\n", db_cnt, db_max);
}
Esempio n. 4
0
int	http_test()
{
	int i;

	int buf_len = 2 * 1024 * 1024;
	unsigned char *buffer = (char *)(0X81000000);

	i = libnet_download_to_mem("http://192.168.0.1/22.rar",
						   buffer, buf_len, 0);

	libc_printf("file len = %d\n", i);
	//int crc = MG_Table_Driven_CRC(0xFFFFFFFF, buffer, i);
	unsigned char md5[17];
	
	md5_do_data(md5, buffer, i);

	for(i = 0; i < 16; i++)
	{
		libc_printf("%x", md5[i]);
	}
	libc_printf("\n");

	return i;
}
Esempio n. 5
0
RET_CODE lib_subt_atsc_get_region_pos(struct osd_device *subt_atsc_osd_dev)
{ 
    RET_CODE ret = SUCCESS;
    struct OSDRect rect;
   ret = OSDDrv_GetRegionPos((HANDLE)subt_atsc_osd_dev,0,&rect);
   if(SUCCESS != ret)
   {
    SDBBP();
   }
   #ifdef tnntc_debug
   
   libc_printf("Character rect region got: uLeft:%d, uTop:%d, uWidth:%d, uHeight:%d\n",rect.uLeft,rect.uTop,\
                   rect.uWidth,rect.uHeight); 
   #endif
   return ret;
}
Esempio n. 6
0
int maincode_verify(unsigned int addr, unsigned int len)
{
	int ret = 0;
	struct sto_device *test_flash_dev;
	unsigned long i = 0;
	RSA *r_vfy;
	int flen;
	
	test_flash_dev = (struct sto_device *)dev_get_by_type(NULL, HLD_DEV_TYPE_STO);
	if (test_flash_dev == NULL)
	{
	    libc_printf("Can't find FLASH device!\n");
	}

	//fetch RSA public key in CI+ chunk
	//sys_get_host_key((UINT8 *)&Public_Key, NULL, CIPLUS_KEY_PUBLIC_KEY);
	sys_get_host_key((UINT8 *)pubkey, NULL, CIPLUS_KEY_PUBLIC_KEY);
	
	//fetch maincode signature in CI+ chunk 
	sys_get_host_key((UINT8 *)&rsa_sig, NULL, CIPLUS_KEY_MAINCODE_SIGNATURE);
	
	//rsapublicfunc(addr_output,&addr_outputlen,rsa_sig,0x100,&Public_Key);
	/********replace rsapublicfunc() with OPENSSL function********/
	r_vfy = RSA_new();
	r_vfy->n = BN_new();
	r_vfy->e = BN_new();
	BN_bin2bn(pubkey+4, 256, r_vfy->n);
	BN_bin2bn(pubkey+4+256+256-3, 3, r_vfy->e);
	flen = RSA_size(r_vfy);
	RSA_public_decrypt(flen, rsa_sig, addr_output, r_vfy, RSA_NO_PADDING);
	/*************************************************************/
	
	create_sha((unsigned char *)addr+SYS_FLASH_BASE_ADDR,len,(unsigned long *)signature);//SHA-256
	
	for(i = 0; i < 32; i += 4)
	{
		if((*(unsigned long *)(addr_output + 0xe0 + i)) != (*(unsigned long *)(signature + i)))
		{
			ret = -1;
			break;
		}
	}
	
	return ret;
}
Esempio n. 7
0
static void  win_favgrplst_set_display(void)
{
    CONTAINER* con;
    TEXT_FIELD* text;
	OBJLIST* ol;
	UINT16 i,top,cnt,page,index,curitem,valid_idx;	
    SYSTEM_DATA* sys_data = sys_data_get();

	ol = &favgrplist_olist;
char ee[30];
	cnt = OSD_GetObjListCount(ol);
	page = OSD_GetObjListPage(ol); 
	top = OSD_GetObjListTop(ol);
	curitem = OSD_GetObjListNewPoint(ol);
	

	for(i=0;i<page;i++)
    {
        con = (CONTAINER*)favgrplist_items[i];
		index = top + i;
		
		if(index< cnt)
			valid_idx = 1;
		else
			valid_idx = 0;		

        /* IDX */
        text = (TEXT_FIELD*)OSD_GetContainerNextObj(con); 
		if(valid_idx)
			OSD_SetTextFieldContent(text, STRING_NUMBER, index+ 1);
		else
			OSD_SetTextFieldContent(text, STRING_ANSI, (UINT32)"");
 
        /* Name**/
        text = (TEXT_FIELD*)OSD_GetObjpNext(text);
		ComUniStrToAsc(sys_data->favgrp_names[index],ee);
		libc_printf("\n88888888===%s\n",ee);
		if(valid_idx)
			OSD_SetTextFieldContent(text, STRING_UNICODE, (UINT32)sys_data->favgrp_names[index]);
		else
			OSD_SetTextFieldContent(text, STRING_ANSI, (UINT32)"");
        
	}    
}
Esempio n. 8
0
static int check_version()
{
    unsigned long handle;
    UINT8 back_saved;
    UINT8* ftpurl;
    UINT32 bufflen = 521;
    CHUNK_HEADER* sw_version;
    CHUNK_HEADER* bootload_version;
    downloadbuff = MALLOC(bufflen);
    ftpurl       = MALLOC(bufflen);
    if( NULL == downloadbuff || NULL == ftpurl)
    {
        libc_printf("Get memorey for download file faild!\n");
        return -1;
    }
    get_updata_url(ftpurl);
    strcat(ftpurl, DEFULT_CONFIG_FILE);
    
    //libc_printf("The servicer addr is %s\n",ftpurl);

    //get system software version
    get_system_version_info();
    if(NULL == (sw_version=get_sw_version()))
        return -1;
    if(NULL == (bootload_version = get_bootloader_version()))
        return -1;
    
     handle = libnet_download_to_mem_thread_save(ftpurl, downloadbuff, bufflen, 0, rstcb);
     osal_task_sleep(20000);
     
    // LIBNET_DEBUG("outfile size is %ld\n",(get_file_length(handle)));
     //libc_printf("system sw version is %s\n",sw_version->version);
     //LIBNET_DEBUG("netservicer sw version is %s\n",downloadbuff);
     
     if(1 == check_netupgrade_configfile(downloadbuff,get_file_length(handle)
                                            ,bootload_version,sw_version))
     {
        free(downloadbuff);
        return 1;//have new version
     }
     free(downloadbuff);
     return 0;
}
Esempio n. 9
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;
}
Esempio n. 10
0
/*--成功返回0,失败返回-1---*/
int dm_write(int handle, unsigned char *netbuf, int writelen)
{
#if 1
	int status=-1;
	int w_total = 0; // total bytes written
	int w_left = writelen; // bytes to be written
	int ret;
	if(SelectTimeOutSecond(handle,0, 30)==1)
	{
		w_total=S_WRITE(handle, netbuf, writelen); /* return the bytes read */
		if((w_total   ==   0)||(w_total   ==   -1))   
		{
			;
		}
		else
		{
			status=0;
		}
	}
	else
	{
		libc_printf("---dm_write , error,server is not ready, w_total %d \r\n",w_total);
	}
	return w_total;
#else
		int status=-1;
		int w_total = 0; // total bytes written
		int w_left = writelen; // bytes to be written
		int ret;
		SelectTimeOutSecond(handle,0, 30);
		w_total=S_WRITE(handle, netbuf, writelen); /* return the bytes read */
		if((w_total   ==   0)||(w_total   ==   -1))   
		{
			;
		}
		else
		{
			status=0;
		}
		return w_total;
#endif
}
Esempio n. 11
0
INT32 restart_netupdate_register(void)
{
	OSAL_T_CTSK t_ctsk; //Net updata thread
	MEMSET(&network_thread_struct, 0, sizeof(NETWORK_CTRL_T));
	/* create auto netupdate thread */
	t_ctsk.task = (OSAL_T_TASK_FUNC_PTR)restart_netupdate_process;
	t_ctsk.itskpri = OSAL_PRI_NORMAL;
	t_ctsk.stksz = 0x4000;
	t_ctsk.quantum = 5;
	t_ctsk.name[0] = 'N';
	t_ctsk.name[1] = 'U';
	t_ctsk.name[2] = 'D';
	network_thread_struct.thread_id = osal_task_create(&t_ctsk);
	if (OSAL_INVALID_ID == network_thread_struct.thread_id)
	{
		//ASSERT(0);
		libc_printf("Creat updata process thread fail!!!\n");
		return 0;
	}
    return 1;
}
Esempio n. 12
0
static void nc_save_serinfo(UINT8 seridx)
{
	UINT32 value;
	UINT8 idx = seridx-1;
	UINT8 deskey[DESKEY_WITH_SEP_LEN+1]={0};
	UINT8 i,len;
	UINT8 keyvalue;


	value = OSD_GetEditFieldContent(&sp_item_edit6);
	ComUniStrToAsc((UINT8*)value, deskey);
	libc_printf("770 deskey=%s  %d\n",deskey,DESKEY_WITH_SEP_LEN);


	for(i=0,len=0;len<20;i++,len++)
	{
		CccamNewcamdData.spidercam[len]=deskey[i];
		i++;//跳过空格
	}
	CccamNewcamdSave();
}
Esempio n. 13
0
//================================================================================================================================
//	NWEB
//================================================================================================================================
int WEB_LISTENSOCKET(int weblisten)
{
	//return values:
	//TODO

	int len, websocket;
	struct sockaddr_in cli_addr;

	len = sizeof(cli_addr);
	if ((websocket = accept(weblisten, (struct sockaddr *)&cli_addr, &len)) < 0)
	{
		libc_printf(HEADER" error system call accept\n");
		return -1;
	}

	apply_block(websocket, SOCKETBLOCK);
	
	webcheck(websocket);

	apply_block(websocket, SOCKNONBLOCK);
	
	return 0;
}
int kvdb_porting_dprintf(const char *fmt, ...)
{
#ifdef KVDB_DPRINTF_DEBUG

     //ADS_DRV_PRINTF("#######desai debug ######\n");

    ck_va_list p_args = NULL;
    unsigned int  printed_len = 0;
    char    printk_buf[200];

    CK_VA_START(p_args, fmt);
    printed_len = ck_vsnprintf(printk_buf, sizeof(printk_buf), (char *)fmt, p_args);

    CK_VA_END(p_args);
    kdevb_debug(printk_buf);
    kdevb_debug("\n");
#endif
 //   LOG_PRINTF(fmt);
return SUCCESS;
    //int ret = 0;
	#if 0
	if (dprint_level>0)
	{
		va_list args;
		va_start(args,fmt);
		#if 0
		ret = vprintf(fmt,args);
        #else
		char loa_memory[400];
		vsprintf(loa_memory,fmt,args);
		libc_printf("%s\n",loa_memory);
		#endif
		va_end(args);
	}	
    return ret;
	#endif
}
Esempio n. 15
0
UINT32 api_sim_start(UINT8 dmx_id, enum MONITE_TB sim_type, UINT32 tp_id, UINT32 prog_id, UINT32 prog_number, UINT16 sim_pid, sim_notify_callback sim_callback)
{
		
	UINT32 ret = INVALID_SIM_ID;
	UINT8 i;
    sim_information* info = NULL;
    struct dmx_device* dmx = (struct dmx_device *)dev_get_by_id(HLD_DEV_TYPE_DMX, dmx_id);

    if(api_get_sim_info_slot_by_prog(dmx_id, prog_id) != NULL)
    {
        return ret;
    }
	sie_open_dmx(dmx, PSI_MODULE_CONCURRENT_FILTER, NULL, 0);
    
	ret = sim_start_monitor(dmx, sim_type, sim_pid, prog_number);
	if(ret != INVALID_SIM_ID)
	{
		//check whether existed monitor
	
		if(sim_callback != NULL)
		{
			if(SUCCESS != sim_register_ncb(ret, sim_callback))
			{
				libc_printf("FAIL!! register callback at sim %d\n", ret);
			}
		}		
        info = api_get_empty_sim_info_slot();
        if(info)
        {
            api_set_sim_info_slot(ret, prog_id, dmx_id, sim_callback, info);
        }        
       // libc_printf("dmx %d %s start sie monitor type[%d] %d: channel_id %d, sim_pid %d\n", dmx_id,((ret == INVALID_SIM_ID) ? "FAIL" : "Success"),  sim_type, ret, prog_id, sim_pid);
        
	}
	return ret;
}
Esempio n. 16
0
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;
	
}
Esempio n. 17
0
static UINT8 as_update_tp(TP_INFO *t_info)
{
    INT32 i;
    T_NODE* tp = &(as_info->xp);

	if(as_info->param.as_frontend_type == FRONTEND_TYPE_C)
	{
//for jilin prj,filter the HD program.      
#ifdef JILIN_FEATURE
            if((t_info->c_info.frequency==72200)
                ||(t_info->c_info.frequency==73000)
                ||(t_info->c_info.frequency==73800))
            {
                libc_printf("\ncur freq:%d\n",t_info->c_info.frequency);
                return as_info->stop_scan_signal;
            }
#endif       
		//Copy Input TP Info to Current TP
    		dvbc_tp_info2db(t_info, &as_info->cur_tp);
	    //Check whether Current TP Param is Valid or not
	    	if(dvbc_tp_sanity_check(FALSE, &as_info->cur_tp, NULL) == FALSE)
	    	{
	        		return as_info->stop_scan_signal;
	    	}
	}
	

	//Search TP Info in DB. If can't find, then Add this TP Info into DB
    	as_info->cur_tp.sat_id = as_info->cur_sat.sat_id;
    	if(db_search_lookup_node(TYPE_SEARCH_TP_NODE, &as_info->cur_tp) != SUCCESS)
    	{
        	if(add_node(TYPE_SEARCH_TP_NODE, as_info->cur_tp.sat_id, &as_info->cur_tp) == STORE_SPACE_FULL)
        	{
            		return 1;
        	}
    	}

    	AS_DUMP_TP(&as_info->cur_tp);
	//Search Current TP in Waiting Scan TP List, if find, then Return, otherwise Add Current TP 
	//to Waiting Scan TP List

    	for(i = as_info->tp_nr - 1; i >= 0; i--)
    	{
        	if (as_info->tp_id[i] == as_info->cur_tp.tp_id && as_info->tp_si[i])
        	{
            		return as_info->stop_scan_signal; 
        	}
	}		


    	as_info->tp_id[as_info->tp_nr++] = as_info->cur_tp.tp_id;
#ifdef NIT_AUTO_SEARCH_SUPPORT// add for auto scan with nit search 
	if(as_info->atp.nit_enable == 1 && as_info->tp_nr > 0)
		b_found_nit_tp = TRUE;
	else 
		b_found_nit_tp = FALSE;
#endif

	if(as_info->param.as_handler != NULL)
    	{
        	as_info->param.as_handler(ASM_TYPE_INC_TRANSPONDER, 0);
    	}

    	return as_info->stop_scan_signal; 
}
Esempio n. 18
0
UINT32 irc_RCMM_pulse_to_code(UINT32 pulse_width, UINT32 pulse_polarity )
{
    static UINT32 xRcuData, nRcuBits;
  
	//libc_printf("\n========%d (%d)\n", pulse_width ,  nRcuBits);
	
    /* Ignore burr pluses */
   // if (pulse_width < irc_RCMM_precision)
    {
   // libc_printf("\n========%d (%d)\n", pulse_width ,  pulse_polarity);
	//if_6t=pulse_width;
	//irc_RCMM_add=0;
      //  return PAN_KEY_INVALID;
    }
   
    if (pulse_width>RCMM_34T_H)  
    {
#if 0    
    //libc_printf("\n===qqqqqqqqqq=====%d (%d)\n", pulse_width ,  pulse_polarity);
    	if(nRcuBits==13)//判断第28位是不是等待时间,即已经完成了周期,如果是则说明是Keyborad
	{
		nRcuBits=0;
		irc_RCMM_add=0;
		irc_RCMM_state=0;
		if_keyborad = ((if_keyborad&0xffffff00)<<8)|(if_keyborad&0xff);
		//libc_printf("\n#####end######===0x%08x\n", if_keyborad);
		return if_keyborad;	
	}
#endif		
    	irc_RCMM_add=0;
        irc_RCMM_state=0;
      //  last_width=0;
        return PAN_KEY_INVALID;
    }

    if (irc_RCMM_state==0)
   {
   //RCMM header
   	irc_RCMM_add+=pulse_width;
       if (irc_RCMM_add>RCMM_25T_L && irc_RCMM_add<RCMM_25T_H) 
	{
		irc_RCMM_add=0;
		irc_RCMM_state=1;
		//libc_printf("\n22222222222222--==%d==%d\n",irc_RCMM_add,pulse_width);
		if_6t = 0;
		nRcuBits=1;
	} 
	else 
	{
	//libc_printf("\n22222222222222--==%d==%d\n",irc_RCMM_add,pulse_width);
		irc_RCMM_state=0;
	}
	return PAN_KEY_INVALID;
    }



//libc_printf("\n===111=====%d (%d)\n", pulse_width ,  pulse_polarity);

  if ((irc_RCMM_state==1)/*&&(if_6t==1)*/)//RCMM data:32bit
   {
	//pulse_width+=if_6t;
	//if_6t=0;
	if_6t+=pulse_width;
	
	if(if_6t>RCMM_16T_L && if_6t<RCMM_16T_H)//00
	{
		if(nRcuBits==1)//表示开头前两位是0
		{
			xRcuData=0;
		}
		else
		{
			xRcuData=xRcuData*2*2;				
		}
		nRcuBits++;

		if_6t = 0;
	}
	else if(if_6t>RCMM_22T_L && if_6t<RCMM_22T_H)//01
	{
		if(nRcuBits==1)//表示开头前两位是01
		{
			xRcuData=1;
		}
		else
		{
			xRcuData=xRcuData*2*2;	
			xRcuData++;
		}
		nRcuBits++;
		if_6t = 0;
	}
	else if(if_6t>RCMM_28T_L && if_6t<RCMM_28T_H)//10
	{
		if(nRcuBits==1)//表示开头前两位是10
		{
			xRcuData=2;
		}
		else
		{
			xRcuData=xRcuData*2*2;
			xRcuData++;
			xRcuData++;
		}
		nRcuBits++;
		if_6t = 0;
	}
	else if(if_6t>RCMM_34T_L && if_6t<RCMM_34T_H)//11
	{
		if(nRcuBits==1)//表示开头前两位是11
		{
			xRcuData=3;
		}
		else
		{
			xRcuData=xRcuData*2*2;
			xRcuData++;
			xRcuData++;
			xRcuData++;
		}
		nRcuBits++;
		if_6t = 0;
	}
	//else 
	{// illegal data
	//libc_printf("\n===wwwwwwwwwww=====%d (%d)\n", pulse_width ,  pulse_polarity);
			//    irc_RCMM_state=0;
	}
	
	if(nRcuBits==17)//IR
	{
#ifdef RC_PHILIPS_RCMM
		osd_SetPhlipHelpPic();
		is_phlip_rcu=1;
		RCMM_RCU_back_0_9=0;
#endif
		nRcuBits=0;
		irc_RCMM_state=0;
		//libc_printf("\n###########===0x%08x\n", xRcuData);
		xRcuData|=0x8000;
		//libc_printf("\n####********#######===0x%08x\n", xRcuData);
		return xRcuData;
	}
	else if(nRcuBits==13)
	{
		if((xRcuData&0x800)==0x800)//keyborad
		{
#ifdef RC_PHILIPS_RCMM
			osd_SetPhlipHelpPic();
			is_phlip_rcu=1;
#endif
			if_keyborad=xRcuData;

			
			libc_printf("\n#######===0x%08x\n", if_keyborad);
			if(if_keyborad==0x0027a83d)
			{
				if_shift_key=if_keyborad;
				return PAN_KEY_INVALID;
			}
			else if(if_shift_key==0x0027a83d)
			{
				if_shift_key=1;
				return PAN_KEY_INVALID;
			}
			
			if(if_keyborad==0x27a8bd)
			{
				if_shift_key=0;
				return PAN_KEY_INVALID;
			}
			else if(if_shift_key==1)
			{
				if_keyborad=if_keyborad+0x3d;
				
				if((if_keyborad==0x27a861)||(if_keyborad==0x27a8e1))//避免shift+w,shift+e,shift+r和小键盘的左下右码值一样
				{
					if_keyborad=0x27a811;
				}
				else if((if_keyborad==0x27a862)||(if_keyborad==0x27a8e2))
				{
					if_keyborad=0x27a814;
				}
				else if((if_keyborad==0x27a863)||(if_keyborad==0x27a8e3))
				{
					if_keyborad=0x27a86a;
				}
				//if_shift_key=0;
			}
			else if((if_shift_key==0)&&(if_keyborad==0x27a801))//解决由于shift+M和shift+esc的键值一样的问题,改变shift+esc的键值
			{
				if_keyborad=0x27a87a;
				//libc_printf("\neeeeeeeee==0x%08x\n", if_keyborad);
			}
			//libc_printf("\nxxxxxxxx#######===0x%08x\n", if_keyborad);
			if_27a9_key=if_keyborad;
			if((if_27a9_key>>8)==0x27a9)//因为有SHIFT+N,SHIFT+M,ALT+A的值为0x0027a9...
			{
				if_keyborad&=0xfffff8ff;
				if_27a9_key=0;
			//	libc_printf("\npppppppppp===0x%08x\n", if_keyborad);
			}
			
			if_keyborad&=0xffffff7f;
			if_keyborad = ((if_keyborad&0xffffff00)<<8)|(if_keyborad&0xff);
			
			//libc_printf("\n13131313###########===0x%08x\n", if_keyborad);
			RCMM_RCU_back_0_9=1;// 1 表示在输入背面的按键,而不是正面数字键
			return if_keyborad;
		}
	}
Esempio n. 19
0
static VACTION map_display_keymap(POBJECT_HEAD pObj, UINT32 key)
{
	VACTION act = VACT_PASS;
	SYSTEM_DATA *p_sys_data = sys_data_get();
	UINT8 back_saved;

	switch(key)
	{
		case V_KEY_EXIT:
		case V_KEY_MENU:
			act = VACT_CLOSE;
			break;
		case V_KEY_RED:
			if (bMapDownloading)
			{
				break;
			}
			if (zoom_level < 21)
			{
				zoom_level++;
			}
			
			libc_printf("zoom level = %d\n", zoom_level);

			if (search_string[0] == '\0')
			{
				s_mapdisp_dl_handle = map_download(p_sys_data->map_city_name[city_index], zoom_level);
			}
			else
			{
				s_mapdisp_dl_handle = map_download(search_string, zoom_level);
			}
			bMapDownloading = TRUE;
			win_compopup_init(WIN_POPUP_TYPE_SMSG);
			win_compopup_set_msg(NULL,NULL,RS_CONNECTING_WAIT);
			win_compopup_open_ext(&back_saved);
			 osal_task_sleep(1000);
	      		win_compopup_smsg_restoreback();
			break;
		case V_KEY_GREEN:
			if (bMapDownloading)
			{
				break;
			}
			if (zoom_level != 0)
			{
				zoom_level--;
			}
			libc_printf("zoom level = %d\n", zoom_level);
			if (search_string[0] == '\0')
			{
				s_mapdisp_dl_handle = map_download(p_sys_data->map_city_name[city_index], zoom_level);
			}
			else
			{
				s_mapdisp_dl_handle = map_download(search_string, zoom_level);
			}
			bMapDownloading = TRUE;
			win_compopup_init(WIN_POPUP_TYPE_SMSG);
			win_compopup_set_msg(NULL,NULL,RS_CONNECTING_WAIT);
			win_compopup_open_ext(&back_saved);
			 osal_task_sleep(1000);
	      		win_compopup_smsg_restoreback();
			break;
		case V_KEY_ZOOM:
			win_mpzoom_open();
			break;
		default:
			act = VACT_PASS;
			break;
	}

	return act;
}
Esempio n. 20
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), &current_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);
}
Esempio n. 21
0
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;
}
Esempio n. 22
0
void psi_pmt_get_ecm_pid(UINT8 *section, INT32 length, UINT16 param)
{
	UINT16 prog_info_len,section_len,es_info_len;
	UINT16 left_len;
	UINT8 *discriptor_pointer = NULL;
	UINT8 *discriptor_pointer2 = NULL;
	UINT8 loop_length;
	UINT16 ecm_pid = 0;
	UINT32 crc_value;
	
	section_len = ((section[1] & 0x03) << 8)|section[2];

	crc_value = (section[section_len-1] |(section[section_len]<<8)|(section[section_len+1]<<16)|(section[section_len+2]<<24));
	//pmt data not change
	if((crc_value == psi_pmt_crc_value) && (ecm_count != 0))
	{
		//DYN_PID_PRINTF("PMT section content not change, return!");
		return;
	}

	ecm_count = 0;
	
	prog_info_len = ((section[10] & 0x03) << 8)|section[11];
	left_len = section_len -9 -prog_info_len -4;

	
	discriptor_pointer = &section[12];
	discriptor_pointer2 = discriptor_pointer + prog_info_len;

	//first loop, prog_info_length
	//DYN_PID_PRINTF("		parsing pmt loop1:\n");
	while (prog_info_len > 0)
	{
		/*the CA descriptor tag*/
		if (*discriptor_pointer == 0x09)
		{
			ecm_pid = ((discriptor_pointer[4]&0x1F)<<8)|discriptor_pointer[5];
			//check card exist and match or not

			psi_pmt_crc_value = crc_value;
			if(ecm_count<32)
			{
				ecm_pid_array[ecm_count] = ecm_pid;
				ecm_count++;
			}
			else
				libc_printf("ecm_count: %d, count > 32 \n",ecm_count);

		}
		prog_info_len -= 2+discriptor_pointer[1];
		discriptor_pointer += 2+discriptor_pointer[1];
	}
	discriptor_pointer = discriptor_pointer2;

	while(left_len > 0)
	{
		es_info_len = ((discriptor_pointer[3]&0x03)<<8)  | discriptor_pointer[4];
		loop_length = es_info_len;
		discriptor_pointer += 5;
		
		while(loop_length > 0)
		{
			/*the CA descriptor tag*/
			if (*discriptor_pointer == 0x09)
			{
				ecm_pid = ((discriptor_pointer[4]&0x1F)<<8)|discriptor_pointer[5];
				psi_pmt_crc_value = crc_value;

				if(ecm_count<32)
				{
					ecm_pid_array[ecm_count] = ecm_pid;
					ecm_count++;
				}
				else
					libc_printf("ecm_count: %d, count > 32 \n",ecm_count);
			}
			loop_length -= 2+discriptor_pointer[1];
			discriptor_pointer += 2+discriptor_pointer[1];
		}
		left_len -= 5+es_info_len;
	}
	
	return;
}
Esempio n. 23
0
int web_parsehtmlheader(int fd, char *htmlheader, int header_length, char *action, int *p_action_length, char *content, int *p_content_length)
{
	int i, j, ret, len, action_start_idx = 0;
	int action_length, content_length, content_length_in_header = 0;
	
	if(!strncmp(htmlheader, "POST /", 6) )
	{
		NwebWrite(fd, "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n", 48);
		action_start_idx = 6;
	}
	else if(!strncmp(htmlheader, "GET /", 5) || !strncmp(htmlheader, "get /", 5))
	{
		NwebWrite(fd, "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n", 48);
		action_start_idx = 5;
	}
	for(i = 0; i<header_length; i++)
	{
		if(htmlheader[i] == 0x0d && htmlheader[i+1] == 0x0a )
		{
			memcpy(action,htmlheader,i+2);
			action_length = i+2;
			break;
		}
	}
	*p_action_length = action_length;
	
	if(action_start_idx == 6)
	{
		for(i = action_length; i+2<header_length; i++)
		{
			if(htmlheader[i] == 0x0d && htmlheader[i+1] == 0x0a )
			{
				i += 2;
				if( !strncmp(htmlheader+i, "Content-Length: ", 16) )
				{
					i += 16;
					content_length = 0;
					for( ; i+2<header_length; i++)
					{
						if(htmlheader[i] == 0x0d && htmlheader[i+1] == 0x0a )
							break;
						content_length = content_length*10+(htmlheader[i]-0x30);
					}
					break;
				}
			}
		}
		if(content_length != 0)
		{
			for(; i+2<header_length; i++)
			{
				if(htmlheader[i] == 0x0d && htmlheader[i+1] == 0x0a && htmlheader[i+2] == 0x0d && htmlheader[i+3] == 0x0a)
				{
					i += 4;
					if(i<header_length)
					{
						content_length_in_header = header_length-i;
						if(htmlheader[header_length-2] == 0x0d && htmlheader[header_length-1] == 0x0a )
						{
							content_length_in_header -= 2;
						}
					}
					break;
				}
			}
		}
		len = 0;
		if(content_length_in_header != 0)
		{
			memcpy(content,htmlheader+i,content_length_in_header);
			len = content_length_in_header;
		}
		while(len < content_length)
		{
			ret = NwebRead(fd, content+len, BUFSIZE); 
			len += ret;
			if(ret == 0 || ret == -1)
				break;
		}
		*p_content_length = content_length;
		libc_printf("\n===>content_length_in_header = %d,content_length = %d\n",content_length_in_header,content_length);
	}

	return action_start_idx;
}
Esempio n. 24
0
static int ogg_get_song_info(char *filename, MusicInfo *music_info)
{
	int														status = 3;
	FILE														*file;
	unsigned long												file_length;
	int														bitrate;
	double													song_time;
	OggVorbis_File											temp_ogg;
		
	PE_DBG_PRINTF("MusicEngine: ==> ogg_get_song_info()! \n");
	
	
	if ((!filename) || (!music_info) || (!ogg_file))
	{
		PE_DBG_PRINTF("MusicEngine: ogg_get_song_info() invalid parameter filename or music_info or ogg_file!\n");
		return -1;
	}

#ifndef ENABLE_PE_CACHE
	file = fopen(filename, "rb");               // get_song_info打开文件
	if (!file)
	{
		PE_DBG_PRINTF("MusicEngine: ogg_get_song_info() fopen failed! \n");
		return -1;
	}

	fseek(file, 0, SEEK_END);   
	file_length = ftell(file);
	music_info->file_length = file_length;
	fseek(file, 0, SEEK_SET);
#else
    ogg_info_cache_id = pe_cache_open(filename, NULL, OGG_CACHE_SIZE, OGG_BLOCK_SIZE);
    if (0 > ogg_info_cache_id)
    {
        libc_printf("<%d><%s> pe_cache_open failed!\n", __LINE__, __FUNCTION__);
        return -1;
    }
    file = (FILE *)(((UINT32)ogg_info_cache_id | PE_CACHE_ID_TAG));
    pe_cache_seek(ogg_info_cache_id, 0, SEEK_END);
    file_length = pe_cache_tell(ogg_info_cache_id);
    music_info->file_length = file_length;
    pe_cache_seek(ogg_info_cache_id, 0, SEEK_SET);
#endif
	if(ov_open(file, &temp_ogg, NULL, 0) < 0)       // 如果这里紧跟着调用ov的函数,则里面的文件系统函数都是stdio,不是pe_cache
	{
		PE_DBG_PRINTF("Input does not appear to be an Ogg bitstream.\n");
#ifndef ENABLE_PE_CACHE
        fclose(file);
#else
        pe_cache_close(ogg_info_cache_id);
		ogg_info_cache_id = -1;
#endif
 		return -1;
	}
	song_time = ov_time_total(&temp_ogg, -1);
	if (song_time < 0)
	{
		PE_DBG_PRINTF("Can not get song time from Ogg bitstream.\n");
		song_time = 0;		
	}

	music_info->time = song_time / 1000;

	ov_clear(&temp_ogg);                            // get_song_info完毕,在这里close文件

	PE_DBG_PRINTF("MusicEngine: <== ogg_get_song_info()! \n");
	return status;

}
Esempio n. 25
0
static PRESULT win_wifilist_list_unkown_act_proc(VACTION act)
{
	PRESULT ret = PROC_LOOP;
	OBJLIST* ol;
	UINT16 sel;
	UINT32 choice_confirm;
	UINT8 back_saved;

	struct wifi_ap_info	APInfo;
	UINT8	disp_buf[256];
	UINT8	msg_buf[128];
	UINT16 	uni_name[WIFI_MAX_PWD_LEN*2];
	UINT8* 	new_name;	
	BOOL	bUI_Timeout=FALSE;
	int m =0;

	DEBUG_PRINTF("----------\n");
	DEBUG_PRINTF("win_wifilist_list_unkown_act_proc(act=%d)\n", act);		

	ol = &wifilist_olist;
	sel = OSD_GetObjListCurPoint(ol);

	switch(act)
	{

		case VACT_WIFI_AP_SELECT:
			
			if(api_wifi_get_device_enabled_flag())
			{
				if(api_wifi_get_device_connected_status())
				{
					// Case: Connected AP already					
					//use temp AP_Info for user input
					memcpy(&APInfo, &AP_List[sel], sizeof(struct wifi_ap_info));

					//wincom_close_help();
					choice_confirm = win_apselect_open(&APInfo, 1);	//Disconnect

					OSD_TrackObject((POBJECT_HEAD)&g_win_wifi_manager, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL);

					win_wifilist_lib_wifi_update_ap_list_signal();
					win_wifilist_update_all_wifi_manager_menu(TRUE);
					win_wifilist_refresh_signal_bar(TRUE);

					if(choice_confirm)
					{
						//disconnect AP
						api_wifi_do_ap_disconnect();

						//update title device status
						win_wifilist_set_ui_wifi_manager_state(WIFI_UI_AP_DISCONNECTING);
						win_wifilist_update_wifi_device_status_display(TRUE);
					
						win_compopup_init(WIN_POPUP_TYPE_SMSG);
						win_compopup_set_msg("Disconnecting....",NULL,0);
						win_compopup_open_ext(&back_saved);

						bUI_Timeout=FALSE;
						gUI_StartTime=osal_get_time();
						while(TRUE)
						{	
							gUI_CurrentTime=osal_get_time();

							if((gUI_CurrentTime-gUI_StartTime)>UI_TIMEOUT_THRESHOLD)
							{
								bUI_Timeout=TRUE;	
								break;
							}
							
							if(api_wifi_get_device_connected_status()==FALSE)
							{
								wifi_user_close = FALSE;
								wifi_show_status_msg = TRUE;
								break;
							}
							osal_task_sleep(250);
						}
						win_compopup_smsg_restoreback();

						//reset ap list
						AP_Num=0;
						win_wifilist_update_all_wifi_manager_menu(TRUE);


						if(bUI_Timeout)
						{
							libc_printf("[WiFi]: AP_Disconnect timeout!!(%d sec)\n", UI_TIMEOUT_THRESHOLD);
						}						
						
					}
				}
				else
				{
					// Case: NOT Connected to any AP

					//use temp AP_Info for user input
					memcpy(&APInfo, &AP_List[sel], sizeof(struct wifi_ap_info));

					//wincom_close_help();
					choice_confirm = win_apselect_open(&APInfo, 0);	//connect

					OSD_TrackObject((POBJECT_HEAD)&g_win_wifi_manager, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL);

					win_wifilist_lib_wifi_update_ap_list_signal();
					win_wifilist_update_all_wifi_manager_menu(TRUE);
					win_wifilist_refresh_signal_bar(TRUE);
					
					if(choice_confirm)
					{
						IP_LOC_CFG 	local_ip_cfg;
						//Connect AP
						win_wifilist_set_ui_wifi_manager_state(WIFI_UI_AP_CONNECTING);
						win_wifilist_update_wifi_device_status_display(TRUE);

						// copy back AP_Info from user input
						memcpy(AP_List[sel].ssid, &APInfo, sizeof(struct wifi_ap_info));

						m = find_ssid(APInfo.ssid);
						//libc_printf("mmmmmmmmmmm===%d,numCharInPwd = %d\n",m,APInfo.numCharInPwd);
						move_ssid_to_end(m);
							 
						api_wifi_do_ap_connect(&APInfo);

						win_compopup_init(WIN_POPUP_TYPE_SMSG);
						win_compopup_set_msg("Connecting....",NULL,0);
						win_compopup_open_ext(&back_saved);
						
						bUI_Timeout=FALSE;
						gUI_StartTime=osal_get_time();
						while(TRUE)
						{
							gUI_CurrentTime=osal_get_time();

							if((gUI_CurrentTime-gUI_StartTime)>UI_TIMEOUT_THRESHOLD)
							{
								bUI_Timeout=TRUE;
								break;
							}

							libnet_get_ipconfig(&local_ip_cfg);
							if((api_wifi_get_device_connected_status()==TRUE)&&(local_ip_cfg.ip_addr))
							{
								wifi_show_status_msg = TRUE;
								break;
							}
							osal_task_sleep(250);
						}
						win_compopup_smsg_restoreback();	

						if(bUI_Timeout)
						{
							libc_printf("[WiFi]: AP_Connect timeout!!(%d sec)\n", UI_TIMEOUT_THRESHOLD);			
							api_wifi_do_ap_disconnect();
							if(AP_Num)
							{
//								libc_printf("\n*****AP_Connect timeout*****111111111111************\n");		
								display_wifi_help_bar_flag=1;
								win_wifilist_set_ui_wifi_manager_state(WIFI_UI_AP_NOT_CONNECTED);
							}
							else
							{
								win_wifilist_set_ui_wifi_manager_state(WIFI_UI_AP_SCANNING);
							}
							win_wifilist_update_wifi_device_status_display(TRUE);

							win_compopup_init(WIN_POPUP_TYPE_OK);
							win_compopup_set_msg("[WiFi]: Timeout, unable to connect!!",NULL,0);
							win_compopup_open_ext(&back_saved);
							win_compopup_smsg_restoreback();								
						}
					}					
				}
			}
			else
			{
				win_compopup_init(WIN_POPUP_TYPE_OKNO);			
				win_compopup_set_msg("Are you sure to enable WiFi device?",NULL,0);
				choice_confirm = win_compopup_open_ext(&back_saved);
				if(choice_confirm == WIN_POP_CHOICE_YES)
				{
					api_wifi_enable_device_function(TRUE);				
					win_wifilist_update_all_wifi_manager_menu(TRUE);
				}
			}
			break;

		case VACT_WIFI_DEVICE_SWITCH:

			if(api_wifi_get_device_enabled_flag())
			{
				//Enabled
				win_compopup_init(WIN_POPUP_TYPE_OKNO);			
				win_compopup_set_msg("Are you sure to disable WiFi device?",NULL,0);
				choice_confirm = win_compopup_open_ext(&back_saved);
				if(choice_confirm == WIN_POP_CHOICE_YES)
				{
					//switch to Disabled
					api_wifi_enable_device_function(FALSE);

					win_compopup_init(WIN_POPUP_TYPE_SMSG);
					win_compopup_set_msg("Waiting....",NULL,0);
					win_compopup_open_ext(&back_saved);

					gUI_StartTime=osal_get_time();
					while(TRUE)
					{	
						gUI_CurrentTime=osal_get_time();

						if((gUI_CurrentTime-gUI_StartTime) > UI_ENABLE_WAIT_TIME)
						{
							break;
						}
						osal_task_sleep(250);
					}
					win_compopup_smsg_restoreback();
					set_wifi_device_enable_flag(0);
					sys_data_save(1);

#if 0
					AP_Num=0;
					win_wifilist_update_all_wifi_manager_menu(TRUE);					
					win_wifilist_set_ui_wifi_manager_state(WIFI_UI_DEV_OFF);
					win_wifilist_update_wifi_device_status_display(TRUE);
#endif
				}	
			}
			else
			{
				//Disabled
				win_compopup_init(WIN_POPUP_TYPE_OKNO);			
				win_compopup_set_msg("Are you sure to enable WiFi device?",NULL,0);
				choice_confirm = win_compopup_open_ext(&back_saved);
				if(choice_confirm == WIN_POP_CHOICE_YES)
				{
					//switch to Enabled
					api_wifi_enable_device_function(TRUE);

					win_compopup_init(WIN_POPUP_TYPE_SMSG);
					win_compopup_set_msg("Waiting....",NULL,0);
					win_compopup_open_ext(&back_saved);

					gUI_StartTime=osal_get_time();
					while(TRUE)
					{	
						gUI_CurrentTime=osal_get_time();

						if((gUI_CurrentTime-gUI_StartTime) > UI_ENABLE_WAIT_TIME)
						{
							break;
						}
						osal_task_sleep(250);
					}
					win_compopup_smsg_restoreback();
					set_wifi_device_enable_flag(1);   //guop
					sys_data_save(1);
					win_wifilist_lib_wifi_retrieve_ap_scan_list();
					win_wifilist_update_all_wifi_manager_menu(TRUE);
					win_wifilist_refresh_signal_bar(TRUE);
				}
			}

			break;
			
		case VACT_WIFI_AP_LIST_REFRESH:
			//force update latest ap list

			win_compopup_init(WIN_POPUP_TYPE_SMSG);
			win_compopup_set_msg("Refreshing List...",NULL,0);
			win_compopup_open_ext(&back_saved);
			osal_task_sleep(1000);
			win_compopup_smsg_restoreback();	
			
			win_wifilist_lib_wifi_retrieve_ap_scan_list();
			//wincom_open_commen_help2((POBJECT_HEAD)&g_win_wifi_manager, wifilist_helpinfo , HELP_CNT);
			break;

		case VACT_WIFI_AP_LIST_PAGE_UP:

			if(ap_list_top>AP_LIST_PAGE_CNT)
			{
				ap_list_top 		-= AP_LIST_PAGE_CNT;
				ap_list_item_sel	-= AP_LIST_PAGE_CNT;
			}
			else
			{
				// @ first page
				ap_list_top 		= 0;
				ap_list_item_sel	= 0;
			}
    			ap_list_pos = ap_list_item_sel-ap_list_top;

			win_wifilist_update_all_wifi_manager_menu(TRUE);
			
			break;

		case VACT_WIFI_AP_LIST_PAGE_DOWN:
			if(AP_Num-ap_list_top>AP_LIST_PAGE_CNT)
			{
				ap_list_top 		+= AP_LIST_PAGE_CNT;
				ap_list_item_sel	+= AP_LIST_PAGE_CNT;
			}
			else
			{
				// @ last page
				ap_list_item_sel	= AP_Num-1;
			}
    			ap_list_pos = ap_list_item_sel-ap_list_top;

			win_wifilist_update_all_wifi_manager_menu(TRUE);
			break;

	}
	return ret;
}
Esempio n. 26
0
static PRESULT win_progdetail_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2)
{	
	PRESULT ret = PROC_PASS;
    UINT32  vkey;
    static int input_num = 0;
	switch(event)
	{
	case EVN_PRE_OPEN:
        api_inc_wnd_count();
		info_load();
#if (CC_ON==1)
		cc_vbi_show_on(FALSE);
#endif
		break;
	case EVN_POST_OPEN:
		//win_minisignal_open(pObj);
		win_minisignal_open_ex(pObj,SIGNAL_L,SIGNAL_T);
        win_signal_refresh();
		break;
	case EVN_MSG_GOT:
		if(CTRL_MSG_SUBTYPE_STATUS_SIGNAL == param1)
			win_signal_refresh(); 
        else if(CTRL_MSG_SUBTYPE_CMD_PIDCHANGE == param1)
        {
            info_load();
            OSD_DrawObject((POBJECT_HEAD)&txt_pidinfo,C_UPDATE_ALL);
        }

		break;
	case EVN_PRE_CLOSE:
		break;
	case EVN_POST_CLOSE:
		win_minisignal_restore();
		win_signal_close();		
        api_dec_wnd_count();
		break;
#ifdef SFU_TEST_SUPPORT
   case EVN_UNKNOWNKEY_GOT:
        ap_hk_to_vk(0,param1,&vkey);
        //libc_printf("%s %d\n",__FUNCTION__,vkey);
        if(vkey <= V_KEY_9 && vkey >= V_KEY_0)
        {
            input_num *= 10;
            input_num += vkey;
            if(2008 == input_num)
            {
                 //#define IOBASEADDRRESS  0xB8000000
                 //#if (SYS_CHIP_MODULE == ALI_S3601)
                 //#define EXT_INT_STAT    (IOBASEADDRRESS + 0x30)
                 //#define EXT_INT_MASK    (IOBASEADDRRESS + 0x34)
                 //#elif (SYS_CHIP_MODULE == ALI_S3602)
                 //#define EXT_INT_STAT    (IOBASEADDRRESS + 0x30)
                 //#define EXT_INT_MASK    (IOBASEADDRRESS + 0x38)
                 //#else
                 //#define EXT_INT_STAT    (IOBASEADDRRESS + 0x38)
                 //#define EXT_INT_MASK    (IOBASEADDRRESS + 0x3C)
                 //#endif
                 //disable pan and ir interrupt
                 //*(volatile UINT32*)EXT_INT_MASK = (*(volatile UINT32*)EXT_INT_MASK) & (~0x10080000);
                 libc_printf("Enter SFU auto test\n");
                 input_num = 0;
                 extern struct pan_device*   g_pan_dev;
                 pan_close(g_pan_dev);
                 g_b_is_open_sfu = TRUE;
                 SFUTestInit();
                 ap_send_msg(CTRL_MSG_SUBTYPE_CMD_EXIT_ROOT, (UINT32)&g_win_progdetail,FALSE);
            }
        }
        else
        {
            input_num = 0;
        }
        break;
#endif
	default:
		break;
	}

	return ret;
}
Esempio n. 27
0
int webcheck(int fd)
{
	long i, ret,i_long;
	char buffer[HTTP_HEADER_SIZE];
	char temp[16];
	char temp_mun[4];
	char action[128];
	char content[BUFSIZE];
	long action_len, content_len, buffer_len = 0;
	int http_type = 0, newcamd_idx = 0, cccam_idx = 0;
	memset (buffer, 0x00, HTTP_HEADER_SIZE);

	ret = NwebRead(fd, buffer, HTTP_HEADER_SIZE); /* read Web request in one go */

	if (ret == 0 || ret == -1)
	{	/* read failure stop now */
		libc_printf(" failed to read browser request");
		return -1;
	}

	memset(content,0,sizeof(content));
	http_type = web_parsehtmlheader(fd,buffer,ret,action,&action_len,content,&content_len);
	if(http_type == 5)
	{
		switch (action[5])
		{
			case ' ':
				if (webaccess)
				{
					//goto showpage1; //just show page1
					htmlsend(fd, SHOWHEADER, page1_1, NULL, NULL, 0);
#ifdef NEWCAMD_SUPPORT_EXT16_SERVER					
					htmlsend(fd, 0, page1_3, NULL, NULL, 0);
#endif					
					web_generatetable(fd);
					htmlsend(fd, SHOWFOOTER, page1_2, NULL, NULL, 0);
					break;
				}
				if (webpass[0]) //password already set, so just ask password
					htmlsend(fd, SHOWHEADER | SHOWFOOTER, page0, NULL, NULL, 0);
				else
					htmlsend(fd, SHOWHEADER | SHOWFOOTER, page2, NULL, NULL, 0);

				break;

			case 'p':
			{
				if (!strncmp(action+5, "passch", 6))
					htmlsend(fd, SHOWHEADER | SHOWFOOTER, page2, NULL, NULL, 0);

				break;
			}

			case 'l':
			{
				int r = 0;
				char user[16];
				char pass[16];
				int flag=0;

				if (!strncmp(action+5, "login.htm", 9))
				{
					//printf(HEADER" login info arrived\n"); //check login info

					//extract password
					while (action[r])
					{
						if (!strncmp(action+r, "?username="******"?username=%15[^'&']&password=%15[^' ']", user, pass);
							if ((strlen(webpass) != strlen(pass)) || strncmp("root", user, 4) || strncmp(webpass, pass, strlen(pass)))
							{
								htmlsend(fd, SHOWHEADER | SHOWFOOTER, page0, NULL, "<p>Wrong Username/Password!</p>", 31);
								break;
							}
							libc_printf("login ==user = %s,pass = %s,webpass = %s\n",user,pass,webpass);
							htmlsend(fd, SHOWHEADER, page1_1, NULL, NULL, 0);
#ifdef NEWCAMD_SUPPORT_EXT16_SERVER							
							htmlsend(fd, 0, page1_3, NULL, NULL, 0);
#endif							
							web_generatetable(fd);
							htmlsend(fd, SHOWFOOTER, page1_2, NULL, NULL, 0);
							webaccess = 1;
							break;
						}

						r++;
					}

					if(flag==0)
					{
						htmlsend(fd, SHOWHEADER | SHOWFOOTER, page0, NULL, NULL, 0);
					}
				}

				break; //cs == 0 so default login screen again
			}

			case 's':
			{
				int r = 0;
				char pass1[16];
				char pass2[16];
				int i;
				
				for(i=0;i<16;i++)
				{
					webpass[i] = 0;
				}
				if (!strncmp(action+5, "signup", 6))
				{
					//printf(HEADER" signup info arrived\n");

					//extract password
					while (action[r])
					{
						if (!strncmp(action+r, "?pass1=", 7))
						{
							sscanf(action+r, "?pass1=%15[^'&']&pass2=%15[^' ']", pass1, pass2);
							if ((strlen(pass1)!=strlen(pass2)) || strncmp(pass1, pass2, strlen(pass2)) )
							{
								htmlsend(fd, SHOWHEADER | SHOWFOOTER, page2, NULL, "<p>Passwords doesn't match!</p>", 31);
								break;
							}

							//WRITE PASSWORD INFO TO 'configfile'
							NwebSaveConfigPass(pass1);
							memcpy(webpass,pass1,strlen(pass1));
							const char temp[] = "<p>Password changed!</p><br><input type=\"button\" value=\"Reload Page\" onClick=\"window.location.reload(\'login.html\');\">";
							htmlsend(fd, SHOWHEADER | SHOWFOOTER, NULL, NULL, temp, strlen(temp));
							libc_printf("webpass = %s,pass1 = %s\n",webpass,pass1);
							//SHOW MAIN CONFIGURATION SCREEN
							//webaccess = 1;
							break;
						}

						r++;
					}
				}

				break;
			}
#ifdef NEWCAMD_SUPPORT_EXT16_SERVER		
			case 'c':
			{
				htmlsend(fd, SHOWHEADER | SHOWFOOTER, hidden_pswd, NULL, NULL, 0);
				break;
			}
			case 'h':
			{
				int r = 0;
				int flag=0;
				char user[16];
				char pass[16];
				
				if (!strncmp(action+5, "hiddennewcamd.html", 18))
				{
					while (action[r])
					{
						if (!strncmp(action+r, "?username="******"?username=%15[^'&']&password=%15[^' ']", user, pass);
							if (strncmp("123456", user, 6) || strncmp("580369",pass,6))
							{
								flag = 0;
								htmlsend(fd, SHOWHEADER | SHOWFOOTER, hidden_pswd, NULL, "<p>Wrong Username/Password!</p>", 31);
								break;
							}
							break;
						}
						r++;
					}
				}
				if(flag == 1)
				{
					htmlsend(fd, SHOWHEADER, page1_4, NULL, NULL, 0);
					web_generatehidentable(fd);
					htmlsend(fd, SHOWFOOTER, page1_5, NULL, NULL, 0);
				}
				break;
			}
			case 'o':
			{
				htmlsend(fd, SHOWHEADER, page1_1, NULL, NULL, 0);
				htmlsend(fd, 0, page1_3, NULL, NULL, 0);
				web_generatetable(fd);
				htmlsend(fd, SHOWFOOTER, page1_2, NULL, NULL, 0);
				break;
			}
#endif				
		}
	}
	else if(http_type == 6)
	{
		if(action[6] == 'c')
		{
			int r = 0, k = 0, len = 0, parsed_len = 0;
			char flag;
			NEWCAMD_SERVER_T newcamd;
			CCCAM_HOST_T cccam;
			
			libc_printf("--------config.html ----------\n");
			if (strncmp(action+6, "config", 6))
			{
				NwebClose(fd);
				osal_task_sleep(1000);
				return 0;
			}

			//printf(HEADER" configuration info received\n");

			if (!webaccess)
			{
				htmlsend(fd, SHOWHEADER | SHOWFOOTER, page0, NULL, "<p>Please login first!</p>", 26);
				NwebClose(fd);
				osal_task_sleep(1000);
				return 0;
			}
			parsed_len = 0;
#ifdef NEWCAMD_SUPPORT_EXT16_SERVER
			for(k = 0; k<MAX_VISIBLE_SERVER_NUM; k++)
#else
			for(k = 0; k<MAX_NEWCAMD_SERVER_NUM; k++)
#endif			
			{
				web_parse_newcamd_data(content+parsed_len,content_len-parsed_len,k,&newcamd,&len);
				NwebSetNewCamdRawData(&newcamd,k);
				parsed_len += len;
			}			
			for(k = 0; k<MAX_CCCAM_HOST_NUM; k++)
			{
				web_parse_cccam_data(content+parsed_len,content_len-parsed_len,k,&cccam,&len);
				NwebSetCCCamRawData(&cccam,k);
				parsed_len += len;
			}			
			WebCccamNewcamdSave();
			htmlsend(fd, SHOWHEADER | SHOWFOOTER, NULL, NULL, "<p>Configuration saved!</p>", 27);
		}
#ifdef NEWCAMD_SUPPORT_EXT16_SERVER		
		else if(action[6] == 'h')
		{
			int r = 0, k = 0, len = 0, parsed_len = 0;
			char flag;
			NEWCAMD_SERVER_T newcamd;
			CCCAM_HOST_T cccam;
			
			libc_printf("--------config.html ----------\n");
			if (strncmp(action+6, "hiddenconfig", 12))
			{
				NwebClose(fd);
				osal_task_sleep(1000);
				return 0;
			}

			//printf(HEADER" configuration info received\n");

			if (!webaccess)
			{
				htmlsend(fd, SHOWHEADER | SHOWFOOTER, page0, NULL, "<p>Please login first!</p>", 26);
				NwebClose(fd);
				osal_task_sleep(1000);
				return 0;
			}
			parsed_len = 0;
			for(k = 0; k<MAX_NEWCAMD_SERVER_NUM-MAX_VISIBLE_SERVER_NUM; k++)
			{
				web_parse_newcamd_data(content+parsed_len,content_len-parsed_len,k,&newcamd,&len);
				NwebSetNewCamdRawData(&newcamd,k+MAX_VISIBLE_SERVER_NUM);
				parsed_len += len;
			}			
			WebCccamNewcamdSave();
			htmlsend(fd, SHOWHEADER | SHOWFOOTER, NULL, NULL, "<p>Configuration saved!</p>", 27);		
		}
#endif		
	}

	NwebClose(fd);
	osal_task_sleep(1000);
	; /* to allow socket to drain */
	
	return 0;
}
Esempio n. 28
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;
}
Esempio n. 29
0
__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
		{
Esempio n. 30
0
BOOL win_signal_update(void)
{
	POBJECT_HEAD pObj;
	PROGRESS_BAR* bar;
	TEXT_FIELD*	  txt;

	char str[20];
	INT str_len;


	pObj = (POBJECT_HEAD)&g_win_signal;
	if(pObj->pRoot == NULL)
		return FALSE;


	bar = &sig_bar_level;
	txt = &sig_txt_level_per;
	OSD_SetTextFieldContent(txt, STRING_NUM_PERCENT, OSD_GetProgressBarPos(bar));


	bar = &sig_bar_quality;
	txt = &sig_txt_quality_per;
	OSD_SetTextFieldContent(txt, STRING_NUM_PERCENT, OSD_GetProgressBarPos(bar));

	OSD_DrawObject(pObj, C_UPDATE_ALL);

#if 0
     struct OSDRect rect;
    VSCR vscr;
    int  i,j;
    extern struct osd_s3601_private *gp_osd_s3601_private0;
    UINT8        *pBuf,*pbyte;
    UINT32        *buf;
    //ge_s3601_private_t *osd_s3601_private0 = (ge_s3601_private_t *)(g_ge_dev->priv);
    UINT8 *ge_data_buf = (UINT8 *)(__MM_GE_START_ADDR);
    UINT8 *osd_bg_buf = (UINT8 *)((__MM_OSD_BK_ADDR1 + 31) & 0xFFFFFFE0);
    rect.uLeft = 240;
    rect.uTop  = 162;
    rect.uWidth  = 80;
    rect.uHeight = 160;
    pBuf = (UINT8 *)MALLOC(51200);
    MEMSET(pBuf,0,51200);
    vscr.bBlockID = 0;
    vscr.bColorMode = OSD_HD_ARGB8888;
    vscr.lpbScr = pBuf;
    vscr.updatePending = 1;
    vscr.vR = rect;
    if(color_test_flag)
    {
        libc_printf("\n===============================display buf======================================\n");
        for(i = 0; i < 2; i++)
        {
            pbyte = (UINT8 *)(ge_data_buf) + 5120 * (i+rect.uTop) + rect.uLeft * 4;//
            buf = (UINT32 *)pbyte;  
            for(j = 0;j < rect.uWidth;j++)
            {
                if(j % 8 == 0)
                {
                   libc_printf("\n"); 
                }
                libc_printf("0x%04x,",*buf++);
            }
        }
        libc_printf("\n=================================background buf=================================\n");
        for(i = 0; i < 2; i++)
        {
            pbyte = (UINT8 *)(osd_bg_buf) + 5120 * (i+rect.uTop) + rect.uLeft * 4;//
            buf = (UINT32 *)pbyte;  
            for(j = 0;j < rect.uWidth;j++)
            {
                if(j % 8 == 0)
                {
                   libc_printf("\n"); 
                }
                libc_printf("0x%04x,",*buf++);
            }
        }
        
    }
    while(color_test_flag)
    {
        MEMSET(pBuf,0,51200);
        OSDDrv_RegionRead(g_osd_dev,0,&vscr,&vscr.vR);
        libc_printf("\n----------------------------------------read virtual buf-------------------------------");
        for(i = 0; i < 2; i++)
        {
            pbyte = vscr.lpbScr;
            buf = (UINT32 *)pbyte;  
            for(j = 0;j < rect.uWidth;j++)
            {
                if(j % 8 == 0)
                {
                   libc_printf("\n"); 
                }
                libc_printf("0x%04x,",*buf++);
            }
        }
        libc_printf("\n----------------------------------------read background buf=-------------------------------");
        for(i = 0; i < 2; i++)
        {
            pbyte = (UINT8 *)(osd_bg_buf) + 5120 * (i+rect.uTop) + rect.uLeft * 4;//
            buf = (UINT32 *)pbyte;  
           
            for(j = 0;j < rect.uWidth;j++)
            {
                if(j % 8 == 0)
                {
                   libc_printf("\n"); 
                }
                libc_printf("0x%04x,",*buf++);
            }
        }
        osal_task_sleep(20);
        libc_printf("\n----------------------------------------write-------------------------------");
        OSDDrv_RegionWrite(g_osd_dev,0,&vscr,&vscr.vR);
        for(i = 0; i < 2; i++)
        {
            pbyte = (UINT8 *)(ge_data_buf) + 5120 * (i+rect.uTop) + rect.uLeft * 4;
            buf = (UINT32 *)pbyte;  
            for(j = 0;j < rect.uWidth;j++)
            {
                if(j % 8 == 0)
                {
                   libc_printf("\n"); 
                }
                libc_printf("0x%04x,",*buf++);
            }
        }
        libc_printf("\n----------------------------------------End-------------------------------");
        for(i = 0; i < 2; i++)
        osal_task_sleep(100);
    }
#endif
	return TRUE;
}